From mboxrd@z Thu Jan 1 00:00:00 1970 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 smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A7A7257459; Tue, 28 Oct 2025 14:54:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761663263; cv=none; b=OpA45wc50LygbacS9ts+PPMGvuuzxHTT+1rtBV38/yjJAfx/+c/LIIjuo/jRypkZNhva7GaKeti2IZo2FFrpMhTA8lUW0kI7kd0MBKuxpdIhou1wpXXgeCPZL02qtKmgYvpnDf/EA8QKtPhLdpcuPoGfbY9UMp6fqd4U6goXaaA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761663263; c=relaxed/simple; bh=tEm0ctuGcJVbOHoM49mfD+yuwiiIfZ3nZWVWiNSlIPM=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bjhUMUNsyL0GCO8DKhQh3lC+KGlii2Wh//OXBVQP8Pm1YZNBi8tmpLLrlQez8aRukeHMuxml4X75YVshCQpOAJTenyMf2UcoZ+h+f39Ns20MIxzm+Fx8hPA1qQI+2zHmDcabjpzXaq90tU1TNcNsXeQx6ZFWlVgMV4dAktvf9VQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4cwtbY1HTSz6HJcR; Tue, 28 Oct 2025 22:50:49 +0800 (CST) Received: from dubpeml100005.china.huawei.com (unknown [7.214.146.113]) by mail.maildlp.com (Postfix) with ESMTPS id 303081402EF; Tue, 28 Oct 2025 22:54:19 +0800 (CST) Received: from localhost (10.203.177.15) by dubpeml100005.china.huawei.com (7.214.146.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 28 Oct 2025 14:54:17 +0000 Date: Tue, 28 Oct 2025 14:54:15 +0000 From: Jonathan Cameron To: "Fabio M. De Francesco" CC: , "Rafael J . Wysocki" , "Len Brown" , Tony Luck , Borislav Petkov , Hanjun Guo , Mauro Carvalho Chehab , Shuai Xue , "Davidlohr Bueso" , 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 , "Peter Zijlstra" , Ingo Molnar , "Guo Weikang" , Xin Li , Will Deacon , Huang Yiwei , Gavin Shan , Smita Koralahalli , Uwe =?ISO-8859-1?Q?Kleine-K=F6n?= =?ISO-8859-1?Q?ig?= , Li Ming , Ilpo =?ISO-8859-1?Q?J=E4rvinen?= , Kuppuswamy Sathyanarayanan , Karolina Stolarek , Jon Pan-Doh , "Lukas Wunner" , Shiju Jose , , , , Subject: Re: [PATCH 4/6 v6] acpi/ghes: Add helper for CXL protocol errors checks Message-ID: <20251028145415.000034bd@huawei.com> In-Reply-To: <20251023122612.1326748-5-fabio.m.de.francesco@linux.intel.com> References: <20251023122612.1326748-1-fabio.m.de.francesco@linux.intel.com> <20251023122612.1326748-5-fabio.m.de.francesco@linux.intel.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: lhrpeml100011.china.huawei.com (7.191.174.247) To dubpeml100005.china.huawei.com (7.214.146.113) On Thu, 23 Oct 2025 14:25:39 +0200 "Fabio M. De Francesco" wrote: > Move the CPER CXL protocol errors validity out of validity check > cxl_cper_post_prot_err() to cxl_cper_sec_prot_err_valid() and limit the to new cxl_cper_sec_prot_err_valid() as otherwise it sounds like it already exists. > serial number check only to CXL agents that are CXL devices (UEFI v2.10, > Appendix N.2.13). Perhaps a little more here on why. I assume because you are going to have a second user for it, but good to say that. Also serves to justify the export. > > 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 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) Useful to return an error number? Or would a bool be better given it is either valid or not? Otherwise looks good to me, Jonathan > { > - 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); >