From nobody Fri Dec 19 12:31:44 2025 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 3C453335097; Tue, 4 Nov 2025 18:25:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762280727; cv=none; b=VwuS0FXreh4aCHua415W/h4jxfjfZNPYu8Lbf9Pw8CmwCEAm1Xvhd/y/Dny3R0jJodh7gR9IfT8Zfy3TSHzLcshaYhhkVxKR8uUc8nqR09t87fU/03ayptuT3Kylcfh1ZYwpqmIla6GBCvA0hb0yVGz1AGYzVsU7yJRvmi8T8aQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762280727; c=relaxed/simple; bh=juJtXgSRiOYqNUeFtIDyt8rosY/EPjrWHvZ2ju4d47g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IlRmqYKHGG62vGUOZtaByHpJWpcG9eZARFzqsZG6Cf+/otf5dV+wy6wyu3E6ZPhbrATJBAzd70QSa4Gn3m8rvb2USMFbHDjSrmZZ0tLMKGrFn/4LmiG6c80nZ9IQxddlpyrhmxFaPg049sffcbgXd/GQja5Uc2EdAlDERWK1xZA= 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=WNO8xnsA; arc=none smtp.client-ip=192.198.163.19 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="WNO8xnsA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1762280726; x=1793816726; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=juJtXgSRiOYqNUeFtIDyt8rosY/EPjrWHvZ2ju4d47g=; b=WNO8xnsAxpj182AmrZxWdDHmU4S/CNGhsFJywxFtbhtWhC40OnK0Ls1p qCSp0zER7kxlRKnDzn5UTlhnI0MFzuczRN+eU4sTakSc4SvSsYr0iTJwJ zoL9kzohkKAPryHQu7AU0HFT2xx2T8NuuxdS3tliG08yu0hNHY4yX93pR SfHLJCZHn94cpeEltj3GiJfJh9MXsg5gphnXV/d7maPuvjeR/zQXM0u+a B1gym1tQbWm7+ejHW0Ffv2O3OAqEjymu/fNc+3LmAhXVjfQeCNFjx3GAv tPNWCTK6RrkbRk09C9QV3B3gONKWcHX0xrKEUDkfF6//kEaGqOwUzQRyD A==; X-CSE-ConnectionGUID: cWEziSosR2256WCeala49w== X-CSE-MsgGUID: hxUFiOLFRhOh7kw3XZNjtw== X-IronPort-AV: E=McAfee;i="6800,10657,11603"; a="63394796" X-IronPort-AV: E=Sophos;i="6.19,279,1754982000"; d="scan'208";a="63394796" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2025 10:25:25 -0800 X-CSE-ConnectionGUID: 8m5SSZNuSw+bS+yaYbMORg== X-CSE-MsgGUID: HMQrkF8GQnGkdgOGnzhoCA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,279,1754982000"; d="scan'208";a="191325327" Received: from fdefranc-mobl3.ger.corp.intel.com (HELO fdefranc-mobl3.intel.com) ([10.245.246.211]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2025 10:25:19 -0800 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 , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org, "Fabio M. De Francesco" Subject: [PATCH 4/6 v7] acpi/ghes: Add helper for CXL protocol errors checks Date: Tue, 4 Nov 2025 19:22:35 +0100 Message-ID: <20251104182446.863422-5-fabio.m.de.francesco@linux.intel.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251104182446.863422-1-fabio.m.de.francesco@linux.intel.com> References: <20251104182446.863422-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 check out of cxl_cper_post_prot_err() to new 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). Export the new symbol for reuse by ELOG. Signed-off-by: Fabio M. De Francesco Reviewed-by: Dave Jiang > --- Reviewed-by: Hanjun Guo Reviewed-by: Jonathan Cameron --- 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.1