diff --git a/include/kvm/ioport.h b/include/kvm/ioport.h index 4243850..75678c0 100644 --- a/include/kvm/ioport.h +++ b/include/kvm/ioport.h @@ -6,7 +6,7 @@ /* some ports we reserve for own use */ #define IOPORT_DBG 0xe0 -#define IOPORT_VIRTIO 0xea +#define IOPORT_VIRTIO 0xc200 struct kvm; diff --git a/pci.c b/pci.c index 1341494..39db138 100644 --- a/pci.c +++ b/pci.c @@ -34,15 +34,20 @@ static bool pci_config_data_out(struct kvm *self, uint16_t port, void *data, int return true; } -#define PCI_VENDOR_ID_REDHAT_QUMRANET 0x1af4 -#define PCI_DEVICE_ID_VIRTIO_BLK 0x1001 +#define PCI_VENDOR_ID_REDHAT_QUMRANET 0x1af4 +#define PCI_DEVICE_ID_VIRTIO_BLK 0x1001 +#define PCI_SUBSYSTEM_VENDOR_ID_REDHAT_QUMRANET 0x1af4 +#define PCI_SUBSYSTEM_ID_VIRTIO_BLK 0x0002 static struct pci_device_header virtio_device = { .vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET, .device_id = PCI_DEVICE_ID_VIRTIO_BLK, .header_type = PCI_HEADER_TYPE_NORMAL, - /* .class = (0x01 << 16) | (0x01 << 8) | ((1<<7) | * (1<<1)), */ - .bar[0] = (IOPORT_VIRTIO << 4) | PCI_BASE_ADDRESS_SPACE_IO, + .revision_id = 0, + .class = 0x010000, + .subsys_vendor_id = PCI_SUBSYSTEM_VENDOR_ID_REDHAT_QUMRANET, + .subsys_id = PCI_SUBSYSTEM_ID_VIRTIO_BLK, + .bar[0] = IOPORT_VIRTIO | PCI_BASE_ADDRESS_SPACE_IO, }; static bool pci_device_matches(uint8_t bus_number, uint8_t device_number, uint8_t function_number)