Skip to contentSkip to conversation

pci-ids: virtio cleanup

PATCH Superseded Gerd Hoffmann 7 participants 19 messages Sep 30, 2022 – Oct 4, 2022

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover pci-ids: virtio cleanup

Drop legacy ids for virtio 1.0 devices, they are not needed and will be overridden anyway by generic virtio pci code.

Improve modern virtio id documentation.

Gerd Hoffmann (5):
pci-ids: drop PCI_DEVICE_ID_VIRTIO_IOMMU
pci-ids: drop PCI_DEVICE_ID_VIRTIO_MEM
pci-ids: drop PCI_DEVICE_ID_VIRTIO_PMEM
pci-ids: drop PCI_DEVICE_ID_VIRTIO_VSOCK
pci-ids: drop list of modern virtio devices

 docs/specs/pci-ids.txt           | 15 ++++++---------
 include/hw/pci/pci.h             |  4 ----
 hw/virtio/vhost-user-vsock-pci.c |  2 --
 hw/virtio/vhost-vsock-pci.c      |  2 --
 hw/virtio/virtio-iommu-pci.c     |  4 +---
 hw/virtio/virtio-mem-pci.c       |  2 --
 hw/virtio/virtio-pmem-pci.c      |  2 --
 7 files changed, 7 insertions(+), 24 deletions(-)
Signature · 1 line
2.37.3
#1 lore raw

PATCH v2 1/5 pci-ids: drop PCI_DEVICE_ID_VIRTIO_IOMMU

Not needed for a virtio 1.0 device.

---
 include/hw/pci/pci.h         | 1 -
 hw/virtio/virtio-iommu-pci.c | 4 +---
 2 files changed, 1 insertion(+), 4 deletions(-)
include/hw/pci/pci.h +0 -1
index b54b6ef88fc3..89eaca429389 100644
@@ -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
hw/virtio/virtio-iommu-pci.c +1 -3
index 844d64770406..79ea8334f04e 100644
@@ -74,8 +74,6 @@ static void virtio_iommu_pci_class_init(ObjectClass *klass, void *data)
     k->realize = virtio_iommu_pci_realize;
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
     device_class_set_props(dc, virtio_iommu_pci_properties);
-    pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
-    pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_IOMMU;
     pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
     pcidev_k->class_id = PCI_CLASS_OTHERS;
     dc->hotpluggable = false;
@@ -90,7 +88,7 @@ static void virtio_iommu_pci_instance_init(Object *obj)
 }
 
 static const VirtioPCIDeviceTypeInfo virtio_iommu_pci_info = {
-    .generic_name          = TYPE_VIRTIO_IOMMU_PCI,
+    .generic_name  = TYPE_VIRTIO_IOMMU_PCI,
     .instance_size = sizeof(VirtIOIOMMUPCI),
     .instance_init = virtio_iommu_pci_instance_init,
     .class_init    = virtio_iommu_pci_class_init,
Signature · 1 line
2.37.3
#2 lore raw

Re: [PATCH v2 1/5] pci-ids: drop PCI_DEVICE_ID_VIRTIO_IOMMU

Quoted 26 lines · Gerd Hoffmann

Not needed for a virtio 1.0 device.

---
 include/hw/pci/pci.h         | 1 -
 hw/virtio/virtio-iommu-pci.c | 4 +---
 2 files changed, 1 insertion(+), 4 deletions(-)
include/hw/pci/pci.h +0 -1
index b54b6ef88fc3..89eaca429389 100644
@@ -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
hw/virtio/virtio-iommu-pci.c +0 -0
index 844d64770406..79ea8334f04e 100644

hw/virtio/virtio-iommu-pci.c static void virtio_iommu_pci_class_init(ObjectClass *klass, void *data) · line 79

Quoted 8 lines
hw/virtio/virtio-iommu-pci.c +0 -2
@@ -74,8 +74,6 @@ static void virtio_iommu_pci_class_init(ObjectClass *klass, void *data)
     k->realize = virtio_iommu_pci_realize;
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
     device_class_set_props(dc, virtio_iommu_pci_properties);
-    pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
-    pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_IOMMU;
     pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
     pcidev_k->class_id = PCI_CLASS_OTHERS;
     dc->hotpluggable = false;

So does this mean:
* these ID values on the device were never used, because some other code always overwrites them with the 'modern' ID values? If so, what is that other code?
* this is a change in behaviour? If so, what does the PCI device show up as if you don't set these fields at all? Do we need to make this only-in-new-machine-versions?

thanks
-- PMM

#3 lore raw

Re: [PATCH v2 1/5] pci-ids: drop PCI_DEVICE_ID_VIRTIO_IOMMU

Quoted 9 lines
Quoted 9 lines
hw/virtio/virtio-iommu-pci.c +0 -1
index 844d64770406..79ea8334f04e 100644
@@ -74,8 +74,6 @@ static void virtio_iommu_pci_class_init(ObjectClass *klass, void *data)
     k->realize = virtio_iommu_pci_realize;
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
     device_class_set_props(dc, virtio_iommu_pci_properties);
-    pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
Quoted 8 lines

hw/virtio/virtio-iommu-pci.c static void virtio_iommu_pci_class_init(ObjectClass *klass, void *data) · line 79

Quoted 4 lines
hw/virtio/virtio-iommu-pci.c +0 -1
-    pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_IOMMU;
     pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
     pcidev_k->class_id = PCI_CLASS_OTHERS;
     dc->hotpluggable = false;

So does this mean:
* these ID values on the device were never used, because some other code always overwrites them with the 'modern' ID values?

Yes.

Quoted 1 line

If so, what is that other code?

searching ...

virtio_pci_device_plugged() does it.
grep for virtio_bus_get_vdev_id to find the exact place.

Guess I should send v3 with that added to the commit messages.

Quoted 1 line

* this is a change in behaviour?

No.

take care,
Gerd

Reviewed-by Tested-by on v2 1/5
#4 lore raw

Re: [PATCH v2 1/5] pci-ids: drop PCI_DEVICE_ID_VIRTIO_IOMMU

In reply to Gerd Hoffmann

Hi Gerd,

Quoted 3 lines · Gerd Hoffmann

Not needed for a virtio 1.0 device.

Eric

Quoted 39 lines
---
 include/hw/pci/pci.h         | 1 -
 hw/virtio/virtio-iommu-pci.c | 4 +---
 2 files changed, 1 insertion(+), 4 deletions(-)
include/hw/pci/pci.h +0 -1
index b54b6ef88fc3..89eaca429389 100644
@@ -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
hw/virtio/virtio-iommu-pci.c +1 -3
index 844d64770406..79ea8334f04e 100644
@@ -74,8 +74,6 @@ static void virtio_iommu_pci_class_init(ObjectClass *klass, void *data)
     k->realize = virtio_iommu_pci_realize;
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
     device_class_set_props(dc, virtio_iommu_pci_properties);
-    pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
-    pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_IOMMU;
     pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
     pcidev_k->class_id = PCI_CLASS_OTHERS;
     dc->hotpluggable = false;
@@ -90,7 +88,7 @@ static void virtio_iommu_pci_instance_init(Object *obj)
 }
 
 static const VirtioPCIDeviceTypeInfo virtio_iommu_pci_info = {
-    .generic_name          = TYPE_VIRTIO_IOMMU_PCI,
+    .generic_name  = TYPE_VIRTIO_IOMMU_PCI,
     .instance_size = sizeof(VirtIOIOMMUPCI),
     .instance_init = virtio_iommu_pci_instance_init,
     .class_init    = virtio_iommu_pci_class_init,
#5 lore raw

PATCH v2 2/5 pci-ids: drop PCI_DEVICE_ID_VIRTIO_MEM

In reply to Gerd Hoffmann

Not needed for a virtio 1.0 device.

---
 include/hw/pci/pci.h       | 1 -
 hw/virtio/virtio-mem-pci.c | 2 --
 2 files changed, 3 deletions(-)
include/hw/pci/pci.h +0 -1
index 89eaca429389..b6aefb33fb17 100644
@@ -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
hw/virtio/virtio-mem-pci.c +0 -2
index be2383b0c522..5c5c1e3ae3da 100644
@@ -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;
 
Signature · 1 line
2.37.3
Reviewed-by on v2 2/5
#6 lore raw

Re: [PATCH v2 2/5] pci-ids: drop PCI_DEVICE_ID_VIRTIO_MEM

Quoted 25 lines · Gerd Hoffmann

Not needed for a virtio 1.0 device.

---
  include/hw/pci/pci.h       | 1 -
  hw/virtio/virtio-mem-pci.c | 2 --
  2 files changed, 3 deletions(-)
include/hw/pci/pci.h +0 -1
index 89eaca429389..b6aefb33fb17 100644
@@ -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
hw/virtio/virtio-mem-pci.c +0 -0
index be2383b0c522..5c5c1e3ae3da 100644

hw/virtio/virtio-mem-pci.c static void virtio_mem_pci_class_init(ObjectClass *klass, void *data) · line 109

Quoted 8 lines
hw/virtio/virtio-mem-pci.c +0 -2
@@ -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;
 
Signature · 3 lines
Thanks,

David / dhildenb
#7 lore raw

PATCH v2 3/5 pci-ids: drop PCI_DEVICE_ID_VIRTIO_PMEM

In reply to Gerd Hoffmann

Not needed for a virtio 1.0 device.

---
 include/hw/pci/pci.h        | 1 -
 hw/virtio/virtio-pmem-pci.c | 2 --
 2 files changed, 3 deletions(-)
include/hw/pci/pci.h +0 -1
index b6aefb33fb17..42c83cb5ed00 100644
@@ -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
hw/virtio/virtio-pmem-pci.c +0 -2
index 2b2a0b1eae10..7d9f4ec189b9 100644
@@ -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;
 
Signature · 1 line
2.37.3
Reviewed-by on v2 3/5
#8 lore raw

Re: [PATCH v2 3/5] pci-ids: drop PCI_DEVICE_ID_VIRTIO_PMEM

Quoted 25 lines · Gerd Hoffmann

Not needed for a virtio 1.0 device.

---
  include/hw/pci/pci.h        | 1 -
  hw/virtio/virtio-pmem-pci.c | 2 --
  2 files changed, 3 deletions(-)
include/hw/pci/pci.h +0 -1
index b6aefb33fb17..42c83cb5ed00 100644
@@ -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
hw/virtio/virtio-pmem-pci.c +0 -0
index 2b2a0b1eae10..7d9f4ec189b9 100644

hw/virtio/virtio-pmem-pci.c static void virtio_pmem_pci_class_init(ObjectClass *klass, void *data) · line 95

Quoted 8 lines
hw/virtio/virtio-pmem-pci.c +0 -2
@@ -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;
 
Signature · 3 lines
Thanks,

David / dhildenb
Reviewed-by Tested-by on v2 3/5
#9 lore raw

Re: [PATCH v2 3/5] pci-ids: drop PCI_DEVICE_ID_VIRTIO_PMEM

In reply to Gerd Hoffmann
Quoted 3 lines · Gerd Hoffmann

Not needed for a virtio 1.0 device.

Quoted 30 lines
---
  include/hw/pci/pci.h        | 1 -
  hw/virtio/virtio-pmem-pci.c | 2 --
  2 files changed, 3 deletions(-)
include/hw/pci/pci.h +0 -1
index b6aefb33fb17..42c83cb5ed00 100644
@@ -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
hw/virtio/virtio-pmem-pci.c +0 -2
index 2b2a0b1eae10..7d9f4ec189b9 100644
@@ -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;
 
#10 lore raw

PATCH v2 4/5 pci-ids: drop PCI_DEVICE_ID_VIRTIO_VSOCK

In reply to Gerd Hoffmann

Not needed for a virtio 1.0 device.

---
 include/hw/pci/pci.h             | 1 -
 hw/virtio/vhost-user-vsock-pci.c | 2 --
 hw/virtio/vhost-vsock-pci.c      | 2 --
 3 files changed, 5 deletions(-)
include/hw/pci/pci.h +0 -1
index 42c83cb5ed00..fe103f35d9d6 100644
@@ -83,7 +83,6 @@ extern bool pci_available;
 #define PCI_DEVICE_ID_VIRTIO_SCSI        0x1004
 #define PCI_DEVICE_ID_VIRTIO_RNG         0x1005
 #define PCI_DEVICE_ID_VIRTIO_9P          0x1009
-#define PCI_DEVICE_ID_VIRTIO_VSOCK       0x1012
 
 #define PCI_VENDOR_ID_REDHAT             0x1b36
 #define PCI_DEVICE_ID_REDHAT_BRIDGE      0x0001
hw/virtio/vhost-user-vsock-pci.c +0 -2
index e5a86e801362..8499b6871f50 100644
@@ -55,8 +55,6 @@ static void vhost_user_vsock_pci_class_init(ObjectClass *klass, void *data)
     k->realize = vhost_user_vsock_pci_realize;
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
     device_class_set_props(dc, vhost_user_vsock_pci_properties);
-    pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
-    pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_VSOCK;
     pcidev_k->revision = 0x00;
     pcidev_k->class_id = PCI_CLASS_COMMUNICATION_OTHER;
 }
hw/virtio/vhost-vsock-pci.c +0 -2
index 9f34414d3814..170a806b6765 100644
@@ -65,8 +65,6 @@ static void vhost_vsock_pci_class_init(ObjectClass *klass, void *data)
     k->realize = vhost_vsock_pci_realize;
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
     device_class_set_props(dc, vhost_vsock_pci_properties);
-    pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
-    pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_VSOCK;
     pcidev_k->revision = 0x00;
     pcidev_k->class_id = PCI_CLASS_COMMUNICATION_OTHER;
 }
Signature · 1 line
2.37.3
#11 lore raw

Re: [PATCH v2 4/5] pci-ids: drop PCI_DEVICE_ID_VIRTIO_VSOCK

Hi Gerd,

Quoted 39 lines · Gerd Hoffmann

Not needed for a virtio 1.0 device.

---

include/hw/pci/pci.h             | 1 -
hw/virtio/vhost-user-vsock-pci.c | 2 --
hw/virtio/vhost-vsock-pci.c      | 2 --
3 files changed, 5 deletions(-)
include/hw/pci/pci.h +0 -1
index 42c83cb5ed00..fe103f35d9d6 100644
@@ -83,7 +83,6 @@ extern bool pci_available;
 #define PCI_DEVICE_ID_VIRTIO_SCSI        0x1004
 #define PCI_DEVICE_ID_VIRTIO_RNG         0x1005
 #define PCI_DEVICE_ID_VIRTIO_9P          0x1009
-#define PCI_DEVICE_ID_VIRTIO_VSOCK       0x1012
 
 #define PCI_VENDOR_ID_REDHAT             0x1b36
 #define PCI_DEVICE_ID_REDHAT_BRIDGE      0x0001
hw/virtio/vhost-user-vsock-pci.c +0 -2
index e5a86e801362..8499b6871f50 100644
@@ -55,8 +55,6 @@ static void vhost_user_vsock_pci_class_init(ObjectClass *klass, void *data)
    k->realize = vhost_user_vsock_pci_realize;
    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
    device_class_set_props(dc, vhost_user_vsock_pci_properties);
-    pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
-    pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_VSOCK;
    pcidev_k->revision = 0x00;
    pcidev_k->class_id = PCI_CLASS_COMMUNICATION_OTHER;
 }
hw/virtio/vhost-vsock-pci.c +0 -0
index 9f34414d3814..170a806b6765 100644

hw/virtio/vhost-vsock-pci.c static void vhost_vsock_pci_class_init(ObjectClass *klass, void *data) · line 70

Quoted 8 lines
hw/virtio/vhost-vsock-pci.c +0 -2
@@ -65,8 +65,6 @@ static void vhost_vsock_pci_class_init(ObjectClass *klass, void *data)
    k->realize = vhost_vsock_pci_realize;
    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
    device_class_set_props(dc, vhost_vsock_pci_properties);
-    pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
-    pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_VSOCK;
    pcidev_k->revision = 0x00;
    pcidev_k->class_id = PCI_CLASS_COMMUNICATION_OTHER;
 }

Could we have migration issues with this change?

This reminded me that we've had issues already with vsock being incorrectly exported as legacy, that we discovered when we added commit 9b3a35ec82 ("virtio: verify that legacy support is not accidentally on").

Then we needed commit d55f518248 ("virtio: skip legacy support check on machine types less than 5.1") to avoid migration issues.

And we merged the following commits to force 1.0 in virtio-vsock devices for machine types >= 5.1 :
- 6209070503 ("vhost-vsock-pci: force virtio version 1")
- 27eda699f5 ("vhost-user-vsock-pci: force virtio version 1")

Thanks,
Stefano

#12 lore raw

Re: [PATCH v2 4/5] pci-ids: drop PCI_DEVICE_ID_VIRTIO_VSOCK

Quoted 20 lines

hw/virtio/vhost-vsock-pci.c static void vhost_vsock_pci_class_init(ObjectClass *klass, void *data) · line 70

Quoted 13 lines
hw/virtio/vhost-vsock-pci.c +0 -2
index 9f34414d3814..170a806b6765 100644
@@ -65,8 +65,6 @@ static void vhost_vsock_pci_class_init(ObjectClass *klass, void *data)
    k->realize = vhost_vsock_pci_realize;
    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
    device_class_set_props(dc, vhost_vsock_pci_properties);
-    pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
-    pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_VSOCK;
    pcidev_k->revision = 0x00;
    pcidev_k->class_id = PCI_CLASS_COMMUNICATION_OTHER;
 }

Could we have migration issues with this change?

This reminded me that we've had issues already with vsock being incorrectly exported as legacy, that we discovered when we added commit 9b3a35ec82 ("virtio: verify that legacy support is not accidentally on").

Quoted 7 lines

Then we needed commit d55f518248 ("virtio: skip legacy support check on machine types less than 5.1") to avoid migration issues.

And we merged the following commits to force 1.0 in virtio-vsock devices for machine types >= 5.1 :
- 6209070503 ("vhost-vsock-pci: force virtio version 1")
- 27eda699f5 ("vhost-user-vsock-pci: force virtio version 1")

Oh, the virtio_pci_force_virtio_1() call is conditional. Hmm.

The change will break vsock devices in legacy/transitional mode. So, if that is allowed for old machine types for backward compatibility reasons I guess I should better drop this patch.

take care,
Gerd

#13 lore raw

Re: [PATCH v2 4/5] pci-ids: drop PCI_DEVICE_ID_VIRTIO_VSOCK

Quoted 28 lines · Gerd Hoffmann
Quoted 20 lines

hw/virtio/vhost-vsock-pci.c static void vhost_vsock_pci_class_init(ObjectClass *klass, void *data) · line 70

Quoted 13 lines
hw/virtio/vhost-vsock-pci.c +0 -2
index 9f34414d3814..170a806b6765 100644
@@ -65,8 +65,6 @@ static void vhost_vsock_pci_class_init(ObjectClass *klass, void *data)
    k->realize = vhost_vsock_pci_realize;
    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
    device_class_set_props(dc, vhost_vsock_pci_properties);
-    pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
-    pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_VSOCK;
    pcidev_k->revision = 0x00;
    pcidev_k->class_id = PCI_CLASS_COMMUNICATION_OTHER;
 }

Could we have migration issues with this change?

This reminded me that we've had issues already with vsock being incorrectly exported as legacy, that we discovered when we added commit 9b3a35ec82 ("virtio: verify that legacy support is not accidentally on").

Quoted 7 lines

Then we needed commit d55f518248 ("virtio: skip legacy support check on machine types less than 5.1") to avoid migration issues.

And we merged the following commits to force 1.0 in virtio-vsock devices for machine types >= 5.1 :
- 6209070503 ("vhost-vsock-pci: force virtio version 1")
- 27eda699f5 ("vhost-user-vsock-pci: force virtio version 1")

Quoted 5 lines

Oh, the virtio_pci_force_virtio_1() call is conditional. Hmm.

The change will break vsock devices in legacy/transitional mode. So, if that is allowed for old machine types for backward compatibility reasons I guess I should better drop this patch.

Maybe add a comment to prevent others from falling into the same trap?

#14 lore raw

PATCH v2 5/5 pci-ids: drop list of modern virtio devices

In reply to Gerd Hoffmann

Drop the list of modern virtio devices and explain how they are calculated instead.

---
 docs/specs/pci-ids.txt | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
docs/specs/pci-ids.txt +6 -9
index dd6859d039d0..a289d2de6521 100644
@@ -23,15 +23,12 @@ maintained as part of the virtio specification.
 1af4:1005  entropy generator device (legacy)
 1af4:1009  9p filesystem device (legacy)
 
-1af4:1041  network device (modern)
-1af4:1042  block device (modern)
-1af4:1043  console device (modern)
-1af4:1044  entropy generator device (modern)
-1af4:1045  balloon device (modern)
-1af4:1048  SCSI host bus adapter device (modern)
-1af4:1049  9p filesystem device (modern)
-1af4:1050  virtio gpu device (modern)
-1af4:1052  virtio input device (modern)
+1af4:1040  Start of ID range for modern virtio devices.  The PCI device
+   to      ID is calculated from the virtio device ID by adding the
+1af4:10ef  0x1040 offset.  The virtio IDs are defined in the virtio
+           specification.  The Linux kernel has a header file with
+           defines for all virtio IDs (linux/virtio_ids.h), qemu has a
+           copy in include/standard-headers/.
 
 1af4:10f0  Available for experimental usage without registration.  Must get
    to      official ID when the code leaves the test lab (i.e. when seeking
Signature · 1 line
2.37.3
Reviewed-by on v2 5/5
#15 lore raw

Re: [PATCH v2 5/5] pci-ids: drop list of modern virtio devices

Quoted 4 lines · Gerd Hoffmann

Drop the list of modern virtio devices and explain how they are calculated instead.

Eric

Quoted 30 lines
---
 docs/specs/pci-ids.txt | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
docs/specs/pci-ids.txt +6 -9
index dd6859d039d0..a289d2de6521 100644
@@ -23,15 +23,12 @@ maintained as part of the virtio specification.
 1af4:1005  entropy generator device (legacy)
 1af4:1009  9p filesystem device (legacy)
 
-1af4:1041  network device (modern)
-1af4:1042  block device (modern)
-1af4:1043  console device (modern)
-1af4:1044  entropy generator device (modern)
-1af4:1045  balloon device (modern)
-1af4:1048  SCSI host bus adapter device (modern)
-1af4:1049  9p filesystem device (modern)
-1af4:1050  virtio gpu device (modern)
-1af4:1052  virtio input device (modern)
+1af4:1040  Start of ID range for modern virtio devices.  The PCI device
+   to      ID is calculated from the virtio device ID by adding the
+1af4:10ef  0x1040 offset.  The virtio IDs are defined in the virtio
+           specification.  The Linux kernel has a header file with
+           defines for all virtio IDs (linux/virtio_ids.h), qemu has a
+           copy in include/standard-headers/.
 
 1af4:10f0  Available for experimental usage without registration.  Must get
    to      official ID when the code leaves the test lab (i.e. when seeking
#16 lore raw
In reply to Gerd Hoffmann
Quoted 8 lines · Gerd Hoffmann

Drop legacy ids for virtio 1.0 devices, they are not needed and will be overridden anyway by generic virtio pci code.

Improve modern virtio id documentation.

Gerd Hoffmann (5):
pci-ids: drop PCI_DEVICE_ID_VIRTIO_IOMMU
pci-ids: drop PCI_DEVICE_ID_VIRTIO_MEM

I remember that for some weird reason, this was required for Linux to actually make use of the device. I never figured out why -- maybe that changed.

Signature · 3 lines
Thanks,

David / dhildenb
#17 lore raw
Quoted 6 lines · David Hildenbrand
Quoted 5 lines · Gerd Hoffmann

Drop legacy ids for virtio 1.0 devices, they are not needed and will be overridden anyway by generic virtio pci code.

Improve modern virtio id documentation.

Quoted 7 lines
Quoted 3 lines

Gerd Hoffmann (5):
pci-ids: drop PCI_DEVICE_ID_VIRTIO_IOMMU
pci-ids: drop PCI_DEVICE_ID_VIRTIO_MEM

I remember that for some weird reason, this was required for Linux to actually make use of the device. I never figured out why -- maybe that changed.

Looking at 'info pci' the mem + pmem devices look identical with and without this series ...

Bus 0, device 3, function 0:

    Class 0255: PCI device 1af4:1058
      PCI subsystem 1af4:1100
      IRQ 11, pin A
      BAR4: 64 bit prefetchable memory at 0xfe000000 [0xfe003fff].
      id ""
  Bus  0, device   4, function 0:
    Class 0255: PCI device 1af4:105b
      PCI subsystem 1af4:1100
      IRQ 10, pin A
      BAR4: 64 bit prefetchable memory at 0xfe004000 [0xfe007fff].
      id ""

... and the PCI ID conforms virtio 1.0 (aka 0x1040 + virtio id).

take care,
Gerd

#18 lore raw
Quoted 31 lines · Gerd Hoffmann
Quoted 6 lines · David Hildenbrand
Quoted 5 lines · Gerd Hoffmann

Drop legacy ids for virtio 1.0 devices, they are not needed and will be overridden anyway by generic virtio pci code.

Improve modern virtio id documentation.

Quoted 7 lines
Quoted 3 lines

Gerd Hoffmann (5):
pci-ids: drop PCI_DEVICE_ID_VIRTIO_IOMMU
pci-ids: drop PCI_DEVICE_ID_VIRTIO_MEM

I remember that for some weird reason, this was required for Linux to actually make use of the device. I never figured out why -- maybe that changed.

Looking at 'info pci' the mem + pmem devices look identical with and without this series ...

   Bus  0, device   3, function 0:
     Class 0255: PCI device 1af4:1058
       PCI subsystem 1af4:1100
       IRQ 11, pin A
       BAR4: 64 bit prefetchable memory at 0xfe000000 [0xfe003fff].
       id ""
   Bus  0, device   4, function 0:
     Class 0255: PCI device 1af4:105b
       PCI subsystem 1af4:1100
       IRQ 10, pin A
       BAR4: 64 bit prefetchable memory at 0xfe004000 [0xfe007fff].
       id ""
Quoted 1 line

... and the PCI ID conforms virtio 1.0 (aka 0x1040 + virtio id).

I just did a quick test and it indeed seems to work as expected. Thanks!

Signature · 3 lines
Thanks,

David / dhildenb