diff mbox series

[SRU,bionic:linux-gcp-4.15,1/2] PCI: Extract ATS disabling to a helper function

Message ID 20240126210928.33641-2-joseph.salisbury@canonical.com
State New
Headers show
Series Fixes for LP:#2049922 | expand

Commit Message

Joseph Salisbury Jan. 26, 2024, 9:09 p.m. UTC
From: Bartosz Pawlowski <bartosz.pawlowski@intel.com>

BugLink: https://bugs.launchpad.net/bugs/2049922

Introduce quirk_no_ats() helper function to provide a standard way to
disable ATS capability in PCI quirks.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230908143606.685930-2-bartosz.pawlowski@intel.com
Signed-off-by: Bartosz Pawlowski <bartosz.pawlowski@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
(backported from commit f18b1137d38c091cc8c16365219f0a1d4a30b3d1)
[jsalisbury: Preserved opposite return logic in quirk_amd_harvest_no_ats()
        found in v4.15 compared to 6.7]
Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
---
 drivers/pci/quirks.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 29e428e48d81..af6ba86cab1d 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -5187,6 +5187,12 @@  DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, 0x0420, quirk_no_ext_tags);
 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, 0x0422, quirk_no_ext_tags);
 
 #ifdef CONFIG_PCI_ATS
+static void quirk_no_ats(struct pci_dev *pdev)
+{
+	pci_info(pdev, "disabling ATS\n");
+	pdev->ats_cap = 0;
+}
+
 /*
  * Some devices require additional driver setup to enable ATS.  Don't use
  * ATS for those devices as ATS will be enabled before the driver has had a
@@ -5197,9 +5203,8 @@  static void quirk_amd_harvest_no_ats(struct pci_dev *pdev)
 	if ((pdev->device == 0x7312 && pdev->revision != 0x00) ||
 	    (pdev->device == 0x7340 && pdev->revision != 0xc5))
 		return;
-
-	dev_info(&pdev->dev, "disabling ATS\n");
-	pdev->ats_cap = 0;
+	else
+		quirk_no_ats(pdev);
 }
 
 /* AMD Stoney platform GPU */