diff mbox series

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

Message ID 20220930135810.1892149-2-kraxel@redhat.com (mailing list archive)
State New, archived
Headers show
Series pci-ids: virtio cleanup | expand

Commit Message

Gerd Hoffmann Sept. 30, 2022, 1:58 p.m. UTC
Not needed for a virtio 1.0 device.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 include/hw/pci/pci.h         | 1 -
 hw/virtio/virtio-iommu-pci.c | 4 +---
 2 files changed, 1 insertion(+), 4 deletions(-)

Comments

Peter Maydell Sept. 30, 2022, 2:37 p.m. UTC | #1
On Fri, 30 Sept 2022 at 14:58, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> Not needed for a virtio 1.0 device.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  include/hw/pci/pci.h         | 1 -
>  hw/virtio/virtio-iommu-pci.c | 4 +---
>  2 files changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
> index b54b6ef88fc3..89eaca429389 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
> diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c
> index 844d64770406..79ea8334f04e 100644
> --- a/hw/virtio/virtio-iommu-pci.c
> +++ b/hw/virtio/virtio-iommu-pci.c
> @@ -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
Eric Auger Sept. 30, 2022, 2:44 p.m. UTC | #2
Hi Gerd,

On 9/30/22 15:58, Gerd Hoffmann wrote:
> Not needed for a virtio 1.0 device.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>

Eric
> ---
>  include/hw/pci/pci.h         | 1 -
>  hw/virtio/virtio-iommu-pci.c | 4 +---
>  2 files changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
> index b54b6ef88fc3..89eaca429389 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
> diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c
> index 844d64770406..79ea8334f04e 100644
> --- a/hw/virtio/virtio-iommu-pci.c
> +++ b/hw/virtio/virtio-iommu-pci.c
> @@ -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,
Gerd Hoffmann Oct. 4, 2022, 7:20 a.m. UTC | #3
> > diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c
> > index 844d64770406..79ea8334f04e 100644
> > --- a/hw/virtio/virtio-iommu-pci.c
> > +++ b/hw/virtio/virtio-iommu-pci.c
> > @@ -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?

Yes.

>    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.

>  * this is a change in behaviour?

No.

take care,
  Gerd
diff mbox series

Patch

diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index b54b6ef88fc3..89eaca429389 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
diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c
index 844d64770406..79ea8334f04e 100644
--- a/hw/virtio/virtio-iommu-pci.c
+++ b/hw/virtio/virtio-iommu-pci.c
@@ -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,