Skip to contentSkip to conversation

PCI: Always call pci_enable_acs() regardless of pdev->acs_cap

PATCH Applied Rajat Jain 3 participants 4 messages Oct 28, 2020 – Oct 30, 2020 PCI

lore
Share & tools
lore

Rajat Jain

author
#0 lore raw

PATCH 1/1 PCI: Always call pci_enable_acs() regardless of pdev->acs_cap

Some devices may have have anomalies with the ACS cpability structure, and they may be using quirks to support ACS functionality via other registers. For such devices, it is important we always call pci_enable_acs() to give the quirks a chance to enable ACS in other ways.

For Eg:
There seems a class of Intel devices quirked with *_intel_pch_acs_* functions, that do not expose the standard ACS capability structure. But these quirks help support ACS on these devices using other registers:
pci_quirk_enable_intel_pch_acs() -> doesn't use acs_cap to enable ACS

This has already been taken care of in the quirks, in the other direction i.e. when checking if the ACS is enabled or not. So no need to do anything there.

Fixes 52fbf5bdeeef ("PCI: Cache ACS capability offset in device")
---
 drivers/pci/pci.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/pci/pci.c +7 -2
index 6d4d5a2f923d..ab398226c55e 100644
@@ -3516,8 +3516,13 @@ void pci_acs_init(struct pci_dev *dev)
 {
 	dev->acs_cap = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ACS);
 
-	if (dev->acs_cap)
-		pci_enable_acs(dev);
+	/*
+	 * Attempt to enable ACS regardless of capability because some rootports
+	 * (e.g. the ones quirked with *_intel_pch_acs_*) may not expose
+	 * standard rootport capability structure, but still may support ACS via
+	 * those quirks.
+	 */
+	pci_enable_acs(dev);
 }
 
 /**
Signature · 1 line
2.29.1.341.ge80a0c044ae-goog
Reviewed-by on v1 1/1
#2 lore raw
In reply to Rajat Jain
Quoted 32 lines · On Wed, 28 Oct 2020 16:15:45 -0700 Rajat Jain <[email protected]> wrote:

Some devices may have have anomalies with the ACS cpability structure, and they may be using quirks to support ACS functionality via other registers. For such devices, it is important we always call pci_enable_acs() to give the quirks a chance to enable ACS in other ways.

For Eg:
There seems a class of Intel devices quirked with *_intel_pch_acs_* functions, that do not expose the standard ACS capability structure. But these quirks help support ACS on these devices using other registers:
pci_quirk_enable_intel_pch_acs() -> doesn't use acs_cap to enable ACS

This has already been taken care of in the quirks, in the other direction i.e. when checking if the ACS is enabled or not. So no need to do anything there.

Fixes 52fbf5bdeeef ("PCI: Cache ACS capability offset in device")
---
 drivers/pci/pci.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/pci/pci.c +0 -2
index 6d4d5a2f923d..ab398226c55e 100644
@@ -3516,8 +3516,13 @@ void pci_acs_init(struct pci_dev *dev)
 {
 	dev->acs_cap = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ACS);
 
-	if (dev->acs_cap)
-		pci_enable_acs(dev);

drivers/pci/pci.c void pci_acs_init(struct pci_dev *dev) · line 3528

Quoted 10 lines
drivers/pci/pci.c +7 -0
+	/*
+	 * Attempt to enable ACS regardless of capability because some rootports
+	 * (e.g. the ones quirked with *_intel_pch_acs_*) may not expose
+	 * standard rootport capability structure, but still may support ACS via
+	 * those quirks.
+	 */
+	pci_enable_acs(dev);
 }
 
 /**

Much needed regression fix for v5.9:

#3 lore raw
In reply to Rajat Jain

[+cc Alex]

Quoted 11 lines · Rajat Jain

Some devices may have have anomalies with the ACS cpability structure, and they may be using quirks to support ACS functionality via other registers. For such devices, it is important we always call pci_enable_acs() to give the quirks a chance to enable ACS in other ways.

For Eg:
There seems a class of Intel devices quirked with *_intel_pch_acs_* functions, that do not expose the standard ACS capability structure. But these quirks help support ACS on these devices using other registers:
pci_quirk_enable_intel_pch_acs() -> doesn't use acs_cap to enable ACS

Quoted 7 lines

This has already been taken care of in the quirks, in the other direction i.e. when checking if the ACS is enabled or not. So no need to do anything there.

Fixes 52fbf5bdeeef ("PCI: Cache ACS capability offset in device")

Applied to for-linus for v5.10, thanks!

Quoted 27 lines
---
 drivers/pci/pci.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/pci/pci.c +7 -2
index 6d4d5a2f923d..ab398226c55e 100644
@@ -3516,8 +3516,13 @@ void pci_acs_init(struct pci_dev *dev)
 {
 	dev->acs_cap = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ACS);
 
-	if (dev->acs_cap)
-		pci_enable_acs(dev);
+	/*
+	 * Attempt to enable ACS regardless of capability because some rootports
+	 * (e.g. the ones quirked with *_intel_pch_acs_*) may not expose
+	 * standard rootport capability structure, but still may support ACS via
+	 * those quirks.
+	 */
+	pci_enable_acs(dev);
 }
 
 /**
Signature · 1 line
2.29.1.341.ge80a0c044ae-goog