]> git.ipfire.org Git - thirdparty/linux.git/commit
ACPI: APEI: EINJ: Refactor available_error_type_show()
authorAvadhut Naik <Avadhut.Naik@amd.com>
Thu, 16 Nov 2023 22:47:22 +0000 (16:47 -0600)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 21 Nov 2023 20:10:44 +0000 (21:10 +0100)
commit709f3cbd652e50e96a9d9c62a300313b636e3f6f
tree7f5702898cdeb83ca0ec9e8ed43e3a312932e802
parent98b1cc82c4affc16f5598d4fa14b1858671b2263
ACPI: APEI: EINJ: Refactor available_error_type_show()

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@amd.com>
Signed-off-by: Avadhut Naik <Avadhut.Naik@amd.com>
Reviewed-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/apei/einj.c