-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
need help translating kvm/vbox/qemu/ect PCI registration to RVVM #157
Comments
hmm i think i may have found one that more closely resembles rvvm in comparison to qemu unfortunately github complains the repository has not yet been indexed (so we cannot search globally for symbols) however we do have an indexable mirror https://github.com/mirror/vbox/blob/master/src/VBox/Devices/VirtIO/VirtioCore.h along with a gpu device https://github.com/mirror/vbox/blob/master/src/VBox/Devices/EFI/Firmware/OvmfPkg/VirtioGpuDxe/Commands.c |
unfortunately it seems almost every "virtio-pci" device uses a different interface for registering with the PCI itself https://github.com/mirror/vbox/blob/master/src/VBox/Devices/VirtIO/VirtioCore.cpp#L2822 meanwhile RVVM's pci interface is almost entirely different typedef struct {
uint16_t vendor_id;
uint16_t device_id;
uint16_t class_code;
uint8_t prog_if;
uint8_t rev;
uint8_t irq_pin;
rvvm_mmio_dev_t bar[PCI_FUNC_BARS];
} pci_func_desc_t; |
OK i found one RVVM contains a Realtek NIC network card that attaches VIA PCI https://github.com/LekKit/RVVM/blob/staging/src/devices/rtl8169.c#L481 and likewise qemu also contains a Realtek NIC network card that attaches VIA PCI https://github.com/qemu/qemu/blob/master/hw/net/rtl8139.c#L3359 all other devices which are in both RVVM and QEMU either connect via the PCI in qemu but the MMIO in RVVM or vice versa or are passthrough in QEMU so the Realtek network card is the ONLY device in which BOTH RVVM and QEMU connect via PCI |
Please have a look at NVMe device example: Line 586 in 419e179
It should be fairly straightforward to use, PCI only defines a device identification mechanism (Device/Vendor IDs, device class). The actual device BARs are simply MMIO regions, so all the usual RVVM API conventions apply in the same way (MMIO read/write callbacks, mappings, alignment, etc from the doc) |
I also want to ask you to stop opening more issues because it is very confusing to navigate them, and some questions you asked lately are not easily understandable. |
PCI Device class codes explanation: https://admin.pci-ids.ucw.cz/read/PD/ Dump PCI device address / class code / vendor & device ID / revision: lspci -n Remove |
sorry, ill keep to #149 |
im struggling to figure out how i might implement a very basic virtio-pci device in rvvm for virtio-over-pci transport based kernel drivers
the virtio spec does not appear to specify exactly how to do such, and qemu appears to use a pci virtio-pci device which manages sub virtio devices (all virtio devices plug into virtio-pci itself which virtio-pci itself plugs into pci) however the spec also does not clarify such as it appears to only talk about virtio-pci devices such as the ones that plug into qemu's virtio-pci
and i am not sure how to begin porting the qemu's virtio-pci over to rvvm as both use quite a different pci interface
The text was updated successfully, but these errors were encountered: