From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BE5E4C7EE30 for ; Tue, 1 Jul 2025 13:05:10 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4bWjtY2nmnz2yqn; Tue, 1 Jul 2025 23:05:09 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1751375109; cv=none; b=FqVwWDsfPGdZqBKlJLyEiVSv+2MgvRFHcpTQryOyaWI4XI614VdWwZK+D7jq7FTYAG7TDF5yQ+LRw+FiCQ6KJIPvJO8TXMcPoeivE2bz44HcN/TaGAS4FmH2p2nvj/T1KPD+sPx9rnjDfmR5Ro9JrwlgHeUWc0iZgx+zEEBAqyK+xeXO9jm1WQaJgiB9a3d+pNTGx5busuXaLhY1Ka2Azkd2U24OuAe3kSY4uBDMMe+0I3zLxmgmiPzyj7XMsyCYneytRdmoKwbKqEs5oEoCeLQuiXQOefWvbG9YLJ3T2BaiYTpVUvvLPYBHuamisR6E9/09H4m6bDOMzN/oFK8PdA== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1751375109; c=relaxed/relaxed; bh=xS89ssfI1kfPEjiB4A8a1PumN2KG/nwc7Aoy5JLZTH4=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=R87rG0bM+Dr+H49FYWChu05/+GrYIp2+i0UULbbvsgfK1wk0fXZqWdQQ3ohx3khLJdu7hqERxeEr9fEKz9qXB6VO8wollvJ69/BBTx0TvoI2X8LHsDRaJB83nAqJk/WDtnAIGTy7NbPWYRbs27Y8LpSu6lxrf6lISg1JmAFpVUmWVaBs6GoJmHQYk2GTZUmoQwZ2AsGr5iFg1ZEEbEVtUj85jSxSGtm7YEzB5us6HK/7s/n82n6T1ItxCTOD/qKC+kDU5s3DXrt7CKda0YgHcUc8H2WVkDRNDS8PYcaa7FvgZYnGSZ+FjuIkieXXUtUJVURv4YRstAz13HfaFNtE4w== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass (client-ip=185.176.79.56; helo=frasgout.his.huawei.com; envelope-from=jonathan.cameron@huawei.com; receiver=lists.ozlabs.org) smtp.mailfrom=huawei.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=huawei.com (client-ip=185.176.79.56; helo=frasgout.his.huawei.com; envelope-from=jonathan.cameron@huawei.com; receiver=lists.ozlabs.org) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4bWjtX3cyDz2xHT for ; Tue, 1 Jul 2025 23:05:08 +1000 (AEST) Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4bWjt25brXz6L5Y7; Tue, 1 Jul 2025 21:04:42 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id 7EEF31402F8; Tue, 1 Jul 2025 21:05:05 +0800 (CST) Received: from localhost (10.122.19.247) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Tue, 1 Jul 2025 15:05:04 +0200 Date: Tue, 1 Jul 2025 14:05:03 +0100 From: Jonathan Cameron To: "Fabio M. De Francesco" CC: , "Rafael J . Wysocki" , "Len Brown" , Davidlohr Bueso , Dave Jiang , Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Mahesh J Salgaonkar , Oliver O'Halloran , Bjorn Helgaas , Tony Luck , Borislav Petkov , , , , , , Kuppuswamy Sathyanarayanan Subject: Re: [PATCH 3/3 v4] ACPI: extlog: Trace CPER CXL Protocol Error Section Message-ID: <20250701140503.00006a48@huawei.com> In-Reply-To: <20250623145453.1046660-4-fabio.m.de.francesco@linux.intel.com> References: <20250623145453.1046660-1-fabio.m.de.francesco@linux.intel.com> <20250623145453.1046660-4-fabio.m.de.francesco@linux.intel.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.122.19.247] X-ClientProxiedBy: lhrpeml100005.china.huawei.com (7.191.160.25) To frapeml500008.china.huawei.com (7.182.85.71) On Mon, 23 Jun 2025 16:54:20 +0200 "Fabio M. De Francesco" wrote: > When Firmware First is enabled, BIOS handles errors first and then it makes > them available to the kernel via the Common Platform Error Record (CPER) > sections (UEFI 2.10 Appendix N). Linux parses the CPER sections via one of > two similar paths, either ELOG or GHES. The errors managed by ELOG are > signaled to the BIOS by the I/O Machine Check Architecture (I/O MCA). > > Currently, ELOG and GHES show some inconsistencies in how they report to > userspace via trace events. > > Therefore, make the two mentioned paths act similarly by tracing the CPER > CXL Protocol Error Section (UEFI v2.10, Appendix N.2.13). > > Cc: Dan Williams > Reviewed-by: Kuppuswamy Sathyanarayanan > Signed-off-by: Fabio M. De Francesco > --- > drivers/acpi/acpi_extlog.c | 62 ++++++++++++++++++++++++++++++++++++++ > drivers/cxl/core/ras.c | 6 ++++ > include/cxl/event.h | 2 ++ > 3 files changed, 70 insertions(+) > > diff --git a/drivers/acpi/acpi_extlog.c b/drivers/acpi/acpi_extlog.c > index cefe8d2d8affc..9a37b08aacfea 100644 > --- a/drivers/acpi/acpi_extlog.c > +++ b/drivers/acpi/acpi_extlog.c > @@ -12,6 +12,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -160,6 +161,60 @@ static void extlog_print_pcie(struct cper_sec_pcie *pcie_err, > pci_dev_put(pdev); > } > > +static void > +extlog_cxl_cper_handle_prot_err(struct cxl_cper_sec_prot_err *prot_err, > + int severity) > +{ > + struct cxl_cper_prot_err_work_data wd; > + u8 *dvsec_start, *cap_start; A bunch of this is identical to cxl_cper_post_prot_err() Can we factor that stuff out for common use? > + > + if (!(prot_err->valid_bits & PROT_ERR_VALID_AGENT_ADDRESS)) { > + pr_warn_ratelimited("CXL CPER invalid agent type\n"); > + return; > + } > + > + if (!(prot_err->valid_bits & PROT_ERR_VALID_ERROR_LOG)) { > + pr_warn_ratelimited("CXL CPER invalid protocol error log\n"); > + return; > + } > + > + if (prot_err->err_len != sizeof(struct cxl_ras_capability_regs)) { > + pr_warn_ratelimited("CXL CPER invalid RAS Cap size (%u)\n", > + prot_err->err_len); > + return; > + } > + > + if ((prot_err->agent_type == RCD || prot_err->agent_type == DEVICE || > + prot_err->agent_type == LD || prot_err->agent_type == FMLD) && > + !(prot_err->valid_bits & PROT_ERR_VALID_SERIAL_NUMBER)) > + pr_warn_ratelimited(FW_WARN > + "CXL CPER no device serial number\n"); Whilst some of this check isn't present in cxl_cper_post_prot_err(), it should be harmless. > + > + switch (prot_err->agent_type) { > + case RCD: > + case DEVICE: > + case LD: > + case FMLD: > + case RP: > + case DSP: > + case USP: > + memcpy(&wd.prot_err, prot_err, sizeof(wd.prot_err)); > + > + dvsec_start = (u8 *)(prot_err + 1); > + cap_start = dvsec_start + prot_err->dvsec_len; > + > + memcpy(&wd.ras_cap, cap_start, sizeof(wd.ras_cap)); > + wd.severity = cper_severity_to_aer(severity); > + break; > + default: > + pr_err_ratelimited("CXL CPER reserved agent type: %d\n", > + prot_err->agent_type); > + return; > + } > + > + cxl_cper_ras_handle_prot_err(&wd); > +}