diff options
author | Andre Przywara <andre.przywara@arm.com> | 2021-01-05 17:57:46 +0000 |
---|---|---|
committer | Khasim Syed Mohammed <khasim.mohammed@arm.com> | 2021-02-04 17:27:42 +0530 |
commit | b6c1d7ac1eec3b7f8c1ba03d5c0bb3c52f95bec9 (patch) | |
tree | 0a72a93a19981789830dfa56ba4e8b4f0e69430c | |
parent | 4727ce773a252ef8923a659c8529e3451e4fbeb8 (diff) |
n1sdp: update n1sdp pci quirk for SR-IOV support
Upstream-Status: Inappropriate [will not be submitted as its a work around to address the hardware issue]
Signed-off-by: Khasim Syed Mohammed <khasim.mohammed@arm.com>
VFs are not probing the vendor ID first, which is otherwise
the gate keeper for undiscovered devices. So any accesses using
a config space offset greater than 0 must be coming for an
already discovered device or from a VF that has just been created.
Also if Linux already has a struct pci_dev* for a given BDF,
this device is safe to access.
Skip the firmware table in these cases and allow accesses to
those devices. That enables SR-IOV support on the N1SDP board.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Khasim Syed Mohammed <khasim.mohammed@arm.com>
-rw-r--r-- | drivers/pci/controller/pcie-n1sdp.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/pci/controller/pcie-n1sdp.c b/drivers/pci/controller/pcie-n1sdp.c index 327aee9c5564..45bbe506045a 100644 --- a/drivers/pci/controller/pcie-n1sdp.c +++ b/drivers/pci/controller/pcie-n1sdp.c @@ -61,6 +61,7 @@ static void __iomem *pci_n1sdp_map_bus(struct pci_bus *bus, unsigned int devfn, unsigned int segment = bus->domain_nr; unsigned int bdf_addr; unsigned int table_count, i; + struct pci_dev *dev; if (segment >= MAX_SEGMENTS || busn < cfg->busr.start || busn > cfg->busr.end) @@ -70,6 +71,14 @@ static void __iomem *pci_n1sdp_map_bus(struct pci_bus *bus, unsigned int devfn, if (busn == 0 && devfn == 0) return rc_remapped_addr[segment] + where; + dev = pci_get_domain_bus_and_slot(segment, busn, devfn); + if (dev && dev->is_virtfn) + return pci_ecam_map_bus(bus, devfn, where); + + /* Accesses beyond the vendor ID always go to existing devices. */ + if (where > 0) + return pci_ecam_map_bus(bus, devfn, where); + busn -= cfg->busr.start; bdf_addr = (busn << cfg->ops->bus_shift) + (devfn << devfn_shift); table_count = pcie_discovery_data[segment]->nr_bdfs; |