linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI/ERR: Use pcie_aer_is_native() to judge whether OS owns AER
@ 2022-07-25 16:01 Zhuo Chen
  2022-07-25 18:13 ` Sathyanarayanan Kuppuswamy
  0 siblings, 1 reply; 2+ messages in thread
From: Zhuo Chen @ 2022-07-25 16:01 UTC (permalink / raw)
  To: ruscur, oohall, bhelgaas
  Cc: chenzhuo.1, lukas, jan.kiszka, stuart.w.hayes, linuxppc-dev,
	linux-pci, linux-kernel

After commit 7d7cbeaba5b7 ("PCI/ERR: Clear status of the reporting
device"), the AER status of the device that reported the error
rather than the first downstream port is cleared. So the problem
in commit aa344bc8b727 ("PCI/ERR: Clear AER status only when we
control AER") is no longer existent, and we change to use
pcie_aer_is_native() here.

pci_aer_clear_nonfatal_status() already has pcie_aer_is_native(),
so we move pci_aer_clear_nonfatal_status() out of
pcie_aer_is_native().

Replace statements that judge whether OS owns AER in
get_port_device_capability() with pcie_aer_is_native().

Signed-off-by: Zhuo Chen <chenzhuo.1@bytedance.com>
---
 drivers/pci/pcie/err.c          | 12 ++----------
 drivers/pci/pcie/portdrv_core.c |  3 +--
 2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c
index 0c5a143025af..28339c741555 100644
--- a/drivers/pci/pcie/err.c
+++ b/drivers/pci/pcie/err.c
@@ -184,7 +184,6 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev,
 	int type = pci_pcie_type(dev);
 	struct pci_dev *bridge;
 	pci_ers_result_t status = PCI_ERS_RESULT_CAN_RECOVER;
-	struct pci_host_bridge *host = pci_find_host_bridge(dev->bus);
 
 	/*
 	 * If the error was detected by a Root Port, Downstream Port, RCEC,
@@ -237,16 +236,9 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev,
 	pci_dbg(bridge, "broadcast resume message\n");
 	pci_walk_bridge(bridge, report_resume, &status);
 
-	/*
-	 * If we have native control of AER, clear error status in the device
-	 * that detected the error.  If the platform retained control of AER,
-	 * it is responsible for clearing this status.  In that case, the
-	 * signaling device may not even be visible to the OS.
-	 */
-	if (host->native_aer || pcie_ports_native) {
+	if (pcie_aer_is_native(dev))
 		pcie_clear_device_status(dev);
-		pci_aer_clear_nonfatal_status(dev);
-	}
+	pci_aer_clear_nonfatal_status(dev);
 	pci_info(bridge, "device recovery successful\n");
 	return status;
 
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index 604feeb84ee4..98c18f4a01b2 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -221,8 +221,7 @@ static int get_port_device_capability(struct pci_dev *dev)
 	}
 
 #ifdef CONFIG_PCIEAER
-	if (dev->aer_cap && pci_aer_available() &&
-	    (pcie_ports_native || host->native_aer)) {
+	if (pcie_aer_is_native(dev) && pci_aer_available()) {
 		services |= PCIE_PORT_SERVICE_AER;
 
 		/*
-- 
2.30.1 (Apple Git-130)


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

* Re: [PATCH] PCI/ERR: Use pcie_aer_is_native() to judge whether OS owns AER
  2022-07-25 16:01 [PATCH] PCI/ERR: Use pcie_aer_is_native() to judge whether OS owns AER Zhuo Chen
@ 2022-07-25 18:13 ` Sathyanarayanan Kuppuswamy
  0 siblings, 0 replies; 2+ messages in thread
From: Sathyanarayanan Kuppuswamy @ 2022-07-25 18:13 UTC (permalink / raw)
  To: Zhuo Chen, ruscur, oohall, bhelgaas
  Cc: lukas, jan.kiszka, stuart.w.hayes, linuxppc-dev, linux-pci, linux-kernel



On 7/25/22 9:01 AM, Zhuo Chen wrote:
> After commit 7d7cbeaba5b7 ("PCI/ERR: Clear status of the reporting
> device"), the AER status of the device that reported the error
> rather than the first downstream port is cleared. So the problem
> in commit aa344bc8b727 ("PCI/ERR: Clear AER status only when we
> control AER") is no longer existent, and we change to use
> pcie_aer_is_native() here.
Can you add the details of the problem you are referring to? Also
include details about how this problem relates to your commit.

IIUC, your commit replaces "host->native_aer || pcie_ports_native"
with pcie_aer_is_native(dev, correct? If so, add a note in commit
log that it has no functional changes.

> 
> pci_aer_clear_nonfatal_status() already has pcie_aer_is_native(),
> so we move pci_aer_clear_nonfatal_status() out of
> pcie_aer_is_native().
> 
> Replace statements that judge whether OS owns AER in
> get_port_device_capability() with pcie_aer_is_native().
> 
> Signed-off-by: Zhuo Chen <chenzhuo.1@bytedance.com>
> ---
>  drivers/pci/pcie/err.c          | 12 ++----------
>  drivers/pci/pcie/portdrv_core.c |  3 +--
>  2 files changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c
> index 0c5a143025af..28339c741555 100644
> --- a/drivers/pci/pcie/err.c
> +++ b/drivers/pci/pcie/err.c
> @@ -184,7 +184,6 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev,
>  	int type = pci_pcie_type(dev);
>  	struct pci_dev *bridge;
>  	pci_ers_result_t status = PCI_ERS_RESULT_CAN_RECOVER;
> -	struct pci_host_bridge *host = pci_find_host_bridge(dev->bus);
>  
>  	/*
>  	 * If the error was detected by a Root Port, Downstream Port, RCEC,
> @@ -237,16 +236,9 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev,
>  	pci_dbg(bridge, "broadcast resume message\n");
>  	pci_walk_bridge(bridge, report_resume, &status);
>  
> -	/*
> -	 * If we have native control of AER, clear error status in the device
> -	 * that detected the error.  If the platform retained control of AER,
> -	 * it is responsible for clearing this status.  In that case, the
> -	 * signaling device may not even be visible to the OS.
> -	 */
> -	if (host->native_aer || pcie_ports_native) {
> +	if (pcie_aer_is_native(dev))
>  		pcie_clear_device_status(dev);
> -		pci_aer_clear_nonfatal_status(dev);
> -	}
> +	pci_aer_clear_nonfatal_status(dev);
>  	pci_info(bridge, "device recovery successful\n");
>  	return status;
>  
> diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
> index 604feeb84ee4..98c18f4a01b2 100644
> --- a/drivers/pci/pcie/portdrv_core.c
> +++ b/drivers/pci/pcie/portdrv_core.c
> @@ -221,8 +221,7 @@ static int get_port_device_capability(struct pci_dev *dev)
>  	}
>  
>  #ifdef CONFIG_PCIEAER
> -	if (dev->aer_cap && pci_aer_available() &&
> -	    (pcie_ports_native || host->native_aer)) {
> +	if (pcie_aer_is_native(dev) && pci_aer_available()) {
>  		services |= PCIE_PORT_SERVICE_AER;
>  
>  		/*

-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer

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

end of thread, other threads:[~2022-07-25 18:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-25 16:01 [PATCH] PCI/ERR: Use pcie_aer_is_native() to judge whether OS owns AER Zhuo Chen
2022-07-25 18:13 ` Sathyanarayanan Kuppuswamy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).