From nobody Fri Nov 14 15:21:56 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1762343237; cv=none; d=zohomail.com; s=zohoarc; b=d71c79OHS1yW0Ng5Sl/RGmhJiDX45eg23cCQH/pgwTNq3i2Z9OmH0Edj2x+gGvmrQZRb66Q1tANCFcdqSG2fnyxP+Nx9O9ARDnv8ny+dxzra7RQEydVIgtrYDTv0wCNWsr+ouDFp+UoEjpgSIi2i0evexa67eGKBhWdj0gWtuZ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762343237; h=Content-Type: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=Yjjbg+s9qvG83ORkq479+/aXcqzaSJRLowKnK8IK7JE=; b=gv79+NoYak5ERRDuis5rdk/SD7Zi7sTFL5vE2KjViTpYtduZrZgtlcSuwHmdKxLSeBAL4zq/xRYXbNEEilictn3BeV1belWbxWrUTHnHnMUaZvfNVxV7CxReo9cs71Im4o0izm7HK4m66bvedkz2uI3g9cjkJ85t6SnpNkBuG2o= 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 1762343237798293.72101072750684; Wed, 5 Nov 2025 03:47:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vGbyV-0005uF-Ba; Wed, 05 Nov 2025 06:46:51 -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 1vGbxt-0005az-Ie for qemu-devel@nongnu.org; Wed, 05 Nov 2025 06:46:15 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vGbxs-000213-58 for qemu-devel@nongnu.org; Wed, 05 Nov 2025 06:46:13 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-304-zwkiTcclOUKD7CmdeNJAkg-1; Wed, 05 Nov 2025 06:46:07 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 653E519560A3; Wed, 5 Nov 2025 11:46:06 +0000 (UTC) Received: from gshan-thinkpadx1nanogen2.rmtau.csb (unknown [10.64.136.5]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 27D721800367; Wed, 5 Nov 2025 11:46:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762343171; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yjjbg+s9qvG83ORkq479+/aXcqzaSJRLowKnK8IK7JE=; b=QNAu2TdWcoloWB7yNshhjhYDQYiMWh6SAJ3qE7uiQQvsG61Y5DVG/l8kiqwuAIDlAR6mW7 VT7Uv09IJ1Ptw67Mr4c/uzKlVcutaEheBOtL5QKiCcJHL0JvJ0/fMkekB2jEsAv/RuVTKx caA8nGy40rekhDsa0vOM6jjGIBXsW9o= X-MC-Unique: zwkiTcclOUKD7CmdeNJAkg-1 X-Mimecast-MFC-AGG-ID: zwkiTcclOUKD7CmdeNJAkg_1762343166 From: Gavin Shan To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, jonathan.cameron@huawei.com, mchehab+huawei@kernel.org, gengdongjiu1@gmail.com, mst@redhat.com, imammedo@redhat.com, anisinha@redhat.com, peter.maydell@linaro.org, pbonzini@redhat.com, shan.gavin@gmail.com Subject: [PATCH v3 1/8] tests/qtest/bios-tables-test: Prepare for changes in the HEST table Date: Wed, 5 Nov 2025 21:44:46 +1000 Message-ID: <20251105114453.2164073-2-gshan@redhat.com> In-Reply-To: <20251105114453.2164073-1-gshan@redhat.com> References: <20251105114453.2164073-1-gshan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.133.124; envelope-from=gshan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.517, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1762343239468154100 Content-Type: text/plain; charset="utf-8" Adds HEST blob to the whilelist, preparing for the increased GHES raw data maximal length (ACPI_GHES_MAX_RAW_DATA_LENGTH) from 1KiB to 4KiB, because we need to send 16 consective errors in case a problematic 64KiB host page affects 16 4KiB guest pages. Signed-off-by: Gavin Shan Reviewed-by: Jonathan Cameron --- tests/qtest/bios-tables-test-allowed-diff.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index dfb8523c8b..39901c58d6 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,2 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/aarch64/virt/HEST", --=20 2.51.0 From nobody Fri Nov 14 15:21:56 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1762343227; cv=none; d=zohomail.com; s=zohoarc; b=exObshNjjL6L6IhUB//dIJgkWcXUgLD1Gv+vskiOddl7uTZyK4ciMug03iFmiO0OFvpsyBENzA8a4AtDqaMQn9jgi2EZiYeZF7ND6H3hRrXmO7igqlPXPUKU8fllLfMtbaC8o5PXltqhdoi270urlDKqfBeVDaEa90FttV9a5G0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762343227; h=Content-Type: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=KjQCgzUuMt/tIaUujFGLuYD4UMTT/LdKiuJpGFsSVAc=; b=RJv30GcMcWauQIPgwy1En1L6FUWNkAWkHdr9EYgog52eg20Kg5Fdjd4cHOdej8A8WYMEpkRUYFBRSpbiO24DlscyfxxNvRr+/C09B+uLH6reb2MFV+R5lIEzn22vHvgjvgrEVg30lpq0nUQL5o4v4upeH08at28kPqZWlsjt8us= 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 1762343227818713.3022302295218; Wed, 5 Nov 2025 03:47:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vGbyW-0005vE-AC; Wed, 05 Nov 2025 06:46:52 -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 1vGby2-0005hl-0O for qemu-devel@nongnu.org; Wed, 05 Nov 2025 06:46:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vGbxy-0002Fn-PL for qemu-devel@nongnu.org; Wed, 05 Nov 2025 06:46:20 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-367-yiCSwjuTPqSOo0HAdq2y5A-1; Wed, 05 Nov 2025 06:46:14 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A4EA618001FE; Wed, 5 Nov 2025 11:46:12 +0000 (UTC) Received: from gshan-thinkpadx1nanogen2.rmtau.csb (unknown [10.64.136.5]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 16A3D180049F; Wed, 5 Nov 2025 11:46:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762343177; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KjQCgzUuMt/tIaUujFGLuYD4UMTT/LdKiuJpGFsSVAc=; b=D1qD0jn/42r1FJaVZ/svj5X9GOq0qRxjleEw1w4BD7kbRKYHIVAhPVNIj3kHUR6a1pIQIH Kb+DjW6nOeqdsLo65v+fSGNvH+n+y9trS5n1/l5lX4j11za6LRHDuevIE50uEM570zb7H1 vgv0PUITPefG942zoCVredMt5TSsJSI= X-MC-Unique: yiCSwjuTPqSOo0HAdq2y5A-1 X-Mimecast-MFC-AGG-ID: yiCSwjuTPqSOo0HAdq2y5A_1762343173 From: Gavin Shan To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, jonathan.cameron@huawei.com, mchehab+huawei@kernel.org, gengdongjiu1@gmail.com, mst@redhat.com, imammedo@redhat.com, anisinha@redhat.com, peter.maydell@linaro.org, pbonzini@redhat.com, shan.gavin@gmail.com Subject: [PATCH v3 2/8] acpi/ghes: Increase GHES raw data maximal length to 4KiB Date: Wed, 5 Nov 2025 21:44:47 +1000 Message-ID: <20251105114453.2164073-3-gshan@redhat.com> In-Reply-To: <20251105114453.2164073-1-gshan@redhat.com> References: <20251105114453.2164073-1-gshan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.129.124; envelope-from=gshan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.517, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1762343229552154100 Content-Type: text/plain; charset="utf-8" The current GHES raw data maximal length isn't enough for 16 consecutive CPER errors, which will be sent to a guest with 4KiB page size on a erroneous 64KiB host page. Note those 16 CPER errors will be contained in one single error block, meaning all CPER errors should be identical in terms of type and severity and all of them should be delivered in one shot. Increase GHES raw data maximal length from 1KiB to 4KiB so that the error block has enough storage space for 16 consecutive CPER errors. Signed-off-by: Gavin Shan Reviewed-by: Jonathan Cameron --- docs/specs/acpi_hest_ghes.rst | 2 +- hw/acpi/ghes.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/specs/acpi_hest_ghes.rst b/docs/specs/acpi_hest_ghes.rst index aaf7b1ad11..acf31d6eeb 100644 --- a/docs/specs/acpi_hest_ghes.rst +++ b/docs/specs/acpi_hest_ghes.rst @@ -68,7 +68,7 @@ Design Details 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 defined at the source code as - ACPI_GHES_MAX_RAW_DATA_LENGTH (currently 1024 bytes). The total size + ACPI_GHES_MAX_RAW_DATA_LENGTH (currently 4096 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. diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index 06555905ce..a9c08e73c0 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -33,7 +33,7 @@ #define ACPI_HEST_ADDR_FW_CFG_FILE "etc/acpi_table_hest_addr" =20 /* The max size in bytes for one error block */ -#define ACPI_GHES_MAX_RAW_DATA_LENGTH (1 * KiB) +#define ACPI_GHES_MAX_RAW_DATA_LENGTH (4 * KiB) =20 /* Generic Hardware Error Source version 2 */ #define ACPI_GHES_SOURCE_GENERIC_ERROR_V2 10 --=20 2.51.0 From nobody Fri Nov 14 15:21:56 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1762343255; cv=none; d=zohomail.com; s=zohoarc; b=aeDz/pIFS7pwGOwr2hMEKzjkkGH6sv8b7bHCwmLANFIydlgzc/92hkBvdYqPUbeLlKZQMsNCux+FC9AZdKlaIb+MY1KJetCY5B9b8GYVAWWEF0KE4foIWYhqbsaoR17CObd+nwglZ8Os3IuLHdf3dWtTCEPvulk29cE+9ub3wao= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762343255; h=Content-Type: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=1SsWOpMbdBPgivPXJMMIje/cYCywerwREolwMo1XTrI=; b=KvElh1HrO46oezHhaohHZ9n9CMc1Bu3rL7msYS5WI6rZAHPGq+YTnrxu7J4/EghOO9fgaVPbmVG34HOrVTFilB29CbQDrnMI+zkmqj02G1dyVcGWUEtnFI8ZawZlwvB2OlvVxdzzsZk6jisA9o/OxtuD6I57gWw36Wo17C0X+3U= 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 1762343255351866.579841198372; Wed, 5 Nov 2025 03:47:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vGbyh-00065U-GO; Wed, 05 Nov 2025 06:47:03 -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 1vGby8-0005k2-2j for qemu-devel@nongnu.org; Wed, 05 Nov 2025 06:46:33 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vGby6-0002be-29 for qemu-devel@nongnu.org; Wed, 05 Nov 2025 06:46:27 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-159-nAUfivNhPl6FjbcWHQUF9Q-1; Wed, 05 Nov 2025 06:46:20 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B8AB21801234; Wed, 5 Nov 2025 11:46:18 +0000 (UTC) Received: from gshan-thinkpadx1nanogen2.rmtau.csb (unknown [10.64.136.5]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4B44B1800451; Wed, 5 Nov 2025 11:46:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762343185; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1SsWOpMbdBPgivPXJMMIje/cYCywerwREolwMo1XTrI=; b=QH6LlJb78Z6/rAwA+IjegfiD/g2m/KuMy6Wb4llK2D4tlV9chc+ie0723W302AMbvJhWLE GChTCjfpGWojSXjP6XQfOuNw5RymczD2kcdqVKqcf/y0Hl9qdora4vje/iGHYq90eaOm7O fkXapEbnCEseP2vsx4WkPtzYHM+ioOY= X-MC-Unique: nAUfivNhPl6FjbcWHQUF9Q-1 X-Mimecast-MFC-AGG-ID: nAUfivNhPl6FjbcWHQUF9Q_1762343179 From: Gavin Shan To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, jonathan.cameron@huawei.com, mchehab+huawei@kernel.org, gengdongjiu1@gmail.com, mst@redhat.com, imammedo@redhat.com, anisinha@redhat.com, peter.maydell@linaro.org, pbonzini@redhat.com, shan.gavin@gmail.com Subject: [PATCH v3 3/8] tests/qtest/bios-tables-test: Update HEST table Date: Wed, 5 Nov 2025 21:44:48 +1000 Message-ID: <20251105114453.2164073-4-gshan@redhat.com> In-Reply-To: <20251105114453.2164073-1-gshan@redhat.com> References: <20251105114453.2164073-1-gshan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.129.124; envelope-from=gshan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.517, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1762343257376154100 Content-Type: text/plain; charset="utf-8" Update HEST table since GHES raw data maximal length has been increased from 1KiB to 4KiB. /* * Intel ACPI Component Architecture * AML/ASL+ Disassembler version 20240322 (64-bit version) * Copyright (c) 2000 - 2023 Intel Corporation * - * Disassembly of tests/data/acpi/aarch64/virt/HEST + * Disassembly of /tmp/aml-28KMF3 * * ACPI Data Table [HEST] * * Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue (i= n hex) */ [000h 0000 004h] Signature : "HEST" [Hardware Error S= ource Table] [004h 0004 004h] Table Length : 000000E0 [008h 0008 001h] Revision : 01 -[009h 0009 001h] Checksum : 6C +[009h 0009 001h] Checksum : 3C [00Ah 0010 006h] Oem ID : "BOCHS " [010h 0016 008h] Oem Table ID : "BXPC " [018h 0024 004h] Oem Revision : 00000001 [01Ch 0028 004h] Asl Compiler ID : "BXPC" [020h 0032 004h] Asl Compiler Revision : 00000001 [024h 0036 004h] Error Source Count : 00000002 [028h 0040 002h] Subtable Type : 000A [Generic Hardware Erro= r Source V2] [02Ah 0042 002h] Source Id : 0000 [02Ch 0044 002h] Related Source Id : FFFF [02Eh 0046 001h] Reserved : 00 [02Fh 0047 001h] Enabled : 01 [030h 0048 004h] Records To Preallocate : 00000001 [034h 0052 004h] Max Sections Per Record : 00000001 -[038h 0056 004h] Max Raw Data Length : 00000400 +[038h 0056 004h] Max Raw Data Length : 00001000 [03Ch 0060 00Ch] Error Status Address : [Generic Address Structure] [03Ch 0060 001h] Space ID : 00 [SystemMemory] [03Dh 0061 001h] Bit Width : 40 [03Eh 0062 001h] Bit Offset : 00 [03Fh 0063 001h] Encoded Access Width : 04 [QWord Access:64] [040h 0064 008h] Address : 0000000043DA0000 [048h 0072 01Ch] Notify : [Hardware Error Notificatio= n Structure] [048h 0072 001h] Notify Type : 08 [SEA] [049h 0073 001h] Notify Length : 1C [04Ah 0074 002h] Configuration Write Enable : 0000 [04Ch 0076 004h] PollInterval : 00000000 [050h 0080 004h] Vector : 00000000 [054h 0084 004h] Polling Threshold Value : 00000000 [058h 0088 004h] Polling Threshold Window : 00000000 [05Ch 0092 004h] Error Threshold Value : 00000000 [060h 0096 004h] Error Threshold Window : 00000000 -[064h 0100 004h] Error Status Block Length : 00000400 +[064h 0100 004h] Error Status Block Length : 00001000 [068h 0104 00Ch] Read Ack Register : [Generic Address Structure] [068h 0104 001h] Space ID : 00 [SystemMemory] [069h 0105 001h] Bit Width : 40 [06Ah 0106 001h] Bit Offset : 00 [06Bh 0107 001h] Encoded Access Width : 04 [QWord Access:64] [06Ch 0108 008h] Address : 0000000043DA0010 [074h 0116 008h] Read Ack Preserve : FFFFFFFFFFFFFFFE [07Ch 0124 008h] Read Ack Write : 0000000000000001 [084h 0132 002h] Subtable Type : 000A [Generic Hardware Erro= r Source V2] [086h 0134 002h] Source Id : 0001 [088h 0136 002h] Related Source Id : FFFF [08Ah 0138 001h] Reserved : 00 [08Bh 0139 001h] Enabled : 01 [08Ch 0140 004h] Records To Preallocate : 00000001 [090h 0144 004h] Max Sections Per Record : 00000001 -[094h 0148 004h] Max Raw Data Length : 00000400 +[094h 0148 004h] Max Raw Data Length : 00001000 [098h 0152 00Ch] Error Status Address : [Generic Address Structure] [098h 0152 001h] Space ID : 00 [SystemMemory] [099h 0153 001h] Bit Width : 40 [09Ah 0154 001h] Bit Offset : 00 [09Bh 0155 001h] Encoded Access Width : 04 [QWord Access:64] [09Ch 0156 008h] Address : 0000000043DA0008 [0A4h 0164 01Ch] Notify : [Hardware Error Notificatio= n Structure] [0A4h 0164 001h] Notify Type : 07 [GPIO] [0A5h 0165 001h] Notify Length : 1C [0A6h 0166 002h] Configuration Write Enable : 0000 [0A8h 0168 004h] PollInterval : 00000000 [0ACh 0172 004h] Vector : 00000000 [0B0h 0176 004h] Polling Threshold Value : 00000000 [0B4h 0180 004h] Polling Threshold Window : 00000000 [0B8h 0184 004h] Error Threshold Value : 00000000 [0BCh 0188 004h] Error Threshold Window : 00000000 -[0C0h 0192 004h] Error Status Block Length : 00000400 +[0C0h 0192 004h] Error Status Block Length : 00001000 [0C4h 0196 00Ch] Read Ack Register : [Generic Address Structure] [0C4h 0196 001h] Space ID : 00 [SystemMemory] [0C5h 0197 001h] Bit Width : 40 [0C6h 0198 001h] Bit Offset : 00 [0C7h 0199 001h] Encoded Access Width : 04 [QWord Access:64] [0C8h 0200 008h] Address : 0000000043DA0018 [0D0h 0208 008h] Read Ack Preserve : FFFFFFFFFFFFFFFE [0D8h 0216 008h] Read Ack Write : 0000000000000001 Raw Table Data: Length 224 (0xE0) - 0000: 48 45 53 54 E0 00 00 00 01 6C 42 4F 43 48 53 20 // HEST.....lBO= CHS + 0000: 48 45 53 54 E0 00 00 00 01 3C 42 4F 43 48 53 20 // HEST..... Reviewed-by: Jonathan Cameron --- tests/data/acpi/aarch64/virt/HEST | Bin 224 -> 224 bytes tests/qtest/bios-tables-test-allowed-diff.h | 1 - 2 files changed, 1 deletion(-) diff --git a/tests/data/acpi/aarch64/virt/HEST b/tests/data/acpi/aarch64/vi= rt/HEST index 674272922db7d48f7821aa7c83ec76bb3b556d2a..247345901b9be41a86c51bcced5= 9287f74f9e918 100644 GIT binary patch delta 45 ycmaFB_<)hi!!GveMW(aR@#gL6VpJfY1$kD3=3D9ko3@j28bHxD$GYS#_ delta 45 ycmaFB_<)hi!! (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 1762343323167796.7733556011677; Wed, 5 Nov 2025 03:48:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vGbyo-0006AM-1K; Wed, 05 Nov 2025 06:47:10 -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 1vGbyG-0005kw-8b for qemu-devel@nongnu.org; Wed, 05 Nov 2025 06:46:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vGbyE-000332-47 for qemu-devel@nongnu.org; Wed, 05 Nov 2025 06:46:35 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-126-eftmmyP2MVSDDMjpvt79Bg-1; Wed, 05 Nov 2025 06:46:28 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B2626195608F; Wed, 5 Nov 2025 11:46:26 +0000 (UTC) Received: from gshan-thinkpadx1nanogen2.rmtau.csb (unknown [10.64.136.5]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 44E731800451; Wed, 5 Nov 2025 11:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762343193; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wQPNfR7Z4o5b8yAIQSrssT0KUFwVLUHnqa1jRtT1UKQ=; b=FJTnqshC3VNZM42DpFvCSJgS6KC7i0Hp0do1u3QPYksoalPrLEurMMHgO55/wPrcGF5gCa ECpIGKphEA5LlViT1qSk1s+QYBTuw6G8WlaaVEFLKoOEfoee1b8ZBzRHsNZWO2YTZCWg9B CqSn6SAQfGyttUwXwjnGTH2Xs3SUV2E= X-MC-Unique: eftmmyP2MVSDDMjpvt79Bg-1 X-Mimecast-MFC-AGG-ID: eftmmyP2MVSDDMjpvt79Bg_1762343187 From: Gavin Shan To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, jonathan.cameron@huawei.com, mchehab+huawei@kernel.org, gengdongjiu1@gmail.com, mst@redhat.com, imammedo@redhat.com, anisinha@redhat.com, peter.maydell@linaro.org, pbonzini@redhat.com, shan.gavin@gmail.com Subject: [PATCH v3 4/8] acpi/ghes: Extend acpi_ghes_memory_errors() to support multiple CPERs Date: Wed, 5 Nov 2025 21:44:49 +1000 Message-ID: <20251105114453.2164073-5-gshan@redhat.com> In-Reply-To: <20251105114453.2164073-1-gshan@redhat.com> References: <20251105114453.2164073-1-gshan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.133.124; envelope-from=gshan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.517, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1762343333215158500 Content-Type: text/plain; charset="utf-8" In the situation where host and guest has 64KiB and 4KiB page sizes, one problematic host page affects 16 guest pages. we need to send 16 consective errors in this specific case. Extend acpi_ghes_memory_errors() to support multiple CPERs after the hunk of code to generate the GHES error status is pulled out from ghes_gen_err_data_uncorrectable_recoverable(). The status field of generic error status block is also updated accordingly if multiple error data entries are contained in the generic error status block. Signed-off-by: Gavin Shan --- hw/acpi/ghes-stub.c | 2 +- hw/acpi/ghes.c | 60 +++++++++++++++++++++++------------------- include/hw/acpi/ghes.h | 2 +- target/arm/kvm.c | 4 ++- 4 files changed, 38 insertions(+), 30 deletions(-) diff --git a/hw/acpi/ghes-stub.c b/hw/acpi/ghes-stub.c index 40f660c246..4faf573aeb 100644 --- a/hw/acpi/ghes-stub.c +++ b/hw/acpi/ghes-stub.c @@ -12,7 +12,7 @@ #include "hw/acpi/ghes.h" =20 int acpi_ghes_memory_errors(AcpiGhesState *ags, uint16_t source_id, - uint64_t physical_address) + uint64_t *addresses, uint32_t num_of_addresses) { return -1; } diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index a9c08e73c0..527b85c8d8 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -57,8 +57,12 @@ /* The memory section CPER size, UEFI 2.6: N.2.5 Memory Error Section */ #define ACPI_GHES_MEM_CPER_LENGTH 80 =20 -/* Masks for block_status flags */ -#define ACPI_GEBS_UNCORRECTABLE 1 +/* Bits for block_status flags */ +#define ACPI_GEBS_UNCORRECTABLE 0 +#define ACPI_GEBS_CORRECTABLE 1 +#define ACPI_GEBS_MULTIPLE_UNCORRECTABLE 2 +#define ACPI_GEBS_MULTIPLE_CORRECTABLE 3 +#define ACPI_GEBS_ERROR_DATA_ENTRIES 4 =20 /* * Total size for Generic Error Status Block except Generic Error Data Ent= ries @@ -212,26 +216,6 @@ static void acpi_ghes_build_append_mem_cper(GArray *ta= ble, build_append_int_noprefix(table, 0, 7); } =20 -static void -ghes_gen_err_data_uncorrectable_recoverable(GArray *block, - const uint8_t *section_type, - int data_length) -{ - /* 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 {}; - - /* 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); - - /* Build this new generic error data entry header */ - acpi_ghes_generic_error_data(block, section_type, - ACPI_CPER_SEV_RECOVERABLE, 0, 0, - ACPI_GHES_MEM_CPER_LENGTH, fru_id, 0); -} - /* * Build table for the hardware error fw_cfg blob. * Initialize "etc/hardware_errors" and "etc/hardware_errors_addr" fw_cfg = blobs. @@ -557,19 +541,26 @@ void ghes_record_cper_errors(AcpiGhesState *ags, cons= t void *cper, size_t len, } =20 int acpi_ghes_memory_errors(AcpiGhesState *ags, uint16_t source_id, - uint64_t physical_address) + uint64_t *addresses, uint32_t num_of_addresses) { /* Memory Error Section Type */ const uint8_t guid[] =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 {}; Error *errp =3D NULL; int data_length; GArray *block; + uint32_t block_status, i; =20 block =3D g_array_new(false, true /* clear */, 1); =20 - data_length =3D ACPI_GHES_DATA_LENGTH + ACPI_GHES_MEM_CPER_LENGTH; + data_length =3D num_of_addresses * + (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 @@ -577,10 +568,25 @@ int acpi_ghes_memory_errors(AcpiGhesState *ags, uint1= 6_t source_id, assert((data_length + ACPI_GHES_GESB_SIZE) <=3D ACPI_GHES_MAX_RAW_DATA_LENGTH); =20 - ghes_gen_err_data_uncorrectable_recoverable(block, guid, data_length); + /* Build the new generic error status block header */ + block_status =3D (1 << ACPI_GEBS_UNCORRECTABLE) | + (num_of_addresses << ACPI_GEBS_ERROR_DATA_ENTRIES); + if (num_of_addresses > 1) { + block_status |=3D ACPI_GEBS_MULTIPLE_UNCORRECTABLE; + } + + acpi_ghes_generic_error_status(block, block_status, 0, 0, + data_length, ACPI_CPER_SEV_RECOVERABLE); =20 - /* Build the memory section CPER for above new generic error data entr= y */ - acpi_ghes_build_append_mem_cper(block, physical_address); + for (i =3D 0; i < num_of_addresses; i++) { + /* Build generic error data entries */ + acpi_ghes_generic_error_data(block, guid, + ACPI_CPER_SEV_RECOVERABLE, 0, 0, + ACPI_GHES_MEM_CPER_LENGTH, fru_id, 0); + + /* Memory section CPER on top of the generic error data entry */ + acpi_ghes_build_append_mem_cper(block, addresses[i]); + } =20 /* Report the error */ ghes_record_cper_errors(ags, block->data, block->len, source_id, &errp= ); diff --git a/include/hw/acpi/ghes.h b/include/hw/acpi/ghes.h index df2ecbf6e4..f73908985d 100644 --- a/include/hw/acpi/ghes.h +++ b/include/hw/acpi/ghes.h @@ -99,7 +99,7 @@ void acpi_build_hest(AcpiGhesState *ags, GArray *table_da= ta, void acpi_ghes_add_fw_cfg(AcpiGhesState *vms, FWCfgState *s, GArray *hardware_errors); int acpi_ghes_memory_errors(AcpiGhesState *ags, uint16_t source_id, - uint64_t error_physical_addr); + uint64_t *addresses, uint32_t num_of_addresses= ); void ghes_record_cper_errors(AcpiGhesState *ags, const void *cper, size_t = len, uint16_t source_id, Error **errp); =20 diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 0d57081e69..459ca4a9b0 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -2434,6 +2434,7 @@ void kvm_arch_on_sigbus_vcpu(CPUState *c, int code, v= oid *addr) ram_addr_t ram_addr; hwaddr paddr; AcpiGhesState *ags; + uint64_t addresses[16]; =20 assert(code =3D=3D BUS_MCEERR_AR || code =3D=3D BUS_MCEERR_AO); =20 @@ -2454,10 +2455,11 @@ void kvm_arch_on_sigbus_vcpu(CPUState *c, int code,= void *addr) * later from the main thread, so doing the injection of * the error would be more complicated. */ + addresses[0] =3D paddr; if (code =3D=3D BUS_MCEERR_AR) { kvm_cpu_synchronize_state(c); if (!acpi_ghes_memory_errors(ags, ACPI_HEST_SRC_ID_SYNC, - paddr)) { + addresses, 1)) { kvm_inject_arm_sea(c); } else { error_report("failed to record the error"); --=20 2.51.0 From nobody Fri Nov 14 15:21:56 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1762343324; cv=none; d=zohomail.com; s=zohoarc; b=XJp58NxyYocOdWFWGRTakag0ZU4TjoUSzEYJjX2NSYgyxfim4Z9LfbwphIWbNwPYftOEeUzS8W1EOkQaSlMJQe0L42L7OptQ/cIjXE2YMW+yqF9NkzNmPGY8BpBqwaA6pDIcLcE4+R8pGx37ilXBnxEmNdOEp7BG7x0X8OHor5o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762343324; h=Content-Type: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=vaAaP1W1mqUaZG5PCtjNhroyXMv30+g98uX5rmpOrV0=; b=eSQ6ujis7BV/+wOpWAVRhBkMdXJugpS5HxJz8F4mnXJrZcZk+lW5A5sHZu+xmQxjJu7bIxI+e3GbTsjyaIzUne9SLC+dhnbcX0S8SSHsH27GUKGuFr8AAoaItEfmXaaA1FznBbD6rwBcOBGK0nxaCDeJm7iBc/usPDON70VnxBE= 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 1762343324206999.5105832512836; Wed, 5 Nov 2025 03:48:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vGbyq-0006Fe-FM; Wed, 05 Nov 2025 06:47:13 -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 1vGbyM-0005qQ-9V for qemu-devel@nongnu.org; Wed, 05 Nov 2025 06:46:46 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vGbyI-0003Gp-DL for qemu-devel@nongnu.org; Wed, 05 Nov 2025 06:46:40 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-577-5zXy3BC_N_qrfwirtoMu5Q-1; Wed, 05 Nov 2025 06:46:33 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 35D0F1800343; Wed, 5 Nov 2025 11:46:32 +0000 (UTC) Received: from gshan-thinkpadx1nanogen2.rmtau.csb (unknown [10.64.136.5]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7BFB11800451; Wed, 5 Nov 2025 11:46:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762343197; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vaAaP1W1mqUaZG5PCtjNhroyXMv30+g98uX5rmpOrV0=; b=F1QyWidMdqqKRvz2BGdNxuEUDzT6VFB1rK90CCdMpbboY2doR0UoAnLO6TQQYnCk89wsO/ NaRW2YehfO/kWecvXOgmN8LinWIofK0vAttlRO8a7b8p8HLTVqYNoIjIkz1HJUQfsyjlQy v9iNa7Pxa4W9pTF7E+Yi1/D1YVcptuc= X-MC-Unique: 5zXy3BC_N_qrfwirtoMu5Q-1 X-Mimecast-MFC-AGG-ID: 5zXy3BC_N_qrfwirtoMu5Q_1762343192 From: Gavin Shan To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, jonathan.cameron@huawei.com, mchehab+huawei@kernel.org, gengdongjiu1@gmail.com, mst@redhat.com, imammedo@redhat.com, anisinha@redhat.com, peter.maydell@linaro.org, pbonzini@redhat.com, shan.gavin@gmail.com Subject: [PATCH v3 5/8] acpi/ghes: Bail early on error from get_ghes_source_offsets() Date: Wed, 5 Nov 2025 21:44:50 +1000 Message-ID: <20251105114453.2164073-6-gshan@redhat.com> In-Reply-To: <20251105114453.2164073-1-gshan@redhat.com> References: <20251105114453.2164073-1-gshan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.129.124; envelope-from=gshan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.517, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1762343336774158500 Content-Type: text/plain; charset="utf-8" For one particular error (Error), we can't call error_setg() for twice. Otherwise, the assert(*errp =3D=3D NULL) will be triggered unexpectedly in error_setv(). In ghes_record_cper_errors(), get_ghes_source_offsets() can return a error initialized by error_setg(). Without bailing on this error, it can call into the second error_setg() due to the unexpected value from the read acknowledgement register. Bail early in ghes_record_cper_errors() when error is received from get_ghes_source_offsets() to avoid the exception. Signed-off-by: Gavin Shan Reviewed-by: Igor Mammedov Reviewed-by: Jonathan Cameron --- hw/acpi/ghes.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index 527b85c8d8..055e5d719a 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -513,6 +513,9 @@ void ghes_record_cper_errors(AcpiGhesState *ags, const = void *cper, size_t len, } else { get_ghes_source_offsets(source_id, le64_to_cpu(ags->hest_addr_le), &cper_addr, &read_ack_register_addr, errp); + if (*errp) { + return; + } } =20 cpu_physical_memory_read(read_ack_register_addr, --=20 2.51.0 From nobody Fri Nov 14 15:21:56 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1762343320; cv=none; d=zohomail.com; s=zohoarc; b=jnE5spzjjWsjJOW8bhGHwtAI9UJJOd5etNFJI03Iv4hWH/0JxRuqCAk4LP63wAdCFi8oSwXme5DgTqobwgiPHqTM9Jx3FEG9kfR7oLrBC/20r5PXtJ/7pYRQ531l0zEOC8ZOF1GE7kYqBgr3W9WVPPtKp7MeNXpHBu9atn4LIJ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762343320; h=Content-Type: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=ZU3GkXmIIfHWZ3UrydTfdU7hH9glzdRJ1Io68IszhhE=; b=jyiRCcVIKOnPPxDxPnbDrtzckIb03i1/DUb11nkSl2czzp9N977eOuKlbTcxBkv/e0aZp/plUXcII2W55hVwSjtz7Xwep1RDzgkov5Essy0BXyPpyr0m2n19+89gDOSiJKOJpd8UPUMHZlKNb/mnJ8FQz9pCD6p32cu8kpIO510= 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 1762343320173428.80367217815467; Wed, 5 Nov 2025 03:48:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vGbyx-0006N5-FT; Wed, 05 Nov 2025 06:47:19 -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 1vGbyV-0005vQ-TK for qemu-devel@nongnu.org; Wed, 05 Nov 2025 06:46:52 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vGbyR-0003aK-UH for qemu-devel@nongnu.org; Wed, 05 Nov 2025 06:46:51 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-627-U05nP2xtOl6WvjFiMp8Etw-1; Wed, 05 Nov 2025 06:46:39 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 253A81800250; Wed, 5 Nov 2025 11:46:38 +0000 (UTC) Received: from gshan-thinkpadx1nanogen2.rmtau.csb (unknown [10.64.136.5]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 037C71800451; Wed, 5 Nov 2025 11:46:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762343204; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZU3GkXmIIfHWZ3UrydTfdU7hH9glzdRJ1Io68IszhhE=; b=O0/mxegBOnL8w/HK1d/OPQ6x8Qe0XfshAHPFUCJDGfx2NdxaypN6K6Q0ZdcyRwI3rOzE3Z KJoNcq47eSaLRAYW7pNiOlzTzzhnCDzU5g4mIsiz+5yLXl2+/TukxmfmrwGq0aJnfjNya7 QzJVka9SgaHocekernkyxMgAKpwz33o= X-MC-Unique: U05nP2xtOl6WvjFiMp8Etw-1 X-Mimecast-MFC-AGG-ID: U05nP2xtOl6WvjFiMp8Etw_1762343198 From: Gavin Shan To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, jonathan.cameron@huawei.com, mchehab+huawei@kernel.org, gengdongjiu1@gmail.com, mst@redhat.com, imammedo@redhat.com, anisinha@redhat.com, peter.maydell@linaro.org, pbonzini@redhat.com, shan.gavin@gmail.com Subject: [PATCH v3 6/8] acpi/ghes: Use error_abort in acpi_ghes_memory_errors() Date: Wed, 5 Nov 2025 21:44:51 +1000 Message-ID: <20251105114453.2164073-7-gshan@redhat.com> In-Reply-To: <20251105114453.2164073-1-gshan@redhat.com> References: <20251105114453.2164073-1-gshan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.129.124; envelope-from=gshan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.517, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1762343321891154100 Content-Type: text/plain; charset="utf-8" Use error_abort in acpi_ghes_memory_errors() so that the caller needn't explicitly call abort() on errors. With this change, its return value isn't needed any more. Suggested-by: Igor Mammedov Signed-off-by: Gavin Shan Reviewed-by: Igor Mammedov Reviewed-by: Jonathan Cameron --- hw/acpi/ghes-stub.c | 6 +++--- hw/acpi/ghes.c | 15 ++++----------- include/hw/acpi/ghes.h | 5 +++-- target/arm/kvm.c | 10 +++------- 4 files changed, 13 insertions(+), 23 deletions(-) diff --git a/hw/acpi/ghes-stub.c b/hw/acpi/ghes-stub.c index 4faf573aeb..4ef914ffc5 100644 --- a/hw/acpi/ghes-stub.c +++ b/hw/acpi/ghes-stub.c @@ -11,10 +11,10 @@ #include "qemu/osdep.h" #include "hw/acpi/ghes.h" =20 -int acpi_ghes_memory_errors(AcpiGhesState *ags, uint16_t source_id, - uint64_t *addresses, uint32_t num_of_addresses) +void acpi_ghes_memory_errors(AcpiGhesState *ags, uint16_t source_id, + uint64_t *addresses, uint32_t num_of_addresse= s, + Error **errp) { - return -1; } =20 AcpiGhesState *acpi_ghes_get_state(void) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index 055e5d719a..aa469c03f2 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -543,8 +543,9 @@ void ghes_record_cper_errors(AcpiGhesState *ags, const = void *cper, size_t len, notifier_list_notify(&acpi_generic_error_notifiers, &source_id); } =20 -int acpi_ghes_memory_errors(AcpiGhesState *ags, uint16_t source_id, - uint64_t *addresses, uint32_t num_of_addresses) +void acpi_ghes_memory_errors(AcpiGhesState *ags, uint16_t source_id, + uint64_t *addresses, uint32_t num_of_addresse= s, + Error **errp) { /* Memory Error Section Type */ const uint8_t guid[] =3D @@ -555,7 +556,6 @@ int acpi_ghes_memory_errors(AcpiGhesState *ags, uint16_= t source_id, * Table 17-13 Generic Error Data Entry */ QemuUUID fru_id =3D {}; - Error *errp =3D NULL; int data_length; GArray *block; uint32_t block_status, i; @@ -592,16 +592,9 @@ int acpi_ghes_memory_errors(AcpiGhesState *ags, uint16= _t source_id, } =20 /* Report the error */ - ghes_record_cper_errors(ags, block->data, block->len, source_id, &errp= ); + ghes_record_cper_errors(ags, block->data, block->len, source_id, errp); =20 g_array_free(block, true); - - if (errp) { - error_report_err(errp); - return -1; - } - - return 0; } =20 AcpiGhesState *acpi_ghes_get_state(void) diff --git a/include/hw/acpi/ghes.h b/include/hw/acpi/ghes.h index f73908985d..35c7bbbb01 100644 --- a/include/hw/acpi/ghes.h +++ b/include/hw/acpi/ghes.h @@ -98,8 +98,9 @@ void acpi_build_hest(AcpiGhesState *ags, GArray *table_da= ta, 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(AcpiGhesState *ags, uint16_t source_id, - uint64_t *addresses, uint32_t num_of_addresses= ); +void acpi_ghes_memory_errors(AcpiGhesState *ags, uint16_t source_id, + uint64_t *addresses, uint32_t num_of_addresse= s, + Error **errp); void ghes_record_cper_errors(AcpiGhesState *ags, const void *cper, size_t = len, uint16_t source_id, Error **errp); =20 diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 459ca4a9b0..a889315606 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -2458,13 +2458,9 @@ void kvm_arch_on_sigbus_vcpu(CPUState *c, int code, = void *addr) addresses[0] =3D paddr; if (code =3D=3D BUS_MCEERR_AR) { kvm_cpu_synchronize_state(c); - if (!acpi_ghes_memory_errors(ags, ACPI_HEST_SRC_ID_SYNC, - addresses, 1)) { - kvm_inject_arm_sea(c); - } else { - error_report("failed to record the error"); - abort(); - } + acpi_ghes_memory_errors(ags, ACPI_HEST_SRC_ID_SYNC, + addresses, 1, &error_abort); + kvm_inject_arm_sea(c); } return; } --=20 2.51.0 From nobody Fri Nov 14 15:21:56 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1762343282; cv=none; d=zohomail.com; s=zohoarc; b=c909d8qiY6w0Xa9Y6opKu2sNpOkqxWynbw+L+e7D2djvxRHVIMPpLKRwxrmUTgOaUtI68dCxIH642u063ZovmJCXnWQi/VGMw9JpuekG6iRcwGKPUAg4XNixUGcqFTbn6UrQ3X34zm2QlAgrrEYImgmdavvkM+t9iLWrrapOGHY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762343282; h=Content-Type: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=TdPL9uIhQICvUXMZRqohjzNZ3rdqxelbqFx+NwG8wN8=; b=UxNFp4BTBbNhGticBwvc2XcuBEuIrCl4EsdLkvq/J9OBnR2ddEq1wCI/wpA0qoM3H82o+ygYzynnxSXYui53AEqvjqL2xXuj6vxulWx7Mb93Lr1w7oL0f53rfRkbstdyVdh/cMuXpFYQCn4kvnvsu03ki0yuKPNrg1LzMaSYHAg= 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 1762343282231668.5013635194358; Wed, 5 Nov 2025 03:48:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vGbzF-0006cT-RU; Wed, 05 Nov 2025 06:47:38 -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 1vGbyU-0005tY-JD for qemu-devel@nongnu.org; Wed, 05 Nov 2025 06:46:50 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vGbyR-0003fB-Ty for qemu-devel@nongnu.org; Wed, 05 Nov 2025 06:46:50 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-383-6tyzGIASN9qWIGWNLaxHXw-1; Wed, 05 Nov 2025 06:46:45 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 031FE1956089; Wed, 5 Nov 2025 11:46:44 +0000 (UTC) Received: from gshan-thinkpadx1nanogen2.rmtau.csb (unknown [10.64.136.5]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CFED41800451; Wed, 5 Nov 2025 11:46:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762343206; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TdPL9uIhQICvUXMZRqohjzNZ3rdqxelbqFx+NwG8wN8=; b=gKccsWvhSVyKUeAQ8VlLZxS2WEWlnMt9RVo4CefwD0rxoTMp/UhVTiGT+8h/0ZBTOv6cTv 7cyqbmL0vsIfpAfpOhg+mDr7eP56fPnrdHqf/RiSKhHdHwHxN5WGSH3pTB4ba3bFLBEcCt gtTwjND6j468Wb+ZEibfBISpRRJaH6c= X-MC-Unique: 6tyzGIASN9qWIGWNLaxHXw-1 X-Mimecast-MFC-AGG-ID: 6tyzGIASN9qWIGWNLaxHXw_1762343204 From: Gavin Shan To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, jonathan.cameron@huawei.com, mchehab+huawei@kernel.org, gengdongjiu1@gmail.com, mst@redhat.com, imammedo@redhat.com, anisinha@redhat.com, peter.maydell@linaro.org, pbonzini@redhat.com, shan.gavin@gmail.com Subject: [PATCH v3 7/8] kvm/arm/kvm: Introduce helper push_ghes_memory_errors() Date: Wed, 5 Nov 2025 21:44:52 +1000 Message-ID: <20251105114453.2164073-8-gshan@redhat.com> In-Reply-To: <20251105114453.2164073-1-gshan@redhat.com> References: <20251105114453.2164073-1-gshan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.129.124; envelope-from=gshan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.517, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1762343283809154100 Content-Type: text/plain; charset="utf-8" Introduce helper push_ghes_memory_errors(), which sends ACPI GHES memory errors and injects SEA exception. With this, we can add more logics to the function to support multiple ACPI GHES memory errors in the next path. No functional changes intended. Signed-off-by: Gavin Shan Reviewed-by: Jonathan Cameron --- target/arm/kvm.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/target/arm/kvm.c b/target/arm/kvm.c index a889315606..5b151eda3c 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -2429,12 +2429,23 @@ int kvm_arch_get_registers(CPUState *cs, Error **er= rp) return ret; } =20 +static void push_ghes_memory_errors(CPUState *c, AcpiGhesState *ags, + uint64_t paddr, Error **errp) +{ + uint64_t addresses[16]; + + addresses[0] =3D paddr; + + kvm_cpu_synchronize_state(c); + acpi_ghes_memory_errors(ags, ACPI_HEST_SRC_ID_SYNC, addresses, 1, errp= ); + kvm_inject_arm_sea(c); +} + void kvm_arch_on_sigbus_vcpu(CPUState *c, int code, void *addr) { ram_addr_t ram_addr; hwaddr paddr; AcpiGhesState *ags; - uint64_t addresses[16]; =20 assert(code =3D=3D BUS_MCEERR_AR || code =3D=3D BUS_MCEERR_AO); =20 @@ -2455,12 +2466,8 @@ void kvm_arch_on_sigbus_vcpu(CPUState *c, int code, = void *addr) * later from the main thread, so doing the injection of * the error would be more complicated. */ - addresses[0] =3D paddr; if (code =3D=3D BUS_MCEERR_AR) { - kvm_cpu_synchronize_state(c); - acpi_ghes_memory_errors(ags, ACPI_HEST_SRC_ID_SYNC, - addresses, 1, &error_abort); - kvm_inject_arm_sea(c); + push_ghes_memory_errors(c, ags, paddr, &error_abort); } return; } --=20 2.51.0 From nobody Fri Nov 14 15:21:56 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1762343360; cv=none; d=zohomail.com; s=zohoarc; b=dvdNlYECiIpzhGcnbTHFyrL5yoxA162zOd4TGLv4KNk/VSfknETHBTECS87ObzFDg0a/a+gCKvcpu++gkExJ+t3UQc0XNwWpYQBokt9QLM+KynYb55qsNKFMIc2YvUFRmoa75sqpgvf/g5wyt9SOS017d40Cmvlig1WtuM9r7vM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762343360; h=Content-Type: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=29LUfHiShuavtJENtMDfqPVZdMKOAjQ5KT9Nqx8YzVU=; b=CprX7O2T0zvhHJwltErxksEsT4ZHQ9lTPBOSn1PQUPviOKxHIodyaxKz4+l96B2YdP4fnm0cFtiEqVJeO6MyfLoUjYRD8srioP9jB0mWekQtBEiGgROOT8xFw68xWf50iTNaBY6zqld50GdrvuGFql0mj/jJShNpD6pYZoAsumU= 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 1762343360259330.9659334864082; Wed, 5 Nov 2025 03:49:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vGbzL-0006wP-8F; Wed, 05 Nov 2025 06:47:44 -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 1vGbyb-00064u-Tf for qemu-devel@nongnu.org; Wed, 05 Nov 2025 06:47:01 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vGbyZ-00047C-AI for qemu-devel@nongnu.org; Wed, 05 Nov 2025 06:46:56 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-53-JHugRRm5P_qQes0t7qSjWg-1; Wed, 05 Nov 2025 06:46:51 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B2A1719560B7; Wed, 5 Nov 2025 11:46:49 +0000 (UTC) Received: from gshan-thinkpadx1nanogen2.rmtau.csb (unknown [10.64.136.5]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A8B641800451; Wed, 5 Nov 2025 11:46:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762343214; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=29LUfHiShuavtJENtMDfqPVZdMKOAjQ5KT9Nqx8YzVU=; b=YipcYHaeo9WYTBPl7dXxGvjcaYifYogXoWg4ySbiMkFxIqRYQk44kC95V9AeeeEthFFy5O JuOq/cv9RLjW/NdxOJDWswucUziWZiPifNPZxGp5Fjzew0FX99La+Qar8gHwfrWrtBXRC+ sR9k13Cl8yf3x+Soq7QhdkYzEbyt6RY= X-MC-Unique: JHugRRm5P_qQes0t7qSjWg-1 X-Mimecast-MFC-AGG-ID: JHugRRm5P_qQes0t7qSjWg_1762343209 From: Gavin Shan To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, jonathan.cameron@huawei.com, mchehab+huawei@kernel.org, gengdongjiu1@gmail.com, mst@redhat.com, imammedo@redhat.com, anisinha@redhat.com, peter.maydell@linaro.org, pbonzini@redhat.com, shan.gavin@gmail.com Subject: [PATCH v3 8/8] target/arm/kvm: Support multiple memory CPERs injection Date: Wed, 5 Nov 2025 21:44:53 +1000 Message-ID: <20251105114453.2164073-9-gshan@redhat.com> In-Reply-To: <20251105114453.2164073-1-gshan@redhat.com> References: <20251105114453.2164073-1-gshan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.129.124; envelope-from=gshan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.517, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1762343362171154100 Content-Type: text/plain; charset="utf-8" In the combination of 64KiB host and 4KiB guest, a problematic host page affects 16x guest pages that can be owned by different threads. It means 16x memory errors can be raised at once due to the parallel accesses to those 16x guest pages on the guest. Unfortunately, QEMU can't deliver them one by one because we just one GHES error block, corresponding one read acknowledgement register. It can eventually cause QEMU crash dump due to the contention on that register, meaning the current memory error can't be delivered before the previous error isn't acknowledged. Imporve push_ghes_memory_errors() to push 16x consecutive memory errors under this situation to avoid the contention on the read acknowledgement register. Signed-off-by: Gavin Shan --- target/arm/kvm.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 5b151eda3c..d7de8262da 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -11,6 +11,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/units.h" #include =20 #include @@ -2432,12 +2433,59 @@ int kvm_arch_get_registers(CPUState *cs, Error **er= rp) static void push_ghes_memory_errors(CPUState *c, AcpiGhesState *ags, uint64_t paddr, Error **errp) { + uint64_t val, start, end, guest_pgsz, host_pgsz; uint64_t addresses[16]; + uint32_t num_of_addresses; + int ret; + + /* + * Sort out the guest page size from TCR_EL1, which can be modified + * by the guest from time to time. So we have to sort it out dynamical= ly. + */ + ret =3D read_sys_reg64(c->kvm_fd, &val, ARM64_SYS_REG(3, 0, 2, 0, 2)); + if (ret) { + error_setg(errp, "Error %" PRId32 " to read TCR_EL1 register", ret= ); + return; + } + + switch (extract64(val, 14, 2)) { + case 0: + guest_pgsz =3D 4 * KiB; + break; + case 1: + guest_pgsz =3D 64 * KiB; + break; + case 2: + guest_pgsz =3D 16 * KiB; + break; + default: + error_setg(errp, "Unknown page size from TCR_EL1 (0x%" PRIx64 ")",= val); + return; + } + + host_pgsz =3D qemu_real_host_page_size(); + start =3D paddr & ~(host_pgsz - 1); + end =3D start + host_pgsz; + num_of_addresses =3D 0; =20 - addresses[0] =3D paddr; + while (start < end) { + /* + * The precise physical address is provided for the affected + * guest page that contains @paddr. Otherwise, the starting + * address of the guest page is provided. + */ + if (paddr >=3D start && paddr < (start + guest_pgsz)) { + addresses[num_of_addresses++] =3D paddr; + } else { + addresses[num_of_addresses++] =3D start; + } + + start +=3D guest_pgsz; + } =20 kvm_cpu_synchronize_state(c); - acpi_ghes_memory_errors(ags, ACPI_HEST_SRC_ID_SYNC, addresses, 1, errp= ); + acpi_ghes_memory_errors(ags, ACPI_HEST_SRC_ID_SYNC, + addresses, num_of_addresses, errp); kvm_inject_arm_sea(c); } =20 --=20 2.51.0