From: Ryan Chen <ryan_chen@aspeedtech.com>
To: Stefan Schaeckeler <sschaeck@cisco.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>, Joel Stanley <joel@jms.id.au>,
Andrew Jeffery <andrew@codeconstruct.com.au>,
Borislav Petkov <bp@alien8.de>, Tony Luck <tony.luck@intel.com>,
Billy Tsai <billy_tsai@aspeedtech.com>
Cc: <devicetree@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-aspeed@lists.ozlabs.org>, <linux-kernel@vger.kernel.org>,
<linux-edac@vger.kernel.org>,
Ryan Chen <ryan_chen@aspeedtech.com>
Subject: [PATCH v7 06/10] EDAC/aspeed: Allow reporting an error without an address
Date: Mon, 30 Nov 2026 15:24:33 +0800 [thread overview]
Message-ID: <20261130-edac-v7-6-3aaf6d243f07@aspeedtech.com> (raw)
In-Reply-To: <20261130-edac-v7-0-3aaf6d243f07@aspeedtech.com>
Prepare for the AST2700, which has only one failure address register
for both corrected and uncorrected errors. When both happen at once,
one of them has to be reported without an address.
Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
---
drivers/edac/aspeed_edac.c | 38 +++++++++++++++++++++++---------------
1 file changed, 23 insertions(+), 15 deletions(-)
diff --git a/drivers/edac/aspeed_edac.c b/drivers/edac/aspeed_edac.c
index 5858a15ddfac..85179e229543 100644
--- a/drivers/edac/aspeed_edac.c
+++ b/drivers/edac/aspeed_edac.c
@@ -75,7 +75,8 @@ static void mcr_update_bits(struct aspeed_edac *priv, u32 reg, u32 mask,
spin_unlock_irqrestore(&priv->lock, flags);
}
-static void count_rec(struct mem_ctl_info *mci, u8 rec_cnt, u32 rec_addr)
+static void count_rec(struct mem_ctl_info *mci, u8 rec_cnt, u32 rec_addr,
+ bool have_addr)
{
struct csrow_info *csrow = mci->csrows[0];
u32 page, offset, syndrome;
@@ -85,16 +86,20 @@ static void count_rec(struct mem_ctl_info *mci, u8 rec_cnt, u32 rec_addr)
/* report first few errors (if there are) */
/* note: no addresses are recorded */
- if (rec_cnt > 1) {
+ if (rec_cnt > 1 || !have_addr) {
/* page, offset and syndrome are not available */
page = 0;
offset = 0;
syndrome = 0;
- edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, rec_cnt-1,
+ edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci,
+ have_addr ? rec_cnt - 1 : rec_cnt,
page, offset, syndrome, 0, 0, -1,
"address(es) not available", "");
}
+ if (!have_addr)
+ return;
+
/* report last error */
/* note: rec_addr is the last recoverable error addr */
page = rec_addr >> PAGE_SHIFT;
@@ -107,7 +112,7 @@ static void count_rec(struct mem_ctl_info *mci, u8 rec_cnt, u32 rec_addr)
}
static void count_un_rec(struct mem_ctl_info *mci, u8 un_rec_cnt,
- u32 un_rec_addr)
+ u32 un_rec_addr, bool have_addr)
{
struct csrow_info *csrow = mci->csrows[0];
u32 page, offset, syndrome;
@@ -117,22 +122,25 @@ static void count_un_rec(struct mem_ctl_info *mci, u8 un_rec_cnt,
/* report 1. error */
/* note: un_rec_addr is the first unrecoverable error addr */
- page = un_rec_addr >> PAGE_SHIFT;
- offset = un_rec_addr & ~PAGE_MASK;
- /* syndrome is not available */
- syndrome = 0;
- edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, 1,
- csrow->first_page + page, offset, syndrome,
- 0, 0, -1, "", "");
+ if (have_addr) {
+ page = un_rec_addr >> PAGE_SHIFT;
+ offset = un_rec_addr & ~PAGE_MASK;
+ /* syndrome is not available */
+ syndrome = 0;
+ edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, 1,
+ csrow->first_page + page, offset, syndrome,
+ 0, 0, -1, "", "");
+ }
/* report further errors (if there are) */
/* note: no addresses are recorded */
- if (un_rec_cnt > 1) {
+ if (un_rec_cnt > 1 || !have_addr) {
/* page, offset and syndrome are not available */
page = 0;
offset = 0;
syndrome = 0;
- edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, un_rec_cnt-1,
+ edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci,
+ have_addr ? un_rec_cnt - 1 : un_rec_cnt,
page, offset, syndrome, 0, 0, -1,
"address(es) not available", "");
}
@@ -171,8 +179,8 @@ static irqreturn_t mcr_isr(int irq, void *arg)
ASPEED_MCR_INTR_CTRL_CLEAR, 0);
/* process recoverable and unrecoverable errors */
- count_rec(mci, rec_cnt, rec_addr);
- count_un_rec(mci, un_rec_cnt, un_rec_addr);
+ count_rec(mci, rec_cnt, rec_addr, true);
+ count_un_rec(mci, un_rec_cnt, un_rec_addr, true);
if (!rec_cnt && !un_rec_cnt)
dev_dbg(mci->pdev, "received edac interrupt, but did not find any ECC counters\n");
--
2.34.1
next prev parent reply other threads:[~2026-11-30 7:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 7:24 [PATCH v7 00/10] Add Aspeed AST2700 SDRAM EDAC support Ryan Chen
2026-11-30 7:24 ` [PATCH v7 01/10] EDAC/aspeed: Stop keeping driver state in global variables Ryan Chen
2026-11-30 7:24 ` [PATCH v7 02/10] EDAC/aspeed: Replace regmap with direct register access Ryan Chen
2026-11-30 7:24 ` [PATCH v7 03/10] EDAC/aspeed: Put the differences between chips in a table Ryan Chen
2026-11-30 7:24 ` [PATCH v7 04/10] EDAC/aspeed: Don't unlock the interrupt control register on AST2600 Ryan Chen
2026-11-30 7:24 ` [PATCH v7 05/10] EDAC/aspeed: Let each chip provide its own interrupt handling Ryan Chen
2026-11-30 7:24 ` Ryan Chen [this message]
2026-11-30 7:24 ` [PATCH v7 07/10] EDAC/aspeed: Allow error addresses above 4 GiB Ryan Chen
2026-11-30 7:24 ` [PATCH v7 08/10] EDAC/aspeed: Disable interrupts before requesting the interrupt line Ryan Chen
2026-11-30 7:24 ` [PATCH v7 09/10] EDAC/aspeed: Add AST2700 support Ryan Chen
2026-11-30 7:24 ` [PATCH v7 10/10] MAINTAINERS: Step down as Aspeed AST2500 EDAC driver maintainer Ryan Chen
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=20261130-edac-v7-6-3aaf6d243f07@aspeedtech.com \
--to=ryan_chen@aspeedtech.com \
--cc=andrew@codeconstruct.com.au \
--cc=billy_tsai@aspeedtech.com \
--cc=bp@alien8.de \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=joel@jms.id.au \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sschaeck@cisco.com \
--cc=tony.luck@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