mbox series

[v6,0/4] Add support for Vendor Defined Error Types in Einj Module

Message ID 20231116224725.3695952-1-avadhut.naik@amd.com
Headers show
Series Add support for Vendor Defined Error Types in Einj Module | expand

Message

Avadhut Naik Nov. 16, 2023, 10:47 p.m. UTC
This patchset adds support for Vendor Defined Error types in the einj
module by exporting a binary blob file in module's debugfs directory.
Userspace tools can write OEM Defined Structures into the blob file as
part of injecting Vendor defined errors. Similarly, the very tools can
also read from the blob file for information, if any, provided by the
firmware after error injection.

The first patch refactors available_error_type_show() function to ensure
all errors supported by the platform are output through einj module's
available_error_type file in debugfs.

The second patch adds a write callback for binary blobs created through
debugfs_create_blob() API.

The third patch fixes the permissions of panicinfo file in debugfs to
ensure it remains read-only

The fourth patch adds the required support i.e. establishing the memory
mapping and exporting it through debugfs blob file for Vendor-defined
Error types.

Changes in v2:
 - Split the v1 patch, as was recommended, to have a separate patch for
changes in debugfs.
 - Refactored available_error_type_show() function into a separate patch.
 - Changed file permissions to octal format to remove checkpatch warnings.

Changes in v3:
 - Use BIT macro for generating error masks instead of hex values since
ACPI spec uses bit numbers.
 - Handle the corner case of acpi_os_map_iomem() returning NULL through
a local variable to a store the size of OEM defined data structure.

Changes in v4:
 - Fix permissions for panicinfo file in debugfs.
 - Replace acpi_os_map_iomem() and acpi_os_unmap_iomem() calls with
   acpi_os_map_memory() and acpi_os_unmap_memory() respectively to avert
   sparse warnings as suggested by Alexey.

Changes in v5:
 - Change permissions of the "oem_error" file, being created in einj
   module's debugfs directory, from "w" to "rw" since system firmware
   in some cases might provide some information through OEM-defined
   structure for tools to consume.
 - Remove Reviewed-by: Alexey Kardashevskiy <aik@amd.com> from the
   fourth patch since permissions of the oem_error file have changed.
 - Add Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> for
   second and third patch.
 - Rebase on top of tip master.

Changes in v6:
 - Minor formatting undertaken in the first and fourth patch per v5
   feedback by Boris.
 - Added check in the second patch to ensure that only owners can write
   into the binary blob files. Mentioned the same in commit description.
 - Modified commit description of the third patch per recommendations
   provided by Tony.
 - Add Reviewed-by: Borislav Petkov (AMD) <bp@alien8.de> for first and
   fourth patch.
 - Add Reviewed-by: Tony Luck <tony.luck@intel.com> for second, third and
   fourth patch.


[NOTE:

 - The second patch already had the below tags for v5:
    Reviewed-by: Alexey Kardashevskiy <aik@amd.com>
    Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

   Since the changes to the patch for v6 are very minimal i.e. addition of
   a check to ensure that only owners write into the blobs, have retained
   the tags for v6 as well.

 - Similarly, the third patch already had the below tag for v5:
    Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

   Since only the commit description was slightly changed for this patch
   in v6, have retained the tag for v6 too.

   Having said so, if advised, will attempt to reacquire the tags.]


Avadhut Naik (4):
  ACPI: APEI: EINJ: Refactor available_error_type_show()
  fs: debugfs: Add write functionality to debugfs blobs
  platform/chrome: cros_ec_debugfs: Fix permissions for panicinfo
  ACPI: APEI: EINJ: Add support for vendor defined error types

 drivers/acpi/apei/einj.c                  | 71 +++++++++++++++--------
 drivers/platform/chrome/cros_ec_debugfs.c |  2 +-
 fs/debugfs/file.c                         | 28 +++++++--
 3 files changed, 72 insertions(+), 29 deletions(-)


base-commit: a1cc6ec03d1e56b795607fce8442222b37d1dd99

Comments

Rafael J. Wysocki Nov. 21, 2023, 8:12 p.m. UTC | #1
On Thu, Nov 16, 2023 at 11:47 PM Avadhut Naik <avadhut.naik@amd.com> wrote:
>
> This patchset adds support for Vendor Defined Error types in the einj
> module by exporting a binary blob file in module's debugfs directory.
> Userspace tools can write OEM Defined Structures into the blob file as
> part of injecting Vendor defined errors. Similarly, the very tools can
> also read from the blob file for information, if any, provided by the
> firmware after error injection.
>
> The first patch refactors available_error_type_show() function to ensure
> all errors supported by the platform are output through einj module's
> available_error_type file in debugfs.
>
> The second patch adds a write callback for binary blobs created through
> debugfs_create_blob() API.
>
> The third patch fixes the permissions of panicinfo file in debugfs to
> ensure it remains read-only
>
> The fourth patch adds the required support i.e. establishing the memory
> mapping and exporting it through debugfs blob file for Vendor-defined
> Error types.
>
> Changes in v2:
>  - Split the v1 patch, as was recommended, to have a separate patch for
> changes in debugfs.
>  - Refactored available_error_type_show() function into a separate patch.
>  - Changed file permissions to octal format to remove checkpatch warnings.
>
> Changes in v3:
>  - Use BIT macro for generating error masks instead of hex values since
> ACPI spec uses bit numbers.
>  - Handle the corner case of acpi_os_map_iomem() returning NULL through
> a local variable to a store the size of OEM defined data structure.
>
> Changes in v4:
>  - Fix permissions for panicinfo file in debugfs.
>  - Replace acpi_os_map_iomem() and acpi_os_unmap_iomem() calls with
>    acpi_os_map_memory() and acpi_os_unmap_memory() respectively to avert
>    sparse warnings as suggested by Alexey.
>
> Changes in v5:
>  - Change permissions of the "oem_error" file, being created in einj
>    module's debugfs directory, from "w" to "rw" since system firmware
>    in some cases might provide some information through OEM-defined
>    structure for tools to consume.
>  - Remove Reviewed-by: Alexey Kardashevskiy <aik@amd.com> from the
>    fourth patch since permissions of the oem_error file have changed.
>  - Add Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> for
>    second and third patch.
>  - Rebase on top of tip master.
>
> Changes in v6:
>  - Minor formatting undertaken in the first and fourth patch per v5
>    feedback by Boris.
>  - Added check in the second patch to ensure that only owners can write
>    into the binary blob files. Mentioned the same in commit description.
>  - Modified commit description of the third patch per recommendations
>    provided by Tony.
>  - Add Reviewed-by: Borislav Petkov (AMD) <bp@alien8.de> for first and
>    fourth patch.
>  - Add Reviewed-by: Tony Luck <tony.luck@intel.com> for second, third and
>    fourth patch.
>
>
> [NOTE:
>
>  - The second patch already had the below tags for v5:
>     Reviewed-by: Alexey Kardashevskiy <aik@amd.com>
>     Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
>    Since the changes to the patch for v6 are very minimal i.e. addition of
>    a check to ensure that only owners write into the blobs, have retained
>    the tags for v6 as well.
>
>  - Similarly, the third patch already had the below tag for v5:
>     Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
>    Since only the commit description was slightly changed for this patch
>    in v6, have retained the tag for v6 too.
>
>    Having said so, if advised, will attempt to reacquire the tags.]
>
>
> Avadhut Naik (4):
>   ACPI: APEI: EINJ: Refactor available_error_type_show()
>   fs: debugfs: Add write functionality to debugfs blobs
>   platform/chrome: cros_ec_debugfs: Fix permissions for panicinfo
>   ACPI: APEI: EINJ: Add support for vendor defined error types
>
>  drivers/acpi/apei/einj.c                  | 71 +++++++++++++++--------
>  drivers/platform/chrome/cros_ec_debugfs.c |  2 +-
>  fs/debugfs/file.c                         | 28 +++++++--
>  3 files changed, 72 insertions(+), 29 deletions(-)
>
>
> base-commit: a1cc6ec03d1e56b795607fce8442222b37d1dd99
> --

All patches in the series applied as 6.8 material, thanks!