linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/3] Fully enable AER
@ 2022-01-25  7:18 Stefan Roese
  2022-01-25  7:18 ` [PATCH v4 1/3] PCI/AER: Call pcie_set_ecrc_checking() for each PCIe device Stefan Roese
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Stefan Roese @ 2022-01-25  7:18 UTC (permalink / raw)
  To: linux-pci
  Cc: Rafael J . Wysocki, Bjorn Helgaas, Pali Rohár,
	Bharat Kumar Gogada, Michal Simek, Yao Hongbo, Naveen Naidu

While working on AER support on a ZynqMP based system, which has some
PCIe Device connected via a PCIe switch, problems with AER enabling in
the Device Control registers of all PCIe devices but the Root Port. In
fact, only the Root Port has AER enabled right now. This patch set now
fixes this problem by first fixing the AER enabing in the
interconnected PCIe switches between the Root Port and the PCIe
devices and in a 2nd patch, also enabling AER in the PCIe Endpoints.

Please note that these changes are quite invasive, as with these
patches applied, AER now will be enabled in the Device Control
registers of all available PCIe Endpoints, which currently is not the
case.

Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Bjorn Helgaas <helgaas@kernel.org>
Cc: Pali Rohár <pali@kernel.org>
Cc: Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Yao Hongbo <yaohongbo@linux.alibaba.com>
Cc: Naveen Naidu <naveennaidu479@gmail.com>

Stefan Roese (3):
  PCI/AER: Call pcie_set_ecrc_checking() for each PCIe device
  PCI/portdrv: Don't disable AER reporting in
    get_port_device_capability()
  PCI/AER: Enable AER on all PCIe devices supporting it

 drivers/pci/pcie/aer.c          | 10 +++++++---
 drivers/pci/pcie/portdrv_core.c |  9 +--------
 2 files changed, 8 insertions(+), 11 deletions(-)

-- 
2.35.0


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

* [PATCH v4 1/3] PCI/AER: Call pcie_set_ecrc_checking() for each PCIe device
  2022-01-25  7:18 [PATCH v4 0/3] Fully enable AER Stefan Roese
@ 2022-01-25  7:18 ` Stefan Roese
  2022-01-25 14:52   ` Pali Rohár
  2022-01-25  7:18 ` [PATCH v4 2/3] PCI/portdrv: Don't disable AER reporting in get_port_device_capability() Stefan Roese
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Stefan Roese @ 2022-01-25  7:18 UTC (permalink / raw)
  To: linux-pci
  Cc: Bjorn Helgaas, Pali Rohár, Bharat Kumar Gogada,
	Michal Simek, Yao Hongbo, Naveen Naidu

Make sure that pcie_set_ecrc_checking() is called for each PCIe device,
also when it's hot-plugged. This is done by moving
pcie_set_ecrc_checking() to pci_aer_init().

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Bjorn Helgaas <helgaas@kernel.org>
Cc: Pali Rohár <pali@kernel.org>
Cc: Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Yao Hongbo <yaohongbo@linux.alibaba.com>
Cc: Naveen Naidu <naveennaidu479@gmail.com>
---
v4:
- New patch

 drivers/pci/pcie/aer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index 9fa1f97e5b27..5585fefc4d0e 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -387,6 +387,9 @@ void pci_aer_init(struct pci_dev *dev)
 	pci_add_ext_cap_save_buffer(dev, PCI_EXT_CAP_ID_ERR, sizeof(u32) * n);
 
 	pci_aer_clear_status(dev);
+
+	/* Enable ECRC checking if enabled and configured */
+	pcie_set_ecrc_checking(dev);
 }
 
 void pci_aer_exit(struct pci_dev *dev)
@@ -1223,9 +1226,6 @@ static int set_device_error_reporting(struct pci_dev *dev, void *data)
 			pci_disable_pcie_error_reporting(dev);
 	}
 
-	if (enable)
-		pcie_set_ecrc_checking(dev);
-
 	return 0;
 }
 
-- 
2.35.0


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

* [PATCH v4 2/3] PCI/portdrv: Don't disable AER reporting in get_port_device_capability()
  2022-01-25  7:18 [PATCH v4 0/3] Fully enable AER Stefan Roese
  2022-01-25  7:18 ` [PATCH v4 1/3] PCI/AER: Call pcie_set_ecrc_checking() for each PCIe device Stefan Roese
@ 2022-01-25  7:18 ` Stefan Roese
  2022-01-25  7:18 ` [PATCH v4 3/3] PCI/AER: Enable AER on all PCIe devices supporting it Stefan Roese
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Stefan Roese @ 2022-01-25  7:18 UTC (permalink / raw)
  To: linux-pci
  Cc: Pali Rohár, Rafael J . Wysocki, Bjorn Helgaas,
	Bharat Kumar Gogada, Michal Simek, Yao Hongbo, Naveen Naidu

Testing has shown, that AER reporting is currently disabled in the
DevCtl registers of all non Root Port PCIe devices on systems using
pcie_ports_native || host->native_aer. Practically disabling AER
completely in such systems. This is due to the fact that with commit
2bd50dd800b5 ("PCI: PCIe: Disable PCIe port services during port
initialization"), a call to pci_disable_pcie_error_reporting() was
added *after* the PCIe AER setup was completed for the PCIe device
tree.

Here a longer analysis about the currect status of AER enaling /
disabling upon bootup provided by Bjorn:

  pcie_portdrv_probe
    pcie_port_device_register
      get_port_device_capability
        pci_disable_pcie_error_reporting
          clear CERE NFERE FERE URRE               # <-- disable for RP USP DSP
      pcie_device_init
        device_register                            # new AER service device
          aer_probe
            aer_enable_rootport                    # RP only
              set_downstream_devices_error_reporting
                set_device_error_reporting         # self (RP)
                  if (RP || USP || DSP)
                    pci_enable_pcie_error_reporting
                      set CERE NFERE FERE URRE     # <-- enable for RP
                pci_walk_bus
                  set_device_error_reporting
                    if (RP || USP || DSP)
                      pci_enable_pcie_error_reporting
                        set CERE NFERE FERE URRE   # <-- enable for USP DSP

In a typical Root Port -> Endpoint hierarchy, the above:
  - Disables Error Reporting for the Root Port,
  - Enables Error Reporting for the Root Port,
  - Does NOT enable Error Reporting for the Endpoint because it is not
    a Root Port or Switch Port.

In a deeper Root Port -> Upstream Switch Port -> Downstream Switch
Port -> Endpoint hierarchy:
  - Disables Error Reporting for the Root Port,
  - Enables Error Reporting for the Root Port,
  - Enables Error Reporting for both Switch Ports,
  - Does NOT enable Error Reporting for the Endpoint because it is not
    a Root Port or Switch Port,
  - Disables Error Reporting for the Switch Ports when
    pcie_portdrv_probe() claims them.  AER does not re-enable it
    because these are not Root Ports.

This patch now removes this call to pci_disable_pcie_error_reporting()
from get_port_device_capability(), leaving the already enabled AER
configuration intact. With this change, AER is enabled in the Root Port
and the PCIe switch upstream and downstream ports. Only the PCIe
Endpoints don't have AER enabled yet. A follow-up patch will take
care of this Endpoint enabling.

Fixes: 2bd50dd800b5 ("PCI: PCIe: Disable PCIe port services during port initialization")
Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Bjorn Helgaas <helgaas@kernel.org>
Cc: Pali Rohár <pali@kernel.org>
Cc: Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Yao Hongbo <yaohongbo@linux.alibaba.com>
Cc: Naveen Naidu <naveennaidu479@gmail.com>
---
v4:
- No change

v3:
- Added RB tag from Pali

v2:
- Enhance commit message as suggested by Bjorn

 drivers/pci/pcie/portdrv_core.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index f81c7be4d7d8..27b990cedb4c 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -244,15 +244,8 @@ 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)) {
+	    (pcie_ports_native || host->native_aer))
 		services |= PCIE_PORT_SERVICE_AER;
-
-		/*
-		 * Disable AER on this port in case it's been enabled by the
-		 * BIOS (the AER service driver will enable it when necessary).
-		 */
-		pci_disable_pcie_error_reporting(dev);
-	}
 #endif
 
 	/* Root Ports and Root Complex Event Collectors may generate PMEs */
-- 
2.35.0


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

* [PATCH v4 3/3] PCI/AER: Enable AER on all PCIe devices supporting it
  2022-01-25  7:18 [PATCH v4 0/3] Fully enable AER Stefan Roese
  2022-01-25  7:18 ` [PATCH v4 1/3] PCI/AER: Call pcie_set_ecrc_checking() for each PCIe device Stefan Roese
  2022-01-25  7:18 ` [PATCH v4 2/3] PCI/portdrv: Don't disable AER reporting in get_port_device_capability() Stefan Roese
@ 2022-01-25  7:18 ` Stefan Roese
  2022-01-25 14:53   ` Pali Rohár
  2022-04-04 20:22   ` Jonathan Derrick
  2022-03-24 16:55 ` [PATCH v4 0/3] Fully enable AER Stefan Roese
  2022-07-11 19:53 ` Bjorn Helgaas
  4 siblings, 2 replies; 12+ messages in thread
From: Stefan Roese @ 2022-01-25  7:18 UTC (permalink / raw)
  To: linux-pci
  Cc: Bjorn Helgaas, Pali Rohár, Bharat Kumar Gogada,
	Michal Simek, Yao Hongbo, Naveen Naidu

With this change, AER is now enabled on all PCIe devices, also when the
PCIe device is hot-plugged.

Please note that this change is quite invasive, as with this patch
applied, AER now will be enabled in the Device Control registers of all
available PCIe Endpoints, which currently is not the case.

When "pci=noaer" is selected, AER stays disabled of course.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Bjorn Helgaas <helgaas@kernel.org>
Cc: Pali Rohár <pali@kernel.org>
Cc: Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Yao Hongbo <yaohongbo@linux.alibaba.com>
Cc: Naveen Naidu <naveennaidu479@gmail.com>
---
v4:
- No change

v3:
- New patch, replacing the "old" 2/2 patch
  Now enabling of AER for each PCIe device is done in pci_aer_init(),
  which also makes sure that AER is enabled in each PCIe device even when
  it's hot-plugged.

 drivers/pci/pcie/aer.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index 5585fefc4d0e..10b2f7db8adb 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -388,6 +388,10 @@ void pci_aer_init(struct pci_dev *dev)
 
 	pci_aer_clear_status(dev);
 
+	/* Enable AER if requested */
+	if (pci_aer_available())
+		pci_enable_pcie_error_reporting(dev);
+
 	/* Enable ECRC checking if enabled and configured */
 	pcie_set_ecrc_checking(dev);
 }
-- 
2.35.0


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

* Re: [PATCH v4 1/3] PCI/AER: Call pcie_set_ecrc_checking() for each PCIe device
  2022-01-25  7:18 ` [PATCH v4 1/3] PCI/AER: Call pcie_set_ecrc_checking() for each PCIe device Stefan Roese
@ 2022-01-25 14:52   ` Pali Rohár
  0 siblings, 0 replies; 12+ messages in thread
From: Pali Rohár @ 2022-01-25 14:52 UTC (permalink / raw)
  To: Stefan Roese
  Cc: linux-pci, Bjorn Helgaas, Bharat Kumar Gogada, Michal Simek,
	Yao Hongbo, Naveen Naidu

On Tuesday 25 January 2022 08:18:18 Stefan Roese wrote:
> Make sure that pcie_set_ecrc_checking() is called for each PCIe device,
> also when it's hot-plugged. This is done by moving
> pcie_set_ecrc_checking() to pci_aer_init().
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Bjorn Helgaas <helgaas@kernel.org>
> Cc: Pali Rohár <pali@kernel.org>
> Cc: Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Cc: Yao Hongbo <yaohongbo@linux.alibaba.com>
> Cc: Naveen Naidu <naveennaidu479@gmail.com>

Reviewed-by: Pali Rohár <pali@kernel.org>

> ---
> v4:
> - New patch
> 
>  drivers/pci/pcie/aer.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
> index 9fa1f97e5b27..5585fefc4d0e 100644
> --- a/drivers/pci/pcie/aer.c
> +++ b/drivers/pci/pcie/aer.c
> @@ -387,6 +387,9 @@ void pci_aer_init(struct pci_dev *dev)
>  	pci_add_ext_cap_save_buffer(dev, PCI_EXT_CAP_ID_ERR, sizeof(u32) * n);
>  
>  	pci_aer_clear_status(dev);
> +
> +	/* Enable ECRC checking if enabled and configured */
> +	pcie_set_ecrc_checking(dev);
>  }
>  
>  void pci_aer_exit(struct pci_dev *dev)
> @@ -1223,9 +1226,6 @@ static int set_device_error_reporting(struct pci_dev *dev, void *data)
>  			pci_disable_pcie_error_reporting(dev);
>  	}
>  
> -	if (enable)
> -		pcie_set_ecrc_checking(dev);
> -
>  	return 0;
>  }
>  
> -- 
> 2.35.0
> 

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

* Re: [PATCH v4 3/3] PCI/AER: Enable AER on all PCIe devices supporting it
  2022-01-25  7:18 ` [PATCH v4 3/3] PCI/AER: Enable AER on all PCIe devices supporting it Stefan Roese
@ 2022-01-25 14:53   ` Pali Rohár
  2022-04-04 20:22   ` Jonathan Derrick
  1 sibling, 0 replies; 12+ messages in thread
From: Pali Rohár @ 2022-01-25 14:53 UTC (permalink / raw)
  To: Stefan Roese
  Cc: linux-pci, Bjorn Helgaas, Bharat Kumar Gogada, Michal Simek,
	Yao Hongbo, Naveen Naidu

On Tuesday 25 January 2022 08:18:20 Stefan Roese wrote:
> With this change, AER is now enabled on all PCIe devices, also when the
> PCIe device is hot-plugged.
> 
> Please note that this change is quite invasive, as with this patch
> applied, AER now will be enabled in the Device Control registers of all
> available PCIe Endpoints, which currently is not the case.
> 
> When "pci=noaer" is selected, AER stays disabled of course.
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Bjorn Helgaas <helgaas@kernel.org>
> Cc: Pali Rohár <pali@kernel.org>
> Cc: Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Cc: Yao Hongbo <yaohongbo@linux.alibaba.com>
> Cc: Naveen Naidu <naveennaidu479@gmail.com>

Reviewed-by: Pali Rohár <pali@kernel.org>

> ---
> v4:
> - No change
> 
> v3:
> - New patch, replacing the "old" 2/2 patch
>   Now enabling of AER for each PCIe device is done in pci_aer_init(),
>   which also makes sure that AER is enabled in each PCIe device even when
>   it's hot-plugged.
> 
>  drivers/pci/pcie/aer.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
> index 5585fefc4d0e..10b2f7db8adb 100644
> --- a/drivers/pci/pcie/aer.c
> +++ b/drivers/pci/pcie/aer.c
> @@ -388,6 +388,10 @@ void pci_aer_init(struct pci_dev *dev)
>  
>  	pci_aer_clear_status(dev);
>  
> +	/* Enable AER if requested */
> +	if (pci_aer_available())
> +		pci_enable_pcie_error_reporting(dev);
> +
>  	/* Enable ECRC checking if enabled and configured */
>  	pcie_set_ecrc_checking(dev);
>  }
> -- 
> 2.35.0
> 

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

* Re: [PATCH v4 0/3] Fully enable AER
  2022-01-25  7:18 [PATCH v4 0/3] Fully enable AER Stefan Roese
                   ` (2 preceding siblings ...)
  2022-01-25  7:18 ` [PATCH v4 3/3] PCI/AER: Enable AER on all PCIe devices supporting it Stefan Roese
@ 2022-03-24 16:55 ` Stefan Roese
  2022-04-04 10:36   ` Stefan Roese
  2022-07-11 19:53 ` Bjorn Helgaas
  4 siblings, 1 reply; 12+ messages in thread
From: Stefan Roese @ 2022-03-24 16:55 UTC (permalink / raw)
  To: linux-pci, Bjorn Helgaas
  Cc: Rafael J . Wysocki, Pali Rohár, Bharat Kumar Gogada,
	Michal Simek, Yao Hongbo, Naveen Naidu

On 1/25/22 08:18, Stefan Roese wrote:
> While working on AER support on a ZynqMP based system, which has some
> PCIe Device connected via a PCIe switch, problems with AER enabling in
> the Device Control registers of all PCIe devices but the Root Port. In
> fact, only the Root Port has AER enabled right now. This patch set now
> fixes this problem by first fixing the AER enabing in the
> interconnected PCIe switches between the Root Port and the PCIe
> devices and in a 2nd patch, also enabling AER in the PCIe Endpoints.
> 
> Please note that these changes are quite invasive, as with these
> patches applied, AER now will be enabled in the Device Control
> registers of all available PCIe Endpoints, which currently is not the
> case.
> 
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> Cc: Bjorn Helgaas <helgaas@kernel.org>
> Cc: Pali Rohár <pali@kernel.org>
> Cc: Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Cc: Yao Hongbo <yaohongbo@linux.alibaba.com>
> Cc: Naveen Naidu <naveennaidu479@gmail.com>
> 
> Stefan Roese (3):
>    PCI/AER: Call pcie_set_ecrc_checking() for each PCIe device
>    PCI/portdrv: Don't disable AER reporting in
>      get_port_device_capability()
>    PCI/AER: Enable AER on all PCIe devices supporting it
> 
>   drivers/pci/pcie/aer.c          | 10 +++++++---
>   drivers/pci/pcie/portdrv_core.c |  9 +--------
>   2 files changed, 8 insertions(+), 11 deletions(-)
> 

Bjorn, what's the status of this patchset? I know this is sensible
stuff, to fully enable PCIe AER. How should be handle this? Do you
plan to pull this soon'ish? Please let me know if something is missing.

Thanks,
Stefan

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

* Re: [PATCH v4 0/3] Fully enable AER
  2022-03-24 16:55 ` [PATCH v4 0/3] Fully enable AER Stefan Roese
@ 2022-04-04 10:36   ` Stefan Roese
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan Roese @ 2022-04-04 10:36 UTC (permalink / raw)
  To: linux-pci, Bjorn Helgaas
  Cc: Rafael J . Wysocki, Pali Rohár, Bharat Kumar Gogada,
	Michal Simek, Yao Hongbo, Naveen Naidu

On 3/24/22 17:55, Stefan Roese wrote:
> On 1/25/22 08:18, Stefan Roese wrote:
>> While working on AER support on a ZynqMP based system, which has some
>> PCIe Device connected via a PCIe switch, problems with AER enabling in
>> the Device Control registers of all PCIe devices but the Root Port. In
>> fact, only the Root Port has AER enabled right now. This patch set now
>> fixes this problem by first fixing the AER enabing in the
>> interconnected PCIe switches between the Root Port and the PCIe
>> devices and in a 2nd patch, also enabling AER in the PCIe Endpoints.
>>
>> Please note that these changes are quite invasive, as with these
>> patches applied, AER now will be enabled in the Device Control
>> registers of all available PCIe Endpoints, which currently is not the
>> case.
>>
>> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
>> Cc: Bjorn Helgaas <helgaas@kernel.org>
>> Cc: Pali Rohár <pali@kernel.org>
>> Cc: Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>
>> Cc: Michal Simek <michal.simek@xilinx.com>
>> Cc: Yao Hongbo <yaohongbo@linux.alibaba.com>
>> Cc: Naveen Naidu <naveennaidu479@gmail.com>
>>
>> Stefan Roese (3):
>>    PCI/AER: Call pcie_set_ecrc_checking() for each PCIe device
>>    PCI/portdrv: Don't disable AER reporting in
>>      get_port_device_capability()
>>    PCI/AER: Enable AER on all PCIe devices supporting it
>>
>>   drivers/pci/pcie/aer.c          | 10 +++++++---
>>   drivers/pci/pcie/portdrv_core.c |  9 +--------
>>   2 files changed, 8 insertions(+), 11 deletions(-)
>>
> 
> Bjorn, what's the status of this patchset? I know this is sensible
> stuff, to fully enable PCIe AER. How should be handle this? Do you
> plan to pull this soon'ish? Please let me know if something is missing.

Hi Bjorn,

maybe it helps, if I send the patchwork links for these patches as
well. Here we go:

https://patchwork.kernel.org/project/linux-pci/patch/20220125071820.2247260-2-sr@denx.de/
https://patchwork.kernel.org/project/linux-pci/patch/20220125071820.2247260-3-sr@denx.de/
https://patchwork.kernel.org/project/linux-pci/patch/20220125071820.2247260-4-sr@denx.de/

All 3 are delegated to you.

Thanks,
Stefan

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

* Re: [PATCH v4 3/3] PCI/AER: Enable AER on all PCIe devices supporting it
  2022-01-25  7:18 ` [PATCH v4 3/3] PCI/AER: Enable AER on all PCIe devices supporting it Stefan Roese
  2022-01-25 14:53   ` Pali Rohár
@ 2022-04-04 20:22   ` Jonathan Derrick
  2022-04-06  5:16     ` Stefan Roese
  1 sibling, 1 reply; 12+ messages in thread
From: Jonathan Derrick @ 2022-04-04 20:22 UTC (permalink / raw)
  To: Stefan Roese, linux-pci
  Cc: Bjorn Helgaas, Pali Rohár, Bharat Kumar Gogada,
	Michal Simek, Yao Hongbo, Naveen Naidu



On 1/25/2022 12:18 AM, Stefan Roese wrote:
> With this change, AER is now enabled on all PCIe devices, also when the
> PCIe device is hot-plugged.
> 
> Please note that this change is quite invasive, as with this patch
> applied, AER now will be enabled in the Device Control registers of all
> available PCIe Endpoints, which currently is not the case.
> 
> When "pci=noaer" is selected, AER stays disabled of course.
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Bjorn Helgaas <helgaas@kernel.org>
> Cc: Pali Rohár <pali@kernel.org>
> Cc: Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Cc: Yao Hongbo <yaohongbo@linux.alibaba.com>
> Cc: Naveen Naidu <naveennaidu479@gmail.com>
> ---
> v4:
> - No change
> 
> v3:
> - New patch, replacing the "old" 2/2 patch
>    Now enabling of AER for each PCIe device is done in pci_aer_init(),
>    which also makes sure that AER is enabled in each PCIe device even when
>    it's hot-plugged.
> 
>   drivers/pci/pcie/aer.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
> index 5585fefc4d0e..10b2f7db8adb 100644
> --- a/drivers/pci/pcie/aer.c
> +++ b/drivers/pci/pcie/aer.c
> @@ -388,6 +388,10 @@ void pci_aer_init(struct pci_dev *dev)
>   
>   	pci_aer_clear_status(dev);
>   
> +	/* Enable AER if requested */
> +	if (pci_aer_available())
> +		pci_enable_pcie_error_reporting(dev);
There are a lot of devices that do this explicitly [1]
May suggest a cleanup patch to follow-up?

[1] 
https://elixir.bootlin.com/linux/v5.18-rc1/A/ident/pci_enable_pcie_error_reporting

... Also a quirk list in the future for broken devices

> +
>   	/* Enable ECRC checking if enabled and configured */
>   	pcie_set_ecrc_checking(dev);
>   }

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

* Re: [PATCH v4 3/3] PCI/AER: Enable AER on all PCIe devices supporting it
  2022-04-04 20:22   ` Jonathan Derrick
@ 2022-04-06  5:16     ` Stefan Roese
  2022-04-06 14:49       ` Jonathan Derrick
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Roese @ 2022-04-06  5:16 UTC (permalink / raw)
  To: Jonathan Derrick, linux-pci
  Cc: Bjorn Helgaas, Pali Rohár, Bharat Kumar Gogada,
	Michal Simek, Yao Hongbo, Naveen Naidu

On 4/4/22 22:22, Jonathan Derrick wrote:
> 
> 
> On 1/25/2022 12:18 AM, Stefan Roese wrote:
>> With this change, AER is now enabled on all PCIe devices, also when the
>> PCIe device is hot-plugged.
>>
>> Please note that this change is quite invasive, as with this patch
>> applied, AER now will be enabled in the Device Control registers of all
>> available PCIe Endpoints, which currently is not the case.
>>
>> When "pci=noaer" is selected, AER stays disabled of course.
>>
>> Signed-off-by: Stefan Roese <sr@denx.de>
>> Cc: Bjorn Helgaas <helgaas@kernel.org>
>> Cc: Pali Rohár <pali@kernel.org>
>> Cc: Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>
>> Cc: Michal Simek <michal.simek@xilinx.com>
>> Cc: Yao Hongbo <yaohongbo@linux.alibaba.com>
>> Cc: Naveen Naidu <naveennaidu479@gmail.com>
>> ---
>> v4:
>> - No change
>>
>> v3:
>> - New patch, replacing the "old" 2/2 patch
>>    Now enabling of AER for each PCIe device is done in pci_aer_init(),
>>    which also makes sure that AER is enabled in each PCIe device even 
>> when
>>    it's hot-plugged.
>>
>>   drivers/pci/pcie/aer.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
>> index 5585fefc4d0e..10b2f7db8adb 100644
>> --- a/drivers/pci/pcie/aer.c
>> +++ b/drivers/pci/pcie/aer.c
>> @@ -388,6 +388,10 @@ void pci_aer_init(struct pci_dev *dev)
>>       pci_aer_clear_status(dev);
>> +    /* Enable AER if requested */
>> +    if (pci_aer_available())
>> +        pci_enable_pcie_error_reporting(dev);
> There are a lot of devices that do this explicitly [1]
> May suggest a cleanup patch to follow-up?

Yes, good idea. I can try to work on this once this patchset is merged.

> [1] 
> https://elixir.bootlin.com/linux/v5.18-rc1/A/ident/pci_enable_pcie_error_reporting 
> 
> 
> ... Also a quirk list in the future for broken devices

IMHO this should only be done, when such devices are detected.

Thanks,
Stefan

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

* Re: [PATCH v4 3/3] PCI/AER: Enable AER on all PCIe devices supporting it
  2022-04-06  5:16     ` Stefan Roese
@ 2022-04-06 14:49       ` Jonathan Derrick
  0 siblings, 0 replies; 12+ messages in thread
From: Jonathan Derrick @ 2022-04-06 14:49 UTC (permalink / raw)
  To: Stefan Roese, linux-pci
  Cc: Bjorn Helgaas, Pali Rohár, Bharat Kumar Gogada,
	Michal Simek, Yao Hongbo, Naveen Naidu



On 4/5/2022 11:16 PM, Stefan Roese wrote:
> On 4/4/22 22:22, Jonathan Derrick wrote:
>>
>>
>> On 1/25/2022 12:18 AM, Stefan Roese wrote:
>>> With this change, AER is now enabled on all PCIe devices, also when the
>>> PCIe device is hot-plugged.
>>>
>>> Please note that this change is quite invasive, as with this patch
>>> applied, AER now will be enabled in the Device Control registers of all
>>> available PCIe Endpoints, which currently is not the case.
>>>
>>> When "pci=noaer" is selected, AER stays disabled of course.
>>>
>>> Signed-off-by: Stefan Roese <sr@denx.de>
>>> Cc: Bjorn Helgaas <helgaas@kernel.org>
>>> Cc: Pali Rohár <pali@kernel.org>
>>> Cc: Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>
>>> Cc: Michal Simek <michal.simek@xilinx.com>
>>> Cc: Yao Hongbo <yaohongbo@linux.alibaba.com>
>>> Cc: Naveen Naidu <naveennaidu479@gmail.com>
>>> ---
>>> v4:
>>> - No change
>>>
>>> v3:
>>> - New patch, replacing the "old" 2/2 patch
>>>    Now enabling of AER for each PCIe device is done in pci_aer_init(),
>>>    which also makes sure that AER is enabled in each PCIe device even 
>>> when
>>>    it's hot-plugged.
>>>
>>>   drivers/pci/pcie/aer.c | 4 ++++
>>>   1 file changed, 4 insertions(+)
>>>
>>> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
>>> index 5585fefc4d0e..10b2f7db8adb 100644
>>> --- a/drivers/pci/pcie/aer.c
>>> +++ b/drivers/pci/pcie/aer.c
>>> @@ -388,6 +388,10 @@ void pci_aer_init(struct pci_dev *dev)
>>>       pci_aer_clear_status(dev);
>>> +    /* Enable AER if requested */
>>> +    if (pci_aer_available())
>>> +        pci_enable_pcie_error_reporting(dev);
>> There are a lot of devices that do this explicitly [1]
>> May suggest a cleanup patch to follow-up?
> 
> Yes, good idea. I can try to work on this once this patchset is merged.
> 
>> [1] 
>> https://elixir.bootlin.com/linux/v5.18-rc1/A/ident/pci_enable_pcie_error_reporting 
>>
>>
>> ... Also a quirk list in the future for broken devices
> 
> IMHO this should only be done, when such devices are detected.
Yep; I'm just anticipating

> 
> Thanks,
> Stefan

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

* Re: [PATCH v4 0/3] Fully enable AER
  2022-01-25  7:18 [PATCH v4 0/3] Fully enable AER Stefan Roese
                   ` (3 preceding siblings ...)
  2022-03-24 16:55 ` [PATCH v4 0/3] Fully enable AER Stefan Roese
@ 2022-07-11 19:53 ` Bjorn Helgaas
  4 siblings, 0 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2022-07-11 19:53 UTC (permalink / raw)
  To: Stefan Roese
  Cc: linux-pci, Rafael J . Wysocki, Pali Rohár,
	Bharat Kumar Gogada, Michal Simek, Yao Hongbo, Naveen Naidu

On Tue, Jan 25, 2022 at 08:18:17AM +0100, Stefan Roese wrote:
> While working on AER support on a ZynqMP based system, which has some
> PCIe Device connected via a PCIe switch, problems with AER enabling in
> the Device Control registers of all PCIe devices but the Root Port. In
> fact, only the Root Port has AER enabled right now. This patch set now
> fixes this problem by first fixing the AER enabing in the
> interconnected PCIe switches between the Root Port and the PCIe
> devices and in a 2nd patch, also enabling AER in the PCIe Endpoints.
> 
> Please note that these changes are quite invasive, as with these
> patches applied, AER now will be enabled in the Device Control
> registers of all available PCIe Endpoints, which currently is not the
> case.
> 
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> Cc: Bjorn Helgaas <helgaas@kernel.org>
> Cc: Pali Rohár <pali@kernel.org>
> Cc: Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Cc: Yao Hongbo <yaohongbo@linux.alibaba.com>
> Cc: Naveen Naidu <naveennaidu479@gmail.com>
> 
> Stefan Roese (3):
>   PCI/AER: Call pcie_set_ecrc_checking() for each PCIe device
>   PCI/portdrv: Don't disable AER reporting in
>     get_port_device_capability()
>   PCI/AER: Enable AER on all PCIe devices supporting it
> 
>  drivers/pci/pcie/aer.c          | 10 +++++++---
>  drivers/pci/pcie/portdrv_core.c |  9 +--------
>  2 files changed, 8 insertions(+), 11 deletions(-)

Applied to pci/err for v5.20, thanks and sorry for the delay.

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

end of thread, other threads:[~2022-07-11 19:53 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-25  7:18 [PATCH v4 0/3] Fully enable AER Stefan Roese
2022-01-25  7:18 ` [PATCH v4 1/3] PCI/AER: Call pcie_set_ecrc_checking() for each PCIe device Stefan Roese
2022-01-25 14:52   ` Pali Rohár
2022-01-25  7:18 ` [PATCH v4 2/3] PCI/portdrv: Don't disable AER reporting in get_port_device_capability() Stefan Roese
2022-01-25  7:18 ` [PATCH v4 3/3] PCI/AER: Enable AER on all PCIe devices supporting it Stefan Roese
2022-01-25 14:53   ` Pali Rohár
2022-04-04 20:22   ` Jonathan Derrick
2022-04-06  5:16     ` Stefan Roese
2022-04-06 14:49       ` Jonathan Derrick
2022-03-24 16:55 ` [PATCH v4 0/3] Fully enable AER Stefan Roese
2022-04-04 10:36   ` Stefan Roese
2022-07-11 19:53 ` Bjorn Helgaas

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).