mbox series

[RFC,v2,0/8] Enable EINJv2 support

Message ID 20240521211036.227674-1-zaidal@os.amperecomputing.com
Headers show
Series Enable EINJv2 support | expand

Message

Zaid Alali May 21, 2024, 9:10 p.m. UTC
This patch set intends to enable EINJv2 support. The goal of this
update is to allow the driver to simultaneously support EINJ and EINJv2.
The implementation follows a proposed ACPI specs(1)(2) that enables the
driver to discover system capabilities through GET_ERROR_TYPE.

Note: this revision includes new updates from the last review, where
some changes remove redundant code as well as converting decimal
values to hex for consistency purposes. This revision also includes
CXL error injection updates.

Note: The first two ACPICA patches are to be dropped once merged in
ACPICA project(3).

(1) https://bugzilla.tianocore.org/show_bug.cgi?id=4615
(2) https://bugzilla.tianocore.org/attachment.cgi?id=1446
(3) https://lore.kernel.org/acpica-devel/20240514184150.6285-1-zaidal@os.amperecomputing.com/

Zaid Alali (8):
  ACPICA: Update values to hex to follow ACPI specs
  ACPICA: Add EINJv2 get error type action
  ACPI: APEI: EINJ: Remove redundant calls to
    einj_get_available_error_type
  ACPI: APEI: EINJ: Enable the discovery of EINJv2 capabilities
  ACPI: APEI: EINJ: Add einjv2 extension struct
  ACPI: APEI: EINJ: Add debugfs files for EINJv2 support
  ACPI: APEI: EINJ: Enable EINJv2 error injections
  ACPI: APEI: EINJ: Update the documentation for EINJv2 support

 .../firmware-guide/acpi/apei/einj.rst         |  51 ++++-
 drivers/acpi/apei/apei-internal.h             |   2 +-
 drivers/acpi/apei/einj-core.c                 | 177 +++++++++++++++---
 drivers/acpi/apei/einj-cxl.c                  |   2 +-
 include/acpi/actbl1.h                         |  25 +--
 5 files changed, 214 insertions(+), 43 deletions(-)

Comments

Rafael J. Wysocki May 22, 2024, 10:10 a.m. UTC | #1
On Tue, May 21, 2024 at 11:11 PM Zaid Alali
<zaidal@os.amperecomputing.com> wrote:
>
> ACPI specs(1) define Error Injection Actions in hex values.
> This commit intends to update values from decimal to hex to be
> consistent with ACPI specs. This commit and the following one are
> not to be merged and will come form ACPICA project(2).
>
> (1) https://uefi.org/specs/ACPI/6.5/18_Platform_Error_Interfaces.html
> (2) https://lore.kernel.org/acpica-devel/20240514184150.6285-1-zaidal@os.amperecomputing.com/
>
> Signed-off-by: Zaid Alali <zaidal@os.amperecomputing.com>

In order to modify the ACPICA code in the Linux kernel, you need to
submit a corresponding pull request to the upstream ACPICA project on
GitHub.  Once that pull request has been merged, please send the Linux
patch with a Link: tag pointing to the upstream ACPICA pull request
corresponding to it.

Thanks!

> ---
>  include/acpi/actbl1.h | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
> index 841ef9f22795..b321d481b09a 100644
> --- a/include/acpi/actbl1.h
> +++ b/include/acpi/actbl1.h
> @@ -1017,18 +1017,18 @@ struct acpi_einj_entry {
>  /* Values for Action field above */
>
>  enum acpi_einj_actions {
> -       ACPI_EINJ_BEGIN_OPERATION = 0,
> -       ACPI_EINJ_GET_TRIGGER_TABLE = 1,
> -       ACPI_EINJ_SET_ERROR_TYPE = 2,
> -       ACPI_EINJ_GET_ERROR_TYPE = 3,
> -       ACPI_EINJ_END_OPERATION = 4,
> -       ACPI_EINJ_EXECUTE_OPERATION = 5,
> -       ACPI_EINJ_CHECK_BUSY_STATUS = 6,
> -       ACPI_EINJ_GET_COMMAND_STATUS = 7,
> -       ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS = 8,
> -       ACPI_EINJ_GET_EXECUTE_TIMINGS = 9,
> -       ACPI_EINJ_ACTION_RESERVED = 10, /* 10 and greater are reserved */
> -       ACPI_EINJ_TRIGGER_ERROR = 0xFF  /* Except for this value */
> +       ACPI_EINJ_BEGIN_OPERATION =             0x0,
> +       ACPI_EINJ_GET_TRIGGER_TABLE =           0x1,
> +       ACPI_EINJ_SET_ERROR_TYPE =              0x2,
> +       ACPI_EINJ_GET_ERROR_TYPE =              0x3,
> +       ACPI_EINJ_END_OPERATION =               0x4,
> +       ACPI_EINJ_EXECUTE_OPERATION =           0x5,
> +       ACPI_EINJ_CHECK_BUSY_STATUS =           0x6,
> +       ACPI_EINJ_GET_COMMAND_STATUS =          0x7,
> +       ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS = 0x8,
> +       ACPI_EINJ_GET_EXECUTE_TIMINGS =         0x9,
> +       ACPI_EINJ_ACTION_RESERVED =             0xA,    /* 0xA and greater are reserved */
> +       ACPI_EINJ_TRIGGER_ERROR =               0xFF    /* Except for this value */
>  };
>
>  /* Values for Instruction field above */
> --
> 2.34.1
>
Ben Cheatham May 22, 2024, 4:50 p.m. UTC | #2
On 5/21/24 4:10 PM, Zaid Alali wrote:
> Add einjv2 extension struct and EINJv2 error types to prepare
> the driver for EINJv2 support. ACPI specifications(1) enables
> EINJv2 by extending set_error_type_with_address strcut.
> 
> Signed-off-by: Zaid Alali <zaidal@os.amperecomputing.com>
> ---
>  drivers/acpi/apei/einj-core.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/drivers/acpi/apei/einj-core.c b/drivers/acpi/apei/einj-core.c
> index cc5ad1f45ea4..2021bea02996 100644
> --- a/drivers/acpi/apei/einj-core.c
> +++ b/drivers/acpi/apei/einj-core.c
> @@ -50,6 +50,28 @@
>   */
>  static int acpi5;
>  
> +struct syndrome_array {
> +	union {
> +		u32	acpi_id;
> +		u32	device_id;
> +		u32	pcie_sbdf;
> +		u8	fru_id[16];

I would rename fru_id to vendor_id since this isn't necessarily a FRU id. It also has the
added benefit of matching the naming of the vendor field in comp_synd as well.

> +	} comp_id;
> +	union {
> +		u32	proc_synd;
> +		u32	mem_synd;
> +		u32	pcie_synd;
> +		u8	vendor_synd[16];
> +	} comp_synd;
> +};
> +
> +struct einjv2_extension_struct {
> +	u32 length;
> +	u16 revision;
> +	u16 component_arr_count;
> +	struct syndrome_array component_arr[];
> +};
> +
>  struct set_error_type_with_address {
>  	u32	type;
>  	u32	vendor_extension;
> @@ -58,6 +80,7 @@ struct set_error_type_with_address {
>  	u64	memory_address;
>  	u64	memory_address_range;
>  	u32	pcie_sbdf;
> +	struct einjv2_extension_struct einjv2_struct;
>  };
>  enum {
>  	SETWA_FLAGS_APICID = 1,