RE: [PATCH v2] ACPI: APEI: EINJ: Fix EINJv2 memory injection
From: Luck, Tony
Date: Wed Apr 15 2026 - 16:06:20 EST
> > > > +static bool is_memory_injection(u32 type, u64 param2)
> > > > +{
> > > > + if (is_v2)
> > > > + return type & BIT(1);
> > >
> > > Hi Tony, just a nit: for readability would it better to introduce a
> > > macro for BIT(1)? like ACPI65_EINJV2_ERROR_TYPE_MEMORY
> >
> > I thought about that. The old (v1?) EINJ type bits are in <acpi/actbl1.h>
> >
> > So "the right thing"(TM) might be to add some V2 defines there:
> >
> > #define ACPI_EINJV2_PROCESSOR BIT(0)
> > #define ACPI_EINJV2_MEMORY BIT(1)
> > #define ACPI_EINJV2_PCIX BIT(2)
>
> Looks good to me. Let's see what Rafael thinks about adding them.
>
> >
> > Rafael: Do you want that? I can start the process in the ACPICA tree if you do.
The sashiko AI review found another spot where code is checking for memory injection
but is unaware of EINJ V2. In einj_error_inject() there's a check to see if this is memory
injection, if so, validate the address to avoid problematic ranges:
Link: https://sashiko.dev/#/patchset/20260415163620.12957-1-tony.luck%40intel.com
I first tried another simple band-aid check for is_v2 ... but the problem seems more structural.
Code passes around "type" all over the place. Sometimes it might be a V1 bitmask,
and sometimes a V2 bitmask.
I'm going to think a bit more on this to see if there is a better solution that adding
checks for "is_v2" all over the place.
-Tony