From nobody Mon Feb 9 01:21:03 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5E332F6928; Thu, 23 Oct 2025 12:27:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761222433; cv=none; b=RazrH75kqFPrYyHY4jHD6D8Y+Pbm9xnzgDeI49CqhIXkBJBWUfFmLOTxcZZ0PYpgFgCa85eniAJyAs2Z2nYCiZ08OUQofLdWX11gcYAuRS4c54Gpml4oMB3f1Cua2cfDlnKJiyhfsXJFuJXR95USrm8Tvv2LLicf9ss7WhqIVjU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761222433; c=relaxed/simple; bh=m/rUtA0AMDKt0v+zqAAwnwEJS8vRn5weJur5wdFlyLE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fRoDZuAgYNw0Eo8rLI5K6CCBaf+9BCZGoTOYT2vHpK03rYglJaCLFWv7fM3yCKJq/HLCUGVwYY7J8/n572EOP9j5cS3cLL9vDXi+HAQAMiVJ3qm7zrlaO3vGXfVaWLXM+heYw2Omf5sCLu9ReOfNWVbdtk6Aoi+i7WnwSYOoWJg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=chAT903l; arc=none smtp.client-ip=198.175.65.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="chAT903l" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1761222431; x=1792758431; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=m/rUtA0AMDKt0v+zqAAwnwEJS8vRn5weJur5wdFlyLE=; b=chAT903lRgo66/C4Y4u30PxBh/zHK3K6nvULi+ErWYHwmGx/xtyop7GH lEPN640oi3y+QaXccANxSGUk9cPbkUhnPe8ulq7m0hZ1fS98BwYZBoKXS hEg438aVBxQV1KpTBjZrO61GoTKjsfHMJ6CBBcu26rW5QddqEAEMVOzg3 Tgzi9PQ+aMhpoOmMlT/jtme00REw9j/o57TPPriCcf+0Etwp4TwUm/udG xB9XVaIiaKbq73rPo1syuw4lqQ3PmSQPaGphJZix5jtBsixLpOF5/jgDW Bvgu9NTBpD5aW5kStMWPjItBNQlMKAjZ1z17DudSsQiJOv4I/zU9CnxM/ w==; X-CSE-ConnectionGUID: Kh2Tn5qcSEaEopiCpo9E/g== X-CSE-MsgGUID: 3KAfBAv/Qdax3M1AzZviDA== X-IronPort-AV: E=McAfee;i="6800,10657,11586"; a="74506760" X-IronPort-AV: E=Sophos;i="6.19,249,1754982000"; d="scan'208";a="74506760" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Oct 2025 05:27:11 -0700 X-CSE-ConnectionGUID: iomVXMNYQgSrdGJDUxuTZA== X-CSE-MsgGUID: eXgs3qMmTeG2602MVH+ETA== X-ExtLoop1: 1 Received: from unknown (HELO fdefranc-mobl3.igk.intel.com) ([10.237.142.160]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Oct 2025 05:27:00 -0700 From: "Fabio M. De Francesco" To: linux-cxl@vger.kernel.org Cc: "Rafael J . Wysocki" , Len Brown , Tony Luck , Borislav Petkov , Hanjun Guo , Mauro Carvalho Chehab , Shuai Xue , Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Mahesh J Salgaonkar , Oliver O'Halloran , Bjorn Helgaas , Sunil V L , Xiaofei Tan , Mario Limonciello , Huacai Chen , Heinrich Schuchardt , Arnd Bergmann , "Fabio M . De Francesco" , Peter Zijlstra , Ingo Molnar , Guo Weikang , Xin Li , Will Deacon , Huang Yiwei , Gavin Shan , Smita Koralahalli , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Li Ming , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Kuppuswamy Sathyanarayanan , Karolina Stolarek , Jon Pan-Doh , Lukas Wunner , Shiju Jose , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org Subject: [PATCH 4/6 v6] acpi/ghes: Add helper for CXL protocol errors checks Date: Thu, 23 Oct 2025 14:25:39 +0200 Message-ID: <20251023122612.1326748-5-fabio.m.de.francesco@linux.intel.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023122612.1326748-1-fabio.m.de.francesco@linux.intel.com> References: <20251023122612.1326748-1-fabio.m.de.francesco@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Move the CPER CXL protocol errors validity out of cxl_cper_post_prot_err() to cxl_cper_sec_prot_err_valid() and limit the serial number check only to CXL agents that are CXL devices (UEFI v2.10, Appendix N.2.13). Signed-off-by: Fabio M. De Francesco --- 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 d6fe5f020e96..e69ae864f43d 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 cx= l_cper_prot_err_work_data, static DEFINE_SPINLOCK(cxl_cper_prot_err_work_lock); struct work_struct *cxl_cper_prot_err_work; =20 -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; } =20 if (!(prot_err->valid_bits & PROT_ERR_VALID_ERROR_LOG)) { pr_err_ratelimited("CXL CPER invalid protocol error log\n"); - return; + return -EINVAL; } =20 if (prot_err->err_len !=3D sizeof(struct cxl_ras_capability_regs)) { pr_err_ratelimited("CXL CPER invalid RAS Cap size (%u)\n", prot_err->err_len); - return; + return -EINVAL; } =20 - 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 =3D=3D RCD || prot_err->agent_type =3D=3D DEVIC= E || + prot_err->agent_type =3D=3D LD || prot_err->agent_type =3D=3D 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; =20 guard(spinlock_irqsave)(&cxl_cper_prot_err_work_lock); =20 diff --git a/include/cxl/event.h b/include/cxl/event.h index 6fd90f9cc203..4d7d1036ea9c 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 c= xl_cper_prot_err_work_data } #endif =20 +#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 -EOPNOTSUPP; +} +#endif + #endif /* _LINUX_CXL_EVENT_H */ --=20 2.51.0