[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH v2] plat/virtio: Update off-by-one device id



Extract the virtio_device_id for legacy devices from the PCI Subsystem
Device ID. The previous behaviour resulted in some devices having the
wrong ID attributed to them. For example, a virtio-9p device has a PCI
Device ID of 0x1009 (which would have resulted in virtio_device_id of
10), but a PCI Subsystem Device ID of 9 (which is the correct constant
under virtio_ids.h).

Removes now unused function virtio_device_id_add.

Signed-off-by: Cristian Banu <cristb@xxxxxxxxx>
---
 plat/drivers/virtio/virtio_pci.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/plat/drivers/virtio/virtio_pci.c b/plat/drivers/virtio/virtio_pci.c
index 8503b534d054..d21a65064bd7 100644
--- a/plat/drivers/virtio/virtio_pci.c
+++ b/plat/drivers/virtio/virtio_pci.c
@@ -93,9 +93,6 @@ static struct virtqueue *vpci_legacy_vq_setup(struct 
virtio_dev *vdev,
                                              __u16 num_desc,
                                              virtqueue_callback_t callback,
                                              struct uk_alloc *a);
-static inline void virtio_device_id_add(struct virtio_dev *vdev,
-                                       __u16 pci_dev_id,
-                                       __u16 vpci_dev_id_start);
 static int virtio_pci_handle(void *arg);
 static int vpci_legacy_notify(struct virtio_dev *vdev, __u16 queue_id);
 static int virtio_pci_legacy_add_dev(struct pci_device *pci_dev,
@@ -338,13 +335,6 @@ static void vpci_legacy_pci_features_set(struct virtio_dev 
*vdev,
                        VIRTIO_PCI_GUEST_FEATURES, (__u32)features);
 }
 
-static inline void virtio_device_id_add(struct virtio_dev *vdev,
-                                       __u16 pci_dev_id,
-                                       __u16 pci_dev_id_start)
-{
-       vdev->id.virtio_device_id = (pci_dev_id - pci_dev_id_start);
-}
-
 static int virtio_pci_legacy_add_dev(struct pci_device *pci_dev,
                                     struct virtio_pci_dev *vpci_dev)
 {
@@ -364,8 +354,7 @@ static int virtio_pci_legacy_add_dev(struct pci_device 
*pci_dev,
                   pci_dev->id.device_id);
 
        /* Mapping the virtio device identifier */
-       virtio_device_id_add(&vpci_dev->vdev, pci_dev->id.device_id,
-                            VIRTIO_PCI_LEGACY_DEVICEID_START);
+       vpci_dev->vdev.id.virtio_device_id = pci_dev->id.subsystem_device_id;
        return 0;
 }
 
-- 
2.11.0


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.