From nobody Mon Feb 9 09:11:25 2026 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=1764599834; cv=none; d=zohomail.com; s=zohoarc; b=EDLio0TL2xjlIbqpiYMyWAFVMdnrMGVyDVP3Ezm/M+lYL4GfisXvM4FCWqlgXwC2eQn0aI9Vm3lPlUdTBQdB/FV+tzf1D/LWYjQlRnHYFgxCW6n0XQnMuIKR4FUeMaYaezxkdR1Ca/FB0sgJyftg4jxJ0SOv4r/VD6td1gF7JNg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764599834; 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=a9aoFy3Yg4lbh+by5lZ+UhEryQqCrrXjwP0LjVujXcA=; b=Tv07SSvoxAS9X39lCgq+bJQ/335kkdeXaKkfi7tY7Hm0oZzB83F227GGjwF+o6v3HdwUZSQJdbFFqYAIa+FgVvC5q7eDgqPBbym22FNaU9160rO4vcR5Gii1wwoLM1slIaP25YWN+KMxTZwpgqrjfa5hG1cGo5PIihHiQAz+I5A= 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 1764599834492128.12988700136373; Mon, 1 Dec 2025 06:37:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vQ4kC-0008M1-OV; Mon, 01 Dec 2025 09:19:12 -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 1vQ4jn-0008Ax-Jz for qemu-devel@nongnu.org; Mon, 01 Dec 2025 09:18:50 -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 1vQ4jl-0008I4-8g for qemu-devel@nongnu.org; Mon, 01 Dec 2025 09:18:46 -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-650-sNMmjBkpOvavgPq5dJGPDA-1; Mon, 01 Dec 2025 09:18:41 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 9B83119560B0; Mon, 1 Dec 2025 14:18:39 +0000 (UTC) Received: from gshan-thinkpadx1nanogen2.rmtau.csb (unknown [10.64.136.76]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DAD67195608E; Mon, 1 Dec 2025 14:18:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1764598724; 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=a9aoFy3Yg4lbh+by5lZ+UhEryQqCrrXjwP0LjVujXcA=; b=NhOU6PI7yC8R9woHvtuhPINy1cl4wVtigQjSC3+3RUm3cF8LrV4HBdNfnAuNTDYqDWfAZa l0aiQa282aZsRNZ0N9XsF9sdWXVOCNvYrkS3pNd6hVE+7o1M1USW97coJHuMM/lVb/iUzC iTq5P3vJ4ZLFyvauH7ig0NJKOC1sAGI= X-MC-Unique: sNMmjBkpOvavgPq5dJGPDA-1 X-Mimecast-MFC-AGG-ID: sNMmjBkpOvavgPq5dJGPDA_1764598719 From: Gavin Shan To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, mst@redhat.com, jonathan.cameron@huawei.com, mchehab+huawei@kernel.org, imammedo@redhat.com, armbru@redhat.com, anisinha@redhat.com, gengdongjiu1@gmail.com, peter.maydell@linaro.org, pbonzini@redhat.com, shan.gavin@gmail.com Subject: [PATCH v2 1/5] acpi/ghes: Automate data block cleanup in acpi_ghes_memory_errors() Date: Tue, 2 Dec 2025 00:17:59 +1000 Message-ID: <20251201141803.2386129-2-gshan@redhat.com> In-Reply-To: <20251201141803.2386129-1-gshan@redhat.com> References: <20251201141803.2386129-1-gshan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1764599836562019200 Content-Type: text/plain; charset="utf-8" Use g_auto_ptr() to automate data block cleanup in the function so that it won't be a burden to us. Suggested-by: Markus Armbruster Signed-off-by: Gavin Shan Reviewed-by: Markus Armbruster Reviewed-by: Igor Mammedov Reviewed-by: Mauro Carvalho Chehab --- hw/acpi/ghes.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index 06555905ce..6366c74248 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -565,9 +565,7 @@ int acpi_ghes_memory_errors(AcpiGhesState *ags, uint16_= t source_id, 0xED, 0x7C, 0x83, 0xB1); Error *errp =3D NULL; int data_length; - GArray *block; - - block =3D g_array_new(false, true /* clear */, 1); + g_autoptr(GArray) block =3D g_array_new(false, true /* clear */, 1); =20 data_length =3D ACPI_GHES_DATA_LENGTH + ACPI_GHES_MEM_CPER_LENGTH; /* @@ -585,8 +583,6 @@ int acpi_ghes_memory_errors(AcpiGhesState *ags, uint16_= t source_id, /* Report the error */ 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; --=20 2.51.1 From nobody Mon Feb 9 09:11:25 2026 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=1764603386; cv=none; d=zohomail.com; s=zohoarc; b=VMFJbjpjnNP721D+TweYoP88Q/yhqM4ERXI8WaPVTEWen0nQsj+ICRCu17qKAfrat01z85TVu7xvm/fa8xXEEaK9fJtdsU9Ccuh/iDI5B5+eOYPQp52BC9kKnICc4Oylhd5xhYfQ+5B6/Bj7zfl9ubVx8tkgarHnK4fdVFwkpXk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764603386; 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=hFTrMQc5IxJJ3/jIi048eNx7CAwoEJpAp9GF73Up+MQ=; b=mk3M7wZwYOPH1so2sM0n63BInC+OLNuLdcXNo4DjCLNDdt+fUpIEWOhiFtkfJbNPYKORwG20wC6eWxFA0uQAYHNsik1xwNq79sEH/Yvp06chtFhJHqYQpPFiTICbaBZyeSlmf6dw9AIgM/ZvRi2NPeXnlduROndAUU61TB0MPDw= 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 1764603386511736.7782313441004; Mon, 1 Dec 2025 07:36:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vQ4k8-0008Ft-BE; Mon, 01 Dec 2025 09:19:08 -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 1vQ4jq-0008BE-Sn for qemu-devel@nongnu.org; Mon, 01 Dec 2025 09:18:50 -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 1vQ4jp-0008Ie-Ll for qemu-devel@nongnu.org; Mon, 01 Dec 2025 09:18:50 -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-354-8uBxEuYuPNOVu8sTGUCZAg-1; Mon, 01 Dec 2025 09:18:47 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 F02901955E74; Mon, 1 Dec 2025 14:18:45 +0000 (UTC) Received: from gshan-thinkpadx1nanogen2.rmtau.csb (unknown [10.64.136.76]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 697561956095; Mon, 1 Dec 2025 14:18:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1764598729; 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=hFTrMQc5IxJJ3/jIi048eNx7CAwoEJpAp9GF73Up+MQ=; b=C1UImXeBiRJJEGI0S9Q5rImdQ0uDNcFDsq1Zy97ca/qOjEgNdTf7l67ol0hFW0cA7sw7yN ykJtdYQqKtBIuuhtg3a06iuKjnkrP5zMGPfEULtwo244NtJ8MZ0YnVyCAuNh26gM+CvTZv yGdL7kvBcnpUrF1motDTk3hTUGBS3cI= X-MC-Unique: 8uBxEuYuPNOVu8sTGUCZAg-1 X-Mimecast-MFC-AGG-ID: 8uBxEuYuPNOVu8sTGUCZAg_1764598726 From: Gavin Shan To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, mst@redhat.com, jonathan.cameron@huawei.com, mchehab+huawei@kernel.org, imammedo@redhat.com, armbru@redhat.com, anisinha@redhat.com, gengdongjiu1@gmail.com, peter.maydell@linaro.org, pbonzini@redhat.com, shan.gavin@gmail.com Subject: [PATCH v2 2/5] acpi/ghes: Abort in acpi_ghes_memory_errors() if necessary Date: Tue, 2 Dec 2025 00:18:00 +1000 Message-ID: <20251201141803.2386129-3-gshan@redhat.com> In-Reply-To: <20251201141803.2386129-1-gshan@redhat.com> References: <20251201141803.2386129-1-gshan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1764603387061019201 Content-Type: text/plain; charset="utf-8" The function hw/acpi/ghes-stub.c::acpi_ghes_memory_errors() shouldn't be called by any one. Take g_assert_not_reached() as a clearer indication. Suggested-by: Markus Armbruster Signed-off-by: Gavin Shan Reviewed-by: Igor Mammedov Reviewed-by: Mauro Carvalho Chehab --- hw/acpi/ghes-stub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/acpi/ghes-stub.c b/hw/acpi/ghes-stub.c index 40f660c246..b54f1b093c 100644 --- a/hw/acpi/ghes-stub.c +++ b/hw/acpi/ghes-stub.c @@ -14,7 +14,7 @@ int acpi_ghes_memory_errors(AcpiGhesState *ags, uint16_t source_id, uint64_t physical_address) { - return -1; + g_assert_not_reached(); } =20 AcpiGhesState *acpi_ghes_get_state(void) --=20 2.51.1 From nobody Mon Feb 9 09:11:25 2026 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=1764602837; cv=none; d=zohomail.com; s=zohoarc; b=BP2xo+OW0UddXh8Jogm+/10P1b4tgRXAH3wFVYjZnomd7vlMcKRmfZw9X8nyUQjlfVXeFEKe8TVJElj19Ar+8+FYcIC6W4GJMhqcgcHuGENexYQnjt8HXlRtjVjafvTzp0kXdYvNjlQsPu+ttOQ5DeVegz8QTYoUMEYHY2eetzg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764602837; 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=nDP1WCx0rv/zXhPzDDZ+21OXcCYasE+5bNqIHWjszJ8=; b=aUnOCbQ2y+tPNkC98mOwPvF6og+TGQj7NJRddFD8ahTF7y7pZjmS+heYC8PzRji6Dd64x6T2hedF/MJLVjFtKXF9P+VGOi7v9WTVWQWAUTvu2wymdiLTdCaFU2fOafDoczZuMu0i7f01B5hHqj12q1Po6IAshNI5ML5YD4MWvpU= 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 1764602837807993.2922733542621; Mon, 1 Dec 2025 07:27:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vQ4kA-0008H7-W6; Mon, 01 Dec 2025 09:19:11 -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 1vQ4k1-0008CY-IU for qemu-devel@nongnu.org; Mon, 01 Dec 2025 09:19: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 1vQ4jy-0008Jq-Us for qemu-devel@nongnu.org; Mon, 01 Dec 2025 09:19:00 -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-35-cs8GBQq_O5-IbGG-CEOJ9w-1; Mon, 01 Dec 2025 09:18:54 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 9BA41195605A; Mon, 1 Dec 2025 14:18:52 +0000 (UTC) Received: from gshan-thinkpadx1nanogen2.rmtau.csb (unknown [10.64.136.76]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B8E9C195608E; Mon, 1 Dec 2025 14:18:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1764598738; 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=nDP1WCx0rv/zXhPzDDZ+21OXcCYasE+5bNqIHWjszJ8=; b=AvEdXvhq6PQC3i66k4k/festAa3qUh3+Al1kF6Mb/m4ySFYHqfeWgjrmI3r/dN3QEe9kDs xyM7cmdE4sdZ+JcpcamIsPI0kpYdm8MpWHT28GChD3a348/Cdn8FIdrzW9YToCdde8HGME NL9wQo9vSC9r0vKdjr7NLjQUH14L8eQ= X-MC-Unique: cs8GBQq_O5-IbGG-CEOJ9w-1 X-Mimecast-MFC-AGG-ID: cs8GBQq_O5-IbGG-CEOJ9w_1764598732 From: Gavin Shan To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, mst@redhat.com, jonathan.cameron@huawei.com, mchehab+huawei@kernel.org, imammedo@redhat.com, armbru@redhat.com, anisinha@redhat.com, gengdongjiu1@gmail.com, peter.maydell@linaro.org, pbonzini@redhat.com, shan.gavin@gmail.com Subject: [PATCH v2 3/5] target/arm/kvm: Exit on error from acpi_ghes_memory_errors() Date: Tue, 2 Dec 2025 00:18:01 +1000 Message-ID: <20251201141803.2386129-4-gshan@redhat.com> In-Reply-To: <20251201141803.2386129-1-gshan@redhat.com> References: <20251201141803.2386129-1-gshan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1764602839606019200 Content-Type: text/plain; charset="utf-8" A core dump is no sense as there isn't programming bugs related to errors from acpi_ghes_memory_errors(). Exit instead of abort when the function returns errors, and the excessive error message is also dropped. Suggested-by: Igor Mammedov Suggested-by: Markus Armbruster Signed-off-by: Gavin Shan Reviewed-by: Igor Mammedov Reviewed-by: Mauro Carvalho Chehab --- target/arm/kvm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 0d57081e69..acda0b3fb4 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -2460,8 +2460,7 @@ void kvm_arch_on_sigbus_vcpu(CPUState *c, int code, v= oid *addr) paddr)) { kvm_inject_arm_sea(c); } else { - error_report("failed to record the error"); - abort(); + exit(1); } } return; --=20 2.51.1 From nobody Mon Feb 9 09:11:25 2026 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=1764603041; cv=none; d=zohomail.com; s=zohoarc; b=JCjTo6IRwAWT0O2iMTLib1xx3PI5oBvdfB9xChxsWLbY6Q65BTSpPOkxfYtj0+qUfyIEeplqiyezvyg34P9WfFES2p8n+TY/umtf4jGXK9/51X6Kf97hXOiiy3an+bNFQGaTuRx7e4OHAIe91PxFW+HotGKUKJYCofXH1+12+I8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764603041; 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=1CrFa71CCM1qX3auV6g1zo9fM/xwzBDD7ik1D4FQARM=; b=MZ7CVihrgznU4R62azGW5kHozERsmA9oUisYV5IqbolKmCABt7hmKbUeptyngjJRqwlQgu8Ijv0HsZNYBIL3K2GLCIQVnAvBtD6R5VhPe+js7BMi/gU1llM326TdFBYYpTStnAptGUfYtwNJpvP56onU27gzaF2Hf7AvQ6y7MXY= 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 176460304118740.81592456125361; Mon, 1 Dec 2025 07:30:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vQ4kD-0008NH-5u; Mon, 01 Dec 2025 09:19: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 1vQ4kA-0008IZ-QQ for qemu-devel@nongnu.org; Mon, 01 Dec 2025 09:19:10 -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 1vQ4k6-0008Kg-S7 for qemu-devel@nongnu.org; Mon, 01 Dec 2025 09:19:09 -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-180-iIc-on76PiqjJrpS6vyECw-1; Mon, 01 Dec 2025 09:19:00 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 AEE541801234; Mon, 1 Dec 2025 14:18:58 +0000 (UTC) Received: from gshan-thinkpadx1nanogen2.rmtau.csb (unknown [10.64.136.76]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6A83D195608E; Mon, 1 Dec 2025 14:18:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1764598745; 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=1CrFa71CCM1qX3auV6g1zo9fM/xwzBDD7ik1D4FQARM=; b=VJXYpDUKjspVv/H1VLBCGKLYflwuVxRLmCeyr2zkxrC1SG8kUvMWXLEX7txOr4vg3XqH86 rC2zbRM4cnuRi8pF4lfEfYCQbMEDVB1PBwLd8obRT9Ijd3m+F8z6sR0nNkU108/GijKSYM schmrylO9ABuVr8SMuW9bR/Tt3Eo8Sc= X-MC-Unique: iIc-on76PiqjJrpS6vyECw-1 X-Mimecast-MFC-AGG-ID: iIc-on76PiqjJrpS6vyECw_1764598739 From: Gavin Shan To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, mst@redhat.com, jonathan.cameron@huawei.com, mchehab+huawei@kernel.org, imammedo@redhat.com, armbru@redhat.com, anisinha@redhat.com, gengdongjiu1@gmail.com, peter.maydell@linaro.org, pbonzini@redhat.com, shan.gavin@gmail.com Subject: [PATCH v2 4/5] acpi/ghes: Bail early on error from get_ghes_source_offsets() Date: Tue, 2 Dec 2025 00:18:02 +1000 Message-ID: <20251201141803.2386129-5-gshan@redhat.com> In-Reply-To: <20251201141803.2386129-1-gshan@redhat.com> References: <20251201141803.2386129-1-gshan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1764603046645019200 Content-Type: text/plain; charset="utf-8" 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 returned from the read acknowledgement register. The second error_setg() can trigger assert(*errp =3D=3D NULL) in its callee error_setv(), which isn't expected. Bail early in ghes_record_cper_errors() when error is received from get_ghes_source_offsets() to avoid the unexpected behavior. Signed-off-by: Gavin Shan Reviewed-by: Jonathan Cameron Reviewed-by: Markus Armbruster Reviewed-by: Igor Mammedov Reviewed-by: Mauro Carvalho Chehab --- hw/acpi/ghes.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index 6366c74248..c35883dfa9 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -443,7 +443,7 @@ static void get_hw_error_offsets(uint64_t ghes_addr, *read_ack_register_addr =3D ghes_addr + sizeof(uint64_t); } =20 -static void get_ghes_source_offsets(uint16_t source_id, +static bool get_ghes_source_offsets(uint16_t source_id, uint64_t hest_addr, uint64_t *cper_addr, uint64_t *read_ack_start_addr, @@ -474,7 +474,7 @@ static void get_ghes_source_offsets(uint16_t source_id, /* For now, we only know the size of GHESv2 table */ if (type !=3D ACPI_GHES_SOURCE_GENERIC_ERROR_V2) { error_setg(errp, "HEST: type %d not supported.", type); - return; + return false; } =20 /* Compare CPER source ID at the GHESv2 structure */ @@ -488,7 +488,7 @@ static void get_ghes_source_offsets(uint16_t source_id, } if (i =3D=3D num_sources) { error_setg(errp, "HEST: Source %d not found.", source_id); - return; + return false; } =20 /* Navigate through table address pointers */ @@ -508,6 +508,8 @@ static void get_ghes_source_offsets(uint16_t source_id, cpu_physical_memory_read(hest_read_ack_addr, read_ack_start_addr, sizeof(*read_ack_start_addr)); *read_ack_start_addr =3D le64_to_cpu(*read_ack_start_addr); + + return true; } =20 NotifierList acpi_generic_error_notifiers =3D @@ -526,9 +528,10 @@ void ghes_record_cper_errors(AcpiGhesState *ags, const= void *cper, size_t len, if (!ags->use_hest_addr) { get_hw_error_offsets(le64_to_cpu(ags->hw_error_le), &cper_addr, &read_ack_register_addr); - } else { - get_ghes_source_offsets(source_id, le64_to_cpu(ags->hest_addr_le), - &cper_addr, &read_ack_register_addr, errp); + } else if (!get_ghes_source_offsets(source_id, + le64_to_cpu(ags->hest_addr_le), + &cper_addr, &read_ack_register_addr, errp)) { + return; } =20 cpu_physical_memory_read(read_ack_register_addr, --=20 2.51.1 From nobody Mon Feb 9 09:11:25 2026 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=1764602782; cv=none; d=zohomail.com; s=zohoarc; b=QOSboFr1MW1XLgDA/JrfzaxuNVKOSBWm/veVC7Z+AjwKE2SRQGpwnoRlZDcy9FQyiugWMuIlzowmo/noZMRFlExKHtochr98cCC9tjfbP+c8LS7Iqe3hH0AR+DvG9JCgnITK/gF6lpGhdd+0+qRkiJjWDcoltrmGoTll4M6rN7o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764602782; 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=vdTV+74vIxizRlieA9uyr9rY8BeSNKGquMiPkVB06BQ=; b=KuEc1KwgoIzNCmJFCrPY5hX6rRMGQ7jkuSKDREtievfmvhKVxncLiDm9nRlgV1AKckZLuIuuH127+D90qH2xcwO1ZcILzRy5IAIkv8E7qjis6O767hAWHBguwHvIy7ZiFzhJgb2mIPOkJT4LOKf/jafznQBiX4tD65IFEpei7Ps= 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 1764602782633326.1225800140985; Mon, 1 Dec 2025 07:26:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vQ4kQ-0008TO-5w; Mon, 01 Dec 2025 09:19:26 -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 1vQ4kF-0008QD-3y for qemu-devel@nongnu.org; Mon, 01 Dec 2025 09:19:17 -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 1vQ4kC-0008Lb-G4 for qemu-devel@nongnu.org; Mon, 01 Dec 2025 09:19:14 -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-74-dTUAxy84PwCmE3ZKlr86zw-1; Mon, 01 Dec 2025 09:19:10 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 9C59518002CD; Mon, 1 Dec 2025 14:19:07 +0000 (UTC) Received: from gshan-thinkpadx1nanogen2.rmtau.csb (unknown [10.64.136.76]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 74B59195608E; Mon, 1 Dec 2025 14:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1764598751; 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=vdTV+74vIxizRlieA9uyr9rY8BeSNKGquMiPkVB06BQ=; b=Hz3V1LRRSoGV5QP+m6G83hR1M28cc3VaGPRdyAFLJqqjw9Jm5PqgoVaFL4ghDKd4yoDmgW aWlo3SM9LccaHmNJ0xsbwbq/yaDiuk7xQPZDL9u/yAbSmYq+3ni0zwE5mijZEEvie6Hu91 fwn0XfwCQEOUmvLEtX5PaW6xK3cYWmo= X-MC-Unique: dTUAxy84PwCmE3ZKlr86zw-1 X-Mimecast-MFC-AGG-ID: dTUAxy84PwCmE3ZKlr86zw_1764598747 From: Gavin Shan To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, mst@redhat.com, jonathan.cameron@huawei.com, mchehab+huawei@kernel.org, imammedo@redhat.com, armbru@redhat.com, anisinha@redhat.com, gengdongjiu1@gmail.com, peter.maydell@linaro.org, pbonzini@redhat.com, shan.gavin@gmail.com Subject: [PATCH v2 5/5] acpi/ghes: Use error_fatal in acpi_ghes_memory_errors() Date: Tue, 2 Dec 2025 00:18:03 +1000 Message-ID: <20251201141803.2386129-6-gshan@redhat.com> In-Reply-To: <20251201141803.2386129-1-gshan@redhat.com> References: <20251201141803.2386129-1-gshan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1764602784019019200 Content-Type: text/plain; charset="utf-8" Use error_fatal in acpi_ghes_memory_errors() so that the caller needn't explicitly call exit(). The return value of acpi_ghes_memory_errors() and ghes_record_cper_errors() is changed to 'bool' indicating an error has been raised, to be compatible with what's documented in error.h. Suggested-by: Igor Mammedov Suggested-by: Markus Armbruster Signed-off-by: Gavin Shan Reviewed-by: Jonathan Cameron Reviewed-by: Markus Armbruster Reviewed-by: Igor Mammedov Reviewed-by: Mauro Carvalho Chehab --- hw/acpi/ghes-stub.c | 4 ++-- hw/acpi/ghes.c | 26 ++++++++++---------------- include/hw/acpi/ghes.h | 6 +++--- target/arm/kvm.c | 9 +++------ 4 files changed, 18 insertions(+), 27 deletions(-) diff --git a/hw/acpi/ghes-stub.c b/hw/acpi/ghes-stub.c index b54f1b093c..5f9313cce9 100644 --- a/hw/acpi/ghes-stub.c +++ b/hw/acpi/ghes-stub.c @@ -11,8 +11,8 @@ #include "qemu/osdep.h" #include "hw/acpi/ghes.h" =20 -int acpi_ghes_memory_errors(AcpiGhesState *ags, uint16_t source_id, - uint64_t physical_address) +bool acpi_ghes_memory_errors(AcpiGhesState *ags, uint16_t source_id, + uint64_t physical_address, Error **errp) { g_assert_not_reached(); } diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index c35883dfa9..3033e93d65 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -515,14 +515,14 @@ static bool get_ghes_source_offsets(uint16_t source_i= d, NotifierList acpi_generic_error_notifiers =3D NOTIFIER_LIST_INITIALIZER(acpi_generic_error_notifiers); =20 -void ghes_record_cper_errors(AcpiGhesState *ags, const void *cper, size_t = len, +bool ghes_record_cper_errors(AcpiGhesState *ags, 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; =20 if (len > ACPI_GHES_MAX_RAW_DATA_LENGTH) { error_setg(errp, "GHES CPER record is too big: %zd", len); - return; + return false; } =20 if (!ags->use_hest_addr) { @@ -531,7 +531,7 @@ void ghes_record_cper_errors(AcpiGhesState *ags, const = void *cper, size_t len, } else if (!get_ghes_source_offsets(source_id, le64_to_cpu(ags->hest_addr_le), &cper_addr, &read_ack_register_addr, errp)) { - return; + return false; } =20 cpu_physical_memory_read(read_ack_register_addr, @@ -542,7 +542,7 @@ void ghes_record_cper_errors(AcpiGhesState *ags, const = void *cper, size_t len, error_setg(errp, "OSPM does not acknowledge previous error," " so can not record CPER for current error anymore"); - return; + return false; } =20 read_ack_register =3D cpu_to_le64(0); @@ -557,16 +557,17 @@ void ghes_record_cper_errors(AcpiGhesState *ags, cons= t void *cper, size_t len, cpu_physical_memory_write(cper_addr, cper, len); =20 notifier_list_notify(&acpi_generic_error_notifiers, &source_id); + + return true; } =20 -int acpi_ghes_memory_errors(AcpiGhesState *ags, uint16_t source_id, - uint64_t physical_address) +bool acpi_ghes_memory_errors(AcpiGhesState *ags, uint16_t source_id, + uint64_t physical_address, Error **errp) { /* 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; g_autoptr(GArray) block =3D g_array_new(false, true /* clear */, 1); =20 @@ -583,15 +584,8 @@ int acpi_ghes_memory_errors(AcpiGhesState *ags, uint16= _t source_id, /* Build the memory section CPER for above new generic error data entr= y */ acpi_ghes_build_append_mem_cper(block, physical_address); =20 - /* Report the error */ - ghes_record_cper_errors(ags, block->data, block->len, source_id, &errp= ); - - if (errp) { - error_report_err(errp); - return -1; - } - - return 0; + return ghes_record_cper_errors(ags, block->data, block->len, + source_id, errp); } =20 AcpiGhesState *acpi_ghes_get_state(void) diff --git a/include/hw/acpi/ghes.h b/include/hw/acpi/ghes.h index df2ecbf6e4..5b29aae4dd 100644 --- a/include/hw/acpi/ghes.h +++ b/include/hw/acpi/ghes.h @@ -98,9 +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 error_physical_addr); -void ghes_record_cper_errors(AcpiGhesState *ags, const void *cper, size_t = len, +bool acpi_ghes_memory_errors(AcpiGhesState *ags, uint16_t source_id, + uint64_t error_physical_addr, Error **errp); +bool 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 acda0b3fb4..76aa09810f 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -2456,12 +2456,9 @@ void kvm_arch_on_sigbus_vcpu(CPUState *c, int code, = void *addr) */ if (code =3D=3D BUS_MCEERR_AR) { kvm_cpu_synchronize_state(c); - if (!acpi_ghes_memory_errors(ags, ACPI_HEST_SRC_ID_SYNC, - paddr)) { - kvm_inject_arm_sea(c); - } else { - exit(1); - } + acpi_ghes_memory_errors(ags, ACPI_HEST_SRC_ID_SYNC, + paddr, &error_fatal); + kvm_inject_arm_sea(c); } return; } --=20 2.51.1