Re: [PATCH v2 5/6] ACPI: APEI: add separate Memory Error Section 2 handlers

From: Breno Leitao

Date: Tue Nov 03 2026 - 08:43:39 EST


On Mon, Oct 19, 2026 at 10:38:44PM +0200, Pierre Gondois wrote:
> +static bool ghes_handle_memory_failure2(struct acpi_hest_generic_data *gdata,
> + int sev, bool sync)
> +{
> + int flags = -1;
> + int sec_sev = ghes_severity(gdata->error_severity);
> + struct cper_sec_mem_err2 *mem_err = acpi_hest_get_payload(gdata);
> +
> + if (!(mem_err->validation_bits & CPER_MEM2_VALID_PA))
> + return false;
> +
> + /* iff following two events can be handled properly by now */
> + if (sec_sev == GHES_SEV_CORRECTED &&
> + (gdata->flags & CPER_SEC_ERROR_THRESHOLD_EXCEEDED))
> + flags = MF_SOFT_OFFLINE;
> + if (sev == GHES_SEV_RECOVERABLE && sec_sev == GHES_SEV_RECOVERABLE)
> + flags = sync ? MF_ACTION_REQUIRED : 0;
> +
> + if (flags != -1)
> + return ghes_do_memory_failure(mem_err->physical_addr, flags);
> +
> + return false;
> +}

This isn't a bug, but the body is ghes_handle_memory_failure() line for
line, apart from the payload type and the PA valid bit.

Could the severity to flags part move into a helper that takes the
physical address, so both share it?