summary refs log tree commit diff stats
path: root/include/hw/pci/pci.h
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2022-10-04 13:21:00 +0200
committerGerd Hoffmann <kraxel@redhat.com>2022-10-12 12:01:11 +0200
commit0468fe82d32e99b6d84085e76d1e946bbe1e80ac (patch)
tree214015f1a7245405ad2f03630b7392d183486071 /include/hw/pci/pci.h
parent55f01e76a305df90fe6b8f02dbeb88a2d7a04f97 (diff)
downloadfocaccia-qemu-0468fe82d32e99b6d84085e76d1e946bbe1e80ac.tar.gz
focaccia-qemu-0468fe82d32e99b6d84085e76d1e946bbe1e80ac.zip
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 <kraxel@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Message-Id: <20221004112100.301935-6-kraxel@redhat.com>
Diffstat (limited to 'include/hw/pci/pci.h')
-rw-r--r--include/hw/pci/pci.h10
1 files changed, 10 insertions, 0 deletions
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