Re: [PATCH v6 4/6] acpi/ghes, cper: Recognize and cache CXL Protocol errors

Dan Williams
2025-02-05T22:21:41Z

Smita Koralahalli wrote:
> Add support in GHES to detect and process CXL CPER Protocol errors, as
> defined in UEFI v2.10, section N.2.13.
>
> Define struct cxl_cper_prot_err_work_data to cache CXL protocol error
> information, including RAS capabilities and severity, for further
> handling.
>
> These cached CXL CPER records will later be processed by workqueues
> within the CXL subsystem.
>
> Signed-off-by: Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> Reviewed-by: Ira Weiny <ira.weiny@intel.com>
> ---
> drivers/acpi/apei/ghes.c | 54 ++++++++++++++++++++++++++++++++++++++++
> include/cxl/event.h | 6 +++++
> 2 files changed, 60 insertions(+)
>
> diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
> index b72772494655..4d725d988c43 100644
> --- a/drivers/acpi/apei/ghes.c
> +++ b/drivers/acpi/apei/ghes.c
> @@ -674,6 +674,56 @@ static void ghes_defer_non_standard_event(struct acpi_hest_generic_data *gdata,
> schedule_work(&entry->work);
> }
>
> +static void cxl_cper_post_prot_err(struct cxl_cper_sec_prot_err *prot_err,
> + int severity)
> +{
> +#ifdef CONFIG_ACPI_APEI_PCIEAER

This is ok for now, but now that there are two of these functions I
would not say "no" to a follow on patch that moves ghes_handle_aer() and
cxl_cper_post_prot_err() to a new:

drivers/acpi/apei/aer.c

...that gets conditionally compiled instead of this minor coding-style
nit. Certainly if a third instance like this arrives, a new aer.c
becomes warranted.

> + 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;
> + }

I notice that the component event prints are not ratelimited, so a
follow-on patch to add rate limiting to cxl_cper_post_event() would be
welcome to match what you have here.