]> git.droids-corp.org - dpdk.git/commitdiff
bus/pci: assign driver pointer before mapping
authorMichal Krawczyk <mk@semihalf.com>
Wed, 19 Jan 2022 14:50:37 +0000 (15:50 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Sun, 27 Feb 2022 19:15:15 +0000 (20:15 +0100)
Patch changing the way of accessing interrupt handle also changed order
of the rte_pci_map_device() call and rte_pci_device:driver assignment.
It was causing issues with Write Combine mapping on the Linux platform
if it was used with the igb_uio module.

Linux implementation of pci_uio_map_resource_by_index(), which is called
by rte_pci_map_device(), needs access to the device's driver. Otherwise
it won't be able to check the driver's flags and won't respect them.

Fixes: d61138d4f0e2 ("drivers: remove direct access to interrupt handle")
Cc: stable@dpdk.org
Signed-off-by: Michal Krawczyk <mk@semihalf.com>
drivers/bus/pci/pci_common.c

index 4a3a87f24fb8eae870ec986a42c4a9d13a81d818..def372b67ebddfec35b5b1037987b5bb18e47681 100644 (file)
@@ -247,9 +247,12 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,
                        return -ENOMEM;
                }
 
+               dev->driver = dr;
+
                if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) {
                        ret = rte_pci_map_device(dev);
                        if (ret != 0) {
+                               dev->driver = NULL;
                                rte_intr_instance_free(dev->vfio_req_intr_handle);
                                dev->vfio_req_intr_handle = NULL;
                                rte_intr_instance_free(dev->intr_handle);
@@ -257,8 +260,6 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,
                                return ret;
                        }
                }
-
-               dev->driver = dr;
        }
 
        RTE_LOG(INFO, EAL, "Probe PCI driver: %s (%x:%x) device: "PCI_PRI_FMT" (socket %i)\n",