Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Danielle Costantino <dcostantino@meta.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Keith Busch <kbusch@kernel.org>,
	Kuppuswamy Sathyanarayanan
	<sathyanarayanan.kuppuswamy@linux.intel.com>,
	Lukas Wunner <lukas@wunner.de>,
	Mahesh J Salgaonkar <mahesh@linux.ibm.com>,
	Oliver O'Halloran <oohall@gmail.com>, <linux-pci@vger.kernel.org>,
	Danielle Costantino <dcostantino@meta.com>
Subject: [PATCH 2/2] PCI/EDR: Defer AER status clearing until after recovery
Date: Thu, 12 Feb 2026 11:18:18 -0800	[thread overview]
Message-ID: <20260212191818.3625264-3-dcostantino@meta.com> (raw)
In-Reply-To: <20260212191818.3625264-1-dcostantino@meta.com>

edr_handle_event() calls pci_aer_raw_clear_status() immediately after
dpc_process_error() but before pcie_do_recovery().  While
dpc_process_error() has already read and logged the AER uncorrectable
status by this point, clearing the registers before recovery means
that driver error_detected/slot_reset/resume callbacks invoked by
pcie_do_recovery() can no longer inspect the AER status to make their
own decisions.

Additionally, in the firmware-first EDR path, the normal AER clearing
inside pcie_do_recovery() is a no-op because pcie_aer_is_native()
returns false, so pci_aer_raw_clear_status() in edr_handle_event() is
the only place these registers get cleared.  Moving it after recovery
completes keeps the diagnostic data available throughout the entire
recovery sequence.

Move pci_aer_raw_clear_status() to after pcie_do_recovery() returns so
AER registers remain readable during the full recovery sequence.

Fixes: ac1c8e35a326 ("PCI/DPC: Add Error Disconnect Recover (EDR) support")
Signed-off-by: Danielle Costantino <dcostantino@meta.com>
---
 drivers/pci/pcie/edr.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/pcie/edr.c b/drivers/pci/pcie/edr.c
index e86298dbbcff..94a0e5e58fea 100644
--- a/drivers/pci/pcie/edr.c
+++ b/drivers/pci/pcie/edr.c
@@ -191,7 +191,6 @@ static void edr_handle_event(acpi_handle handle, u32 event, void *data)
 	}
 
 	dpc_process_error(edev);
-	pci_aer_raw_clear_status(edev);
 
 	/*
 	 * Irrespective of whether the DPC event is triggered by ERR_FATAL
@@ -200,6 +199,16 @@ static void edr_handle_event(acpi_handle handle, u32 event, void *data)
 	 */
 	estate = pcie_do_recovery(edev, pci_channel_io_frozen, dpc_reset_link);
 
+	/*
+	 * Clear AER status only after pcie_do_recovery() completes.
+	 * dpc_process_error() has already read and logged the AER
+	 * status above.  Deferring the clear keeps diagnostic data
+	 * available to driver callbacks invoked during recovery and
+	 * avoids interfering with any AER status reads they may
+	 * perform.
+	 */
+	pci_aer_raw_clear_status(edev);
+
 send_ost:
 
 	/*
-- 
2.47.3


      parent reply	other threads:[~2026-02-12 19:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-12 19:18 [PATCH 0/2] PCI/DPC: Fix EDR recovery path issues Danielle Costantino
2026-02-12 19:18 ` [PATCH 1/2] PCI/DPC: Clear Interrupt Status in dpc_reset_link() Danielle Costantino
2026-02-12 19:50   ` Kuppuswamy Sathyanarayanan
2026-02-12 21:23     ` Keith Busch
2026-02-12 21:49       ` Kuppuswamy Sathyanarayanan
2026-02-12 22:12         ` Keith Busch
2026-02-12 22:51           ` Kuppuswamy Sathyanarayanan
2026-02-13  1:22             ` Keith Busch
2026-02-13  4:28               ` Sathyanarayanan Kuppuswamy
2026-02-13 14:01                 ` Keith Busch
2026-02-13 17:08                   ` Kuppuswamy Sathyanarayanan
     [not found]               ` <4c0d0575-0da1-49ff-878e-65622b442e98@linux.intel.com>
2026-02-13  4:29                 ` Sathyanarayanan Kuppuswamy
2026-02-12 21:36   ` Lukas Wunner
2026-02-12 21:50     ` Keith Busch
2026-02-12 19:18 ` Danielle Costantino [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260212191818.3625264-3-dcostantino@meta.com \
    --to=dcostantino@meta.com \
    --cc=bhelgaas@google.com \
    --cc=kbusch@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=mahesh@linux.ibm.com \
    --cc=oohall@gmail.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox