From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08216606A325 for ; Mon, 30 Nov 2026 07:25:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=p/NdutVA DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=dsSwCYujyA8z23lcGW/Nn6BreS5Xja7ZFoXRahTtxYc=; b=p/NdutVAJQo5F3 rmQp/9KqfUVblGqOCBwV2oY3enENvFG1n/Mv/mA5arWGEI4NZZ3JMuxHGOc1N1H84KxmtO0JNY9f5 dKiAPotohsDvWR50zW2FUL07xxjXF0TXoHlNCzHDOuFbHsp7c9GZTSHC0O2o9CORt5j39/uTJsr4d TPWC3TpVu0rx7lP13o/TxgQKnpzebTiR1p71RfqnCHRpiRB8Qp14gP4A9AjSfvg97gdMweyQU2d+M e5x627fdyCxFvvWGUseoq/1+6sZLpGCV2o/pSeiQc8imWDXkDBGwcVSVTeiUzuoDPGOamTeEaNn7R ixqK0MJmbraz/q/UGAlA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXvlD-00000003Yl2-04Lv; Mon, 30 Nov 2026 07:25:15 +0000 Received: from mail.aspeedtech.com ([211.20.114.72] helo=twmbx01.aspeedtech.com) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXvl9-00000003Ybq-030s for linux-arm-kernel@lists.infradead.org; Mon, 30 Nov 2026 07:25:12 +0000 Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.39; Mon, 30 Nov 2026 15:24:47 +0800 Received: from [127.0.1.1] (192.168.10.13) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.39 via Frontend Transport; Mon, 30 Nov 2026 15:24:47 +0800 From: Ryan Chen Date: Mon, 30 Nov 2026 15:24:33 +0800 Subject: [PATCH v7 06/10] EDAC/aspeed: Allow reporting an error without an address X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-ID: <20261130-edac-v7-6-3aaf6d243f07@aspeedtech.com> References: <20261130-edac-v7-0-3aaf6d243f07@aspeedtech.com> In-Reply-To: <20261130-edac-v7-0-3aaf6d243f07@aspeedtech.com> To: Stefan Schaeckeler , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Joel Stanley , Andrew Jeffery , Borislav Petkov , Tony Luck , Billy Tsai CC: , , , , , Ryan Chen X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796023486; l=3801; i=ryan_chen@aspeedtech.com; s=20251126; h=from:subject:message-id; bh=xKh4pCqRyuTVC4t17whUjaK51bmIysKhKdtUMddSZDk=; b=KBe8lKett4TgilDXshrzGxsyrvb1Bt4VSdFmUneRFD8cyA2ClouH6XVwiweEow3WFU1R4xC7C t9cX6vR68BBDXeIKMJVhsHFFRBcpIrujQwOH2P25IfQLdqXWjZ8omiv X-Developer-Key: i=ryan_chen@aspeedtech.com; a=ed25519; pk=Xe73xY6tcnkuRjjbVAB/oU30KdB3FvG4nuJuILj7ZVc= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261129_232511_057604_09435C79 X-CRM114-Status: GOOD ( 14.96 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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 --- 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