Linux-PCI Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] PCI: Always call pci_enable_acs() regardless of pdev->acs_cap
@ 2020-10-28 23:15 Rajat Jain
  2020-10-28 23:19 ` Rajat Jain
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rajat Jain @ 2020-10-28 23:15 UTC (permalink / raw)
  To: 0001-PCI-Always-call-pci_enable_acs-regardless-of-pdev-ac.patch,
	linux-pci, Boris V.,
	Linux Kernel Mailing List, Bjorn Helgaas
  Cc: rajatxjain, 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

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.

Reported-by: Boris V <borisvk@bstnet.org>
Fixes: 52fbf5bdeeef ("PCI: Cache ACS capability offset in device")
Signed-off-by: Rajat Jain <rajatja@google.com>
---
 drivers/pci/pci.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 6d4d5a2f923d..ab398226c55e 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -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);
 }
 
 /**
-- 
2.29.1.341.ge80a0c044ae-goog


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: Always call pci_enable_acs() regardless of pdev->acs_cap
  2020-10-28 23:15 [PATCH] PCI: Always call pci_enable_acs() regardless of pdev->acs_cap Rajat Jain
@ 2020-10-28 23:19 ` Rajat Jain
  2020-10-30 19:25 ` Alex Williamson
  2020-10-30 21:42 ` Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Rajat Jain @ 2020-10-28 23:19 UTC (permalink / raw)
  To: linux-pci, Boris V., Linux Kernel Mailing List, Bjorn Helgaas; +Cc: Rajat Jain

-random email address (typo)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: Always call pci_enable_acs() regardless of pdev->acs_cap
  2020-10-28 23:15 [PATCH] PCI: Always call pci_enable_acs() regardless of pdev->acs_cap Rajat Jain
  2020-10-28 23:19 ` Rajat Jain
@ 2020-10-30 19:25 ` Alex Williamson
  2020-10-30 21:42 ` Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Alex Williamson @ 2020-10-30 19:25 UTC (permalink / raw)
  To: Rajat Jain
  Cc: linux-pci, Boris V.,
	Linux Kernel Mailing List, Bjorn Helgaas, rajatxjain

On Wed, 28 Oct 2020 16:15:45 -0700
Rajat Jain <rajatja@google.com> 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.
> 
> Reported-by: Boris V <borisvk@bstnet.org>
> Fixes: 52fbf5bdeeef ("PCI: Cache ACS capability offset in device")
> Signed-off-by: Rajat Jain <rajatja@google.com>
> ---
>  drivers/pci/pci.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 6d4d5a2f923d..ab398226c55e 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -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);
>  }
>  
>  /**

Much needed regression fix for v5.9:

Reviewed-by: Alex Williamson <alex.williamson@redhat.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: Always call pci_enable_acs() regardless of pdev->acs_cap
  2020-10-28 23:15 [PATCH] PCI: Always call pci_enable_acs() regardless of pdev->acs_cap Rajat Jain
  2020-10-28 23:19 ` Rajat Jain
  2020-10-30 19:25 ` Alex Williamson
@ 2020-10-30 21:42 ` Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2020-10-30 21:42 UTC (permalink / raw)
  To: Rajat Jain
  Cc: linux-pci, Boris V.,
	Linux Kernel Mailing List, rajatxjain, Alex Williamson

[+cc Alex]

On Wed, Oct 28, 2020 at 04:15:45PM -0700, Rajat Jain 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.
> 
> Reported-by: Boris V <borisvk@bstnet.org>
> Fixes: 52fbf5bdeeef ("PCI: Cache ACS capability offset in device")
> Signed-off-by: Rajat Jain <rajatja@google.com>

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

> ---
>  drivers/pci/pci.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 6d4d5a2f923d..ab398226c55e 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -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);
>  }
>  
>  /**
> -- 
> 2.29.1.341.ge80a0c044ae-goog
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-28 23:15 [PATCH] PCI: Always call pci_enable_acs() regardless of pdev->acs_cap Rajat Jain
2020-10-28 23:19 ` Rajat Jain
2020-10-30 19:25 ` Alex Williamson
2020-10-30 21:42 ` Bjorn Helgaas

Linux-PCI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-pci/0 linux-pci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-pci linux-pci/ https://lore.kernel.org/linux-pci \
		linux-pci@vger.kernel.org
	public-inbox-index linux-pci

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-pci


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git