Skip to content

Commit 54cab94

Browse files
nicolincnirmoy
authored andcommitted
NVIDIA: VR: SAUCE: PCI: Allow ATS to be always on for non-CXL NVIDIA GPUs
Some non-CXL NVIDIA GPU devices support non-PASID ATS function when their RIDs are IOMMU bypassed. This is slightly different than the default ATS policy which would only enable ATS on demand: when a non-zero PASID line is enabled in SVA use cases. Introduce a pci_dev_specific_ats_always_on() quirk function to support a list of IDs for these device. Then, include it pci_ats_always_on(). Suggested-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com> (backported from https://lore.kernel.org/linux-iommu/cover.1768624180.git.nicolinc@nvidia.com) Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
1 parent f5f9ad8 commit 54cab94

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

drivers/pci/ats.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ bool pci_ats_always_on(struct pci_dev *pdev)
245245
if (pdev->is_virtfn)
246246
pdev = pci_physfn(pdev);
247247

248-
return pci_cxl_ats_always_on(pdev);
248+
return pci_cxl_ats_always_on(pdev) ||
249+
pci_dev_specific_ats_always_on(pdev);
249250
}
250251
EXPORT_SYMBOL_GPL(pci_ats_always_on);
251252

drivers/pci/pci.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,15 @@ static inline int pci_dev_specific_reset(struct pci_dev *dev, bool probe)
914914
}
915915
#endif
916916

917+
#if defined(CONFIG_PCI_QUIRKS) && defined(CONFIG_PCI_ATS)
918+
bool pci_dev_specific_ats_always_on(struct pci_dev *dev);
919+
#else
920+
static inline bool pci_dev_specific_ats_always_on(struct pci_dev *dev)
921+
{
922+
return false;
923+
}
924+
#endif
925+
917926
#if defined(CONFIG_PCI_QUIRKS) && defined(CONFIG_ARM64)
918927
int acpi_get_rc_resources(struct device *dev, const char *hid, u16 segment,
919928
struct resource *res);

drivers/pci/quirks.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5678,6 +5678,29 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1457, quirk_intel_e2000_no_ats);
56785678
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1459, quirk_intel_e2000_no_ats);
56795679
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x145a, quirk_intel_e2000_no_ats);
56805680
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x145c, quirk_intel_e2000_no_ats);
5681+
5682+
static const struct pci_dev_ats_always_on {
5683+
u16 vendor;
5684+
u16 device;
5685+
} pci_dev_ats_always_on[] = {
5686+
{ PCI_VENDOR_ID_NVIDIA, 0x2e12, },
5687+
{ PCI_VENDOR_ID_NVIDIA, 0x2e2a, },
5688+
{ PCI_VENDOR_ID_NVIDIA, 0x2e2b, },
5689+
{ 0 }
5690+
};
5691+
5692+
/* Some non-CXL devices support ATS on RID when it is IOMMU-bypassed */
5693+
bool pci_dev_specific_ats_always_on(struct pci_dev *pdev)
5694+
{
5695+
const struct pci_dev_ats_always_on *i;
5696+
5697+
for (i = pci_dev_ats_always_on; i->vendor; i++) {
5698+
if (i->vendor == pdev->vendor && i->device == pdev->device)
5699+
return true;
5700+
}
5701+
5702+
return false;
5703+
}
56815704
#endif /* CONFIG_PCI_ATS */
56825705

56835706
/* Freescale PCIe doesn't support MSI in RC mode */

0 commit comments

Comments
 (0)