From c82190fa1ba738b66513cf8869f25d45b1061ac6 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Tue, 4 Oct 2022 13:20:56 +0200 Subject: pci-ids: drop PCI_DEVICE_ID_VIRTIO_IOMMU Not needed for a virtio 1.0 device. virtio_pci_device_plugged() overrides them anyway (so no functional change). Signed-off-by: Gerd Hoffmann Reviewed-by: Eric Auger Tested-by: Eric Auger Message-Id: <20221004112100.301935-2-kraxel@redhat.com> --- include/hw/pci/pci.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index b54b6ef88f..89eaca4293 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -85,7 +85,6 @@ extern bool pci_available; #define PCI_DEVICE_ID_VIRTIO_9P 0x1009 #define PCI_DEVICE_ID_VIRTIO_VSOCK 0x1012 #define PCI_DEVICE_ID_VIRTIO_PMEM 0x1013 -#define PCI_DEVICE_ID_VIRTIO_IOMMU 0x1014 #define PCI_DEVICE_ID_VIRTIO_MEM 0x1015 #define PCI_VENDOR_ID_REDHAT 0x1b36 -- cgit v1.2.3-55-g7522 From 58de96e2ebc4977e3d0a042946a70a3e4bdde4ba Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Tue, 4 Oct 2022 13:20:57 +0200 Subject: pci-ids: drop PCI_DEVICE_ID_VIRTIO_MEM Not needed for a virtio 1.0 device. virtio_pci_device_plugged() overrides them anyway (so no functional change). Signed-off-by: Gerd Hoffmann Reviewed-by: David Hildenbrand Message-Id: <20221004112100.301935-3-kraxel@redhat.com> --- hw/virtio/virtio-mem-pci.c | 2 -- include/hw/pci/pci.h | 1 - 2 files changed, 3 deletions(-) (limited to 'include') diff --git a/hw/virtio/virtio-mem-pci.c b/hw/virtio/virtio-mem-pci.c index be2383b0c5..5c5c1e3ae3 100644 --- a/hw/virtio/virtio-mem-pci.c +++ b/hw/virtio/virtio-mem-pci.c @@ -104,8 +104,6 @@ static void virtio_mem_pci_class_init(ObjectClass *klass, void *data) k->realize = virtio_mem_pci_realize; set_bit(DEVICE_CATEGORY_MISC, dc->categories); - pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET; - pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_MEM; pcidev_k->revision = VIRTIO_PCI_ABI_VERSION; pcidev_k->class_id = PCI_CLASS_OTHERS; diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 89eaca4293..b6aefb33fb 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -85,7 +85,6 @@ extern bool pci_available; #define PCI_DEVICE_ID_VIRTIO_9P 0x1009 #define PCI_DEVICE_ID_VIRTIO_VSOCK 0x1012 #define PCI_DEVICE_ID_VIRTIO_PMEM 0x1013 -#define PCI_DEVICE_ID_VIRTIO_MEM 0x1015 #define PCI_VENDOR_ID_REDHAT 0x1b36 #define PCI_DEVICE_ID_REDHAT_BRIDGE 0x0001 -- cgit v1.2.3-55-g7522 From cbd56573f769f8ebefd6a1241169a101ca639f85 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Tue, 4 Oct 2022 13:20:58 +0200 Subject: pci-ids: drop PCI_DEVICE_ID_VIRTIO_PMEM Not needed for a virtio 1.0 device. virtio_pci_device_plugged() overrides them anyway (so no functional change). Signed-off-by: Gerd Hoffmann Reviewed-by: David Hildenbrand Reviewed-by: Pankaj Gupta Tested-by: Pankaj Gupta Message-Id: <20221004112100.301935-4-kraxel@redhat.com> --- hw/virtio/virtio-pmem-pci.c | 2 -- include/hw/pci/pci.h | 1 - 2 files changed, 3 deletions(-) (limited to 'include') diff --git a/hw/virtio/virtio-pmem-pci.c b/hw/virtio/virtio-pmem-pci.c index 2b2a0b1eae..7d9f4ec189 100644 --- a/hw/virtio/virtio-pmem-pci.c +++ b/hw/virtio/virtio-pmem-pci.c @@ -90,8 +90,6 @@ static void virtio_pmem_pci_class_init(ObjectClass *klass, void *data) k->realize = virtio_pmem_pci_realize; set_bit(DEVICE_CATEGORY_MISC, dc->categories); - pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET; - pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_PMEM; pcidev_k->revision = VIRTIO_PCI_ABI_VERSION; pcidev_k->class_id = PCI_CLASS_OTHERS; diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index b6aefb33fb..42c83cb5ed 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -84,7 +84,6 @@ extern bool pci_available; #define PCI_DEVICE_ID_VIRTIO_RNG 0x1005 #define PCI_DEVICE_ID_VIRTIO_9P 0x1009 #define PCI_DEVICE_ID_VIRTIO_VSOCK 0x1012 -#define PCI_DEVICE_ID_VIRTIO_PMEM 0x1013 #define PCI_VENDOR_ID_REDHAT 0x1b36 #define PCI_DEVICE_ID_REDHAT_BRIDGE 0x0001 -- cgit v1.2.3-55-g7522 From 0468fe82d32e99b6d84085e76d1e946bbe1e80ac Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Tue, 4 Oct 2022 13:21:00 +0200 Subject: pci-ids: document modern virtio-pci ids in pci.h too While being at it add a #define for the magic 0x1040 number. Signed-off-by: Gerd Hoffmann Reviewed-by: Eric Auger Message-Id: <20221004112100.301935-6-kraxel@redhat.com> --- hw/virtio/virtio-pci.c | 2 +- include/hw/pci/pci.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index a50c5a57d7..e7d80242b7 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1688,7 +1688,7 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) pci_set_word(config + PCI_VENDOR_ID, PCI_VENDOR_ID_REDHAT_QUMRANET); pci_set_word(config + PCI_DEVICE_ID, - 0x1040 + virtio_bus_get_vdev_id(bus)); + PCI_DEVICE_ID_VIRTIO_10_BASE + virtio_bus_get_vdev_id(bus)); pci_config_set_revision(config, 1); } config[PCI_INTERRUPT_PIN] = 1; diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 42c83cb5ed..d1ac308574 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -76,6 +76,7 @@ extern bool pci_available; #define PCI_SUBVENDOR_ID_REDHAT_QUMRANET 0x1af4 #define PCI_SUBDEVICE_ID_QEMU 0x1100 +/* legacy virtio-pci devices */ #define PCI_DEVICE_ID_VIRTIO_NET 0x1000 #define PCI_DEVICE_ID_VIRTIO_BLOCK 0x1001 #define PCI_DEVICE_ID_VIRTIO_BALLOON 0x1002 @@ -85,6 +86,15 @@ extern bool pci_available; #define PCI_DEVICE_ID_VIRTIO_9P 0x1009 #define PCI_DEVICE_ID_VIRTIO_VSOCK 0x1012 +/* + * modern virtio-pci devices get their id assigned automatically, + * there is no need to add #defines here. It gets calculated as + * + * PCI_DEVICE_ID = PCI_DEVICE_ID_VIRTIO_10_BASE + + * virtio_bus_get_vdev_id(bus) + */ +#define PCI_DEVICE_ID_VIRTIO_10_BASE 0x1040 + #define PCI_VENDOR_ID_REDHAT 0x1b36 #define PCI_DEVICE_ID_REDHAT_BRIDGE 0x0001 #define PCI_DEVICE_ID_REDHAT_SERIAL 0x0002 -- cgit v1.2.3-55-g7522