[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7d4a53ea-1d2b-42b5-ad22-3a023f415cd2@intel.com>
Date: Mon, 20 Oct 2025 09:04:01 -0700
From: Dave Jiang <dave.jiang@...el.com>
To: "Fabio M. De Francesco" <fabio.m.de.francesco@...ux.intel.com>,
linux-cxl@...r.kernel.org
Cc: "Rafael J . Wysocki" <rafael@...nel.org>, Len Brown <lenb@...nel.org>,
Tony Luck <tony.luck@...el.com>, Borislav Petkov <bp@...en8.de>,
Hanjun Guo <guohanjun@...wei.com>, Mauro Carvalho Chehab
<mchehab@...nel.org>, Shuai Xue <xueshuai@...ux.alibaba.com>,
Davidlohr Bueso <dave@...olabs.net>,
Jonathan Cameron <jonathan.cameron@...wei.com>,
Alison Schofield <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>, Ira Weiny <ira.weiny@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Mahesh J Salgaonkar <mahesh@...ux.ibm.com>,
Oliver O'Halloran <oohall@...il.com>, Bjorn Helgaas <bhelgaas@...gle.com>,
Sunil V L <sunilvl@...tanamicro.com>, Xiaofei Tan <tanxiaofei@...wei.com>,
Mario Limonciello <mario.limonciello@....com>,
Huacai Chen <chenhuacai@...nel.org>,
Heinrich Schuchardt <heinrich.schuchardt@...onical.com>,
Arnd Bergmann <arnd@...db.de>, Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>, Guo Weikang <guoweikang.kernel@...il.com>,
Xin Li <xin@...or.com>, Will Deacon <will@...nel.org>,
Huang Yiwei <quic_hyiwei@...cinc.com>, Gavin Shan <gshan@...hat.com>,
Smita Koralahalli <Smita.KoralahalliChannabasappa@....com>,
Uwe Kleine-König <u.kleine-koenig@...libre.com>,
Li Ming <ming.li@...omail.com>, Ilpo Järvinen
<ilpo.jarvinen@...ux.intel.com>,
Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>,
Karolina Stolarek <karolina.stolarek@...cle.com>,
Jon Pan-Doh <pandoh@...gle.com>, Lukas Wunner <lukas@...ner.de>,
Shiju Jose <shiju.jose@...wei.com>, linux-kernel@...r.kernel.org,
linux-acpi@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
linux-pci@...r.kernel.org
Subject: Re: [PATCH 4/6 v5] acpi/ghes: Add helper for CPER CXL protocol errors
checks
On 10/17/25 6:30 AM, Fabio M. De Francesco wrote:
> Move the CPER CXL protocol errors validity checks out of
> cxl_cper_post_prot_err() to cxl_cper_sec_prot_err_valid() and check the
> serial number only for CXL agents that are CXL devices (UEFI v2.10,
> Appendix N.2.13).
>
> Signed-off-by: Fabio M. De Francesco <fabio.m.de.francesco@...ux.intel.com>
> ---
> drivers/acpi/apei/ghes.c | 32 ++++++++++++++++++++++----------
> include/cxl/event.h | 10 ++++++++++
> 2 files changed, 32 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
> index d6fe5f020e96e..e69ae864f43d3 100644
> --- a/drivers/acpi/apei/ghes.c
> +++ b/drivers/acpi/apei/ghes.c
> @@ -706,30 +706,42 @@ static DEFINE_KFIFO(cxl_cper_prot_err_fifo, struct cxl_cper_prot_err_work_data,
> static DEFINE_SPINLOCK(cxl_cper_prot_err_work_lock);
> struct work_struct *cxl_cper_prot_err_work;
>
> -static void cxl_cper_post_prot_err(struct cxl_cper_sec_prot_err *prot_err,
> - int severity)
> +int cxl_cper_sec_prot_err_valid(struct cxl_cper_sec_prot_err *prot_err)
> {
> - struct cxl_cper_prot_err_work_data wd;
> - u8 *dvsec_start, *cap_start;
> -
> if (!(prot_err->valid_bits & PROT_ERR_VALID_AGENT_ADDRESS)) {
> pr_err_ratelimited("CXL CPER invalid agent type\n");
> - return;
> + return -EINVAL;
> }
>
> if (!(prot_err->valid_bits & PROT_ERR_VALID_ERROR_LOG)) {
> pr_err_ratelimited("CXL CPER invalid protocol error log\n");
> - return;
> + return -EINVAL;
> }
>
> if (prot_err->err_len != sizeof(struct cxl_ras_capability_regs)) {
> pr_err_ratelimited("CXL CPER invalid RAS Cap size (%u)\n",
> prot_err->err_len);
> - return;
> + return -EINVAL;
> }
>
> - if (!(prot_err->valid_bits & PROT_ERR_VALID_SERIAL_NUMBER))
> - pr_warn(FW_WARN "CXL CPER no device serial number\n");
> + 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");
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(cxl_cper_sec_prot_err_valid);
> +
> +static void cxl_cper_post_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;
> +
> + if (cxl_cper_sec_prot_err_valid(prot_err))
> + return;
>
> guard(spinlock_irqsave)(&cxl_cper_prot_err_work_lock);
>
> diff --git a/include/cxl/event.h b/include/cxl/event.h
> index 6fd90f9cc2034..e1deb66c2197e 100644
> --- a/include/cxl/event.h
> +++ b/include/cxl/event.h
> @@ -320,4 +320,14 @@ static inline int cxl_cper_prot_err_kfifo_get(struct cxl_cper_prot_err_work_data
> }
> #endif
>
> +#ifdef CONFIG_ACPI_APEI_PCIEAER
> +int cxl_cper_sec_prot_err_valid(struct cxl_cper_sec_prot_err *prot_err);
> +#else
> +static inline int
> +cxl_cper_sec_prot_err_valid(struct cxl_cper_sec_prot_err *prot_err)
> +{
> + return -EINVAL;
-EOPNOTSUPP?
> +}
> +#endif
> +
> #endif /* _LINUX_CXL_EVENT_H */
Powered by blists - more mailing lists