From nobody Wed Dec 17 05:33:21 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94B2018E743 for ; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; cv=none; b=Lrnwd45mP54aLjrYRfC6998hth1RW8P4Efjvj7wwaaYd4sd6WsjYoJIffZTvz7WLZK3wUiwu/J8VctPCaZ2MyU4URH0Wj13IcZrF1BIkYTyUaOBxO+fZvBB1EF8M2JNSfSgPZEJ6e6nvBAof2bH1NfW1rk+pdbB1JK4JGYvN6rM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; c=relaxed/simple; bh=XnsenWzyXY6TfpyfSZrWfMTz6cEF8BKuThN2HBT4U7c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C7fvZkX6gs0ZlIP3wFdyATY/XnMmuGuCe2Un8LI5DaxDty22WeThxM7HMCeBmK+5WtLokW1XLsz+Mp9nJXHEPFXdstj+fZBrDKrhmgKl9K6w8zTb5CgrE4omESBTr6fxEArV2xKHyHHWte1ZoKWkQKRMjZacnK1ZGTVWKMC3PXc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fbponakC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fbponakC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10CB6C4CEE1; Wed, 4 Dec 2024 07:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733298153; bh=XnsenWzyXY6TfpyfSZrWfMTz6cEF8BKuThN2HBT4U7c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fbponakCBVFyAC3ys2tT9X+vSjKWU3lRx65Bqo04Q/Yg5hHgF3pfoTTUXduqlG2KK 8Zh9/IdLlSGIUxVneyu0JVd8woI60mTcC7mb9kzc8tcGUbLX7jYbNYCXnWxfB/wwLk M801AxREsZQ7YkDZYEMmdfdVEgJHUVFyIdhhL33VA8/NGcDwLSRvLZqsogK6C2yRcj N7wNU759O4zs9PQahG0jguKxwTtGrA7/9iqQF3Kev+YzO97H1GO2Tx3DMAbM5MUy4Y CFZrGd5exX3VCgQ1T4jIGVFghgCm0WZquwsxjC2DoiGvy+amY5m212lnLJ5HqYkF8S bWc7stJga3EkQ== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tIk1m-00000004Kii-40jz; Wed, 04 Dec 2024 08:42:30 +0100 From: Mauro Carvalho Chehab To: Igor Mammedov Cc: Jonathan Cameron , Shiju Jose , Mauro Carvalho Chehab , "Michael S. Tsirkin" , Ani Sinha , Dongjiu Geng , linux-kernel@vger.kernel.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v5 01/16] acpi/ghes: get rid of ACPI_HEST_SRC_ID_RESERVED Date: Wed, 4 Dec 2024 08:41:09 +0100 Message-ID: <4818bdd98597822033a10c15fcca6d736db93bf2.1733297707.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" This is just duplicating ACPI_GHES_ERROR_SOURCE_COUNT, which has a better name. So, drop the duplication. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Igor Mammedov Reviewed-by: Jonathan Cameron --- hw/acpi/ghes.c | 7 ++----- include/hw/acpi/ghes.h | 3 ++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index e9511d9b8f71..dc217694deb9 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -34,9 +34,6 @@ /* The max size in bytes for one error block */ #define ACPI_GHES_MAX_RAW_DATA_LENGTH (1 * KiB) =20 -/* Now only support ARMv8 SEA notification type error source */ -#define ACPI_GHES_ERROR_SOURCE_COUNT 1 - /* Generic Hardware Error Source version 2 */ #define ACPI_GHES_SOURCE_GENERIC_ERROR_V2 10 =20 @@ -396,7 +393,7 @@ int acpi_ghes_record_errors(uint8_t source_id, uint64_t= physical_address) AcpiGedState *acpi_ged_state; AcpiGhesState *ags; =20 - assert(source_id < ACPI_HEST_SRC_ID_RESERVED); + assert(source_id < ACPI_GHES_ERROR_SOURCE_COUNT); =20 acpi_ged_state =3D ACPI_GED(object_resolve_path_type("", TYPE_ACPI_GED, NULL)); @@ -407,7 +404,7 @@ int acpi_ghes_record_errors(uint8_t source_id, uint64_t= physical_address) =20 if (physical_address) { =20 - if (source_id < ACPI_HEST_SRC_ID_RESERVED) { + if (source_id < ACPI_GHES_ERROR_SOURCE_COUNT) { start_addr +=3D source_id * sizeof(uint64_t); } =20 diff --git a/include/hw/acpi/ghes.h b/include/hw/acpi/ghes.h index 674f6958e905..59e3b8fb24b9 100644 --- a/include/hw/acpi/ghes.h +++ b/include/hw/acpi/ghes.h @@ -59,7 +59,8 @@ enum AcpiGhesNotifyType { enum { ACPI_HEST_SRC_ID_SEA =3D 0, /* future ids go here */ - ACPI_HEST_SRC_ID_RESERVED, + + ACPI_GHES_ERROR_SOURCE_COUNT }; =20 typedef struct AcpiGhesState { --=20 2.47.1 From nobody Wed Dec 17 05:33:21 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94AC718E379 for ; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; cv=none; b=Wn3jTxRp2cyF99YSlqO8N+9JVgZL8y98O2qKXJ2ncL3u1L4h6WNpY5IgQigCdcTYJaA1zyoIPXGikPosjm3O7n5FIutGxQEDTw5xSx/guNY6wHBJen9gDrjfowG60c+AtJ4pBJY0SpFwg14G/SbKQBMCGMpFZOiBewDEHB9imKE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; c=relaxed/simple; bh=uDihMbAVHajyrPqIm6xCk4kSLNVBW/olOYucuqFWoPc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C8PBQdzlHWmnYzmuKdZ+RI/5a8NqnepfKvO4Wu9ytFw+owWl6QGxYhXJdbCOHgX4nJy4m3X0baoWeCntr1bxuEjh8oN+wQIiYJDP0Ddir0Lj5uj+CyeNssI6XJWJQSX3GC/R4B76+v08hyCcK9+lqAAsITlbNeVwlE0nsP/3+5U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=czQmyl+A; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="czQmyl+A" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A86FC4CEE7; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733298153; bh=uDihMbAVHajyrPqIm6xCk4kSLNVBW/olOYucuqFWoPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=czQmyl+AX++IkbELUJZwjAdtdZVgC05x2aD2bG8G8cyH8UJ4EkIxeya5BijhrA4b1 szhkd6Y+T/XjGy6GsrcYDfEf4IojvzwavXDeTWA5tYm/fQpTihyyC8Euc5cUbrbU62 ivkAiCgRM9+eHPJ8M6ciTzf8ZENa6hLVwFzjSrT5BEX/T6H+QaBeQiypOZrTd6CGNl Chd+0QJaJxOhJYCwtBg8xpLJfPpAwpRLxsxySDeUzNZasrtnzxK1GAXNFVWuB7tM8h Yru8jz5xY57VHWamI4xBNHxjLDvj9VOW4zbHEIruKDRkDglai7G/QZxdyUymRGBrA1 ct1CpABnhWsoA== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tIk1m-00000004Kim-47VJ; Wed, 04 Dec 2024 08:42:30 +0100 From: Mauro Carvalho Chehab To: Igor Mammedov Cc: Jonathan Cameron , Shiju Jose , Mauro Carvalho Chehab , "Michael S. Tsirkin" , Ani Sinha , Dongjiu Geng , linux-kernel@vger.kernel.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v5 02/16] acpi/ghes: simplify acpi_ghes_record_errors() code Date: Wed, 4 Dec 2024 08:41:10 +0100 Message-ID: <766ac4c230af004689e464f6f8a731bbc31508c5.1733297707.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" Reduce the ident of the function and prepares it for the next changes. No functional changes. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Igor Mammedov Reviewed-by: Jonathan Cameron --- hw/acpi/ghes.c | 56 ++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index dc217694deb9..e66f3be1502b 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -402,40 +402,42 @@ int acpi_ghes_record_errors(uint8_t source_id, uint64= _t physical_address) =20 start_addr =3D le64_to_cpu(ags->ghes_addr_le); =20 - if (physical_address) { + if (!physical_address) { + return -1; + } =20 - if (source_id < ACPI_GHES_ERROR_SOURCE_COUNT) { - start_addr +=3D source_id * sizeof(uint64_t); - } + if (source_id < ACPI_GHES_ERROR_SOURCE_COUNT) { + start_addr +=3D source_id * sizeof(uint64_t); + } =20 - cpu_physical_memory_read(start_addr, &error_block_addr, - sizeof(error_block_addr)); + cpu_physical_memory_read(start_addr, &error_block_addr, + sizeof(error_block_addr)); =20 - error_block_addr =3D le64_to_cpu(error_block_addr); + error_block_addr =3D le64_to_cpu(error_block_addr); =20 - read_ack_register_addr =3D start_addr + - ACPI_GHES_ERROR_SOURCE_COUNT * sizeof(uint64_t); + read_ack_register_addr =3D start_addr + + ACPI_GHES_ERROR_SOURCE_COUNT * sizeof(uint64_= t); =20 - cpu_physical_memory_read(read_ack_register_addr, - &read_ack_register, sizeof(read_ack_regis= ter)); + cpu_physical_memory_read(read_ack_register_addr, + &read_ack_register, sizeof(read_ack_register)= ); =20 - /* zero means OSPM does not acknowledge the error */ - if (!read_ack_register) { - error_report("OSPM does not acknowledge previous error," - " so can not record CPER for current error anymore"); - } else if (error_block_addr) { - read_ack_register =3D cpu_to_le64(0); - /* - * Clear the Read Ack Register, OSPM will write it to 1 when - * it acknowledges this error. - */ - cpu_physical_memory_write(read_ack_register_addr, - &read_ack_register, sizeof(uint64_t)); + /* zero means OSPM does not acknowledge the error */ + if (!read_ack_register) { + error_report("OSPM does not acknowledge previous error," + " so can not record CPER for current error anymore"); + } else if (error_block_addr) { + read_ack_register =3D cpu_to_le64(0); + /* + * Clear the Read Ack Register, OSPM will write it to 1 when + * it acknowledges this error. + */ + cpu_physical_memory_write(read_ack_register_addr, + &read_ack_register, sizeof(uint64_t)); =20 - ret =3D acpi_ghes_record_mem_error(error_block_addr, - physical_address); - } else - error_report("can not find Generic Error Status Block"); + ret =3D acpi_ghes_record_mem_error(error_block_addr, + physical_address); + } else { + error_report("can not find Generic Error Status Block"); } =20 return ret; --=20 2.47.1 From nobody Wed Dec 17 05:33:21 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67BA118E02A for ; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; cv=none; b=lN5okWf5FLhHn/izBYuNSAUAg3WxE4jdrlL4ON0w6CvNsl9WaNID9rQG2Wq0FxEk/kL9GL740RJe4vUSgI4XEqzfpOzyIRXBubDVC5ea3NrRKw0rtMRki4zpkkyAHx+zyuGWpGL95B7J8S8YK+LZawHl8iINjrlBScOCEXRolCY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; c=relaxed/simple; bh=WpC/WWVfFKAeHGzqCpuL7CrOqSUL9tc8JrM8fpL82sA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AANG0D7w3KFcM5us2RxXRcxtGY2ESFX1bVQMnb6Yz8bSVV5UoXTUMlRnEMIGUHoC67KWmda6XJOY2cC3qdVs6PuGLGXRZbRrwTbuzIq2M3u7KBonYhipoWzJPWyT7recSuyAhlKusb6o/loef/uQp9ctemcvxk+gD/TL+JRv/1I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sozOBgIy; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sozOBgIy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BB05C4CEE5; Wed, 4 Dec 2024 07:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733298153; bh=WpC/WWVfFKAeHGzqCpuL7CrOqSUL9tc8JrM8fpL82sA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sozOBgIyoTmdDcqWlHvwaC7qMgGAu0fMbQPiEErorL490dHR8ssKpRWpWjFPfIFs/ /w4XvNNZmqmgBuoB+C5PhtaEgbh53TDbQkOF3Dfx8hcwM3awXdUUlX13wjANoLBiln UTCDUPj6coarkAj8WFsXi+ruCK8qHfNWRy9XxCGmC5zI0fH04oau+bJIqLU33/Vkln OClY1yuWfIq4WRjtzqkB7/tM6JW2eDoSfA4H1ea0JHScFkxppmg1laTMigy6W4NDns AZhjbBgwDY9l9/szN93zs4fOefJKaySs46fuE3aK/kETR1hUxOm/EpglYofChUllvh sEc8bbKCzNFVw== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tIk1n-00000004Kiq-02QW; Wed, 04 Dec 2024 08:42:31 +0100 From: Mauro Carvalho Chehab To: Igor Mammedov Cc: Jonathan Cameron , Shiju Jose , Mauro Carvalho Chehab , "Michael S. Tsirkin" , Ani Sinha , Dongjiu Geng , Peter Maydell , Shannon Zhao , linux-kernel@vger.kernel.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v5 03/16] acpi/ghes: simplify the per-arch caller to build HEST table Date: Wed, 4 Dec 2024 08:41:11 +0100 Message-ID: <0617c0652412212cc34ba182a93b55fa0b12cc90.1733297707.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" The GHES driver requires not only a HEST table, but also a separate firmware file to store Error Structure records. It can't do one without the other. Simplify the caller logic for it to require one function. No functional changes. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Jonathan Cameron Reviewed-by: Igor Mammedov --- Changes from v10: - Removed the logic which associates notification and source ID. This will be placed on a separate patch. Changes from v8: - Non-rename/cleanup changes merged altogether; - source ID is now more generic, defined per guest target. That should make easier to add support for 86. Signed-off-by: Mauro Carvalho Chehab --- hw/acpi/ghes.c | 7 +++++-- hw/arm/virt-acpi-build.c | 5 ++--- include/hw/acpi/ghes.h | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index e66f3be1502b..4a6c45bcb4be 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -233,7 +233,7 @@ static int acpi_ghes_record_mem_error(uint64_t error_bl= ock_address, * Initialize "etc/hardware_errors" and "etc/hardware_errors_addr" fw_cfg = blobs. * See docs/specs/acpi_hest_ghes.rst for blobs format. */ -void build_ghes_error_table(GArray *hardware_errors, BIOSLinker *linker) +static void build_ghes_error_table(GArray *hardware_errors, BIOSLinker *li= nker) { int i, error_status_block_offset; =20 @@ -356,12 +356,15 @@ static void build_ghes_v2(GArray *table_data, int sou= rce_id, BIOSLinker *linker) } =20 /* Build Hardware Error Source Table */ -void acpi_build_hest(GArray *table_data, BIOSLinker *linker, +void acpi_build_hest(GArray *table_data, GArray *hardware_errors, + BIOSLinker *linker, const char *oem_id, const char *oem_table_id) { AcpiTable table =3D { .sig =3D "HEST", .rev =3D 1, .oem_id =3D oem_id, .oem_table_id =3D oem_table_id= }; =20 + build_ghes_error_table(hardware_errors, linker); + acpi_table_begin(&table, table_data); =20 /* Error Source Count */ diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 620992c92c12..e059317b002e 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -942,10 +942,9 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildT= ables *tables) build_dbg2(tables_blob, tables->linker, vms); =20 if (vms->ras) { - build_ghes_error_table(tables->hardware_errors, tables->linker); acpi_add_table(table_offsets, tables_blob); - acpi_build_hest(tables_blob, tables->linker, vms->oem_id, - vms->oem_table_id); + acpi_build_hest(tables_blob, tables->hardware_errors, tables->link= er, + vms->oem_id, vms->oem_table_id); } =20 if (ms->numa_state->num_nodes > 0) { diff --git a/include/hw/acpi/ghes.h b/include/hw/acpi/ghes.h index 59e3b8fb24b9..20016c226d1f 100644 --- a/include/hw/acpi/ghes.h +++ b/include/hw/acpi/ghes.h @@ -68,8 +68,8 @@ typedef struct AcpiGhesState { bool present; /* True if GHES is present at all on this board */ } AcpiGhesState; =20 -void build_ghes_error_table(GArray *hardware_errors, BIOSLinker *linker); -void acpi_build_hest(GArray *table_data, BIOSLinker *linker, +void acpi_build_hest(GArray *table_data, GArray *hardware_errors, + BIOSLinker *linker, const char *oem_id, const char *oem_table_id); void acpi_ghes_add_fw_cfg(AcpiGhesState *vms, FWCfgState *s, GArray *hardware_errors); --=20 2.47.1 From nobody Wed Dec 17 05:33:21 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1733298202; cv=none; d=zohomail.com; s=zohoarc; b=X/didP7p7gcNDXsaUeW+TAPQc2WtqdB2h0gYk0w4FgWDtuz6SI+y2/01oQWt1YLHWV+gFNBC9NTK6guwawlATToUxI2lQBxjtQaieInaUe7Uf8BhhCM7MaGah+V8hxPMDG5Wbrty1PttVR0AqwFr9hBYDW7DsrYOc+CUUiTe0Cg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1733298202; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gyYDlTrCXnTmceOnqwlOgM7OUAAchD1Pahq1wQ6BNK4=; b=b/KTrqmOcL7+EETulxdpxYVlYT1gD2vyt0CyMocWTXTGvLeIsGZsn3R7CT/pORzKQHlf9ym+eA0QBAix2GYrHj3IQu00FXzJPrlYYEHfrYL/A6t0aOR8BsRu2nOeSJvFpGY75XHvmi4BZ2sZlTBfigjdPcNbSGlpj2gvjX4V6Nk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1733298202561347.1638720469332; Tue, 3 Dec 2024 23:43:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tIk20-0003mJ-3L; Wed, 04 Dec 2024 02:42:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tIk1u-0003lL-4h; Wed, 04 Dec 2024 02:42:38 -0500 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tIk1s-0006Xq-DJ; Wed, 04 Dec 2024 02:42:37 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 084B0A41C0A; Wed, 4 Dec 2024 07:40:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE1A3C4CEE0; Wed, 4 Dec 2024 07:42:32 +0000 (UTC) Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tIk1n-00000004Kiu-09La; Wed, 04 Dec 2024 08:42:31 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733298153; bh=Zdz33+JrFuLWEYr3Q523j6TOZr8k9EjWwbpOCTAVnQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WmVcEjWkke/rDeYQ2obmJhkoAGJAPkxlbZEXvMX+MLFMJIUS4MWTgCwb85UP8htJX w7CskJ2rHQwrZV5w+I3LLjR7Kl5inq19etKKtCEDs9PCnJDpHFCEXLZgLSyxDpRArh Bd7Wv+Mq3LUJ51gd2wdvL9vb7u0HAYsHdXFar9J2ZuW7wrl8u7SyZS125IoPBkj8ho w+zxPw3x55e3AWt6N2TZEAp5foCI8KcD4jw5Lzlh0lEHT9BjWTkyIbI0gqJl0PZjhL u6nGo+YMgef1b5JhO84/LP3IWWPkQxsJSu1rnDpVZQePdcnJ8nGrkl0DyKoShajIgd WCm1q5Ofg3VUw== From: Mauro Carvalho Chehab To: Igor Mammedov Cc: Jonathan Cameron , Shiju Jose , Mauro Carvalho Chehab , "Michael S. Tsirkin" , Ani Sinha , Dongjiu Geng , linux-kernel@vger.kernel.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v5 04/16] acpi/ghes: better handle source_id and notification Date: Wed, 4 Dec 2024 08:41:12 +0100 Message-ID: <266784293ac084e27f2b13a3855bf234eb96a9ba.1733297707.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2604:1380:45d1:ec00::3; envelope-from=mchehab+huawei@kernel.org; helo=nyc.source.kernel.org X-Spam_score_int: -73 X-Spam_score: -7.4 X-Spam_bar: ------- X-Spam_report: (-7.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.996, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1733298203502116600 Content-Type: text/plain; charset="utf-8" GHES has two fields that are stored on HEST error source blocks associated with notifications: - notification type, which is a number defined at the ACPI spec containing several arch-specific synchronous and assynchronous types; - source id, which is a HW/FW defined number, used to distinguish between different implemented sources. There could be several sources with the same notification type, which is dependent of the way each architecture maps notifications. Right now, build_ghes_v2() hardcodes a 1:1 mapping between such fields. Move it to two independent parameters, allowing the caller function to fill both. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Jonathan Cameron Reviewed-by: Igor Mammedov --- Chenges from v10: - Some changes got moved to the previous patch. Changes from v8: - Non-rename/cleanup changes merged altogether; - source ID is now more generic, defined per guest target. That should make easier to add support for 86. Signed-off-by: Mauro Carvalho Chehab --- hw/acpi/ghes.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index 4a6c45bcb4be..29cd7e4d8171 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -284,9 +284,13 @@ static void build_ghes_error_table(GArray *hardware_er= rors, BIOSLinker *linker) } =20 /* Build Generic Hardware Error Source version 2 (GHESv2) */ -static void build_ghes_v2(GArray *table_data, int source_id, BIOSLinker *l= inker) +static void build_ghes_v2(GArray *table_data, + BIOSLinker *linker, + enum AcpiGhesNotifyType notify, + uint16_t source_id) { uint64_t address_offset; + /* * Type: * Generic Hardware Error Source version 2(GHESv2 - Type 10) @@ -316,18 +320,8 @@ static void build_ghes_v2(GArray *table_data, int sour= ce_id, BIOSLinker *linker) address_offset + GAS_ADDR_OFFSET, sizeof(uint64_t), ACPI_GHES_ERRORS_FW_CFG_FILE, source_id * sizeof(uint64_t)); =20 - switch (source_id) { - case ACPI_HEST_SRC_ID_SEA: - /* - * Notification Structure - * Now only enable ARMv8 SEA notification type - */ - build_ghes_hw_error_notification(table_data, ACPI_GHES_NOTIFY_SEA); - break; - default: - error_report("Not support this error source"); - abort(); - } + /* Notification Structure */ + build_ghes_hw_error_notification(table_data, notify); =20 /* Error Status Block Length */ build_append_int_noprefix(table_data, ACPI_GHES_MAX_RAW_DATA_LENGTH, 4= ); @@ -369,7 +363,8 @@ void acpi_build_hest(GArray *table_data, GArray *hardwa= re_errors, =20 /* Error Source Count */ build_append_int_noprefix(table_data, ACPI_GHES_ERROR_SOURCE_COUNT, 4); - build_ghes_v2(table_data, ACPI_HEST_SRC_ID_SEA, linker); + build_ghes_v2(table_data, linker, + ACPI_GHES_NOTIFY_SEA, ACPI_HEST_SRC_ID_SEA); =20 acpi_table_end(linker, &table); } --=20 2.47.1 From nobody Wed Dec 17 05:33:21 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB77218E764 for ; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; cv=none; b=CTJPBe7yBAMM65zfJP8VyageMXuIy2OiiTD6H0G4ZwC4Of74N8FE/dENdFmGQnmuvQ+87ZJxTKnPf4o8E3G1BCgMc+MOmM1xRF5zDpp1uIF0r3jzV6xC2Zi1+fxdwUywNfnFUV2cTLI+OSPVzla+KFMVjVQWVI6kGHGx2FgO1hI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; c=relaxed/simple; bh=WUvT8Ughz2H3l7zFkf4yAqTlDCn4hpG5JQNObbE2feQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hwdWss/eO+ifGQtyvCDW+2wOeEf1PBaGVV7vFtpYNO/wOGx2n4z8N3ZqFsVL2gsvfZ3kq/7+U0v8x9mqQICPLx4p31unDAA0Te5uim98XHwi08NhIwrz+5flsOA4qq188/xk92wNFlSA5rivvm4UNK3tRUtoA5w1MRedK0WZ0kY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AqyeXqi/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AqyeXqi/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17385C4CEE6; Wed, 4 Dec 2024 07:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733298153; bh=WUvT8Ughz2H3l7zFkf4yAqTlDCn4hpG5JQNObbE2feQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AqyeXqi/iQubsZ0LmfpUgncboOmdJjPWuOwc7JOFzUX9iI3/OsERiEL4eVk7aN9+w IMVDBx5Fbc2xHIP97EwVbUzTSNEJFmCMd7nMM/KPNgkCkQEXNiz7Cs7ig6O3KUSvqO /JmSyasiCqF4V7v0/L/bXbS/+IFm7M7o2aZYqnFJdtFgOeyhxbQnxiLHVqWjQQtFUG CjOVkIk/i44ehwPfrum+m9K2iiWkWDcYjgrT7S7lPyRhv8Yh7mCJF+QHejqIC1QBF6 gkqhsrPN/BIQhkrsXEe3nSNbjO6eQkYzDJx2U4SkHZ5wdhgTZR7Xzv4wiztOh0vNDT Mcg9n3WHq+G6A== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tIk1n-00000004Kiy-0GH3; Wed, 04 Dec 2024 08:42:31 +0100 From: Mauro Carvalho Chehab To: Igor Mammedov Cc: Jonathan Cameron , Shiju Jose , Mauro Carvalho Chehab , "Michael S. Tsirkin" , Ani Sinha , Dongjiu Geng , linux-kernel@vger.kernel.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v5 05/16] acpi/ghes: Fix acpi_ghes_record_errors() argument Date: Wed, 4 Dec 2024 08:41:13 +0100 Message-ID: X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" Align the header file with the actual implementation of this function, as the first argument is source ID and not notification type. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Jonathan Cameron Reviewed-by: Igor Mammedov --- Changes from v8: - Non-rename/cleanup changes merged altogether; - source ID is now more generic, defined per guest target. That should make easier to add support for 86. Signed-off-by: Mauro Carvalho Chehab --- include/hw/acpi/ghes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/acpi/ghes.h b/include/hw/acpi/ghes.h index 20016c226d1f..50e3a25ea384 100644 --- a/include/hw/acpi/ghes.h +++ b/include/hw/acpi/ghes.h @@ -73,7 +73,7 @@ void acpi_build_hest(GArray *table_data, GArray *hardware= _errors, const char *oem_id, const char *oem_table_id); void acpi_ghes_add_fw_cfg(AcpiGhesState *vms, FWCfgState *s, GArray *hardware_errors); -int acpi_ghes_record_errors(uint8_t notify, uint64_t error_physical_addr); +int acpi_ghes_record_errors(uint8_t source_id, uint64_t error_physical_add= r); =20 /** * acpi_ghes_present: Report whether ACPI GHES table is present --=20 2.47.1 From nobody Wed Dec 17 05:33:21 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB80518EFCC for ; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; cv=none; b=plteDuICP65ombwJHZYKMOZIV70LDZRLZhEJPLuRdplksS3A8Lxvlgw2z1kfHO7WFPni8vjffV7GgT+hSzxT11rLCffWiXGs+ZsVhhKtALCTXgfMeEwYMntbo4SYFW5GmdXoa1+8kz9b4AZ4qaGxP7gEH1nhn/XBjkwFT3LiY5o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; c=relaxed/simple; bh=mtr3SAhcJul8SH7gyq7dWJqCajR+YSKyCDlfSYBqOeM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NcDq4L6iUoFG+z2M9HGh3iu0NBCe0OOa9yLPtLE/wA30npnUYHT7/E2Qe+pObqiDH2uVv964XHaEyO0t/NSPvLdbMgGWmG86bOhJLYrOU/PRiKADrRa6Vp2cUKWEcYipDwDuGhaDLrrB0cv1Wmq/WRavYK4SLYDa7V4e4qSTZuQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nnKzYgWl; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nnKzYgWl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EA57C4CEE9; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733298153; bh=mtr3SAhcJul8SH7gyq7dWJqCajR+YSKyCDlfSYBqOeM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nnKzYgWlEY4eCl1TbECjPQe0NywyeGcVa9klsW3z8dEdH4tGq0SU+wN3KN+sQFAKG RqsR5lQRfRvZarKiSAFNVOU/4fh76kkVfg1pr4aT7SDKR130zefC5ToE7P7m7QL6e4 oVDnw4mGbjFPc8B3P6k4WYLRKQD9dCKJEq1X8gl9Hnheyq8syWF5BsR/lTP91GPavk RaaA7+R4wezzRiZgzK1NB3e3jj86Ar/RfWn6SCoHaHfLk9/X5sRnvTZGHY99gw3oRP UCXTS41cBm/omSd/VsEUxNImh1Rud8k5V+kWJ+c5Px1+RtWwnF20Py8qpXYhsFgANf wOasEZJpZpBAQ== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tIk1n-00000004Kj2-0N2r; Wed, 04 Dec 2024 08:42:31 +0100 From: Mauro Carvalho Chehab To: Igor Mammedov Cc: Jonathan Cameron , Shiju Jose , Mauro Carvalho Chehab , "Michael S. Tsirkin" , Ani Sinha , Dongjiu Geng , linux-kernel@vger.kernel.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v5 06/16] acpi/ghes: Remove a duplicated out of bounds check Date: Wed, 4 Dec 2024 08:41:14 +0100 Message-ID: <3447853c8f174a8f2a1a0e8c029c73c403a85ba0.1733297707.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" acpi_ghes_record_errors() has an assert() at the beginning to ensure that source_id will be lower than ACPI_GHES_ERROR_SOURCE_COUNT. Remove a duplicated check. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Igor Mammedov Reviewed-by: Jonathan Cameron --- hw/acpi/ghes.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index 29cd7e4d8171..5f67322bf0f2 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -404,9 +404,7 @@ int acpi_ghes_record_errors(uint8_t source_id, uint64_t= physical_address) return -1; } =20 - if (source_id < ACPI_GHES_ERROR_SOURCE_COUNT) { - start_addr +=3D source_id * sizeof(uint64_t); - } + start_addr +=3D source_id * sizeof(uint64_t); =20 cpu_physical_memory_read(start_addr, &error_block_addr, sizeof(error_block_addr)); --=20 2.47.1 From nobody Wed Dec 17 05:33:21 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67B5218E028 for ; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; cv=none; b=j+seSHFoUAd9u8S97lkHYu2egtijjTyc3GAjJDLtVfB3ylfjbHTlju9r9fo3yqG0wXnrccjS+rfspGaI7wexoVR8/PjLSGQmYjI73rLbBnPl310Fm98WYwzwT2gbid/JkF6ma+9EDjf5t5OTz4i3fd6AVE9b9A9sYs+g9xr5wms= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; c=relaxed/simple; bh=PPyhW6VsW+yo+jj9o/izTT956e12rFUm5rYlBvONhoQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=itTqUhyE84lhC5Xfveg6m2xEHjf/fqyWwGAGZ+VPmfYJb8CcEyPc4n+vQFsbKTvntx4vd6KjY7qVXc4IyTMUTNWXTVJbFEwcSAv8SY4a82PDcJc3IZUPBgI5ptHVe3dKObjpA8SoGqzzwfTRxNv13ZFPTQxjc6/9KSpTtjVu4xI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DJ8XBERW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DJ8XBERW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08CA9C4CEE3; Wed, 4 Dec 2024 07:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733298153; bh=PPyhW6VsW+yo+jj9o/izTT956e12rFUm5rYlBvONhoQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DJ8XBERWRFmjXTGFjdtz+V4WEC/5Pv4Nd9dmhR5QRKDHErXAg1C3smig7ab9ZRAOY hUZ5LBbcxP73LIiByGw8DJkp3Z0CK+IXm35xC10xoT+3gRv8Rm3cKAZlWZGpzpQTdO a3itGBiIArjJ/Wnju0gqTlVRBF6RCxU2sUhguwmVLxaeklvh3lHUYIIkpL+dkx2mYL hbsFAIBIq+TNgwHDeFBvx7JeyPho6FnH8ZwxXA+JImrfiQEsVEmp7+TUvZ+SLKNCqs /ltZI8BVingWE8TjFnqYEYejJr0QZOkBQwJU6++B0beyKlRvHbpOWA5XVUHkCg4dD4 vKXbIp0oRfG8A== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tIk1n-00000004Kj6-0Tim; Wed, 04 Dec 2024 08:42:31 +0100 From: Mauro Carvalho Chehab To: Igor Mammedov Cc: Jonathan Cameron , Shiju Jose , Mauro Carvalho Chehab , "Michael S. Tsirkin" , Ani Sinha , Dongjiu Geng , linux-kernel@vger.kernel.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v5 07/16] acpi/ghes: Change the type for source_id Date: Wed, 4 Dec 2024 08:41:15 +0100 Message-ID: <905c6c7329c39bde6f67f6f6636245de8baeca14.1733297707.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" As described at: ACPI 6.5 spec at: 18.3.2. ACPI Error Source In particular at GHES/GHESv2 table: Table 18.10 Generic Hardware Error Source Structure HEST source ID is actually a 16-bit value. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Jonathan Cameron Reviewed-by: Igor Mammedov --- hw/acpi/ghes-stub.c | 2 +- hw/acpi/ghes.c | 2 +- include/hw/acpi/ghes.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/acpi/ghes-stub.c b/hw/acpi/ghes-stub.c index c315de1802d6..2b64cbd2819a 100644 --- a/hw/acpi/ghes-stub.c +++ b/hw/acpi/ghes-stub.c @@ -11,7 +11,7 @@ #include "qemu/osdep.h" #include "hw/acpi/ghes.h" =20 -int acpi_ghes_record_errors(uint8_t source_id, uint64_t physical_address) +int acpi_ghes_record_errors(uint16_t source_id, uint64_t physical_address) { return -1; } diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index 5f67322bf0f2..edc74c38bf8a 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -383,7 +383,7 @@ void acpi_ghes_add_fw_cfg(AcpiGhesState *ags, FWCfgStat= e *s, ags->present =3D true; } =20 -int acpi_ghes_record_errors(uint8_t source_id, uint64_t physical_address) +int acpi_ghes_record_errors(uint16_t source_id, uint64_t physical_address) { uint64_t error_block_addr, read_ack_register_addr, read_ack_register = =3D 0; uint64_t start_addr; diff --git a/include/hw/acpi/ghes.h b/include/hw/acpi/ghes.h index 50e3a25ea384..9295e46be25e 100644 --- a/include/hw/acpi/ghes.h +++ b/include/hw/acpi/ghes.h @@ -73,7 +73,7 @@ void acpi_build_hest(GArray *table_data, GArray *hardware= _errors, const char *oem_id, const char *oem_table_id); void acpi_ghes_add_fw_cfg(AcpiGhesState *vms, FWCfgState *s, GArray *hardware_errors); -int acpi_ghes_record_errors(uint8_t source_id, uint64_t error_physical_add= r); +int acpi_ghes_record_errors(uint16_t source_id, uint64_t error_physical_ad= dr); =20 /** * acpi_ghes_present: Report whether ACPI GHES table is present --=20 2.47.1 From nobody Wed Dec 17 05:33:21 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB71818E75A for ; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; cv=none; b=RKwt6h1rXj05NOIOZjbUUMZUpF0RLih1oAaD/eVtKzbFdUabwxUPLrFnSBb4PWQ+paaVPitA6xoJoPSPISOtfcya7/TseNQZru5JALMONXBBjhgIx8cWYkc2q1ZI+Xzj4KReq9ZzgxRknUnsMoTAwJGzXcY8eGuz3IFBvXuzn80= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; c=relaxed/simple; bh=xKr5K1TW0pYorJXNz1Ksgf7p26nCCQVwbb66JoUnk8M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iHk1PlP89hzTbn0x3OsRz0nztPIWj7b06/w3gfbbKQBdNjJP0a5HMFtLQXyjxxUCzuV8QFG1RMLRupJbrAFfAxmEoVtf4iIeW+O1Jo2XMlAvtk8arK/ls5vgZYXIXPQsJqG9fuZ7FptcTEvYDhANeZHOnBPt18jzGrlgAKyigQ4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AJb+FyFM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AJb+FyFM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1408BC4CEE8; Wed, 4 Dec 2024 07:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733298153; bh=xKr5K1TW0pYorJXNz1Ksgf7p26nCCQVwbb66JoUnk8M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AJb+FyFMhbW4wtXckB9r/3Jrr1JZ2l2UyfBxBNzNFLE4AN118IU/Lkk7lXHo+oLT8 PzBexZjWcyPlYq8oTNDLBCtTtze9DEf4zsKFdJ8glRFMWEszQl426dD2pCy0Sum4BP AazDt338RWog+J4kCkQm45YoFlq14mT3noEenF6fefbgG4h0G7lezRwucJLXu8/OHO KMVvDFRftS8h6JX0//I/jUm8fMinNSLv4958QQY7r1vr2WD5ILKkCVIvcc8cPuprXj KqJlNAX5VmdhqOy0nyjx5ijlRnbqQOSp9Qf44kTDLDfU/glPXivznc5euYpAKVxkIz udDDeNfo0H8lg== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tIk1n-00000004KjA-0ad9; Wed, 04 Dec 2024 08:42:31 +0100 From: Mauro Carvalho Chehab To: Igor Mammedov Cc: Jonathan Cameron , Shiju Jose , Mauro Carvalho Chehab , "Michael S. Tsirkin" , Ani Sinha , Dongjiu Geng , linux-kernel@vger.kernel.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v5 08/16] acpi/ghes: don't check if physical_address is not zero Date: Wed, 4 Dec 2024 08:41:16 +0100 Message-ID: <95c0fa3fc2969daf3b6bc1f007733f11b715a465.1733297707.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" The 'physical_address' value is a faulty page. As such, 0 is as valid as any other value. Suggested-by: Igor Mammedov Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Igor Mammedov Reviewed-by: Jonathan Cameron --- hw/acpi/ghes.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index edc74c38bf8a..a3dffd78b012 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -400,10 +400,6 @@ int acpi_ghes_record_errors(uint16_t source_id, uint64= _t physical_address) =20 start_addr =3D le64_to_cpu(ags->ghes_addr_le); =20 - if (!physical_address) { - return -1; - } - start_addr +=3D source_id * sizeof(uint64_t); =20 cpu_physical_memory_read(start_addr, &error_block_addr, --=20 2.47.1 From nobody Wed Dec 17 05:33:21 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC3B318F2EA for ; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; cv=none; b=SgBv40IKOBB72hjyKLEJfGohEsMCHdT2Oe+AUPYuzZXIE9Vkxz+vct5vEXiL9ZeR/NsaNy5/+zmgQR5qCtrDxWFWey8+G9sdEDQu/4S0IxxTVbD0/IwLqCBfnLAXLRM6lM0+V/iTQnId4hwlEQLyv3fccCar9gB2+t7LbUqCSP0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; c=relaxed/simple; bh=z5ztZr4R5hxYOEhqpQF+hg9axZqmthQ+STOvq0Uft7k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=goxW4ZGY8pjYHh/VeFaFIHlYvPW3BvjKiiVkt/hxEqsIOygXEb/d080Ig90pzlVQNZmahm7H6VSfD0T49BdVa6wUo/aOxoo7OZBhmDKas/BcXnaRWf0eigu+pPb23vjCVED8QvfGRuv5blXe8Nalrcg1Zg3NLldAxMNltsNeFsc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YiufVzXB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YiufVzXB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B379C4CEEA; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733298153; bh=z5ztZr4R5hxYOEhqpQF+hg9axZqmthQ+STOvq0Uft7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YiufVzXBIzfOMTcOhxJ0HmoBw939V4vEU2L+CPQVTZInYfRWyMju6OrXhvcAR2Tlr Z3HNMxBXjVSze/XR7QUavU4Sh/zvCC2+8wNDHdR0hnHyGZy75EUd2HRZ4B7Jo1RJnq ONxflBrDjkZMOQlDR9AMnWGO8Rw5qIf9Wnenkuu/9xFAmn0AgNf1ov9z5SH/Kx4VZo dYAxTzZxhGx0bNCW0HBk8E1CbRQA8Xb8Jdax5PrjIdZgw1LSZiP3yfeWgVkpTEU/PL aoJt8bm/agdXBFvLZ1zc3SRLRq7q2Kl1XES5cDwVd12f5W8gbaBzNkK8VKil2l/2I3 MxDcF6rVHJoVQ== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tIk1n-00000004KjE-0hev; Wed, 04 Dec 2024 08:42:31 +0100 From: Mauro Carvalho Chehab To: Igor Mammedov Cc: Jonathan Cameron , Shiju Jose , Mauro Carvalho Chehab , "Michael S. Tsirkin" , Ani Sinha , Dongjiu Geng , linux-kernel@vger.kernel.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v5 09/16] acpi/ghes: make the GHES record generation more generic Date: Wed, 4 Dec 2024 08:41:17 +0100 Message-ID: X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" Split the code into separate functions to allow using the common CPER filling code by different error sources. The generic code was moved to ghes_record_cper_errors(), and ghes_gen_err_data_uncorrectable_recoverable() now contains only a logic to fill the Generic Error Data part of the record, as described at: ACPI 6.2: 18.3.2.7.1 Generic Error Data The remaining code to generate a memory error now belongs to acpi_ghes_record_errors() function. A further patch will give it a better name. Signed-off-by: Mauro Carvalho Chehab # Conflicts: # roms/edk2 Reviewed-by: Igor Mammedov --- hw/acpi/ghes.c | 121 ++++++++++++++++++++++++----------------- include/hw/acpi/ghes.h | 3 + 2 files changed, 73 insertions(+), 51 deletions(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index a3dffd78b012..4b5332f8c667 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -181,51 +181,24 @@ static void acpi_ghes_build_append_mem_cper(GArray *t= able, build_append_int_noprefix(table, 0, 7); } =20 -static int acpi_ghes_record_mem_error(uint64_t error_block_address, - uint64_t error_physical_addr) +static void +ghes_gen_err_data_uncorrectable_recoverable(GArray *block, + const uint8_t *section_type, + int data_length) { - GArray *block; - - /* Memory Error Section Type */ - const uint8_t uefi_cper_mem_sec[] =3D - UUID_LE(0xA5BC1114, 0x6F64, 0x4EDE, 0xB8, 0x63, 0x3E, 0x83, \ - 0xED, 0x7C, 0x83, 0xB1); - /* invalid fru id: ACPI 4.0: 17.3.2.6.1 Generic Error Data, * Table 17-13 Generic Error Data Entry */ QemuUUID fru_id =3D {}; - uint32_t data_length; - - block =3D g_array_new(false, true /* clear */, 1); - - /* This is the length if adding a new generic error data entry*/ - data_length =3D ACPI_GHES_DATA_LENGTH + ACPI_GHES_MEM_CPER_LENGTH; - /* - * It should not run out of the preallocated memory if adding a new ge= neric - * error data entry - */ - assert((data_length + ACPI_GHES_GESB_SIZE) <=3D - ACPI_GHES_MAX_RAW_DATA_LENGTH); =20 /* Build the new generic error status block header */ acpi_ghes_generic_error_status(block, ACPI_GEBS_UNCORRECTABLE, 0, 0, data_length, ACPI_CPER_SEV_RECOVERABLE); =20 /* Build this new generic error data entry header */ - acpi_ghes_generic_error_data(block, uefi_cper_mem_sec, + acpi_ghes_generic_error_data(block, section_type, ACPI_CPER_SEV_RECOVERABLE, 0, 0, ACPI_GHES_MEM_CPER_LENGTH, fru_id, 0); - - /* Build the memory section CPER for above new generic error data entr= y */ - acpi_ghes_build_append_mem_cper(block, error_physical_addr); - - /* Write the generic error data entry into guest memory */ - cpu_physical_memory_write(error_block_address, block->data, block->len= ); - - g_array_free(block, true); - - return 0; } =20 /* @@ -383,15 +356,18 @@ void acpi_ghes_add_fw_cfg(AcpiGhesState *ags, FWCfgSt= ate *s, ags->present =3D true; } =20 -int acpi_ghes_record_errors(uint16_t source_id, uint64_t physical_address) +void ghes_record_cper_errors(const void *cper, size_t len, + uint16_t source_id, Error **errp) { uint64_t error_block_addr, read_ack_register_addr, read_ack_register = =3D 0; uint64_t start_addr; - bool ret =3D -1; AcpiGedState *acpi_ged_state; AcpiGhesState *ags; =20 - assert(source_id < ACPI_GHES_ERROR_SOURCE_COUNT); + if (len > ACPI_GHES_MAX_RAW_DATA_LENGTH) { + error_setg(errp, "GHES CPER record is too big: %ld", len); + return; + } =20 acpi_ged_state =3D ACPI_GED(object_resolve_path_type("", TYPE_ACPI_GED, NULL)); @@ -406,6 +382,10 @@ int acpi_ghes_record_errors(uint16_t source_id, uint64= _t physical_address) sizeof(error_block_addr)); =20 error_block_addr =3D le64_to_cpu(error_block_addr); + if (!error_block_addr) { + error_setg(errp, "can not find Generic Error Status Block"); + return; + } =20 read_ack_register_addr =3D start_addr + ACPI_GHES_ERROR_SOURCE_COUNT * sizeof(uint64_= t); @@ -415,24 +395,63 @@ int acpi_ghes_record_errors(uint16_t source_id, uint6= 4_t physical_address) =20 /* zero means OSPM does not acknowledge the error */ if (!read_ack_register) { - error_report("OSPM does not acknowledge previous error," - " so can not record CPER for current error anymore"); - } else if (error_block_addr) { - read_ack_register =3D cpu_to_le64(0); - /* - * Clear the Read Ack Register, OSPM will write it to 1 when - * it acknowledges this error. - */ - cpu_physical_memory_write(read_ack_register_addr, - &read_ack_register, sizeof(uint64_t)); - - ret =3D acpi_ghes_record_mem_error(error_block_addr, - physical_address); - } else { - error_report("can not find Generic Error Status Block"); + error_setg(errp, + "OSPM does not acknowledge previous error," + " so can not record CPER for current error anymore"); + return; } =20 - return ret; + read_ack_register =3D cpu_to_le64(0); + /* + * Clear the Read Ack Register, OSPM will write 1 to this register when + * it acknowledges the error. + */ + cpu_physical_memory_write(read_ack_register_addr, + &read_ack_register, sizeof(uint64_t)); + + /* Write the generic error data entry into guest memory */ + cpu_physical_memory_write(error_block_addr, cper, len); + + return; +} + +int acpi_ghes_record_errors(uint16_t source_id, uint64_t physical_address) +{ + /* Memory Error Section Type */ + const uint8_t guid[] =3D + UUID_LE(0xA5BC1114, 0x6F64, 0x4EDE, 0xB8, 0x63, 0x3E, 0x83, \ + 0xED, 0x7C, 0x83, 0xB1); + Error *errp =3D NULL; + int data_length; + GArray *block; + + block =3D g_array_new(false, true /* clear */, 1); + + data_length =3D ACPI_GHES_DATA_LENGTH + ACPI_GHES_MEM_CPER_LENGTH; + /* + * It should not run out of the preallocated memory if adding a new ge= neric + * error data entry + */ + assert((data_length + ACPI_GHES_GESB_SIZE) <=3D + ACPI_GHES_MAX_RAW_DATA_LENGTH); + + ghes_gen_err_data_uncorrectable_recoverable(block, guid, + data_length); + + /* Build the memory section CPER for above new generic error data entr= y */ + acpi_ghes_build_append_mem_cper(block, physical_address); + + /* Report the error */ + ghes_record_cper_errors(block->data, block->len, source_id, &errp); + + g_array_free(block, true); + + if (errp) { + error_report_err(errp); + return -1; + } + + return 0; } =20 bool acpi_ghes_present(void) diff --git a/include/hw/acpi/ghes.h b/include/hw/acpi/ghes.h index 9295e46be25e..8859346af51a 100644 --- a/include/hw/acpi/ghes.h +++ b/include/hw/acpi/ghes.h @@ -23,6 +23,7 @@ #define ACPI_GHES_H =20 #include "hw/acpi/bios-linker-loader.h" +#include "qapi/error.h" =20 /* * Values for Hardware Error Notification Type field @@ -73,6 +74,8 @@ void acpi_build_hest(GArray *table_data, GArray *hardware= _errors, const char *oem_id, const char *oem_table_id); void acpi_ghes_add_fw_cfg(AcpiGhesState *vms, FWCfgState *s, GArray *hardware_errors); +void ghes_record_cper_errors(const void *cper, size_t len, + uint16_t source_id, Error **errp); int acpi_ghes_record_errors(uint16_t source_id, uint64_t error_physical_ad= dr); =20 /** --=20 2.47.1 From nobody Wed Dec 17 05:33:21 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B542318F2DF; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; cv=none; b=lsCVTpr0fqf5ynacSI8HFt/7i5JI2uYwfjQejzaMlqRyVKkJOFLpEm+dMUvCjEE0ZIOfDFfS8uKn0/TixVzdkXcZLGyPieiIiJP+dP4IW0Y0l7/+btpkfe8r5/jVOyx4/EGD4EzSpxnkBtnwzCzuUEXx7Lgtc1vtuXttSiyyzFY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; c=relaxed/simple; bh=OYpJ08rHteRT8bwU9HTyEKQSVLVCzWu7IgUkypsnOm8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qlGqVKtCNVWZ6kTHyV50zr7l7YlzIXgdxhxjL9YxwTIRaCZWSL2leX3f0ARjxuB8yquyVb06kim7KACrtujj/pNV4r3vTJy9N6E8ngI7cafgjZ/6ZVkoM5q5LUtCQ1aen//UgMZCFudR/rHVF8cclj/ewh7vYV0zdii9lIY6LUc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=V6jCI8CP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="V6jCI8CP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21F4EC4AF0D; Wed, 4 Dec 2024 07:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733298153; bh=OYpJ08rHteRT8bwU9HTyEKQSVLVCzWu7IgUkypsnOm8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V6jCI8CPd97kDF65ZwDijMtNZe/FcTfh+P9IZGUAWE9sSXStBFo/Jwk/RIQB3ilys hYan0p/tLdw4DTdz3hhoLo1rxpagktZN3sCoUbyEC50dqqtVGcI97g8wSUiUEX5mzk 5J4m81pcKd5zCgOOeYcKdxHLF6IVjGSvhTgZfoU3TERyuVnYwDRFfYgju6PQz4LWl0 Z5GyQKGRAXWnSUBthvWRZdQwcLTB6++jk1zFGqfTkD7n2M/dLJV0hZsTObFfcYk58x 4RFG8RxT2qyoUUlxRfO7i5CArJwbcOUJmuniPydHCUde4/yfU6eNOXsTNVqWco5cUY l9hxh7Szirc5A== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tIk1n-00000004KjI-0oiS; Wed, 04 Dec 2024 08:42:31 +0100 From: Mauro Carvalho Chehab To: Igor Mammedov Cc: Jonathan Cameron , Shiju Jose , Mauro Carvalho Chehab , "Michael S. Tsirkin" , Ani Sinha , Dongjiu Geng , Paolo Bonzini , Peter Maydell , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v5 10/16] acpi/ghes: better name GHES memory error function Date: Wed, 4 Dec 2024 08:41:18 +0100 Message-ID: <1f16080ef9848dacb207ffdbb2716b1c928d8fad.1733297707.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" The current function used to generate GHES data is specific for memory errors. Give a better name for it, as we now have a generic function as well. Reviewed-by: Igor Mammedov Reviewed-by: Jonathan Cameron Signed-off-by: Mauro Carvalho Chehab --- hw/acpi/ghes-stub.c | 2 +- hw/acpi/ghes.c | 2 +- include/hw/acpi/ghes.h | 4 ++-- target/arm/kvm.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/acpi/ghes-stub.c b/hw/acpi/ghes-stub.c index 2b64cbd2819a..7cec1812dad9 100644 --- a/hw/acpi/ghes-stub.c +++ b/hw/acpi/ghes-stub.c @@ -11,7 +11,7 @@ #include "qemu/osdep.h" #include "hw/acpi/ghes.h" =20 -int acpi_ghes_record_errors(uint16_t source_id, uint64_t physical_address) +int acpi_ghes_memory_errors(uint16_t source_id, uint64_t physical_address) { return -1; } diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index 4b5332f8c667..414a4a1ee00e 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -415,7 +415,7 @@ void ghes_record_cper_errors(const void *cper, size_t l= en, return; } =20 -int acpi_ghes_record_errors(uint16_t source_id, uint64_t physical_address) +int acpi_ghes_memory_errors(uint16_t source_id, uint64_t physical_address) { /* Memory Error Section Type */ const uint8_t guid[] =3D diff --git a/include/hw/acpi/ghes.h b/include/hw/acpi/ghes.h index 8859346af51a..21666a4bcc8b 100644 --- a/include/hw/acpi/ghes.h +++ b/include/hw/acpi/ghes.h @@ -74,15 +74,15 @@ void acpi_build_hest(GArray *table_data, GArray *hardwa= re_errors, const char *oem_id, const char *oem_table_id); void acpi_ghes_add_fw_cfg(AcpiGhesState *vms, FWCfgState *s, GArray *hardware_errors); +int acpi_ghes_memory_errors(uint16_t source_id, uint64_t error_physical_ad= dr); void ghes_record_cper_errors(const void *cper, size_t len, uint16_t source_id, Error **errp); -int acpi_ghes_record_errors(uint16_t source_id, uint64_t error_physical_ad= dr); =20 /** * acpi_ghes_present: Report whether ACPI GHES table is present * * Returns: true if the system has an ACPI GHES table and it is - * safe to call acpi_ghes_record_errors() to record a memory error. + * safe to call acpi_ghes_memory_errors() to record a memory error. */ bool acpi_ghes_present(void); #endif diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 7b6812c0de2e..b4260467f8b9 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -2387,7 +2387,7 @@ void kvm_arch_on_sigbus_vcpu(CPUState *c, int code, v= oid *addr) */ if (code =3D=3D BUS_MCEERR_AR) { kvm_cpu_synchronize_state(c); - if (!acpi_ghes_record_errors(ACPI_HEST_SRC_ID_SEA, paddr))= { + if (!acpi_ghes_memory_errors(ACPI_HEST_SRC_ID_SEA, paddr))= { kvm_inject_arm_sea(c); } else { error_report("failed to record the error"); --=20 2.47.1 From nobody Wed Dec 17 05:33:21 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B53BD18F2DD for ; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; cv=none; b=XqGdzEA9CiHquKGzjvpq6ydZSujg21PPQEb8QSabKN+HUXF/BcKEJRhoOOzt1ugMlVW2abUY2qgiSumdN/wSWM8wbm+eh6JfBM/CxT/zyMGEf531oCXM5ee4mjhFcR2gXagyN3K8s/xlUJsEXyLYvRXxG/YbzIATLFXn12lqAis= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; c=relaxed/simple; bh=EZFsmHMf3WbcMSlyh1u3n8d24jrZ2fM6gqwzFgnZ1EY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o0ZkK0572ZfoDZjk99Azw83mmWV5TYDxbyJWq4qmCzwWPqMqA7LKKO9yS++i6Vp0sVH38tYctFF4QY/c5uvuHAWiPB1oKBZHf1NKHarYvxbrrm6Fb/mGnNH9xqhenR9zyjdoB0sJi8qjdwD/qOlAMxicYGaZx4TeglcB1OtQqfc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XEBd8xOG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XEBd8xOG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A567C4AF09; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733298153; bh=EZFsmHMf3WbcMSlyh1u3n8d24jrZ2fM6gqwzFgnZ1EY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XEBd8xOGayV49WeWOwFn8wQfRHGPP9w7sohNjZh8L6XGyDbOASMSeY41VZ/Lykev/ 80zwdT/xzNQ4uM1dnCAECKCB452rlyAFsbdtrOMpa07mBDBuvVX52mdYummYAcrI6k v4fl5Pom1Js6d4C9D5OlOiMoaFLWvI6RFwuuLn2SMppxZ2EIc+j1lyypLeSZ+ezjbT zSKi7opI3jmz1EXdJNXBP+y28O4RJg0bRecMNJEMCLd+KMPYLe3yerepcK7Lm6WUZA tqduL3TVjcMMMWDwoyR3svoz93JCRxP7Tg2A6tO+yQTmn3I8m5Yitx0++0SMkp7wxI 2Ghr0hv3IDhJg== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tIk1n-00000004KjM-0vha; Wed, 04 Dec 2024 08:42:31 +0100 From: Mauro Carvalho Chehab To: Igor Mammedov Cc: Jonathan Cameron , Shiju Jose , Mauro Carvalho Chehab , "Michael S. Tsirkin" , Ani Sinha , Dongjiu Geng , linux-kernel@vger.kernel.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v5 11/16] acpi/ghes: don't crash QEMU if ghes GED is not found Date: Wed, 4 Dec 2024 08:41:19 +0100 Message-ID: <070b31b912eae803a47ab070f1ca747bd1e69e95.1733297707.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" Make error handling within ghes_record_cper_errors() consistent, i.e. instead abort just print a error in case ghes GED is not found. Reviewed-by: Jonathan Cameron Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Igor Mammedov --- hw/acpi/ghes.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index 414a4a1ee00e..2df5ddf68a13 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -371,7 +371,10 @@ void ghes_record_cper_errors(const void *cper, size_t = len, =20 acpi_ged_state =3D ACPI_GED(object_resolve_path_type("", TYPE_ACPI_GED, NULL)); - g_assert(acpi_ged_state); + if (!acpi_ged_state) { + error_setg(errp, "Can't find ACPI_GED object"); + return; + } ags =3D &acpi_ged_state->ghes_state; =20 start_addr =3D le64_to_cpu(ags->ghes_addr_le); --=20 2.47.1 From nobody Wed Dec 17 05:33:21 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCA1118FC70 for ; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; cv=none; b=IVFo1xIzCPrTERv0f2MEB0Az/k3fjHXloa4+O+dNrf4Mum+rddR2wIUT06FB493hAQTLcAhDop1cy1XwHCgASGAlCufr79m7XyQQGzch4+19797OvmHeIFYzdeyuigRDyoCGRXXX2N7GHlz89LJx9rGdi2tKQZDK/B5TmfTAD+Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; c=relaxed/simple; bh=er2E7uTLlujIsFePhTmXIu236pd9wB9P2GkaIjEE/Vc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jzuIud8+CYHeDkToRgM6EmPANKycwkG7c3Hyu4fupJ9qXp4cF29hH8Hm7GlxYoRBhCi78WzBxZcXa2CTbwKMdUMzr8iTsEe9eJ41rRL0HtjEmANYRM9Xa34vZmcE9gpNSFVQbTthTWhurE6vU7zgjxkAHPDqrx5r7PF8hNfbjZE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=de6jUmWT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="de6jUmWT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 300EFC4CEED; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733298153; bh=er2E7uTLlujIsFePhTmXIu236pd9wB9P2GkaIjEE/Vc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=de6jUmWTGG5zKrulbkUutZ5qi2pgotLEtx1BBHWW5DwgOtkmxy/69KczJnXpT2iIw iUdSv379yhhMKnsduoiNkXdoj3//AubX2VrmePd6jvNHNT4s2+A6GuqnPl/nXKuUUd RsZWL4uKR0mjgMIFy5Vl3X815SRiOqKLQNky77vUMMD9ZwYmqnMD5a4oCuNDHpI72v Jh8dWYyF5RUOFeQFk9nsl/wPJSY/N7Kb9FEfdcUujDq24KCGxVa96Gys/O+xi02l2G B2GtsRjBt/pYNEYOzfRbzZEFLx3YN1zzgCj96KFRguhjPTcFxgQmii2VBohdmP5rib X1EK/KRZKZh3Q== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tIk1n-00000004KjQ-12jX; Wed, 04 Dec 2024 08:42:31 +0100 From: Mauro Carvalho Chehab To: Igor Mammedov Cc: Jonathan Cameron , Shiju Jose , Mauro Carvalho Chehab , "Michael S. Tsirkin" , Ani Sinha , Dongjiu Geng , linux-kernel@vger.kernel.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v5 12/16] acpi/ghes: rename etc/hardware_error file macros Date: Wed, 4 Dec 2024 08:41:20 +0100 Message-ID: X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" Now that we have also have a file to store HEST data location, which is part of GHES, better name the file where CPER records are stored. No functional changes. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Igor Mammedov Reviewed-by: Jonathan Cameron --- hw/acpi/ghes.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index 2df5ddf68a13..52c2b69d3664 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -28,8 +28,8 @@ #include "hw/nvram/fw_cfg.h" #include "qemu/uuid.h" =20 -#define ACPI_GHES_ERRORS_FW_CFG_FILE "etc/hardware_errors" -#define ACPI_GHES_DATA_ADDR_FW_CFG_FILE "etc/hardware_errors_addr" +#define ACPI_HW_ERROR_FW_CFG_FILE "etc/hardware_errors" +#define ACPI_HW_ERROR_ADDR_FW_CFG_FILE "etc/hardware_errors_addr" =20 /* The max size in bytes for one error block */ #define ACPI_GHES_MAX_RAW_DATA_LENGTH (1 * KiB) @@ -234,7 +234,7 @@ static void build_ghes_error_table(GArray *hardware_err= ors, BIOSLinker *linker) ACPI_GHES_MAX_RAW_DATA_LENGTH * ACPI_GHES_ERROR_SOURCE_COUNT); =20 /* Tell guest firmware to place hardware_errors blob into RAM */ - bios_linker_loader_alloc(linker, ACPI_GHES_ERRORS_FW_CFG_FILE, + bios_linker_loader_alloc(linker, ACPI_HW_ERROR_FW_CFG_FILE, hardware_errors, sizeof(uint64_t), false); =20 for (i =3D 0; i < ACPI_GHES_ERROR_SOURCE_COUNT; i++) { @@ -243,17 +243,21 @@ static void build_ghes_error_table(GArray *hardware_e= rrors, BIOSLinker *linker) * corresponding "Generic Error Status Block" */ bios_linker_loader_add_pointer(linker, - ACPI_GHES_ERRORS_FW_CFG_FILE, sizeof(uint64_t) * i, - sizeof(uint64_t), ACPI_GHES_ERRORS_FW_CFG_FILE, - error_status_block_offset + i * ACPI_GHES_MAX_RAW_DATA_LENGTH); + ACPI_HW_ERROR_FW_CFG_FILE, + sizeof(uint64_t) * i, + sizeof(uint64_t), + ACPI_HW_ERROR_FW_CFG_FILE, + error_status_block_offset + + i * ACPI_GHES_MAX_RAW_DATA_LENGTH); } =20 /* * tell firmware to write hardware_errors GPA into * hardware_errors_addr fw_cfg, once the former has been initialized. */ - bios_linker_loader_write_pointer(linker, ACPI_GHES_DATA_ADDR_FW_CFG_FI= LE, - 0, sizeof(uint64_t), ACPI_GHES_ERRORS_FW_CFG_FILE, 0); + bios_linker_loader_write_pointer(linker, ACPI_HW_ERROR_ADDR_FW_CFG_FIL= E, 0, + sizeof(uint64_t), + ACPI_HW_ERROR_FW_CFG_FILE, 0); } =20 /* Build Generic Hardware Error Source version 2 (GHESv2) */ @@ -290,8 +294,10 @@ static void build_ghes_v2(GArray *table_data, build_append_gas(table_data, AML_AS_SYSTEM_MEMORY, 0x40, 0, 4 /* QWord access */, 0); bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE, - address_offset + GAS_ADDR_OFFSET, sizeof(uint64_t), - ACPI_GHES_ERRORS_FW_CFG_FILE, source_id * sizeof(uint64_t)); + address_offset + GAS_ADDR_OFFSET, + sizeof(uint64_t), + ACPI_HW_ERROR_FW_CFG_FILE, + source_id * sizeof(uint64_t)); =20 /* Notification Structure */ build_ghes_hw_error_notification(table_data, notify); @@ -308,9 +314,11 @@ static void build_ghes_v2(GArray *table_data, build_append_gas(table_data, AML_AS_SYSTEM_MEMORY, 0x40, 0, 4 /* QWord access */, 0); bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE, - address_offset + GAS_ADDR_OFFSET, - sizeof(uint64_t), ACPI_GHES_ERRORS_FW_CFG_FILE, - (ACPI_GHES_ERROR_SOURCE_COUNT + source_id) * sizeof(uint64_t)); + address_offset + GAS_ADDR_OFFSET, + sizeof(uint64_t), + ACPI_HW_ERROR_FW_CFG_FILE, + (ACPI_GHES_ERROR_SOURCE_COUNT + source_= id) + * sizeof(uint64_t)); =20 /* * Read Ack Preserve field @@ -346,11 +354,11 @@ void acpi_ghes_add_fw_cfg(AcpiGhesState *ags, FWCfgSt= ate *s, GArray *hardware_error) { /* Create a read-only fw_cfg file for GHES */ - fw_cfg_add_file(s, ACPI_GHES_ERRORS_FW_CFG_FILE, hardware_error->data, + fw_cfg_add_file(s, ACPI_HW_ERROR_FW_CFG_FILE, hardware_error->data, hardware_error->len); =20 /* Create a read-write fw_cfg file for Address */ - fw_cfg_add_file_callback(s, ACPI_GHES_DATA_ADDR_FW_CFG_FILE, NULL, NUL= L, + fw_cfg_add_file_callback(s, ACPI_HW_ERROR_ADDR_FW_CFG_FILE, NULL, NULL, NULL, &(ags->ghes_addr_le), sizeof(ags->ghes_addr_le), false); =20 ags->present =3D true; --=20 2.47.1 From nobody Wed Dec 17 05:33:21 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC41418F2F8 for ; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; cv=none; b=Cg7Kxm61g+YzwsPV9kY+n+ckN2UovoYtT5CrBfaKoAPstMHjxqsQLtxBmWXIi7JBSml0XVVZElNE+TKo9A94P7bS2vvpddnwFrwuyYScye70KFtBLvf1aX3joKaapElnaTsUT1ik7SJoC4+nY7fhVWMBZ9wOngb0hMZlKWDMha4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; c=relaxed/simple; bh=pgakqgvEh0nG6+NLZ9+IaRjALlaeiQhSzDCOXxqHdyA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fS6Ihd3ptIZKlVQdIfeScrAmCMiW+Sjz1fUKOy4MPR88ETAz2X+LB6wJRDnAW4cMFJJC0rUjFgnd9U4wXz2UFe5VbDaqhRLgzoRREHz0q7pXAKoZCqH3+BGEofqmkUSMKM92F82xTbxXxLe2RsoimjGx/y4yt6xrnPcA+Llbhz8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NI7gUJKP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NI7gUJKP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39013C4CEEF; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733298153; bh=pgakqgvEh0nG6+NLZ9+IaRjALlaeiQhSzDCOXxqHdyA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NI7gUJKPsRPpMsxDugV6NmZXSCIVr4orRroz+wuhp8FifidE2Wua3d8m5fn7dgcQY pYwpk2tKKp7DoXBIdY1xr0lMINbUnim7ftPoE087PgIuizo25pJvjBzOQdFd9v1ezG Q36YPuJPWRp+QOD4EZDY3fFqrekZM3QwooHnvBEbAsvTlkxOLs6grjtsmi2wFxUzXx IKnAoChm25AVV5Dmb/UVAb4tRLXehvvu0rkJEScBtZV8ISvOUAFWhlmjhBdQ5L9Jcr ElX2iZq/Zsw9LGMJn92MYAIZ9TqAG1u1VAj+8uIphmdudSldXyf1oEGxYyaRrq07g5 XXvmSvLIh2VJw== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tIk1n-00000004KjU-19ki; Wed, 04 Dec 2024 08:42:31 +0100 From: Mauro Carvalho Chehab To: Igor Mammedov Cc: Jonathan Cameron , Shiju Jose , Mauro Carvalho Chehab , "Michael S. Tsirkin" , Ani Sinha , Dongjiu Geng , linux-kernel@vger.kernel.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v5 13/16] acpi/ghes: better name the offset of the hardware error firmware Date: Wed, 4 Dec 2024 08:41:21 +0100 Message-ID: <20b003136d8c008fd54e8d40c806f13867336e13.1733297707.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" The hardware error firmware is where HEST error structures are stored. Those can be GHESv2, but they can also be other types. Better name the location of the hardware error. No functional changes. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Jonathan Cameron Reviewed-by: Igor Mammedov --- hw/acpi/generic_event_device.c | 4 ++-- hw/acpi/ghes.c | 4 ++-- include/hw/acpi/ghes.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c index 663d9cb09380..17baf36132a8 100644 --- a/hw/acpi/generic_event_device.c +++ b/hw/acpi/generic_event_device.c @@ -364,7 +364,7 @@ static const VMStateDescription vmstate_ghes =3D { .version_id =3D 1, .minimum_version_id =3D 1, .fields =3D (const VMStateField[]) { - VMSTATE_UINT64(ghes_addr_le, AcpiGhesState), + VMSTATE_UINT64(hw_error_le, AcpiGhesState), VMSTATE_END_OF_LIST() }, }; @@ -372,7 +372,7 @@ static const VMStateDescription vmstate_ghes =3D { static bool ghes_needed(void *opaque) { AcpiGedState *s =3D opaque; - return s->ghes_state.ghes_addr_le; + return s->ghes_state.hw_error_le; } =20 static const VMStateDescription vmstate_ghes_state =3D { diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index 52c2b69d3664..90d76b9c2d8c 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -359,7 +359,7 @@ void acpi_ghes_add_fw_cfg(AcpiGhesState *ags, FWCfgStat= e *s, =20 /* Create a read-write fw_cfg file for Address */ fw_cfg_add_file_callback(s, ACPI_HW_ERROR_ADDR_FW_CFG_FILE, NULL, NULL, - NULL, &(ags->ghes_addr_le), sizeof(ags->ghes_addr_le), false); + NULL, &(ags->hw_error_le), sizeof(ags->hw_error_le), false); =20 ags->present =3D true; } @@ -385,7 +385,7 @@ void ghes_record_cper_errors(const void *cper, size_t l= en, } ags =3D &acpi_ged_state->ghes_state; =20 - start_addr =3D le64_to_cpu(ags->ghes_addr_le); + start_addr =3D le64_to_cpu(ags->hw_error_le); =20 start_addr +=3D source_id * sizeof(uint64_t); =20 diff --git a/include/hw/acpi/ghes.h b/include/hw/acpi/ghes.h index 21666a4bcc8b..39619a2457cb 100644 --- a/include/hw/acpi/ghes.h +++ b/include/hw/acpi/ghes.h @@ -65,7 +65,7 @@ enum { }; =20 typedef struct AcpiGhesState { - uint64_t ghes_addr_le; + uint64_t hw_error_le; bool present; /* True if GHES is present at all on this board */ } AcpiGhesState; =20 --=20 2.47.1 From nobody Wed Dec 17 05:33:21 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D629C18FC7B for ; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; cv=none; b=Dft4c5nyIpoudstQvU2c3GTyjNQKb/ryl3l90xBPHEo0r0PF2B6HGgWZ1P6RwDQ3lQ0+MZ6RzeN0LsBBr1bfoZsypD1egatIXtuzwnOrM8F8sJJZlVXGpCsuUhs/+Xn66k4RcJd2apAkMEUhMsNH0IzngX4MvM1/zc7pskWRG9Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; c=relaxed/simple; bh=Be8M4xyPgWUerVPdOaSTwjg+X2UoRgPgIB1JDMFCf+0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z6xASmXlXpXBLmuIq8GT9NlD58/uu1XuGENXNWt3HNOddS4t/iMDtfLfhQ0muHAo5KbbISEh880GZGPN5eEiXGtfF7G6p9Sx0kZP36Hr1gwB2oMY7jY+BvlN3iRAHQ21nxNuficQo4Rm/SY9wCOfnThOEl/4AEpr2a/7blNlW2c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LLdcgh/K; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LLdcgh/K" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B5B2C4CEF0; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733298153; bh=Be8M4xyPgWUerVPdOaSTwjg+X2UoRgPgIB1JDMFCf+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LLdcgh/Ke1lMyhnUymgjlFrQQrlz4Ho9hj4jptnHfn7dAuxGBiOFT11FGw1nbO8o4 Ia4BY7ttYv+UxHvLR7VqAyHL3LtXwkhXrXftf+SwYZMUd4VjV75YDJzeK+OeGkWRL5 gH0ZLtYwHkrpCSo7exVg53c3LxtRgNyn7EFmYyMGuAl8vGXAtxmOA3nW8+dlJ3Niqk NBemNEdHxLW0xC9+A8SshtZWhEMfS2Qhs1gzmnwQ5TvniiDrIS5lGOV/mdnO5q4NcK YzA9+dcRB19VBWaNt1lA6InwbbwkzMLRIHdueR66tPJ87qD/afW/Y8P4SbPEusq9IR rT/twqpsM3yMQ== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tIk1n-00000004KjY-1Gf5; Wed, 04 Dec 2024 08:42:31 +0100 From: Mauro Carvalho Chehab To: Igor Mammedov Cc: Jonathan Cameron , Shiju Jose , Mauro Carvalho Chehab , "Michael S. Tsirkin" , Ani Sinha , Dongjiu Geng , linux-kernel@vger.kernel.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v5 14/16] acpi/ghes: move offset calculus to a separate function Date: Wed, 4 Dec 2024 08:41:22 +0100 Message-ID: <5a2bda4722e2d45839a75f3a193f6b8f4841c773.1733297707.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" Currently, CPER address location is calculated as an offset of the hardware_errors table. It is also badly named, as the offset actually used is the address where the CPER data starts, and not the beginning of the error source. Move the logic which calculates such offset to a separate function, in preparation for a patch that will be changing the logic to calculate it from the HEST table. While here, properly name the variable which stores the cper address. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Jonathan Cameron --- hw/acpi/ghes.c | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index 90d76b9c2d8c..a4453ee357bc 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -364,10 +364,37 @@ void acpi_ghes_add_fw_cfg(AcpiGhesState *ags, FWCfgSt= ate *s, ags->present =3D true; } =20 +static void get_hw_error_offsets(uint64_t ghes_addr, + uint64_t *cper_addr, + uint64_t *read_ack_register_addr) +{ + if (!ghes_addr) { + return; + } + + /* + * non-HEST version supports only one source, so no need to change + * the start offset based on the source ID. Also, we can't validate + * the source ID, as it is stored inside the HEST table. + */ + + cpu_physical_memory_read(ghes_addr, cper_addr, + sizeof(*cper_addr)); + + *cper_addr =3D le64_to_cpu(*cper_addr); + + /* + * As the current version supports only one source, the ack offset is + * just sizeof(uint64_t). + */ + *read_ack_register_addr =3D ghes_addr + + ACPI_GHES_ERROR_SOURCE_COUNT * sizeof(uint64_t); +} + void ghes_record_cper_errors(const void *cper, size_t len, uint16_t source_id, Error **errp) { - uint64_t error_block_addr, read_ack_register_addr, read_ack_register = =3D 0; + uint64_t cper_addr =3D 0, read_ack_register_addr =3D 0, read_ack_regis= ter; uint64_t start_addr; AcpiGedState *acpi_ged_state; AcpiGhesState *ags; @@ -389,18 +416,13 @@ void ghes_record_cper_errors(const void *cper, size_t= len, =20 start_addr +=3D source_id * sizeof(uint64_t); =20 - cpu_physical_memory_read(start_addr, &error_block_addr, - sizeof(error_block_addr)); + get_hw_error_offsets(start_addr, &cper_addr, &read_ack_register_addr); =20 - error_block_addr =3D le64_to_cpu(error_block_addr); - if (!error_block_addr) { + if (!cper_addr) { error_setg(errp, "can not find Generic Error Status Block"); return; } =20 - read_ack_register_addr =3D start_addr + - ACPI_GHES_ERROR_SOURCE_COUNT * sizeof(uint64_= t); - cpu_physical_memory_read(read_ack_register_addr, &read_ack_register, sizeof(read_ack_register)= ); =20 @@ -421,7 +443,7 @@ void ghes_record_cper_errors(const void *cper, size_t l= en, &read_ack_register, sizeof(uint64_t)); =20 /* Write the generic error data entry into guest memory */ - cpu_physical_memory_write(error_block_addr, cper, len); + cpu_physical_memory_write(cper_addr, cper, len); =20 return; } --=20 2.47.1 From nobody Wed Dec 17 05:33:21 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCA9618FC72 for ; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; cv=none; b=FaYLw9gVwIkUmHV+Cryz/cxUQ3kfyvfGC/MtRy2Y+T+IVEYlO78rSh/J2EH9kA6bG7YsgvEVgIStBjo/O/MGoK/CY4sV/4/qeFm5EN/iuDe8Q03OCG09cW1PofUMA5UacJ8KQAf4oUdmqPdGCd8bbtanyv3w3C5Kl+FH8tGpCv4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; c=relaxed/simple; bh=0CyS+5uMH4bliw7AWJd+kEIWAWXpqKGP1aXYbGP2T70=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W/HpIFEvd948NjN2Ux5C+Ny43RGrhZCp5wEMhnT/3He6GQzF9hy4qosVwiaZpjYYjVJ6Fh2GQBmfIVJ1qqGlNpXvmk6NyC4vbU7hUfZ/z8C3ZQ0GwRlO8N0ESV3jHDdZKK3O+8GA0S22/JjOWvAHMBMIDMx1siFIxCstGsDDNnE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cxXWcFIu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cxXWcFIu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32F2AC4AF0E; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733298153; bh=0CyS+5uMH4bliw7AWJd+kEIWAWXpqKGP1aXYbGP2T70=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cxXWcFIuBV+Uv+qb3yeN7e37cAaw4wxRTpUKKpdloMjvgg+jEPA0sVEQ6sFDuWcjE VxiH/ZVVsK0Logs1wRdr/QYITIwsWgY9Xb6nFjVk41NvjpncKmKM8gdVz/0oEKFhkO 9STGetQjuSOlM6jwHeB+IoCNs7V+MX41ZD4H0BUpzKySAmSAl6J3b8Gy8CkJPP2yC1 D/eBJ1GRdNeQqPVlfXyE44syuWDDgmjmxxrE4SLnZWB5KbtAzrSp7haX7ldWRNby2F BgWUTmyDz3NWnh6OcnDD0JNElqAwDDQcvUXw/UWVtA1JrSPWk3UPJTItg15RTj7CxG 4gBRku+r/appA== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tIk1n-00000004Kjc-1NTs; Wed, 04 Dec 2024 08:42:31 +0100 From: Mauro Carvalho Chehab To: Igor Mammedov Cc: Jonathan Cameron , Shiju Jose , Mauro Carvalho Chehab , "Michael S. Tsirkin" , Ani Sinha , Dongjiu Geng , linux-kernel@vger.kernel.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v5 15/16] acpi/ghes: Change ghes fill logic to work with only one source Date: Wed, 4 Dec 2024 08:41:23 +0100 Message-ID: X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" Extending to multiple sources require a BIOS pointer to the beginning of the HEST table, which in turn requires a backward-compatible code. So, the current code supports only one source. Ensure that and simplify the code. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Jonathan Cameron Reviewed-by: Igor Mammedov --- hw/acpi/ghes.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index a4453ee357bc..5efa50413af3 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -387,15 +387,13 @@ static void get_hw_error_offsets(uint64_t ghes_addr, * As the current version supports only one source, the ack offset is * just sizeof(uint64_t). */ - *read_ack_register_addr =3D ghes_addr + - ACPI_GHES_ERROR_SOURCE_COUNT * sizeof(uint64_t); + *read_ack_register_addr =3D ghes_addr + sizeof(uint64_t); } =20 void ghes_record_cper_errors(const void *cper, size_t len, uint16_t source_id, Error **errp) { uint64_t cper_addr =3D 0, read_ack_register_addr =3D 0, read_ack_regis= ter; - uint64_t start_addr; AcpiGedState *acpi_ged_state; AcpiGhesState *ags; =20 @@ -412,11 +410,9 @@ void ghes_record_cper_errors(const void *cper, size_t = len, } ags =3D &acpi_ged_state->ghes_state; =20 - start_addr =3D le64_to_cpu(ags->hw_error_le); - - start_addr +=3D source_id * sizeof(uint64_t); - - get_hw_error_offsets(start_addr, &cper_addr, &read_ack_register_addr); + assert(ACPI_GHES_ERROR_SOURCE_COUNT =3D=3D 1); + get_hw_error_offsets(le64_to_cpu(ags->hw_error_le), + &cper_addr, &read_ack_register_addr); =20 if (!cper_addr) { error_setg(errp, "can not find Generic Error Status Block"); --=20 2.47.1 From nobody Wed Dec 17 05:33:21 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D631A18FC83 for ; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; cv=none; b=YqaS2ztvFSy63W8IyuWdsPk5vBkysWRqUPC3l9FJ4HQ3qAkgqEKx2lgJzGhw4PeLTAT8rAHq4Uo9myd5nSfafjoVyT45bTltAyExMI9ppQrLeQ2qRUxFMgUyL54pJGMRHK6LdsCrcPSUMLgYKtSv2xN8UiNZQxEzCFvKY2FSvQs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; c=relaxed/simple; bh=DZq3ehynlc63lZ3iGs1SNcajfqzDutIBxgWe19LJFlA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YBVD95qj4LwfwYhoAZ2SEZjQCYd90lyvKStXx2VewuUAFKg9RPVSCnBE7CSmix1R21glebkkfGIS2WgjKoZtnstJpgd7JiZ0UwFcSoG9tUF6x+c9XKvKEG2WsqCDlpI/XCe+pdiQs+6fSBv66FTnTyLGPy2kKuQSjmiNB+RjDlg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YECxV4o4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YECxV4o4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39EC3C4AF0F; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733298153; bh=DZq3ehynlc63lZ3iGs1SNcajfqzDutIBxgWe19LJFlA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YECxV4o4AY+5zzyzQww1VLIUoA/rFeR77HUsq3vSP6lpI1OCW6HJf195bLPHFjtgv jNp1eF5FQuio14fP2TDuMxii8lJ3b0tALlGDEGrRY/te3jSHx50NEHyCRiIySz945V 4lqTwmiMffvDlLlc6f9TGFJ/4x7r5wdb1ssEtUdBpa5fuUCLr6KfKYplUGjz7xzZeZ 5TeuZA+w9cTXVZwK32on2FqOl6RguAXq5CtpOoqHPXQswb9+G8eH+1wwK7WkgLRDYB 3WsRItln7wr3p8e+2iSmTgu1FD1IWIWdQCQhv92uGvv01uVqrqoA4G9duE4z33W5Ql yszxKUCXt61CQ== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tIk1n-00000004Kjg-1UAq; Wed, 04 Dec 2024 08:42:31 +0100 From: Mauro Carvalho Chehab To: Igor Mammedov Cc: Jonathan Cameron , Shiju Jose , Mauro Carvalho Chehab , Dongjiu Geng , linux-kernel@vger.kernel.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v5 16/16] docs: acpi_hest_ghes: fix documentation for CPER size Date: Wed, 4 Dec 2024 08:41:24 +0100 Message-ID: X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" While the spec defines a CPER size of 4KiB for each record, currently it is set to 1KiB. Fix the documentation and add a pointer to the macro name there, as this may help to keep it updated. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Jonathan Cameron Reviewed-by: Igor Mammedov --- docs/specs/acpi_hest_ghes.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/specs/acpi_hest_ghes.rst b/docs/specs/acpi_hest_ghes.rst index 68f1fbe0a4af..c3e9f8d9a702 100644 --- a/docs/specs/acpi_hest_ghes.rst +++ b/docs/specs/acpi_hest_ghes.rst @@ -67,8 +67,10 @@ Design Details (3) The address registers table contains N Error Block Address entries and N Read Ack Register entries. The size for each entry is 8-byte. The Error Status Data Block table contains N Error Status Data Block - entries. The size for each entry is 4096(0x1000) bytes. The total size - for the "etc/hardware_errors" fw_cfg blob is (N * 8 * 2 + N * 4096) by= tes. + entries. The size for each entry is defined at the source code as + ACPI_GHES_MAX_RAW_DATA_LENGTH (currently 1024 bytes). The total size + for the "etc/hardware_errors" fw_cfg blob is + (N * 8 * 2 + N * ACPI_GHES_MAX_RAW_DATA_LENGTH) bytes. N is the number of the kinds of hardware error sources. =20 (4) QEMU generates the ACPI linker/loader script for the firmware. The --=20 2.47.1