summaryrefslogtreecommitdiff
path: root/Kernel/VirtIO
AgeCommit message (Collapse)Author
2021-05-15Kernel: Reorder VirtIODevice PCI initialization stepsSahan Fernando
We can't reset the device before we've read the PCI configuration space, because we read the reset register location from the configuration space.
2021-05-15Kernel: Rename VirtIODevice::clear_status_bit to mask_status_bitsSahan Fernando
2021-05-13Kernel: Move VirtIO code away from using a scatter gather listSahan Fernando
Currently, when passing buffers into VirtIOQueues, we use scatter-gather lists, which contain an internal vector of buffers. This vector is allocated, filled and the destroy whenever we try to provide buffers into a virtqueue, which would happen a lot in performance cricital code (the main transport mechanism for certain paravirtualized devices). This commit moves it over to using VirtIOQueueChains and building the chain in place in the VirtIOQueue. Also included are a bunch of fixups for the VirtIO Console device, making it use an internal VM::RingBuffer instead.
2021-05-13Kernel: Move AHCIPort::ScatterList to VM::ScatterGatherListSahan Fernando
We want to move this out of the AHCI subsystem into the VM system, since other parts of the kernel may need to perform scatter-gather IO. We rename the current VM::ScatterGatherList impl that's used in the virtio subsystem to VM::ScatterGatherRefList, since its distinguishing feature from the AHCI scatter-gather list is that it doesn't own its buffers.
2021-04-27Kernel: Move PCI vendor and device IDs into Kernel/PCI/IDs.hGunnar Beutner
2021-04-23AK: Rename adopt() to adopt_ref()Andreas Kling
This makes it more symmetrical with adopt_own() (which is used to create a NonnullOwnPtr from the result of a naked new.)
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-18Kernel: Add kernel command line flag to disable VirtIO supportIdan Horowitz
This command line flag can be used to disable VirtIO support on certain configurations (native windows) where interfacing with virtio devices can cause qemu to freeze.
2021-04-18Kernel: Make VirtIOConsole block when VirtIOQueue is fullSahan Fernando
2021-04-18Everywhere: Fix a bunch of typosLinus Groh
2021-04-17Kernel: Add base support for VirtRNG (VirtIO based Hardware RNG)Idan Horowitz
This is a very basic implementation that only requests 4096 bytes of entropy from the host once, but its still high quality entropy so it should be a good fix for #4490 (boot-time entropy starvation) for virtualized environments. Co-authored-by: Sahan <sahan.h.fernando@gmail.com>
2021-04-17Kernel: Finish base implementation of VirtQueuesIdan Horowitz
This commit includes a lot of small changes and additions needed to finalize the base implementation of VirtIOQueues and VirtDevices: * The device specific driver implementation now has to handle setting up the queues it needs before letting the base device class know it finised initialization * Supplying buffers to VirtQueues is now done via ScatterGatherLists instead of arbitary buffer pointers - this ensures the pointers are physical and allows us to follow the specification in regards to the requirement that individual descriptors must point to physically contiguous buffers. This can be further improved in the future by implementating support for the Indirect-Descriptors feature (as defined by the specification) to reduce descriptor usage for very fragmented buffers. * When supplying buffers to a VirtQueue the driver must supply a (temporarily-)unique token (usually the supplied buffer's virtual address) to ensure the driver can discern which buffer has finished processing by the device in the case in which the device does not offer the F_IN_ORDER feature. * Device drivers now handle queue updates (supplied buffers being returned from the device) by implementing a single pure virtual method instead of setting a seperate callback for each queue * Two new VirtQueue methods were added to allow the device driver to either discard or get used/returned buffers from the device by cleanly removing them off the descriptor chain (This also allows the VirtQueue implementation to reuse those freed descriptors) This also includes the necessary changes to the VirtIOConsole implementation to match these interface changes. Co-authored-by: Sahan <sahan.h.fernando@gmail.com>
2021-04-17Kernel: Implement a naive version of virtconsole by memcpying to physical pageIdan Horowitz
This patch allocates a physical page for each of the virtqueues and memcpys to it when receiving a buffer to get a physical, aligned contiguous buffer as required by the virtio specification. Co-authored-by: Sahan <sahan.h.fernando@gmail.com>
2021-04-17Kernel: Activate queues and enable interrutps in VirtIODevicesIdan Horowitz
This patch actually enables virtio queues after configuring them so the device can use them, it also enables interrupt handling in VirtIODevice so they are not ignored. Co-authored-by: Sahan <sahan.h.fernando@gmail.com>
2021-04-17Kernel: Modernize use of pointers in VirtIOIdan Horowitz
Raw pointers were mostly replaced with smart pointers and references where appropriate based on kling and smartcomputer7's suggestions :) Co-authored-by: Sahan <sahan.h.fernando@gmail.com>
2021-04-17Kernel: Add base support for VirtConsole (VirtIO based consoles)Idan Horowitz
Based on pull #3236 by tomuta, this is still very much WIP but will eventually allow us to switch from the considerably slower method of knocking on port 0xe9 for each character Co-authored-by: Tom <tomut@yahoo.com> Co-authored-by: Sahan <sahan.h.fernando@gmail.com>
2021-04-17Kernel: Add base support for VirtIO devicesIdan Horowitz
Based on pull #3236 by tomuta, this adds helper methods for generic device initialization, and partily-broken virtqueue helper methods Co-authored-by: Tom <tomut@yahoo.com> Co-authored-by: Sahan <sahan.h.fernando@gmail.com>