From: Jonathan Cameron via qemu development <qemu-devel@nongnu.org>
To: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Michael S Tsirkin <mst@redhat.com>,
Shiju Jose <shiju.jose@huawei.com>, <qemu-devel@nongnu.org>,
Igor Mammedov <imammedo@redhat.com>,
Cleber Rosa <crosa@redhat.com>, John Snow <jsnow@redhat.com>
Subject: Re: [PATCH 05/13] scripts/qmp_helper: fix raw_data logic
Date: Wed, 21 Jan 2026 12:35:26 +0000 [thread overview]
Message-ID: <20260121123526.00004218@huawei.com> (raw)
In-Reply-To: <dbfa5c4c60c9f27a3f13ed9de7d510fa99ea536e.1768993993.git.mchehab+huawei@kernel.org>
On Wed, 21 Jan 2026 12:25:13 +0100
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> wrote:
> According with UEFI 6.4 spec Table 18.11 Generic Error Status Block:
>
> Raw Data Offset: Offset in bytes from the beginning of the
> Error Status Block to raw error data.
> The raw data must follow any Generic Error
> Data Entries.
>
> Data Length: Length in bytes of the generic error data.
>
> So, basically, we have:
>
> +----------+ /
> | GEBS | |
> +----------+ / |
> | GEDE | | |
Mix of tabs and spaces it seems. Nice to tidy that up.
> | header | | +--> raw data
> +----------+ +--> data | offset
> | GEDE | | length |
> | payload | | |
> +----------+ / /
> | Raw data |
> +----------+
>
> where:
>
> - raw data offset is relative to the beginning of GEBS;
> - data length is only for GEDE header and payload.
>
> Fix the code to handle it the expected way.
Maybe say what it did previously?
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Code seems fine to me.
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
> ---
> scripts/qmp_helper.py | 23 ++++++++++++++---------
> 1 file changed, 14 insertions(+), 9 deletions(-)
>
> diff --git a/scripts/qmp_helper.py b/scripts/qmp_helper.py
> index 51c8ad92a39d..40059cd105f6 100755
> --- a/scripts/qmp_helper.py
> +++ b/scripts/qmp_helper.py
> @@ -411,6 +411,7 @@ def _connect(self):
> "simulated": util.bit(2),
> }
>
> + GENERIC_ERROR_STATUS_SIZE = 20
> GENERIC_DATA_SIZE = 72
>
> def argparse(parser):
> @@ -551,7 +552,7 @@ def send_cper_raw(self, cper_data):
>
> return False
>
> - def get_gede(self, notif_type, cper_length):
> + def get_gede(self, notif_type, payload_length):
> """
> Return a Generic Error Data Entry bytearray
> """
> @@ -563,22 +564,27 @@ def get_gede(self, notif_type, cper_length):
> util.data_add(gede, 0x300, 2)
> util.data_add(gede, self.validation_bits, 1)
> util.data_add(gede, self.flags, 1)
> - util.data_add(gede, cper_length, 4)
> + util.data_add(gede, payload_length, 4)
> gede.extend(self.fru_id)
> gede.extend(self.fru_text)
> gede.extend(self.timestamp)
>
> return gede
>
> - def get_gebs(self, data_length):
> + def get_gebs(self, payload_length):
> """
> Return a Generic Error Status Block bytearray
> """
>
> + data_length = payload_length
> + data_length += self.GENERIC_DATA_SIZE
> +
> gebs = bytearray()
>
> if self.raw_data:
> - raw_data_offset = len(gebs)
> + raw_data_offset = payload_length
> + raw_data_offset += self.GENERIC_ERROR_STATUS_SIZE
> + raw_data_offset += self.GENERIC_DATA_SIZE
> else:
> raw_data_offset = 0
>
> @@ -617,8 +623,7 @@ def send_cper(self, notif_type, payload,
> if raw_data:
> self.raw_data = raw_data
>
> - cper_length = len(payload)
> - data_length = cper_length + len(self.raw_data) + self.GENERIC_DATA_SIZE
> + payload_length = len(payload)
>
> if gede and len(gede) != 72:
> print(f"Invalid Generic Error Data Entry length: {len(gede)}. Ignoring it")
> @@ -629,16 +634,16 @@ def send_cper(self, notif_type, payload,
> gebs = None
>
> if not gede:
> - gede = self.get_gede(notif_type, cper_length)
> + gede = self.get_gede(notif_type, payload_length)
>
> if not gebs:
> - gebs = self.get_gebs(data_length)
> + gebs = self.get_gebs(payload_length)
>
> cper_data = bytearray()
> cper_data.extend(gebs)
> cper_data.extend(gede)
> - cper_data.extend(bytearray(self.raw_data))
> cper_data.extend(bytearray(payload))
> + cper_data.extend(bytearray(self.raw_data))
>
> if self.debug:
> print(f"GUID: {notif_type}")
next prev parent reply other threads:[~2026-01-21 12:38 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-21 11:25 [PATCH 00/13] Add more commands to scripts/ghes_inject.py Mauro Carvalho Chehab
2026-01-21 11:25 ` [PATCH 01/13] scripts/qmp_helper: add a return code to send_cper Mauro Carvalho Chehab
2026-01-21 12:08 ` Jonathan Cameron via qemu development
2026-01-21 11:25 ` [PATCH 02/13] scripts/qmp_helper: add missing CXL UEFI GUID Mauro Carvalho Chehab
2026-01-21 12:26 ` Jonathan Cameron
2026-01-21 12:26 ` Jonathan Cameron via qemu development
2026-01-21 15:45 ` Mauro Carvalho Chehab
2026-01-22 10:52 ` Jonathan Cameron
2026-01-22 10:52 ` Jonathan Cameron via qemu development
2026-01-22 15:08 ` Mauro Carvalho Chehab
2026-01-22 17:13 ` Jonathan Cameron
2026-01-22 17:13 ` Jonathan Cameron via qemu development
2026-01-21 11:25 ` [PATCH 03/13] scripts/qmp_helper: add support for FRU Memory Poison Mauro Carvalho Chehab
2026-01-21 12:27 ` Jonathan Cameron via qemu development
2026-01-21 11:25 ` [PATCH 04/13] scripts/qmp_helper: make send_cper() more generic Mauro Carvalho Chehab
2026-01-21 12:30 ` Jonathan Cameron via qemu development
2026-01-21 11:25 ` [PATCH 05/13] scripts/qmp_helper: fix raw_data logic Mauro Carvalho Chehab
2026-01-21 12:35 ` Jonathan Cameron via qemu development [this message]
2026-01-21 11:25 ` [PATCH 06/13] scripts/qmp_helper: add support for a timeout logic Mauro Carvalho Chehab
2026-01-21 12:39 ` Jonathan Cameron via qemu development
2026-01-21 15:56 ` Mauro Carvalho Chehab
2026-01-23 16:16 ` Jonathan Cameron via qemu development
2026-01-26 11:23 ` Mauro Carvalho Chehab
2026-01-26 11:29 ` Mauro Carvalho Chehab
2026-01-26 12:27 ` Jonathan Cameron via qemu development
2026-01-21 11:25 ` [PATCH 07/13] scripts/ghes_inject: add a logic to decode CPER Mauro Carvalho Chehab
2026-01-21 13:27 ` Jonathan Cameron via qemu development
2026-01-21 16:24 ` Mauro Carvalho Chehab
2026-01-22 16:23 ` Mauro Carvalho Chehab
2026-01-21 11:25 ` [PATCH 08/13] scripts/ghes_inject: exit 1 if command was not sent Mauro Carvalho Chehab
2026-01-21 13:28 ` Jonathan Cameron via qemu development
2026-01-21 11:25 ` [PATCH 09/13] scripts/ghes_inject: add a handler for PCIe bus error Mauro Carvalho Chehab
2026-01-21 13:32 ` Jonathan Cameron via qemu development
2026-01-21 13:33 ` Jonathan Cameron via qemu development
2026-02-06 12:52 ` Jonathan Cameron via qemu development
2026-01-21 16:26 ` Mauro Carvalho Chehab
2026-01-22 16:42 ` Mauro Carvalho Chehab
2026-01-21 11:25 ` [PATCH 10/13] scripts/ghes_inject: add support for fuzzy logic testing Mauro Carvalho Chehab
2026-01-21 13:37 ` Jonathan Cameron via qemu development
2026-01-21 16:35 ` Mauro Carvalho Chehab
2026-01-21 11:25 ` [PATCH 11/13] scripts/ghes_inject: add a raw error inject command Mauro Carvalho Chehab
2026-01-21 11:25 ` [PATCH 12/13] scripts/ghes_inject: print help if no command specified Mauro Carvalho Chehab
2026-01-21 13:42 ` Jonathan Cameron via qemu development
2026-01-21 11:25 ` [PATCH 13/13] scripts/ghes_inject: improve help message Mauro Carvalho Chehab
2026-01-21 13:43 ` Jonathan Cameron via qemu development
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=20260121123526.00004218@huawei.com \
--to=qemu-devel@nongnu.org \
--cc=crosa@redhat.com \
--cc=imammedo@redhat.com \
--cc=jonathan.cameron@huawei.com \
--cc=jsnow@redhat.com \
--cc=mchehab+huawei@kernel.org \
--cc=mst@redhat.com \
--cc=shiju.jose@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.