mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Kai-Heng Feng" <kaihengf@nvidia.com>
To: "Ashok Raj" <ashok.raj@oss.qualcomm.com>
Cc: <rafael@kernel.org>, <linux-acpi@vger.kernel.org>,
	<tony.luck@intel.com>, <bp@alien8.de>, <guohanjun@huawei.com>,
	<mchehab@kernel.org>, <xueshuai@linux.alibaba.com>,
	<lenb@kernel.org>, <kees@kernel.org>, <gustavoars@kernel.org>,
	<linux-hardening@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 1/3] ACPI: APEI: GHES: Refactor Grace decoder helpers
Date: Wed, 12 Aug 2026 20:23:17 +0800	[thread overview]
Message-ID: <DKMYNI96TQM8.3OMDZZZA5BGU3@nvidia.com> (raw)
In-Reply-To: <anUpAigVklVNG7ij@hu-ashoraj-lv.qualcomm.com>

On Fri Aug 7, 2026 at 8:38 AM CST, Ashok Raj wrote:
> External email: Use caution opening links or attachments
>
>
> On Tue, Aug 04, 2026 at 08:23:15PM +0800, Kai-Heng Feng wrote:
>> Split the Grace CPER processing into a separate decode step and a
>> print step so the parser can be exercised by KUnit without a live
>> ACPI device. Introduce ghes-nvidia.h to hold shared types that the
>> Vera decoder added in the next commit will also reference.
>>
>> Parse the Grace wire payload with __packed structs and
>> get_unaligned_le*() for multi-byte fields, matching the Vera
>> decoder style. Reject nvidia_ghes_grace_reg_pair() calls with a
>> non-zero register count and a NULL grace_regs pointer, and
>> rate-limit Grace decoder diagnostics.
>>
>> Signed-off-by: Kai-Heng Feng <kaihengf@nvidia.com>
>
> Hi Kai,
>
>> ---
>> v3:
>>  - Use __packed + get_unaligned_le*() for Grace multi-byte fields,
>>    including register pairs (Shuai Xue).
>>  - Keep __counted_by / struct_size; reject NULL grace_regs when
>>    number_regs != 0; document the helper contract.
>>  - Rate-limit Grace decoder and notify error messages.
>> v2:
>>  - No change.
>> ---
>>  MAINTAINERS                     |   2 +-
>>  drivers/acpi/apei/ghes-nvidia.c | 160 ++++++++++++++++++++++----------
>>  drivers/acpi/apei/ghes-nvidia.h |  50 ++++++++++
>>  3 files changed, 160 insertions(+), 52 deletions(-)
>>  create mode 100644 drivers/acpi/apei/ghes-nvidia.h
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 5114e6db7307..aa9c2ae58ac5 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -19348,7 +19348,7 @@ NVIDIA GHES VENDOR CPER RECORD HANDLER
>>  M:   Kai-Heng Feng <kaihengf@nvidia.com>
>>  L:   linux-acpi@vger.kernel.org
>>  S:   Maintained
>> -F:   drivers/acpi/apei/ghes-nvidia.c
>> +F:   drivers/acpi/apei/ghes-nvidia*
>>
>>  NVIDIA VRS RTC DRIVER
>>  M:   Shubhi Garg <shgarg@nvidia.com>
>> diff --git a/drivers/acpi/apei/ghes-nvidia.c b/drivers/acpi/apei/ghes-nvidia.c
>> index 597275d81de8..e7cc912344fd 100644
>> --- a/drivers/acpi/apei/ghes-nvidia.c
>> +++ b/drivers/acpi/apei/ghes-nvidia.c
>> @@ -9,13 +9,18 @@
>>  #include <linux/module.h>
>>  #include <linux/platform_device.h>
>>  #include <linux/types.h>
>> +#include <linux/unaligned.h>
>>  #include <linux/uuid.h>
>>  #include <acpi/ghes.h>
>
> One naive question, do these CPER decoding for vendor specific pieces
> belong in the kernel? Or you would manage them from user space?

I think so, since pcie-hisi-controller is already doing that. And I
think helpers like devm_ghes_register_vendor_record_notifier() is
designed for this kind of work.

Kai-Heng

>
>
>>
>> -static const guid_t nvidia_sec_guid =
>> +#include <kunit/visibility.h>
>> +#include "ghes-nvidia.h"
>> +
>> +static const guid_t nvidia_grace_sec_guid =
>>       GUID_INIT(0x6d5244f2, 0x2712, 0x11ec,
>>                 0xbe, 0xa7, 0xcb, 0x3f, 0xdb, 0x95, 0xc7, 0x86);
>>
>> +/* Grace CPER section wire layout (header without flexible register array). */
>>  struct cper_sec_nvidia {
>>       char    signature[16];
>>       __le16  error_type;
>> @@ -25,84 +30,137 @@ struct cper_sec_nvidia {
>>       u8      number_regs;
>>       u8      reserved;
>>       __le64  instance_base;
>> -     struct {
>> -             __le64  addr;
>> -             __le64  val;
>> -     } regs[] __counted_by(number_regs);
>> -};
>> +     struct nvidia_ghes_grace_reg regs[] __counted_by(number_regs);
>> +} __packed;
>> +
>
> [snip]
>
> Cheers,
> Ashok



  reply	other threads:[~2026-08-12 12:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24 12:20 [PATCH v2 RESEND 0/4] ACPI: APEI: GHES: Add NVIDIA Vera CPER decoder and tests Kai-Heng Feng
2026-07-24 12:20 ` [PATCH v2 RESEND 1/4] ACPI: APEI: GHES: Refactor Grace decoder helpers Kai-Heng Feng
2026-07-26  8:10   ` Shuai Xue
2026-07-24 12:20 ` [PATCH v2 RESEND 2/4] ACPI: APEI: GHES: Add NVIDIA Vera decoder Kai-Heng Feng
2026-07-26  8:21   ` Shuai Xue
2026-07-24 12:20 ` [PATCH v2 RESEND 3/4] ACPI: APEI: GHES: Add Grace and Vera KUnit coverage Kai-Heng Feng
2026-07-26  8:30   ` Shuai Xue
2026-07-24 12:20 ` [PATCH v2 RESEND 4/4] selftests: firmware: Add NVIDIA GHES EINJ selftest Kai-Heng Feng
2026-07-26  9:02   ` Shuai Xue
2026-08-04 12:23 ` [PATCH v3 0/3] ACPI: APEI: GHES: Add NVIDIA Vera CPER decoding Kai-Heng Feng
2026-08-04 12:23   ` [PATCH v3 1/3] ACPI: APEI: GHES: Refactor Grace decoder helpers Kai-Heng Feng
2026-08-07  0:38     ` Ashok Raj
2026-08-12 12:23       ` Kai-Heng Feng [this message]
2026-08-04 12:23   ` [PATCH v3 2/3] ACPI: APEI: GHES: Add NVIDIA Vera decoder Kai-Heng Feng
2026-08-04 12:23   ` [PATCH v3 3/3] ACPI: APEI: GHES: Add Grace and Vera KUnit coverage Kai-Heng Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DKMYNI96TQM8.3OMDZZZA5BGU3@nvidia.com \
    --to=kaihengf@nvidia.com \
    --cc=ashok.raj@oss.qualcomm.com \
    --cc=bp@alien8.de \
    --cc=guohanjun@huawei.com \
    --cc=gustavoars@kernel.org \
    --cc=kees@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rafael@kernel.org \
    --cc=tony.luck@intel.com \
    --cc=xueshuai@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®