Re: [PATCH] ACPI, APEI, EINJ: Remove memory range validation for CXL error types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 29, 2023 at 4:38 PM Ben Cheatham <Benjamin.Cheatham@xxxxxxx> wrote:
>
> From: Yazen Ghannam <yazen.ghannam@xxxxxxx>
>
> This patch is a follow up to the discussion at [1], and builds on Tony's
> CXL error patch at [2].
>
> The new CXL error types will use the Memory Address field in the
> SET_ERROR_TYPE_WITH_ADDRESS structure in order to target a CXL 1.1
> compliant memory-mapped Downstream port. The value of the Memory Address
> will be in the port's MMIO range, and it will not represent physical
> (normal or persistent) memory.
>
> Allow error injection for CXL 1.1 systems by skipping memory range
> validation for CXL error injection types.
>
> Output trying to inject CXL.mem error without patch:
>
> # echo 0x8000 > error_type
> # echo 6 > flags
> # echo 0x3cd5d2000000 > param1
> # echo 0xFFFFFFFFFFFFF000 > param2
> # echo 0 > param3
> # echo 0x400000 > param4
> # echo 1 > error_inject
> -bash: echo: write error: Invalid argument
>
> [1]: https://lore.kernel.org/linux-acpi/20221206205234.606073-1-Benjamin.Cheatham@xxxxxxx/
> [2]: https://lore.kernel.org/linux-cxl/CAJZ5v0hNQUfWViqxbJ5B4JCGJUuHpWWSpqpCFWPNpGuagoFbsQ@xxxxxxxxxxxxxx/T/#t

Link tags for the above, please, and an ACK from the CXL side,
preferably from Dan.

> Signed-off-by: Yazen Ghannam <yazen.ghannam@xxxxxxx>
> Signed-off-by: Ben Cheatham <benjamin.cheatham@xxxxxxx>
> ---
>  drivers/acpi/apei/einj.c | 13 ++++++++++++-
>  include/acpi/actbl1.h    |  6 ++++++
>  2 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
> index 82004abb9643..4e201dfb7d29 100644
> --- a/drivers/acpi/apei/einj.c
> +++ b/drivers/acpi/apei/einj.c
> @@ -37,6 +37,13 @@
>                                 ACPI_EINJ_MEMORY_UNCORRECTABLE | \
>                                 ACPI_EINJ_MEMORY_FATAL)
>
> +#define CXL_ERROR_MASK         (ACPI_EINJ_CXL_CACHE_CORRECTABLE        | \
> +                               ACPI_EINJ_CXL_CACHE_UNCORRECTABLE       | \
> +                               ACPI_EINJ_CXL_CACHE_FATAL               | \
> +                               ACPI_EINJ_CXL_MEM_CORRECTABLE           | \
> +                               ACPI_EINJ_CXL_MEM_UNCORRECTABLE         | \
> +                               ACPI_EINJ_CXL_MEM_FATAL)
> +
>  /*
>   * ACPI version 5 provides a SET_ERROR_TYPE_WITH_ADDRESS action.
>   */
> @@ -511,6 +518,7 @@ static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
>                              u64 param3, u64 param4)
>  {
>         int rc;
> +       u32 available_error_types = 0;
>         u64 base_addr, size;
>
>         /* If user manually set "flags", make sure it is legal */
> @@ -531,8 +539,11 @@ static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
>         if (type & ACPI5_VENDOR_BIT) {
>                 if (vendor_flags != SETWA_FLAGS_MEM)
>                         goto inject;
> -       } else if (!(type & MEM_ERROR_MASK) && !(flags & SETWA_FLAGS_MEM))
> +       } else if (!(type & MEM_ERROR_MASK) && !(flags & SETWA_FLAGS_MEM)) {
> +               goto inject;
> +       } else if (type & CXL_ERROR_MASK) {
>                 goto inject;
> +       }
>
>         /*
>          * Disallow crazy address masks that give BIOS leeway to pick
> diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
> index 15c78678c5d3..68588b2be716 100644
> --- a/include/acpi/actbl1.h
> +++ b/include/acpi/actbl1.h
> @@ -895,6 +895,12 @@ enum acpi_einj_command_status {
>  #define ACPI_EINJ_PLATFORM_CORRECTABLE      (1<<9)
>  #define ACPI_EINJ_PLATFORM_UNCORRECTABLE    (1<<10)
>  #define ACPI_EINJ_PLATFORM_FATAL            (1<<11)
> +#define ACPI_EINJ_CXL_CACHE_CORRECTABLE     BIT(12)
> +#define ACPI_EINJ_CXL_CACHE_UNCORRECTABLE   BIT(13)
> +#define ACPI_EINJ_CXL_CACHE_FATAL           BIT(14)
> +#define ACPI_EINJ_CXL_MEM_CORRECTABLE       BIT(15)
> +#define ACPI_EINJ_CXL_MEM_UNCORRECTABLE     BIT(16)
> +#define ACPI_EINJ_CXL_MEM_FATAL             BIT(17)
>  #define ACPI_EINJ_VENDOR_DEFINED            (1<<31)
>
>  /*******************************************************************************
> --
> 2.34.1
>



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux