summaryrefslogtreecommitdiff
path: root/Kernel/VirtIO
AgeCommit message (Collapse)Author
2021-07-14Kernel: Fix inverted check in VirtIOConsolePortx-yl
We should really only try to open if we're closed. Oops :P
2021-07-11Kernel: Make various T::class_name() and similar return StringViewAndreas Kling
Instead of returning char const*, we can also give you a StringView.
2021-07-09Kernel: Support multiport for VirtIOConsolex-yl
This involves refactoring VirtIOConsole into VirtIOConsole and VirtIOConsolePort. VirtIOConsole is the VirtIODevice, it owns multiple VirtIOConsolePorts as well as two control queues. Each VirtIOConsolePort is a CharacterDevice.
2021-07-09Kernel: Add support for reading from VirtIOConsolex-yl
This allows two-way communication with the host through a VirtIOConsole. This is necessary for features like clipboard sharing.
2021-07-03Kernel: Clarify and make it easy to not use raw numbersLiav A
Let's put the PCI IDs as enums in the PCI namespace so they're free to pollute that namespace, but it's also more easier to use them.
2021-07-02Kernel/PCI: Move the PCI components as a subfolder to the Bus directoryLiav A
2021-06-25Kernel: Add VirtIOGPU graphics deviceSahan Fernando
2021-06-24Kernel: Move special sections into Sections.hHendiadyoin1
This also removes a lot of CPU.h includes infavor for Sections.h
2021-06-22Kernel: Use fewer supervisor pages in VirtIOQueuesSahan Fernando
2021-06-17Kernel/Interrupts: Return boolean on whether we handled the interruptLiav A
If we are in a shared interrupt handler, the called handlers might indicate it was not their interrupt, so we should not increment the call counter of these handlers.
2021-06-17Kernel/VirtIO: Indicate we handling unknown interrupt early when calledLiav A
2021-06-17Kernel/Interrupts: Add sensible purposes to VirtIO and USB devicesLiav A
When we enumerate the interrupt handlers, it's a good idea to show a meaningful name to the user instead of "IRQ Handler".
2021-06-09Kernel: Mark VirtIOConsole constructor as UNMAP_AFTER_INITBrian Gianforcaro
2021-06-09Kernel: Mark VirtIORNG constructor as UNMAP_AFTER_INITBrian Gianforcaro
2021-06-09Kernel: Mark VirtIO detection/creation functions as UNMAP_AFTER_INITBrian Gianforcaro
2021-05-31AK+Kernel: Disallow implicitly lifting pointers to OwnPtr'sAli Mohammad Pur
This doesn't really _fix_ anything, it just gets rid of the API and instead makes the users explicitly use `adopt_own_if_non_null()`.
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>