RE: [PATCH v6 1/4] ACPI: APEI: EINJ: Refactor available_error_type_show()

From: Luck, Tony
Date: Thu Nov 16 2023 - 17:55:52 EST


> From: Avadhut Naik <Avadhut.Naik@xxxxxxx>
>
> OSPM can discover the error injection capabilities of the platform by
> executing GET_ERROR_TYPE error injection action.[1] The action returns
> a DWORD representing a bitmap of platform supported error injections.[2]
>
> The available_error_type_show() function determines the bits set within
> this DWORD and provides a verbose output, from einj_error_type_string
> array, through /sys/kernel/debug/apei/einj/available_error_type file.
>
> The function however, assumes one to one correspondence between an error's
> position in the bitmap and its array entry offset. Consequently, some
> errors like Vendor Defined Error Type fail this assumption and will
> incorrectly be shown as not supported, even if their corresponding bit is
> set in the bitmap and they have an entry in the array.
>
> Navigate around the issue by converting einj_error_type_string into an
> array of structures with a predetermined mask for all error types
> corresponding to their bit position in the DWORD returned by GET_ERROR_TYPE
> action. The same breaks the aforementioned assumption resulting in all
> supported error types by a platform being outputted through the above
> available_error_type file.
>
> [1] ACPI specification 6.5, Table 18.25
> [2] ACPI specification 6.5, Table 18.30
>
> Suggested-by: Alexey Kardashevskiy <alexey.kardashevskiy@xxxxxxx>
> Signed-off-by: Avadhut Naik <Avadhut.Naik@xxxxxxx>
> Reviewed-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>

Reviewed-by: Tony Luck <tony.luck@xxxxxxxxx>