From nobody Sun Apr 12 00:53:17 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=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1771847500; cv=none; d=zohomail.com; s=zohoarc; b=HqEp6EDc3dZSI31TSr0rO762U62VeQ/Xsv6uyCTi41jlWhEqlLDQJzjESwdSHmnR1zSo5cfPJUvjFWcFvnCVowR18z70UEXu/rZTdUR3mPJsLSsj6T99vSWfp3FykRouq9sfLfuYbOlaCL8VyQNS4030AQjzn5fBvcm7aOCmfBc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771847500; 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=harg56gO6rsD2kyojTBnIzMP8or2NtU0Oaw5G2HNI38=; b=fJ8iMOEMr29rve5fGX7t5wSj11QP+QgHHGTiaZIYnPPd4qqfqsuMzMMy7wFFxmL1a/f8LzR3iSayK3yOh+d+ksfedl2FPD79grOq8oheCeUGlQ6A/g6b8HSCl69nj5t5RtByPWOyHgSw7q1Ak2P1rywO6O1QmgMOtDqfegEruro= 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 1771847500869640.6984970787273; Mon, 23 Feb 2026 03:51:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vuUSV-0004Pj-OM; Mon, 23 Feb 2026 06:50:39 -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 1vuUSU-0004P9-A9 for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:38 -0500 Received: from sea.source.kernel.org ([172.234.252.31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vuUSR-0004qs-1g for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:37 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id BC358440B7; Mon, 23 Feb 2026 11:50:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97870C116C6; Mon, 23 Feb 2026 11:50:33 +0000 (UTC) Received: from mchehab by mail.kernel.org with local (Exim 4.99.1) (envelope-from ) id 1vuUSN-00000007JnZ-3Ptw; Mon, 23 Feb 2026 12:50:31 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771847433; bh=TFn+oGlXTvEweHwQM+0j7k4x7K62+/n653dih5LjR+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DvmOp8NM0XxyraCTeUpAY09ySPWLoImGzXFm38SZRv7UXd8cHQqkx2aNnS9aytRoB LcdN8t7JRKnOClLn4a4mWgCkYP999t+25f0uGfWdJovbQNddE79Ky1rUi6ne1xznVi GeJsAFZi8Nndv9aI70YgGMiUBUkQa1jdhNDrVUDu4QEzqwjNTcQT4Qwi8HKVs3xtnR QHeSOR7785MfvwAi/JOhzMa6P0CAp5/YRWEnFKWjFK3KA2vvNl/U0ZnA1SwD2AXjE/ qyn++yGWIpu8ySZvV/aPV2kes1/lUDSdtXeryeVe5M+H8dUZi58nZ5QlmKAPO02b+r me/pJuQlBsJpg== From: Mauro Carvalho Chehab To: Michael S Tsirkin Cc: Jonathan Cameron , Shiju Jose , qemu-devel@nongnu.org, Igor Mammedov , Mauro Carvalho Chehab , Cleber Rosa , John Snow Subject: [PATCH v3 01/14] scripts/qmp_helper: add a return code to send_cper Date: Mon, 23 Feb 2026 12:50:17 +0100 Message-ID: <2aa2c3565ceec788bcf637ce64454b7946e7d20c.1771847176.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=172.234.252.31; envelope-from=mchehab+huawei@kernel.org; helo=sea.source.kernel.org X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 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_VALIDITY_CERTIFIED_BLOCKED=1.179, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.717, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1771847502312158500 When used inside a loop, it is interesting to have a return code to indicate weather a send cper command succedded or not. Signed-off-by: Mauro Carvalho Chehab --- scripts/qmp_helper.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/qmp_helper.py b/scripts/qmp_helper.py index c1e7e0fd80ce..249a8c7187d1 100755 --- a/scripts/qmp_helper.py +++ b/scripts/qmp_helper.py @@ -531,7 +531,11 @@ def __init__(self, host, port, debug=3DFalse): # Socket QMP send command # def send_cper_raw(self, cper_data): - """Send a raw CPER data to QEMU though QMP TCP socket""" + """ + Send a raw CPER data to QEMU though QMP TCP socket. + + Return True on success, False otherwise. + """ =20 data =3D b64encode(bytes(cper_data)).decode('ascii') =20 @@ -543,9 +547,16 @@ def send_cper_raw(self, cper_data): =20 if self.send_cmd("inject-ghes-v2-error", cmd_arg): print("Error injected.") + return True + + return False =20 def send_cper(self, notif_type, payload): - """Send commands to QEMU though QMP TCP socket""" + """ + Send commands to QEMU though QMP TCP socket. + + Return True on success, False otherwise. + """ =20 # Fill CPER record header =20 @@ -599,8 +610,7 @@ def send_cper(self, notif_type, payload): =20 util.dump_bytearray("Payload", payload) =20 - self.send_cper_raw(cper_data) - + return self.send_cper_raw(cper_data) =20 def search_qom(self, path, prop, regex): """ --=20 2.53.0 From nobody Sun Apr 12 00:53:17 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=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1771847477; cv=none; d=zohomail.com; s=zohoarc; b=g2XLIxCwBrzjUhidQlQ4lZ6NF7NXzFVbPT8FSzNYAdESO9K8EvXO+/REgiE+zgpgT/OAFj8GstDX/9mVr7BqHtEOHammhTGLDuE7z/EG53DYHzWRNCykD0SlR+jA2bp909t+G1xEdh7V/Zs1zRvrNtxj7z/xmOfpx62WJHxmS9U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771847477; 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=wbyT301GWOotUwPQZHAk99H5Ntp6/i/2/rtl3yBuyAM=; b=f+zNKn3ogSsbB4Vkvnq31Fr9YBqYaN0BFQ3SNRkSrf9Yw4LH7gCjsTaWpcLv551JGpzQhV+d2qToCJQyjjAFNlS/+9FY4YJB59xvwUrTYjB/oC99W3aXeKWWWAiNozSLswOkfqXPJvvP+H1UA2xPVUubcfBwsWAbM2KskiEZzTM= 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 17718474777381006.8809498415927; Mon, 23 Feb 2026 03:51:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vuUSV-0004Pr-Tu; Mon, 23 Feb 2026 06:50:40 -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 1vuUSU-0004P7-9w for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:38 -0500 Received: from sea.source.kernel.org ([172.234.252.31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vuUSR-0004qu-2P for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:37 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id D963E44129; Mon, 23 Feb 2026 11:50:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5EDAC2BC87; Mon, 23 Feb 2026 11:50:33 +0000 (UTC) Received: from mchehab by mail.kernel.org with local (Exim 4.99.1) (envelope-from ) id 1vuUSN-00000007Jnd-3abM; Mon, 23 Feb 2026 12:50:31 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771847433; bh=3ITQlYCpVacD31WW3NMcDeQ1Tl3FXJTyINAq9AaGCPY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LbYlXAtNUR8L1Sc2mScEvho8YrX7HDx4UJAA3k7y6YZPPtvLwm88fZL3L/jO7GM2l tR0ZPLv6nFYsUUe2pao+ImkisGDJxjtXHgmPUF6Id/zHrS/1jTOs6Pe1tRpcAK/gKD JWVkh6xoIvMvp/9K+EwM5JP8ek9DxUMKk3KIOX1WKR/xreQg2ZY6QiluXrELOVQ1dq aeBBWYRSq2gCLP8gbjgeHJ5NpIBdZaA8cuTzV/op0C4DIx3liqavhKOdGR12IbM5R5 Cap8ZWWdGpd/KTapDE3UeE/noVhxLPUmhtfF3S16/6wNatEmz2DkkWtwFFAoXiiH/N eHGwyBR9XvWAg== From: Mauro Carvalho Chehab To: Michael S Tsirkin Cc: Jonathan Cameron , Shiju Jose , qemu-devel@nongnu.org, Igor Mammedov , Mauro Carvalho Chehab , Cleber Rosa , John Snow Subject: [PATCH v3 02/14] scripts/qmp_helper: add missing CXL UEFI GUID Date: Mon, 23 Feb 2026 12:50:18 +0100 Message-ID: X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=172.234.252.31; envelope-from=mchehab+huawei@kernel.org; helo=sea.source.kernel.org X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 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_VALIDITY_CERTIFIED_BLOCKED=1.179, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.717, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1771847477988158500 The UEFI 2.11 - N.2.14. CXL Component Events Section states that XL events are described at CXL specification 3.2: 8.2.10.2.1 Event Records Add the GUIDs defined here to fuzzy logic error injection code. Signed-off-by: Mauro Carvalho Chehab --- scripts/qmp_helper.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/scripts/qmp_helper.py b/scripts/qmp_helper.py index 249a8c7187d1..7e786c4adfd9 100755 --- a/scripts/qmp_helper.py +++ b/scripts/qmp_helper.py @@ -711,3 +711,28 @@ class cper_guid: CPER_CXL_PROT_ERR =3D guid(0x80B9EFB4, 0x52B5, 0x4DE3, [0xA7, 0x77, 0x68, 0x78, 0x4B, 0x77, 0x10, 0x48]) + + CPER_CXL_EVT_GEN_MEDIA =3D guid(0xFBCD0A77, 0xC260, 0x417F, + [0x85, 0xA9, 0x08, 0x8B, + 0x16, 0x21, 0xEB, 0xA6]) + CPER_CXL_EVT_DRAM =3D guid(0x601DCBB3, 0x9C06, 0x4EAB, + [0xB8, 0xAF, 0x4E, 0x9B, + 0xFB, 0x5C, 0x96, 0x24]) + CPER_CXL_EVT_MEM_MODULE =3D guid(0xFE927475, 0xDD59, 0x4339, + [0xA5, 0x86, 0x79, 0xBA, + 0xB1, 0x13, 0xBC, 0x74]) + CPER_CXL_EVT_MEM_SPARING =3D guid(0xE71F3A40, 0x2D29, 0x4092, + [0x8A, 0x39, 0x4D, 0x1C, + 0x96, 0x6C, 0x7C, 0x65]) + CPER_CXL_EVT_PHY_SW =3D guid(0x77CF9271, 0x9C02, 0x470B, + [0x9F, 0xE4, 0xBC, 0x7B, + 0x75, 0xF2, 0xDA, 0x97]) + CPER_CXL_EVT_VIRT_SW =3D guid(0x40D26425, 0x3396, 0x4C4D, + [0xA5, 0xDA, 0x3D, 0x47, + 0x2A, 0x63, 0xAF, 0x25]) + CPER_CXL_EVT_MLD_PORT =3D guid(0x8DC44363, 0x0C96, 0x4710, + [0xB7, 0xBF, 0x04, 0xBB, + 0x99, 0x53, 0x4C, 0x3F]) + CPER_CXL_EVT_DYNA_CAP =3D guid(0xCA95AFA7, 0xF183, 0x4018, + [0x8C, 0x2F, 0x95, 0x26, + 0x8E, 0x10, 0x1A, 0x2A]) --=20 2.53.0 From nobody Sun Apr 12 00:53:17 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=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1771847500; cv=none; d=zohomail.com; s=zohoarc; b=H8iNOfwvtDa0+ZNuDojuQrcmk3b7WJMtqssr/a5R5QrY5nF5XfTR6Hqbqp/hz1SITxaRuEhyd9hULYtZl2u77cgPGdsFDxq+DsKy4WHYPCQzc3dkib+cZbzc3MCrcD4SzcF8oWfNoNf6o49+XFMSTvXo9B2iz4h93zmHrIk2FfE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771847500; 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=e8m/My0jwEyBxXkQmu3PBGnMBmZw63BcJYAZGXBQlCA=; b=T2C9XVaQ0Lkl3SZ96rVDVJVuTYWduRYsRKEkqbZbssY4zmXHzOGI1qlqk6VRNniTaiiW7J+eU8rRvFUY+M0rp5filRMPztihR1iyOyLhP3B1Uy7XCKFJXSf83V88eQm44G8No19PmlifCtsrCF7eSunPMEuAC4zb1zE4vs//sf8= 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 1771847500898145.29139240522125; Mon, 23 Feb 2026 03:51:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vuUSX-0004QU-3s; Mon, 23 Feb 2026 06:50:41 -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 1vuUSU-0004PA-AC for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:38 -0500 Received: from sea.source.kernel.org ([172.234.252.31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vuUSR-0004qt-1F for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:36 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id D7E9F44123; Mon, 23 Feb 2026 11:50:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B59AFC19424; Mon, 23 Feb 2026 11:50:33 +0000 (UTC) Received: from mchehab by mail.kernel.org with local (Exim 4.99.1) (envelope-from ) id 1vuUSN-00000007Jnh-3hXo; Mon, 23 Feb 2026 12:50:31 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771847433; bh=apHzXrmtB3K9bS+IcAMBedJ//nuE8l/kc7ig4KubSvc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V4OK4BUkXdyRoXAVSOw5n+DFtpsiyYjr0yB0QdLvoneqmivWmFDrLvfjnGNWdk7zY m6AC3M1y4wKS7zdTz11PACqz0l3iol8zllmGuCiiHdHKzZUkWg4OP6RSXCl2jwwfRi s9CZVeZCuhRn4ubKlgvFkMwWUvMwX1gjS2wqIgURjYSaXZ6PbRUf+IdJmEgW2/4ieT 2EvL1RQ/PDzHBlvkGvAz38GBBtvxGvMth2lSMwCk5q9rnQRoEKBGTjTHEVgA/9809u oQS74ktXTmN12Vk9/ZPkk2DOyNaKxm16I3RmDDuOLGgndzKOcARRKTXUE97tHbiAxA qfeBnWTYWcEpA== From: Mauro Carvalho Chehab To: Michael S Tsirkin Cc: Jonathan Cameron , Shiju Jose , qemu-devel@nongnu.org, Igor Mammedov , Mauro Carvalho Chehab , Cleber Rosa , John Snow Subject: [PATCH v3 03/14] scripts/qmp_helper: add support for FRU Memory Poison Date: Mon, 23 Feb 2026 12:50:19 +0100 Message-ID: X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=172.234.252.31; envelope-from=mchehab+huawei@kernel.org; helo=sea.source.kernel.org X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 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_VALIDITY_CERTIFIED_BLOCKED=1.179, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.717, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1771847502293158500 This GUID record descriptor was added on UEFI 2.11. Add support for it. Signed-off-by: Mauro Carvalho Chehab --- scripts/qmp_helper.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/qmp_helper.py b/scripts/qmp_helper.py index 7e786c4adfd9..19bf641a13ce 100755 --- a/scripts/qmp_helper.py +++ b/scripts/qmp_helper.py @@ -736,3 +736,7 @@ class cper_guid: CPER_CXL_EVT_DYNA_CAP =3D guid(0xCA95AFA7, 0xF183, 0x4018, [0x8C, 0x2F, 0x95, 0x26, 0x8E, 0x10, 0x1A, 0x2A]) + + CPER_FRU_MEM_POISON =3D guid(0x5E4706C1, 0x5356, 0x48C6, + [0x93, 0x0B, 0x52, 0xF2, + 0x12, 0x0A, 0x44, 0x58]) --=20 2.53.0 From nobody Sun Apr 12 00:53:17 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=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1771847501; cv=none; d=zohomail.com; s=zohoarc; b=BYMD1GpqOx2AEe4h6eT4K53lddw3dDoSBXjEcduxC8/cfqsb8sWJPfXronPK4280Ds+r71NuKxesuOPiGno8I8KfaNikU02DGx3T8deQDzzbxo5sJMsjKm6fdV2/IWxe4FEhrzmmFYg3w5+Jd9gsg3RyjqcESYYYUcEdxVXaRIU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771847501; 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=MQVW7KulLPLZ0XG9faCuF6r061RXzDmv2uDwyrnpXnk=; b=gBKnqC1TBHOaszZ1SP30FzLJhS0JgBsjcQUg/AOhmOHfqRB7BIQlL17kPn1kRMExj17B255uocPjlv/FY0+POAQZRoYVk+u8Tk4e9ADdJ0yVuAuIEB/F6V9neOaKta1ttpEkmBlxc3gJWBpTrjnh5giROUauqUN6Td+4fVLpiu4= 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 1771847501120306.2769082858989; Mon, 23 Feb 2026 03:51:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vuUSY-0004Qp-NF; Mon, 23 Feb 2026 06:50: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 1vuUSW-0004QE-7d for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:40 -0500 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vuUSU-0004qv-1i for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:39 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id E1E79441ED; Mon, 23 Feb 2026 11:50:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD6D6C2BCB1; Mon, 23 Feb 2026 11:50:33 +0000 (UTC) Received: from mchehab by mail.kernel.org with local (Exim 4.99.1) (envelope-from ) id 1vuUSN-00000007Jo7-3rHt; Mon, 23 Feb 2026 12:50:31 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771847433; bh=2e1s5iCljNb0o5w9CsQT6PzaFq6y7oL34AOzFRWvrao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HbThT8Ftb0REFiR8cC5atWK+EF+b/hTJwklWo1zDq0OoTlH84v0c0PXSP7imJbmyP 03wnhCF0qRUxP6Ir/S33Z1NDolVZEdJa6+5nubHuW0XPmzMg0BUF/YO2NrQkFgc+1w 05WoF1wcfBIeS1o+J3ezQHI2FjadPYOXHUjaYcwyf7kjsL7SV77C2OEKysWoccSEWg 6B6tzt5togUj2qLJY+MzTjCl9QWYTpaOQjcb4zsHAxCQHFPlMM+sHiBid4MtlqHsdi uGni/YpesRlMgYkCvv61jUEsmkL6MZcFMGqd80WTzxazSGq7IGEVeEUBgKR8/lh8ZK uBo+Ur4aA4agw== From: Mauro Carvalho Chehab To: Michael S Tsirkin Cc: Jonathan Cameron , Shiju Jose , qemu-devel@nongnu.org, Igor Mammedov , Mauro Carvalho Chehab , Cleber Rosa , John Snow Subject: [PATCH v3 04/14] scripts/qmp_helper: make send_cper() more generic Date: Mon, 23 Feb 2026 12:50:20 +0100 Message-ID: X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2600:3c0a:e001:78e:0:1991:8:25; envelope-from=mchehab+huawei@kernel.org; helo=sea.source.kernel.org 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1771847502344158500 Allow the caller to set GEDE, GEBS and raw data. This can be useful if one wants to replicate a CPER with the same parameters as the original one. Signed-off-by: Mauro Carvalho Chehab --- scripts/qmp_helper.py | 69 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 55 insertions(+), 14 deletions(-) diff --git a/scripts/qmp_helper.py b/scripts/qmp_helper.py index 19bf641a13ce..51c8ad92a39d 100755 --- a/scripts/qmp_helper.py +++ b/scripts/qmp_helper.py @@ -551,22 +551,11 @@ def send_cper_raw(self, cper_data): =20 return False =20 - def send_cper(self, notif_type, payload): + def get_gede(self, notif_type, cper_length): """ - Send commands to QEMU though QMP TCP socket. - - Return True on success, False otherwise. + Return a Generic Error Data Entry bytearray """ =20 - # Fill CPER record header - - # NOTE: bits 4 to 13 of block status contain the number of - # data entries in the data section. This is currently unsupported. - - cper_length =3D len(payload) - data_length =3D cper_length + len(self.raw_data) + self.GENERIC_DA= TA_SIZE - - # Generic Error Data Entry gede =3D bytearray() =20 gede.extend(notif_type.to_bytes()) @@ -579,7 +568,13 @@ def send_cper(self, notif_type, payload): gede.extend(self.fru_text) gede.extend(self.timestamp) =20 - # Generic Error Status Block + return gede + + def get_gebs(self, data_length): + """ + Return a Generic Error Status Block bytearray + """ + gebs =3D bytearray() =20 if self.raw_data: @@ -593,6 +588,52 @@ def send_cper(self, notif_type, payload): util.data_add(gebs, data_length, 4) util.data_add(gebs, self.error_severity, 4) =20 + return gebs + + def send_cper(self, notif_type, payload, + gede=3DNone, gebs=3DNone, raw_data=3DNone): + """ + Send commands to QEMU though QMP TCP socket. + + Return True on success, False otherwise. + + Arguments: + notif_type: Notification type (GUID) + payload: bytearray with the payload + gede: Generic Error Data Entry. If None, the code will generate + one using the defaults and generic error data arguments + gebs: Generic Error Status block. If None, the code will gener= ate + one using the defaults and generic error data arguments + raw_data: Raw data to be added after GEBS. If not specified, + the code will generate one if Generic Error Data + --raw-data parameter is specified. + """ + + # Fill CPER record header + + # NOTE: bits 4 to 13 of block status contain the number of + # data entries in the data section. This is currently unsupported. + + if raw_data: + self.raw_data =3D raw_data + + cper_length =3D len(payload) + data_length =3D cper_length + len(self.raw_data) + self.GENERIC_DA= TA_SIZE + + if gede and len(gede) !=3D 72: + print(f"Invalid Generic Error Data Entry length: {len(gede)}. = Ignoring it") + gede =3D None + + if gebs and len(gebs) !=3D 20: + print(f"Invalid Generic Error Status Block length: {len(gebs)}= . Ignoring it") + gebs =3D None + + if not gede: + gede =3D self.get_gede(notif_type, cper_length) + + if not gebs: + gebs =3D self.get_gebs(data_length) + cper_data =3D bytearray() cper_data.extend(gebs) cper_data.extend(gede) --=20 2.53.0 From nobody Sun Apr 12 00:53:17 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=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1771847508; cv=none; d=zohomail.com; s=zohoarc; b=U0aJjxMiypal6Z3Hv8fjfPgnEbUR20JY2bcd6AT1aE6d+rGpmuMsg5kZLAXDhlzHyw8JexqOMeGSKNhZRHpbyW8OXV7VRO4nZ31i0xrcOnYkc+YydKWTK/BVu7zVwqxNdDvkKIr47VtdOU6X8Zuiel5QZrcupGIK25UsBCHFnk0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771847508; 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=yOWkCUSwCU06p0CG5glVari6AGe2/wobq5L4MUNUnpk=; b=Hn3fKLAaO5x/Js3cOGKbefuUNQ2Us+yYIWXpude3zfiinqqtkPg0OckInZkWbdlNS8geF4LBpHXLbYTvDiIQl0sy7KRnhz1ddT6ndWWvJeEaF0kzeXvdBi7h47vN7f65hx2iujFGRLgo4G31kVf0d+TvsLIV9gQAR/ghXaNxRx0= 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 1771847508044204.3019894809173; Mon, 23 Feb 2026 03:51:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vuUSe-0004So-M7; Mon, 23 Feb 2026 06:50:49 -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 1vuUSW-0004QD-7E for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:40 -0500 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vuUSS-0004qx-Vk for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:39 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id E1E5044164; Mon, 23 Feb 2026 11:50:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0181C2BCB2; Mon, 23 Feb 2026 11:50:33 +0000 (UTC) Received: from mchehab by mail.kernel.org with local (Exim 4.99.1) (envelope-from ) id 1vuUSN-00000007JoB-40ek; Mon, 23 Feb 2026 12:50:31 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771847433; bh=SSFGjo4RyRuGvG2rm8xB9wVYOwkheaOQBxWc2jqVffw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B0RGMUTvnFKlQ3GRoW2U5SnZuohoaBoEA7hDRkf4aLXcKwFIZ1j9I00WhgEuuo3BZ kG9uLLZIsNP2uqrwU2YRClPiWCEDZTtf+W86gpM1Y+24khgptYI51aj7C2k/+qQPq+ lAU+zf4ZGthG9zkIcV3f3Wv5qSvTNeuCjZTJBhcwa/KIFm9QTlrD8j+0XTogVWj/TR RFSCgQUO4ofxnpeug6W0q60+0DmkjHehB6yL22KTX5M2n+QuMZM42Mn+D10C85MqDq ZQyw26BV/DUNli9v2groGRy6vlOy/Kb1hDtAGma3kTzuNBNHDd8Ceu/RQd8OUmzUmD 7cNtuHJhDJ4IQ== From: Mauro Carvalho Chehab To: Michael S Tsirkin Cc: Jonathan Cameron , Shiju Jose , qemu-devel@nongnu.org, Igor Mammedov , Mauro Carvalho Chehab , Cleber Rosa , John Snow Subject: [PATCH v3 05/14] scripts/qmp_helper: fix raw_data logic Date: Mon, 23 Feb 2026 12:50:21 +0100 Message-ID: X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2600:3c0a:e001:78e:0:1991:8:25; envelope-from=mchehab+huawei@kernel.org; helo=sea.source.kernel.org 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1771847510214158500 According with UEFI 6.4 spec Table 18.11 Generic Error Status Block: Raw Data Offset: Offset in bytes from the beginning of the Error Status Block to raw error data. The raw data must follow any Generic Error Data Entries. Data Length: Length in bytes of the generic error data. So, basically, we have: +----------+ / | GEBS | | +----------+ / | | GEDE | | | | header | | +--> raw data +----------+ +--> data | offset | GEDE | | length | | payload | | | +----------+ / / | Raw data | +----------+ where: - raw data offset is relative to the beginning of GEBS; - data length is only for GEDE header and payload. Fix the code to handle it the expected way. Signed-off-by: Mauro Carvalho Chehab --- scripts/qmp_helper.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/scripts/qmp_helper.py b/scripts/qmp_helper.py index 51c8ad92a39d..40059cd105f6 100755 --- a/scripts/qmp_helper.py +++ b/scripts/qmp_helper.py @@ -411,6 +411,7 @@ def _connect(self): "simulated": util.bit(2), } =20 + GENERIC_ERROR_STATUS_SIZE =3D 20 GENERIC_DATA_SIZE =3D 72 =20 def argparse(parser): @@ -551,7 +552,7 @@ def send_cper_raw(self, cper_data): =20 return False =20 - def get_gede(self, notif_type, cper_length): + def get_gede(self, notif_type, payload_length): """ Return a Generic Error Data Entry bytearray """ @@ -563,22 +564,27 @@ def get_gede(self, notif_type, cper_length): util.data_add(gede, 0x300, 2) util.data_add(gede, self.validation_bits, 1) util.data_add(gede, self.flags, 1) - util.data_add(gede, cper_length, 4) + util.data_add(gede, payload_length, 4) gede.extend(self.fru_id) gede.extend(self.fru_text) gede.extend(self.timestamp) =20 return gede =20 - def get_gebs(self, data_length): + def get_gebs(self, payload_length): """ Return a Generic Error Status Block bytearray """ =20 + data_length =3D payload_length + data_length +=3D self.GENERIC_DATA_SIZE + gebs =3D bytearray() =20 if self.raw_data: - raw_data_offset =3D len(gebs) + raw_data_offset =3D payload_length + raw_data_offset +=3D self.GENERIC_ERROR_STATUS_SIZE + raw_data_offset +=3D self.GENERIC_DATA_SIZE else: raw_data_offset =3D 0 =20 @@ -617,8 +623,7 @@ def send_cper(self, notif_type, payload, if raw_data: self.raw_data =3D raw_data =20 - cper_length =3D len(payload) - data_length =3D cper_length + len(self.raw_data) + self.GENERIC_DA= TA_SIZE + payload_length =3D len(payload) =20 if gede and len(gede) !=3D 72: print(f"Invalid Generic Error Data Entry length: {len(gede)}. = Ignoring it") @@ -629,16 +634,16 @@ def send_cper(self, notif_type, payload, gebs =3D None =20 if not gede: - gede =3D self.get_gede(notif_type, cper_length) + gede =3D self.get_gede(notif_type, payload_length) =20 if not gebs: - gebs =3D self.get_gebs(data_length) + gebs =3D self.get_gebs(payload_length) =20 cper_data =3D bytearray() cper_data.extend(gebs) cper_data.extend(gede) - cper_data.extend(bytearray(self.raw_data)) cper_data.extend(bytearray(payload)) + cper_data.extend(bytearray(self.raw_data)) =20 if self.debug: print(f"GUID: {notif_type}") --=20 2.53.0 From nobody Sun Apr 12 00:53:17 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=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1771847525; cv=none; d=zohomail.com; s=zohoarc; b=WTRmIoCBJe9nxk9rsK9QmTl6epVZWvIkhpFaIlx8biv2iZDiZX5dwrXyOI2lB+2Jhfu/Zt0omYnhkWqB+84MbPO2yHsnGRVsB3SVht9aAjlQbXre8VCnmhNWFH8m6rnW9SIA7uU1+Q+6/fxXjG9HfZLq+KEl6JJZOr63A9bI/zY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771847525; 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=Zjj2Lf9h3xLqedA9cJsgabMJ4XOqFmLnyVy7Lz2/jKY=; b=bsVmHMzgYgREAnW0/8DgF0V9X7276HRRpfdLRb4Q55sUs3sbE/3abfvXPBZbpE18mR+xOQM/YwId5ux6MtuTKxskOY82z6RbiPvumTRAJtuHDKZ3bf+9KFkc+n9dgFqqH/tGY/NPxDNWCh5wIdDI6BRERadPZx5QM+dkU1SouL0= 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 1771847525529883.859729703886; Mon, 23 Feb 2026 03:52:05 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vuUSg-0004Tj-DY; Mon, 23 Feb 2026 06:50:50 -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 1vuUSb-0004RN-47 for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:45 -0500 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vuUSV-0004rf-Un for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:43 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id EE6C94432F; Mon, 23 Feb 2026 11:50:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C923AC116C6; Mon, 23 Feb 2026 11:50:33 +0000 (UTC) Received: from mchehab by mail.kernel.org with local (Exim 4.99.1) (envelope-from ) id 1vuUSN-00000007JoF-4BEn; Mon, 23 Feb 2026 12:50:32 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771847433; bh=EC+8SGzDWCzy7LTHPsNQsqigpybqMtyp8+2fVP7JN04=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RgH108JKeQKoAGUvb2JMNPCOoVTPB0lMzxFaLNR6ZSpZ7grIGye6Jj5jy4d5F8FCt iDvJCLVRyGWO+Ur2nGYyFAt9ajJb5UbwoCdixelN3vuOU/Xfe7/pisdPSq79rI5c9y Jn9nHhNlU8kfX+wz4YmFDPJ+OP3HbWWGxoIoqGOsDCrRkZ3h7UyKOwSCQj2SQeLpjD 4Gj4foGxgoWJnYF5ZdW+fqAYbHtIC+FxhYRebHt49e3Gt98t0hY6/WXsmFK7ze38oC UJa2uXghOrusFL2ZYvvkcXeWHhJ7RGDFxskrS83M+LCG1FwCPwxEbslGcoz1LvTesB 6K81bcpHEWIow== From: Mauro Carvalho Chehab To: Michael S Tsirkin Cc: Jonathan Cameron , Shiju Jose , qemu-devel@nongnu.org, Igor Mammedov , Mauro Carvalho Chehab , Cleber Rosa , John Snow Subject: [PATCH v3 06/14] scripts/qmp_helper: add support for a timeout logic Date: Mon, 23 Feb 2026 12:50:22 +0100 Message-ID: <2539e524dd467af51f8286bd1b201feaad06c81e.1771847176.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2600:3c0a:e001:78e:0:1991:8:25; envelope-from=mchehab+huawei@kernel.org; helo=sea.source.kernel.org 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1771847526239158500 We can't inject a new GHES record to the same source before it has been acked. There is an async mechanism to verify when the Kernel is ready, which is implemented at QEMU's ghes driver. If error inject is too fast, QEMU may return an error. When such errors occur, implement a retry mechanism, based on a maximum timeout. Signed-off-by: Mauro Carvalho Chehab --- scripts/qmp_helper.py | 47 +++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/scripts/qmp_helper.py b/scripts/qmp_helper.py index 40059cd105f6..63f3df2d75c3 100755 --- a/scripts/qmp_helper.py +++ b/scripts/qmp_helper.py @@ -14,6 +14,7 @@ =20 from datetime import datetime from os import path as os_path +from time import sleep =20 try: qemu_dir =3D os_path.abspath(os_path.dirname(os_path.dirname(__file__)= )) @@ -324,7 +325,8 @@ class qmp: Opens a connection and send/receive QMP commands. """ =20 - def send_cmd(self, command, args=3DNone, may_open=3DFalse, return_erro= r=3DTrue): + def send_cmd(self, command, args=3DNone, may_open=3DFalse, return_erro= r=3DTrue, + timeout=3DNone): """Send a command to QMP, optinally opening a connection""" =20 if may_open: @@ -336,12 +338,31 @@ def send_cmd(self, command, args=3DNone, may_open=3DF= alse, return_error=3DTrue): if args: msg['arguments'] =3D args =20 - try: - obj =3D self.qmp_monitor.cmd_obj(msg) - # Can we use some other exception class here? - except Exception as e: # pylint: disable= =3DW0718 - print(f"Command: {command}") - print(f"Failed to inject error: {e}.") + if timeout and timeout > 0: + attempts =3D int(timeout * 10) + else: + attempts =3D 1 + + # Try up to attempts + for i in range(0, attempts): + try: + obj =3D self.qmp_monitor.cmd_obj(msg) + + if obj and "return" in obj and not obj["return"]: + break + + except Exception as e: # pylint: disable= =3DW0718 + print(f"Command: {command}") + print(f"Failed to inject error: {e}.") + obj =3D None + + if attempts > 1: + print(f"Error inject attempt {i + 1}/{attempts} failed.") + + if i + 1 < attempts: + sleep(0.1) + + if not obj: return None =20 if "return" in obj: @@ -531,7 +552,7 @@ def __init__(self, host, port, debug=3DFalse): # # Socket QMP send command # - def send_cper_raw(self, cper_data): + def send_cper_raw(self, cper_data, timeout=3DNone): """ Send a raw CPER data to QEMU though QMP TCP socket. =20 @@ -546,11 +567,11 @@ def send_cper_raw(self, cper_data): =20 self._connect() =20 - if self.send_cmd("inject-ghes-v2-error", cmd_arg): + ret =3D self.send_cmd("inject-ghes-v2-error", cmd_arg, timeout=3Dt= imeout) + if ret: print("Error injected.") - return True =20 - return False + return ret =20 def get_gede(self, notif_type, payload_length): """ @@ -597,7 +618,7 @@ def get_gebs(self, payload_length): return gebs =20 def send_cper(self, notif_type, payload, - gede=3DNone, gebs=3DNone, raw_data=3DNone): + gede=3DNone, gebs=3DNone, raw_data=3DNone, timeout=3DNon= e): """ Send commands to QEMU though QMP TCP socket. =20 @@ -656,7 +677,7 @@ def send_cper(self, notif_type, payload, =20 util.dump_bytearray("Payload", payload) =20 - return self.send_cper_raw(cper_data) + return self.send_cper_raw(cper_data, timeout=3Dtimeout) =20 def search_qom(self, path, prop, regex): """ --=20 2.53.0 From nobody Sun Apr 12 00:53:17 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=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1771847468; cv=none; d=zohomail.com; s=zohoarc; b=nJCw4ZlEWJyD9DhOUF1wkMjbnTeFujWOxvQnHa+B47wU2oNGdiNTzzn3uznfmgSrPuN848LWFOUObd3XRlBs5DOm5aMw5mjqKSAniG0i3xyPma6uQPha4YSPMRrota9rnAVa9UPig/amFNFCiI653NwiYOK2vNs1lyDRO7rVyZU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771847468; 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=sBHEtoKRWZW8uJTi0snZRZudaCGWAmjGTrwooSX1NoA=; b=TqWqZPAXZGx7Km+07SyqwG7HER9ViSH/HvlRhT/wVSe+AL8Zw/an1YiaiDacLCJXsZVEFDj2XDWxn1OC4GyQ4VddlpT6mNBevqFPKHXigf7Rh6M0FkT25E3tDpeLvJb3PLQqNhIzGBEGsSkHDYmrDFM1+IwY7pZsoNZFmGvJTws= 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 1771847468054387.00057220248925; Mon, 23 Feb 2026 03:51:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vuUSc-0004SS-MO; Mon, 23 Feb 2026 06:50:48 -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 1vuUSb-0004RK-2v for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:45 -0500 Received: from sea.source.kernel.org ([172.234.252.31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vuUSV-0004ri-Vj for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:42 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id EE6EF4434C; Mon, 23 Feb 2026 11:50:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4AF5C2BCAF; Mon, 23 Feb 2026 11:50:33 +0000 (UTC) Received: from mchehab by mail.kernel.org with local (Exim 4.99.1) (envelope-from ) id 1vuUSO-00000007JoJ-09WF; Mon, 23 Feb 2026 12:50:32 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771847433; bh=INiyl0aRSuBnQVQ202CeCvEnWeCH+QmITdcQn0SHaNI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rRjjaF5iqvrBfEXMP11OUq6Ev1XoWbLBjEs7vBiTXn5ZUNodWkTl4V88HfpgjTCER Q7gOiHm1q5wcKiTUufcFgpFLw9DIIsG24yYJg/ThIYlXUNq68GW6IoTqe66VtDvi6F 5mJzX6dHpnFqpUbHO90KBi0hWG1JI5jJoZRYH43YbBpqg1A4DNqvvylQug8n6g95yu pEqg1bqru7yEeG2fsqbFJZ/u6Uzs5EHbRX5YPrkqKYbhLcu0GbfZOdW0cH0Ik/O4Le +8LpetTFViD7QVYxf2CQ6jXVAL6uC6ln9KynB44Biqy+9AIDtfdJ2JbVTci4GFwdvw yS/tZhLf3dsZA== From: Mauro Carvalho Chehab To: Michael S Tsirkin Cc: Jonathan Cameron , Shiju Jose , qemu-devel@nongnu.org, Igor Mammedov , Mauro Carvalho Chehab , Cleber Rosa , John Snow Subject: [PATCH v3 07/14] scripts/qmp_helper: avoid long lines when possible Date: Mon, 23 Feb 2026 12:50:23 +0100 Message-ID: X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=172.234.252.31; envelope-from=mchehab+huawei@kernel.org; helo=sea.source.kernel.org X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 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_VALIDITY_CERTIFIED_BLOCKED=1.179, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.717, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1771847470564158500 checkpatch.pl reports some long lines. Most of them are due to strings that need to be long, or due to python's way to indent files and very long names on some class methods. Yet, some of them are due to pylint instructions that can also be placed just before the line, or are too indented. Solve such cases. Signed-off-by: Mauro Carvalho Chehab --- scripts/qmp_helper.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/qmp_helper.py b/scripts/qmp_helper.py index 63f3df2d75c3..80fdaef60214 100755 --- a/scripts/qmp_helper.py +++ b/scripts/qmp_helper.py @@ -199,7 +199,8 @@ def bit(b): def data_add(data, value, num_bytes): """Adds bytes from value inside a bitarray""" =20 - data.extend(value.to_bytes(num_bytes, byteorder=3D"little")) # py= lint: disable=3DE1101 + # pylint: disable=3DE1101 + data.extend(value.to_bytes(num_bytes, byteorder=3D"little")) =20 def dump_bytearray(name, data): """Does an hexdump of a byte array, grouping in bytes""" @@ -351,7 +352,7 @@ def send_cmd(self, command, args=3DNone, may_open=3DFal= se, return_error=3DTrue, if obj and "return" in obj and not obj["return"]: break =20 - except Exception as e: # pylint: disable= =3DW0718 + except Exception as e: # pylint: disable=3DW0718 print(f"Command: {command}") print(f"Failed to inject error: {e}.") obj =3D None @@ -443,7 +444,9 @@ def argparse(parser): validation_bits =3D ",".join(qmp.VALIDATION_BITS.keys()) gedb_flags_bits =3D ",".join(qmp.GEDB_FLAGS_BITS.keys()) =20 - g_gen =3D parser.add_argument_group("Generic Error Data") # pylin= t: disable=3DE1101 + # pylint: disable=3DE1101 + g_gen =3D parser.add_argument_group("Generic Error Data") + g_gen.add_argument("--block-status", help=3Df"block status bits: {block_status_bits}= ") g_gen.add_argument("--raw-data", nargs=3D"+", --=20 2.53.0 From nobody Sun Apr 12 00:53:17 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=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1771847552; cv=none; d=zohomail.com; s=zohoarc; b=NFVc46vjhQVzHszpMFopoNz1+TKkRgnuA7MpaX7Nghp1tLf8Kbttn0hMnqx3jjQ1E9tkvfHMD0b4H38Xm7lexK2ntQTJ0wmpUtyrEEmMzNMBO/6FaBPwbnarZ7FT/Oh86mvZ0ROZFtO7AkdkbU/CJsJY3FNNpRZXtRqKos3g9VM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771847552; 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=9/FS7WFOF7hEQGALRXfmzZZGSDaSJQ9cJG4kKAcN3wg=; b=CblIqzB6yXMoKESorugLAkPvGiruLIKJTFihPUqR1gQtI4/u7bpLsEvevgihv9xVq56F91OE6EpMhydIsfiqpZGdLA13OTPgD+5fVgu148TUuxH/WO8oSHVgXXBCpgSND627D6fK16khfJUD6NrUo/WDnq668VrH/JCMorMFQeY= 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 1771847552366230.28549481474795; Mon, 23 Feb 2026 03:52:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vuUSp-0004Va-Ha; Mon, 23 Feb 2026 06:50:59 -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 1vuUSf-0004TW-MY for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:49 -0500 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vuUSa-0004sW-PJ for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:49 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 5CF9F44571; Mon, 23 Feb 2026 11:50:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D544BC116D0; Mon, 23 Feb 2026 11:50:33 +0000 (UTC) Received: from mchehab by mail.kernel.org with local (Exim 4.99.1) (envelope-from ) id 1vuUSO-00000007JoN-0KJU; Mon, 23 Feb 2026 12:50:32 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771847434; bh=/lk/BzO1vm6YxaJn+4ItoUlZp5ZKP6/SofuDHZnThMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hmaXtGLYqyahgwsKCGhv1Zytg3R+jH2WWKbObU2KhphuA4k6zfJnpVJ+wmv2uMtEL R/QHE75EEwu1XnbDXRKf7e5QELlOj0m6NzAyA/PXLqs0mLVLMbWLv0+UqAygAm2bSZ EbRDR13+FN+E/+jT1WxOHBqkw+d3oTbuPEr89A/TshMq3n8nth2zEIOzSeVztA8rZt cK1ILZ84FDtVbzdtxpj1clPmXxnOc2ip0ibv7glUw4JdtonPp+IjqgSulcSDGBySJG ksKVOxsmSH09ssM5a9ZKnU/Ud/0acW3bQyxvBwG5mNRYTZGvLWgCFlOwKDqqNLPY6N 7Jrd7pUp/gO4w== From: Mauro Carvalho Chehab To: Michael S Tsirkin Cc: Jonathan Cameron , Shiju Jose , qemu-devel@nongnu.org, Igor Mammedov , Mauro Carvalho Chehab , Cleber Rosa , John Snow Subject: [PATCH v3 08/14] scripts/ghes_inject: add a logic to decode CPER Date: Mon, 23 Feb 2026 12:50:24 +0100 Message-ID: <2afe576a63d6daf537a2d0a470bd078b4893a362.1771847176.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2600:3c0a:e001:78e:0:1991:8:25; envelope-from=mchehab+huawei@kernel.org; helo=sea.source.kernel.org 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1771847554425158500 Add a decoder to help debugging injected CPERs. This is more relevant when we add fuzzy-testing error inject, as the decoder is helpful to identify what it packages will be sent via QEMU to the firmware-fist logic. By purpose, I opted to keep this completely independent from the encoders implementation, as this can be used even when there are no encoders for a certain GGUID type (except for a fuzzy logic test, which is pretty much independent of the records meaning). Signed-off-by: Mauro Carvalho Chehab --- MAINTAINERS | 1 + scripts/ghes_decode.py | 1155 ++++++++++++++++++++++++++++++++++++++++ scripts/qmp_helper.py | 3 + 3 files changed, 1159 insertions(+) create mode 100644 scripts/ghes_decode.py diff --git a/MAINTAINERS b/MAINTAINERS index 36a2be3ddba7..a970c47dd089 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2225,6 +2225,7 @@ S: Maintained F: hw/arm/ghes_cper.c F: hw/acpi/ghes_cper_stub.c F: qapi/acpi-hest.json +F: scripts/ghes_decode.py F: scripts/ghes_inject.py F: scripts/arm_processor_error.py F: scripts/qmp_helper.py diff --git a/scripts/ghes_decode.py b/scripts/ghes_decode.py new file mode 100644 index 000000000000..6c7fdfe84e3a --- /dev/null +++ b/scripts/ghes_decode.py @@ -0,0 +1,1155 @@ +#!/usr/bin/env python3 +# +# pylint: disable=3DR0903,R0912,R0913,R0915,R0917,R1713,E1121,C0302,W0613 +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2025 Mauro Carvalho Chehab + +""" +Helper classes to decode a generic error data entry. + +By purpose, the logic here is independent of the logic inside qmp_helper +and other modules. With a different implementation, it is more likely to +discover bugs at the error injection logic. Also, as this can be used to +dump errors injected by reproducing an error mesage or for fuzzy error +injection, it can't rely at the encoding logic inside each module of +ghes_inject.py. + +To make the decoder simple, the decode logic here is at field level, not +trying to decode bitmaps. +""" + +from typing import Optional + +class DecodeField(): + """ + Helper functions to decode a field, printing its results + """ + + def __init__(self, cper_data: bytearray): + """Initialize the decoder with a cper bytearray""" + self.data =3D cper_data + self.pos =3D 0 + self.past_end =3D False + + @property + def remaining(self): + """Returns the number of bytes not decoded yet""" + return max(0, len(self.data) - self.pos) + + @property + def is_end(self): + """ + Returns true if all bytes were decoded and it didn't try + to read past the end. + """ + if not self.past_end and self.pos =3D=3D len(self.data): + return True + + return False + + def decode(self, name: str, size: int, ftype: str, + pos: Optional[int] =3D None, + show_incomplete: Optional[bool] =3D False) -> None: + """ + Decodes and outputs a specified field from an ACPI table. + + For ints, we opted to decode them byte by byte, thus not being + limited to an integer max size. + + Arguments: + name: name of the field + size: number of bytes of the field + ftype: field type (str, int, guid, bcd) + pos: if specified, show a field at the specific position. If + not, use last position and increment it with size at the = end + """ + if pos: + cur_pos =3D pos + else: + cur_pos =3D self.pos + + try: + if cur_pos + size > len(self.data): + if not pos: + self.past_end =3D True + + if not show_incomplete: + decoded =3D "N/A" + return None + + raw_data =3D self.data[cur_pos:cur_pos + size] + + decoded =3D "" + if ftype =3D=3D "str": + failures =3D False + for b in raw_data: + if b >=3D 32 and b <=3D 126: # pylint: disa= ble=3DR1716 + decoded +=3D chr(b) + elif b: + decoded +=3D '.' + failures =3D True + else: + decoded +=3D r'\x0' + + if failures: + decoded +=3D " # warning: non-ascii chars found" + + if self.past_end: + if decoded: + decoded +=3D " " + decoded +=3D "EOL" + + elif ftype =3D=3D "int": + i =3D 0 + for b in reversed(raw_data): + i +=3D 1 + if len(raw_data) > 8 and i > 1: + decoded +=3D " " + + decoded +=3D f"{b:02x}" + + if self.past_end: + if decoded: + decoded +=3D " " + decoded +=3D "EOL" + + elif ftype =3D=3D "guid": + if len(raw_data) !=3D 16 or size !=3D 16: + decoded =3D "Invalid GUID" + else: + for b in reversed(raw_data[0:4]): + decoded +=3D f"{b:02x}" + + decoded +=3D "-" + + for b in reversed(raw_data[4:6]): + decoded +=3D f"{b:02x}" + + decoded +=3D "-" + + for b in reversed(raw_data[6:8]): + decoded +=3D f"{b:02x}" + + decoded +=3D "-" + + for b in raw_data[8:10]: + decoded +=3D f"{b:02x}" + + decoded +=3D "-" + + for b in raw_data[10:]: + decoded +=3D f"{b:02x}" + + raw_data =3D decoded + + elif ftype =3D=3D "bcd": + val =3D 0 + for b in raw_data: + if (b & 0xf0) > 9 or (b & 0x0f) > 9: + raise ValueError("Invalid BCD value") + val =3D (val << 4) | (b & 0x0f) + + decoded =3D f"{val:0{size * 2}x}" + + if self.past_end: + if decoded: + decoded +=3D " " + decoded +=3D "EOL" + else: + decoded =3D f"Warning: Unknown format {ftype}" + + except ValueError as e: + decoded =3D f"Error decoding {e}" + + finally: + print(f"{name:<26s}: {decoded}") + if not pos: + self.pos +=3D size + + return raw_data + + +class DecodeProcGeneric(): + """ + Class to decode a Generic Processor Error as defined at + UEFI 2.1 - N.2.2 Section Descriptor + """ + # GUID for Generic Processor Error + guid =3D "9876ccad-47b4-4bdb-b65e-16f193c4f3db" + + fields =3D [ + ("Validation Bits", 8, "int"), + ("Processor Type", 1, "int"), + ("Processor ISA", 1, "int"), + ("Processor Error Type", 1, "int"), + ("Operation", 1, "int"), + ("Flags", 1, "int"), + ("Level", 1, "int"), + ("Reserved", 2, "int"), + ("CPU Version Info", 8, "int"), + ("CPU Brand String", 128, "str"), + ("Processor ID", 8, "int"), + ("Target Address", 8, "int"), + ("Requestor Identifier", 8, "int"), + ("Responder Identifier", 8, "int"), + ("Instruction IP", 8, "int") + ] + + def __init__(self, cper: DecodeField): + self.cper =3D cper + + def decode(self, guid): + """Decode Generic Processor Error""" + print("Generic Processor Error") + + for name, size, ftype in self.fields: + self.cper.decode(name, size, ftype) + + @staticmethod + def decode_list(): + """ + Returns a tuple with the GUID and class + """ + return [(DecodeProcGeneric.guid, DecodeProcGeneric)] + +class DecodeProcX86(): + """ + Class to decode an x86 Processor Error as defined at + UEFI 2.1 - N.2.2 Section Descriptor + """ + + # GUID for x86 Processor Error + guid =3D "dc3ea0b0-a144-4797-b95b-53fa242b6e1d" + + pei_fields =3D [ + ("Error Structure Type", 16, "guid"), + ("Validation Bits", 8, "int"), + ("Check Information", 8, "int"), + ("Target Identifier", 8, "int"), + ("Requestor Identifier", 8, "int"), + ("Responder Identifier", 8, "int"), + ("Instruction Pointer", 8, "int") + ] + + def __init__(self, cper: DecodeField): + self.cper =3D cper + + def decode(self, guid): + """Decode x86 Processor Error""" + print("x86 Processor Error") + + val =3D self.cper.decode("Validation Bits", 8, "int") + try: + val_bits =3D int.from_bytes(val, byteorder=3D'little') + except ValueError, TypeError: + val_bits =3D 0 + + error_info_num =3D (val_bits >> 2) & 0x3f # bits 2-7 + context_info_num =3D (val_bits >> 8) & 0xff # bits 8-13 + + self.cper.decode("Local APIC_ID", 8, "int") + self.cper.decode("CPUID Info", 48, "int") + + for pei in range(0, error_info_num): + if self.cper.past_end: + return + + print() + print(f"Processor Error Info {pei}") + for name, size, ftype in self.pei_fields: + self.cper.decode(name, size, ftype) + + for ctx in range(0, context_info_num): + if self.cper.past_end: + return + + print() + print(f"Context {ctx}") + + self.cper.decode("Register Context Type", 2, "int") + + val =3D self.cper.decode("Register Array Size", 2, "int") + try: + context_size =3D int(int.from_bytes(val, byteorder=3D'litt= le') / 8) + except ValueError, TypeError: + context_size =3D 0 + + self.cper.decode("MSR Address", 4, "int") + self.cper.decode("MM Register Address", 8, "int") + + for reg in range(0, context_size): + if self.cper.past_end: + return + self.cper.decode(f"Register offset {reg:<3}", 8, "int") + + @staticmethod + def decode_list(): + """ + Returns a tuple with the GUID and class + """ + return [(DecodeProcX86.guid, DecodeProcX86)] + +class DecodeProcItanium(): + """ + Class to decode an Itanium Processor Error as defined at + UEFI 2.1 - N.2.2 Section Descriptor + """ + + # GUID for Itanium Processor Error + guid =3D "e429faf1-3cb7-11d4-bca7-0080c73c8881" + + def __init__(self, cper: DecodeField): + self.cper =3D cper + + def decode(self, guid): + """ + Decode Itanium Processor Error. + + Itanum processors stopped being sold in 2021. Probably not much + sense implementing a decoder for it. + """ + + print("Itanium Processor Error") + + remaining =3D self.cper.remaining + if remaining: + print() + self.cper.decode("Data", remaining, "int") + + @staticmethod + def decode_list(): + """ + Returns a tuple with the GUID and class + """ + return [(DecodeProcItanium.guid, DecodeProcItanium)] + + +class DecodeProcArm(): + """ + Class to decode an ARM Processor Error as defined at + UEFI 2.6 - N.2.2 Section Descriptor + """ + + # GUID for ARM Processor Error + guid =3D "e19e3d16-bc11-11e4-9caa-c2051d5d46b0" + + arm_pei_fields =3D [ + ("Version", 1, "int"), + ("Length", 1, "int"), + ("valid", 2, "int"), + ("type", 1, "int"), + ("multiple-error", 2, "int"), + ("flags", 1, "int"), + ("error-info", 8, "int"), + ("virt-addr", 8, "int"), + ("phy-addr", 8, "int"), + ] + + def __init__(self, cper: DecodeField): + self.cper =3D cper + + def decode(self, guid): + """Decode Processor ARM""" + + print("ARM Processor Error") + + start =3D self.cper.pos + + self.cper.decode("Valid", 4, "int") + + val =3D self.cper.decode("Error Info num", 2, "int") + try: + error_info_num =3D int.from_bytes(val, byteorder=3D'little') + except ValueError, TypeError: + error_info_num =3D 0 + + val =3D self.cper.decode("Context Info num", 2, "int") + try: + context_info_num =3D int.from_bytes(val, byteorder=3D'little') + except ValueError, TypeError: + context_info_num =3D 0 + + val =3D self.cper.decode("Section Length", 4, "int") + try: + section_length =3D int.from_bytes(val, byteorder=3D'little') + except ValueError, TypeError: + section_length =3D 0 + + self.cper.decode("Error affinity level", 1, "int") + self.cper.decode("Reserved", 3, "int") + self.cper.decode("MPIDR_EL1", 8, "int") + self.cper.decode("MIDR_EL1", 8, "int") + self.cper.decode("Running State", 4, "int") + self.cper.decode("PSCI State", 4, "int") + + for pei in range(0, error_info_num): + if self.cper.past_end: + return + + print() + print(f"Processor Error Info {pei}") + for name, size, ftype in self.arm_pei_fields: + self.cper.decode(name, size, ftype) + + for ctx in range(0, context_info_num): + if self.cper.past_end: + return + + print() + print(f"Context {ctx}") + self.cper.decode("Version", 2, "int") + self.cper.decode("Register Context Type", 2, "int") + val =3D self.cper.decode("Register Array Size", 4, "int") + try: + context_size =3D int(int.from_bytes(val, byteorder=3D'litt= le') / 8) + except ValueError: + context_size =3D 0 + + for reg in range(0, context_size): + if self.cper.past_end: + return + self.cper.decode(f"Register {reg:<3}", 8, "int") + + remaining =3D max(section_length + start - self.cper.pos, 0) + if remaining: + print() + self.cper.decode("Vendor data", remaining, "int") + + @staticmethod + def decode_list(): + """ + Returns a tuple with the GUID and class + """ + return [(DecodeProcArm.guid, DecodeProcArm)] + + +class DecodePlatformMem(): + """ + Class to decode a Platform Memory Error as defined at + UEFI 2.1 - N.2.2 Section Descriptor + """ + + # GUID for Platform Memory Error + guid =3D "a5bc1114-6f64-4ede-b863-3e83ed7c83b1" + + fields =3D [ + ("Validation Bits", 8, "int"), + ("Error Status", 8, "int"), + ("Physical Address", 8, "int"), + ("Physical Address Mask", 8, "int"), + ("Node", 2, "int"), + ("Card", 2, "int"), + ("Module", 2, "int"), + ("Bank", 2, "int"), + ("Device", 2, "int"), + ("Row", 2, "int"), + ("Column", 2, "int"), + ("Bit Position", 2, "int"), + ("Requestor ID", 8, "int"), + ("Responder ID", 8, "int"), + ("Target ID", 8, "int"), + ("Memory Error Type", 1, "int"), + ("Extended", 1, "int"), + ("Rank Number", 2, "int"), + ("Card Handle", 2, "int"), + ("Module Handle", 2, "int") + ] + + def __init__(self, cper: DecodeField): + self.cper =3D cper + + def decode(self, guid): + """Decode Platform Memory Error""" + print("Platform Memory Error") + + for name, size, ftype in self.fields: + self.cper.decode(name, size, ftype) + + @staticmethod + def decode_list(): + """ + Returns a tuple with the GUID and class + """ + return [(DecodePlatformMem.guid, DecodePlatformMem)] + + +class DecodePlatformMem2(): + """ + Class to decode a Platform Memory Error (Type 2) as defined at + UEFI 2.5 - N.2.6. Memory Error Section 2 + """ + + # GUID for Platform Memory Error Type 2 + guid =3D "61ec04fc-48e6-d813-25c9-8daa44750b12" + + fields =3D [ + ("Validation Bits", 8, "int"), + ("Error Status", 8, "int"), + ("Physical Address", 8, "int"), + ("Physical Address Mask", 8, "int"), + ("Node", 2, "int"), + ("Card", 2, "int"), + ("Module", 2, "int"), + ("Bank", 2, "int"), + ("Device", 4, "int"), + ("Row", 4, "int"), + ("Column", 4, "int"), + ("Rank", 4, "int"), + ("Bit Position", 4, "int"), + ("Chip Identification", 1, "int"), + ("Memory Error Type", 1, "int"), + ("Status", 1, "int"), + ("Reserved", 1, "int"), + ("Requestor ID", 8, "int"), + ("Responder ID", 8, "int"), + ("Target ID", 8, "int"), + ("Card Handle", 4, "int"), + ("Module Handle", 4, "int") + ] + + def __init__(self, cper: DecodeField): + self.cper =3D cper + + def decode(self, guid): + """Decode Platform Memory Error Type 2""" + print("Platform Memory Error Type 2") + + for name, size, ftype in self.fields: + self.cper.decode(name, size, ftype) + + @staticmethod + def decode_list(): + """ + Returns a tuple with the GUID and class + """ + return [(DecodePlatformMem2.guid, DecodePlatformMem2)] + + +class DecodePCIe(): + """ + Class to decode a PCI Express Error as defined at + UEFI 2.1 - N.2.2 Section Descriptor + """ + # GUID for PCI Express Error + guid =3D "d995e954-bbc1-430f-ad91-b44dcb3c6f35" + + fields =3D [ + ("Validation Bits", 8, "int"), + ("Port Type", 4, "int"), + ("Version", 4, "int"), + ("Command Status", 4, "int"), + ("RCRB High Address", 4, "int"), + ("Device ID", 16, "int"), + ("Device Serial Number", 8, "int"), + ("Bridge Control Status", 4, "int"), + ("Capability Structure", 60, "int"), + ("AER Info", 96, "int") + ] + + def __init__(self, cper: DecodeField): + self.cper =3D cper + + def decode(self, guid): + """Decode PCI Express Error""" + print("PCI Express Error") + + for name, size, ftype in self.fields: + self.cper.decode(name, size, ftype) + + @staticmethod + def decode_list(): + """ + Returns a tuple with the GUID and class + """ + return [(DecodePCIe.guid, DecodePCIe)] + + +class DecodePCIBus(): + """ + Class to decode a PCI Bus Error as defined at + UEFI 2.1 - N.2.2 Section Descriptor + """ + + # GUID for PCI Bus Error + guid =3D "c5753963-3b84-4095-bf78-eddad3f9c9dd" + + fields =3D [ + ("Validation Bits", 8, "int"), + ("Error Status", 8, "int"), + ("Error Type", 2, "int"), + ("Bus Id", 2, "int"), + ("Reserved", 4, "int"), + ("Bus Address", 8, "int"), + ("Bus Data", 8, "int"), + ("Bus Command", 8, "int"), + ("Bus Requestor Id", 8, "int"), + ("Bus Completer Id", 8, "int"), + ("Target Id", 8, "int") + ] + + def __init__(self, cper: DecodeField): + self.cper =3D cper + + def decode(self, guid): + """Decode PCI Bus Error""" + print("PCI Bus Error") + + for name, size, ftype in self.fields: + self.cper.decode(name, size, ftype) + + @staticmethod + def decode_list(): + """ + Returns a tuple with the GUID and class + """ + return [(DecodePCIBus.guid, DecodePCIBus)] + + +class DecodePCIDev(): + """ + Class to decode a PCI Device Error as defined at + UEFI 2.1 - N.2.2 Section Descriptor + """ + + # GUID for PCI Device Error + guid =3D "eb5e4685-ca66-4769-b6a2-26068b001326" + + def __init__(self, cper: DecodeField): + self.cper =3D cper + + def decode(self, guid): + """Decode PCI Device Error""" + print("PCI Device Error") + + self.cper.decode("Validation Bits", 8, "int") + self.cper.decode("Error Status", 8, "int") + self.cper.decode("Id Info", 16, "int") + + val =3D self.cper.decode("Memory Number", 4, "int") + try: + mem_num =3D int.from_bytes(val, byteorder=3D'little') + except ValueError, TypeError: + mem_num =3D 0 + + self.cper.decode("IO Number", 4, "int") + + for mem in range(0, mem_num): + if self.cper.past_end: + return + + print() + print(f"Register Data Pair {mem}") + self.cper.decode("Register 0", 8, "int") + self.cper.decode("Register 1", 8, "int") + + @staticmethod + def decode_list(): + """ + Returns a tuple with the GUID and class + """ + return [(DecodePCIDev.guid, DecodePCIDev)] + + +class DecodeFWError(): + """ + Class to decode a Firmware Error as defined at + UEFI 2.1 - N.2.2 Section Descriptor + """ + + # GUID for Firmware Error + guid =3D "81212a96-09ed-4996-9471-8d729c8e69ed" + + # NOTE: UEFI 2.11 has a discrepancy, as it lists: + # byte offset 1: revision (1 byte) + # byte offset 1: reserved (7 bytes) + # + # both starting at position 1. We opted to change reserved size to 6, + # in order to better cope with the spec issues + + fields =3D [ + ("Firmware Error Record Type", 1, "int"), + ("Revision", 1, "int"), + ("Reserved", 6, "int"), + ("Record Identifier", 8, "int"), + ("Record identifier GUID extension", 16, "guid") + ] + + def __init__(self, cper: DecodeField): + self.cper =3D cper + + def decode(self, guid): + """Decode Firmware Error""" + print("Firmware Error") + + for name, size, ftype in self.fields: + self.cper.decode(name, size, ftype) + + @staticmethod + def decode_list(): + """ + Returns a tuple with the GUID and class + """ + return [(DecodeFWError.guid, DecodeFWError)] + + +class DecodeDMAGeneric(): + """ + Class to decode a Generic DMA Error as defined at + UEFI 2.2 - N.2.2 Section Descriptor + """ + + # GUID for Generic DMA Error + guid =3D "5b51fef7-c79d-4434-8f1b-aa62de3e2c64" + + fields =3D [ + ("Requester-ID", 2, "int"), + ("Segment Number", 2, "int"), + ("Fault Reason", 1, "int"), + ("Access Type", 1, "int"), + ("Address Type", 1, "int"), + ("Architecture Type", 1, "int"), + ("Device Address", 8, "int"), + ("Reserved", 16, "int") + ] + + def __init__(self, cper: DecodeField): + self.cper =3D cper + + def decode(self, guid): + """Decode Generic DMA Error""" + print("Generic DMA Error") + + for name, size, ftype in self.fields: + self.cper.decode(name, size, ftype) + + @staticmethod + def decode_list(): + """ + Returns a tuple with the GUID and class + """ + return [(DecodeDMAGeneric.guid, DecodeDMAGeneric)] + + +class DecodeDMAVT(): + """ + Class to decode a DMA Virtualization Technology Error as defined at + UEFI 2.2 - N.2.2 Section Descriptor + """ + + # GUID for DMA VT Error + guid =3D "71761d37-32b2-45cd-a7d0-b0fedd93e8cf" + + fields =3D [ + ("Version", 1, "int"), + ("Revision", 1, "int"), + ("OemId", 6, "int"), + ("Capability", 8, "int"), + ("Extended Capability", 8, "int"), + ("Global Command", 4, "int"), + ("Global Status", 4, "int"), + ("Fault Status", 4, "int"), + ("Reserved", 12, "int"), + ("Fault record", 16, "int"), + ("Root Entry", 16, "int"), + ("Context Entry", 16, "int"), + ("Level 6 Page Table Entry", 8, "int"), + ("Level 5 Page Table Entry", 8, "int"), + ("Level 4 Page Table Entry", 8, "int"), + ("Level 3 Page Table Entry", 8, "int"), + ("Level 2 Page Table Entry", 8, "int"), + ("Level 1 Page Table Entry", 8, "int") + ] + + def __init__(self, cper: DecodeField): + self.cper =3D cper + + def decode(self, guid): + """Decode DMA VT Error""" + print("DMA VT Error") + + for name, size, ftype in self.fields: + self.cper.decode(name, size, ftype) + + @staticmethod + def decode_list(): + """ + Returns a tuple with the GUID and class + """ + return [(DecodeDMAVT.guid, DecodeDMAVT)] + + +class DecodeDMAIOMMU(): + """ + Class to decode an IOMMU DMA Error as defined at + UEFI 2.2 - N.2.2 Section Descriptor + """ + + # GUID for IOMMU DMA Error + guid =3D "036f84e1-7f37-428c-a79e-575fdfaa84ec" + + fields =3D [ + ("Revision", 1, "int"), + ("Reserved", 7, "int"), + ("Control", 8, "int"), + ("Status", 8, "int"), + ("Reserved", 8, "int"), + ("Event Log Entry", 16, "int"), + ("Reserved", 16, "int"), + ("Device Table Entry", 32, "int"), + ("Level 6 Page Table Entry", 8, "int"), + ("Level 5 Page Table Entry", 8, "int"), + ("Level 4 Page Table Entry", 8, "int"), + ("Level 3 Page Table Entry", 8, "int"), + ("Level 2 Page Table Entry", 8, "int"), + ("Level 1 Page Table Entry", 8, "int") + ] + + def __init__(self, cper: DecodeField): + self.cper =3D cper + + def decode(self, guid): + """Decode IOMMU DMA Error""" + print("IOMMU DMA Error") + + for name, size, ftype in self.fields: + self.cper.decode(name, size, ftype) + + @staticmethod + def decode_list(): + """ + Returns a tuple with the GUID and class + """ + return [(DecodeDMAIOMMU.guid, DecodeDMAIOMMU)] + + +class DecodeCCIXPER(): + """ + Class to decode a CCIX Protocol Error as defined at + UEFI 2.8 - N.2.12. CCIX PER Log Error Section + """ + + # GUID for CCIX Protocol Error + guid =3D "91335ef6-ebfb-4478-a6a6-88b728cf75d7" + + fields =3D [ + ("Validation Bits", 8, "int"), + ("CCIX Source ID", 1, "int"), + ("CCIX Port ID", 1, "int"), + ("Reserved", 2, "int"), + ] + + def __init__(self, cper: DecodeField): + self.cper =3D cper + + def decode(self, guid): + """Decode CCIX Protocol Error""" + print("CCIX Protocol Error") + + val =3D self.cper.decode("Length", 4, "int") + try: + length =3D int.from_bytes(val, byteorder=3D'little') + except ValueError, TypeError: + length =3D 0 + + for name, size, ftype in self.fields: + self.cper.decode(name, size, ftype) + + remaining =3D max(0, length - self.cper.pos) + for dword in range(0, int(remaining / 4)): + if self.cper.past_end: + return + + self.cper.decode(f"CCIX PER log {dword}", 4, "int") + + @staticmethod + def decode_list(): + """ + Returns a tuple with the GUID and class + """ + return [(DecodeCCIXPER.guid, DecodeCCIXPER)] + + +class DecodeCXLProtErr(): + """ + Class to decode a CXL Protocol Error as defined at + UEFI 2.9 - N.2.13. Compute Express Link (CXL) Protocol Error Section + """ + + # GUID for CXL Protocol Error + guid =3D "80b9efb4-52b5-4de3-a777-68784b771048" + + fields =3D [ + ("Validation Bits", 8, "int"), + ("CXL Agent Type", 1, "int"), + ("Reserved", 7, "int"), + ("CXL Agent Address", 8, "int"), + ("Device ID", 16, "int"), + ("Device Serial Number", 8, "int"), + ("Capability Structure", 60, "int"), + ] + + def __init__(self, cper: DecodeField): + self.cper =3D cper + + def decode(self, guid): + """Decode CXL Protocol Error""" + print("CXL Protocol Error") + + for name, size, ftype in self.fields: + self.cper.decode(name, size, ftype) + + val =3D self.cper.decode("CXL DVSEC Length", 2, "int") + try: + cxl_devsec_len =3D int.from_bytes(val, byteorder=3D'little') + except ValueError, TypeError: + cxl_devsec_len =3D 0 + + val =3D self.cper.decode("CXL Error Log Length", 2, "int") + try: + cxl_error_log_len =3D int.from_bytes(val, byteorder=3D'little') + except ValueError, TypeError: + cxl_error_log_len =3D 0 + + self.cper.decode("Reserved", 4, "int") + self.cper.decode("CXL DVSEC", cxl_devsec_len, "int", + show_incomplete=3DTrue) + self.cper.decode("CXL Error Log", cxl_error_log_len, "int", + show_incomplete=3DTrue) + + @staticmethod + def decode_list(): + """ + Returns a tuple with the GUID and class + """ + return [(DecodeCXLProtErr.guid, DecodeCXLProtErr)] + + +class DecodeCXLCompEvent(): + """ + Class to decode a CXL Component Error as defined at + UEFI 2.9 - N.2.14. CXL Component Events Section + + Currently, the decoder handles only the common fields, displaying + the CXL Component Event Log field in bytes. + """ + + # GUIDs, as defined at CXL specification 3.2: 8.2.10.2.1 Event Records + guids =3D [ + ("General Media", "fbcd0a77-c260-417f-85a9-088b1621eb= a6"), + ("DRAM", "601dcbb3-9c06-4eab-b8af-4e9bfb5c96= 24"), + ("Memory Module", "fe927475-dd59-4339-a586-79bab113bc= 74"), + ("Memory Sparing", "e71f3a40-2d29-4092-8a39-4d1c966c7c= 65"), + ("Physical Switch", "77cf9271-9c02-470b-9fe4-bc7b75f2da= 97"), + ("Virtual Switch", "40d26425-3396-4c4d-a5da-3d472a63af= 25"), + ("MDL Port", "8dc44363-0c96-4710-b7bf-04bb99534c= 3f"), + ("Dynamic Capabilities", "ca95afa7-f183-4018-8c2f-95268e101a= 2a"), + ] + + fields =3D [ + ("Validation Bits", 8, "int"), + ("Device ID", 12, "int"), + ("Device Serial Number", 8, "int") + ] + + def __init__(self, cper: DecodeField): + self.cper =3D cper + + def decode(self, guid): + """Decode CXL Protocol Error""" + for name, guid_event in DecodeCXLCompEvent.guids: + if guid =3D=3D guid_event: + print(f"CXL {name} Event Record") + break + + val =3D self.cper.decode("Length", 4, "int") + try: + length =3D int.from_bytes(val, byteorder=3D'little') + except ValueError, TypeError: + length =3D 0 + + for name, size, ftype in self.fields: + self.cper.decode(name, size, ftype) + + length =3D max(0, length - self.cper.pos) + + self.cper.decode("CXL Component Event Log", length, "int", + show_incomplete=3DTrue) + + @staticmethod + def decode_list(): + """ + Returns a tuple with the GUID and class + """ + + guid_list =3D [] + + for _, guid in DecodeCXLCompEvent.guids: + guid_list.append((guid, DecodeCXLCompEvent)) + + return guid_list + + +class DecodeFRUMemoryPoison(): + """ + Class to decode a CXL Protocol Error as defined at + UEFI 2.11 - N.2.15 FRU Memory Poison Section + """ + + # GUID for FRU Memory Poison Section + guid =3D "5e4706c1-5356-48c6-930b-52f2120a4458" + + common_fields =3D [ + ("Checksum", 4, "int"), + ("Validation Bits", 8, "int"), + ("FRU Architecture Type", 4, "int"), + ("FRU Architecture Value", 8, "int"), + ("FRU Identifier Type", 4, "int"), + ("FRU Identifier Value", 8, "int") + ] + + poison_fields =3D [ + ("Poison Timestamp", 8, "int"), + ("Hardware Identifier Type", 4, "int"), + ("Hardware Identifier Value", 8, "int"), + ("Address Type", 4, "int"), + ("Address Value", 8, "int") + ] + + def __init__(self, cper: DecodeField): + self.cper =3D cper + + def decode(self, guid): + """Decode CXL Protocol Error""" + print("FRU Memory Poison") + + for name, size, ftype in self.common_fields: + self.cper.decode(name, size, ftype) + + val =3D self.cper.decode("Poison List Entries", 4, "int") + try: + poison_list_entries =3D int.from_bytes(val, byteorder=3D'littl= e') + except ValueError, TypeError: + poison_list_entries =3D 0 + + for entry in range(0, poison_list_entries): + if self.cper.past_end: + return + + print() + print(f"Poison List {entry}") + for name, size, ftype in self.poison_fields: + if self.cper.past_end: + return + + self.cper.decode(name, size, ftype) + + @staticmethod + def decode_list(): + """ + Returns a tuple with the GUID and class + """ + return [(DecodeFRUMemoryPoison.guid, DecodeFRUMemoryPoison)] + + +class DecodeGhesEntry(): + """ + Class to decode a GHESv2 element, as defined at: + ACPI 6.1: 18.3.2.8 Generic Hardware Error Source version 2 + """ + + # Fields present on all CPER records + common_fields =3D [ + # Generic Error Status Block fields + ("Block Status", 4, "int", None), + ("Raw Data Offset", 4, "int", "raw_data_offset"), + ("Raw Data Length", 4, "int", "raw_data_len"), + ("Data Length", 4, "int", None), + ("Error Severity", 4, "int", None), + + # Generic Error Data Entry + ("Section Type", 16, "guid", "session_type"), + ("Error Severity", 4, "int", None), + ("Revision", 2, "int", None), + ("Validation Bits", 1, "int", None), + ("Flags", 1, "int", None), + ("Error Data Length", 4, "int", None), + ("FRU Id", 16, "guid", None), + ("FRU Text", 20, "str", None), + ("Timestamp", 8, "bcd", None), + ] + + def __init__(self, cper_data: bytearray): + """ + Initializes a byte array, decoding it, printing results at the + screen. + """ + + # Create a decode list with the per-type decoders + decode_list =3D [] + decode_list +=3D DecodeProcGeneric.decode_list() + decode_list +=3D DecodeProcX86.decode_list() + decode_list +=3D DecodeProcItanium.decode_list() + decode_list +=3D DecodeProcArm.decode_list() + decode_list +=3D DecodePlatformMem.decode_list() + decode_list +=3D DecodePlatformMem2.decode_list() + decode_list +=3D DecodePCIe.decode_list() + decode_list +=3D DecodePCIBus.decode_list() + decode_list +=3D DecodePCIDev.decode_list() + decode_list +=3D DecodeFWError.decode_list() + decode_list +=3D DecodeDMAGeneric.decode_list() + decode_list +=3D DecodeDMAVT.decode_list() + decode_list +=3D DecodeDMAIOMMU.decode_list() + decode_list +=3D DecodeCCIXPER.decode_list() + decode_list +=3D DecodeCXLProtErr.decode_list() + decode_list +=3D DecodeCXLCompEvent.decode_list() + decode_list +=3D DecodeFRUMemoryPoison.decode_list() + + # Handle common types + cper =3D DecodeField(cper_data) + + fields =3D {} + for name, size, ftype, var in self.common_fields: + val =3D cper.decode(name, size, ftype) + + if ftype =3D=3D "int": + try: + val =3D int.from_bytes(val, byteorder=3D'little') + except ValueError, TypeError: + val =3D 0 + + if var is not None: + fields[var] =3D val + + if fields["raw_data_len"]: + cper.decode("Raw Data", fields["raw_data_len"], + "int", pos=3Dfields["raw_data_offset"]) + + if not fields["session_type"]: + return + + print() + + # Now, decode the rest of the record for known decoders + for guid, cls in decode_list: + if fields["session_type"] =3D=3D guid: + dec =3D cls(cper) + dec.decode(guid) + + if not cper.is_end: + print() + print("Warning: incomplete decode or broken CPER") + if cper.remaining: + cper.decode("Extra Data", cper.remaining, "int") + + print() + return + + # If we don't have a class to decode the full payload, + # output the undecoded part + print(f"Unknown GGID: {fields['session_type']}") + remaining =3D cper.remaining + if remaining: + cper.decode("Payload", remaining, "int") + + print() diff --git a/scripts/qmp_helper.py b/scripts/qmp_helper.py index 80fdaef60214..297f80d3cb48 100755 --- a/scripts/qmp_helper.py +++ b/scripts/qmp_helper.py @@ -21,6 +21,7 @@ sys.path.append(os_path.join(qemu_dir, 'python')) =20 from qemu.qmp.legacy import QEMUMonitorProtocol + from ghes_decode import DecodeGhesEntry =20 except ModuleNotFoundError as exc: print(f"Module '{exc.name}' not found.") @@ -680,6 +681,8 @@ def send_cper(self, notif_type, payload, =20 util.dump_bytearray("Payload", payload) =20 + DecodeGhesEntry(cper_data) + return self.send_cper_raw(cper_data, timeout=3Dtimeout) =20 def search_qom(self, path, prop, regex): --=20 2.53.0 From nobody Sun Apr 12 00:53:17 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=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1771847520; cv=none; d=zohomail.com; s=zohoarc; b=fcTLIZGA8F1hT/sAfFs3lSZRqtrMYPII6qMVzQjGfVH8Tx7Ab/Q+XynY+1LjM7FrKMil7f7lU2FPdzwarJ48UyvNyynWXSA1/CUMSypkFsNjwA38b/poEpsbuxuXy39ciEvkNfcGFFarCY/Iwwo1dn8lNx6FVMHUawFyggaEHWs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771847520; 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=Bsijw2oFf50zfbhcilCm+OgTtdYXd9vxHVVFdQuiDnU=; b=M0epNe3a6MasA4CMdosGfierPFN47q4g+fgLnTKaG20RgSNWLiCuzgea3elqjld5AIqPc7FB1PiFSVuEB5fTlAc7ITH8D3HK9lnmGnUlevnHJmeRZGiXlsYq63otur1Q5vYYL2Q0/SviIaTsJLlrBiJAQ5OkHlKZ2FJ6u3I+okA= 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 1771847520751242.0545345777033; Mon, 23 Feb 2026 03:52:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vuUSn-0004VG-JI; Mon, 23 Feb 2026 06:50:57 -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 1vuUSc-0004SG-8Z for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:46 -0500 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vuUSX-0004rh-4F for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:45 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 0240A443A5; Mon, 23 Feb 2026 11:50:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0B5AC2BC9E; Mon, 23 Feb 2026 11:50:33 +0000 (UTC) Received: from mchehab by mail.kernel.org with local (Exim 4.99.1) (envelope-from ) id 1vuUSO-00000007JoR-0UG4; Mon, 23 Feb 2026 12:50:32 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771847433; bh=7wkhWQx0OVm0fhiqLkvqrfLKqF/jJ/70yA1ANDUDhFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DjHledo4byn/Dg4gRfos4Gr87z1rP/8vzkSdPv5GiTIk07eUli6HvctynQLFPRZ9H cZJp+XMEFjG4OT/sffmEmQMkIr4GCHjAzdqYm1a/+owvCXu5w5s1Ih15ShNq31CO6Y yfWqsqdct+4sTvGYSpo6GaFlXW5vQyYM8ckY529w6odIQcfpH5m0V4gm23maoLlNUh s06qSrc59z11RDbNRIh7IXpX1cK0rWaI/KXWb1FXjNv5SuUH5zUMmFAor6rAOJr0K7 AgP7JBa2FFtFV6YbAmRJnsuq5fiqZFp4zT0eUL6pgsw/6Ckp7YR/zA+3Vw5QT9pymg OYnBCmT+D2drw== From: Mauro Carvalho Chehab To: Michael S Tsirkin Cc: Jonathan Cameron , Shiju Jose , qemu-devel@nongnu.org, Igor Mammedov , Mauro Carvalho Chehab , Cleber Rosa , John Snow Subject: [PATCH v3 09/14] scripts/ghes_inject: exit 1 if command was not sent Date: Mon, 23 Feb 2026 12:50:25 +0100 Message-ID: <048db3ff4105e897b5e1356e086171920dcb35de.1771847176.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2600:3c0a:e001:78e:0:1991:8:25; envelope-from=mchehab+huawei@kernel.org; helo=sea.source.kernel.org 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1771847522189158500 add a return code to subparser func() and return 1 if the command failed. Signed-off-by: Mauro Carvalho Chehab --- scripts/arm_processor_error.py | 2 +- scripts/ghes_inject.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/arm_processor_error.py b/scripts/arm_processor_error.py index 73d069f070d4..d9845adb0c0a 100644 --- a/scripts/arm_processor_error.py +++ b/scripts/arm_processor_error.py @@ -473,4 +473,4 @@ def send_cper(self, args): =20 self.data =3D data =20 - qmp_cmd.send_cper(cper_guid.CPER_PROC_ARM, self.data) + return qmp_cmd.send_cper(cper_guid.CPER_PROC_ARM, self.data) diff --git a/scripts/ghes_inject.py b/scripts/ghes_inject.py index 9a235201418b..6ac917d0b5db 100755 --- a/scripts/ghes_inject.py +++ b/scripts/ghes_inject.py @@ -43,7 +43,8 @@ def main(): =20 args =3D parser.parse_args() if "func" in args: - args.func(args) + if not args.func(args): + sys.exit(1) else: sys.exit(f"Please specify a valid command for {sys.argv[0]}") =20 --=20 2.53.0 From nobody Sun Apr 12 00:53:17 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=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1771847548; cv=none; d=zohomail.com; s=zohoarc; b=QRkmbl3NCril7xpa4hpMyv4ThBbnazTynIL+uSW2xn3G8iUZZXHyr/3Nnu7XWT1TLNJlKgNWxfOGiOkkc8fe1w7aWfPijKnJZrqQJ/DI6Dmepczi4bH29XjSdk8MJWEEk2wITacUGyOvlXDEB9X7qIu8O+wSS1LkGZ9yjSrGtk0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771847548; 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=FFlYXMCz64vHqUPji3jmZLzv07ltKSTaGNmrnSX28IY=; b=OGa387cIr0lEf9Ab7Io6I7Ga6oviLRfMBKBwmVjwaVQIIhGSXYCch1qLklRTdI/2VwZoDR8nyCmYdbImgXSBPjPptbGYkdDBXNj3CInq1NKle8kUIFDGMu7jdVQDu3zcWNUTJ9cd3k9+h6iu5WmW/H+V0rF6lEu+vkq31Szx1NM= 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 1771847548126300.89392402312046; Mon, 23 Feb 2026 03:52:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vuUSp-0004VT-58; Mon, 23 Feb 2026 06:50:59 -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 1vuUSe-0004Sl-PL for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:49 -0500 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vuUSY-0004sX-UW for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:47 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 3865044567; Mon, 23 Feb 2026 11:50:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8D7DC2BCB1; Mon, 23 Feb 2026 11:50:33 +0000 (UTC) Received: from mchehab by mail.kernel.org with local (Exim 4.99.1) (envelope-from ) id 1vuUSO-00000007JoV-0btq; Mon, 23 Feb 2026 12:50:32 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771847434; bh=8IGsY45WgQ5MJ7Ga/ShHTmTffKmcJOplT0F5ylfig7g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GNtcgCMqWxwH53pG66bM1+UZn95jxGMoKy76U7LfrNAp/7cYLrF7vDa6WVsxQZHxE P736T0kp1o+vhsLll3IUJ+xvEXfVcKra44WEGuBRX/x72IUfyJLmD+z6Thpcv1oK0A bDv/24DLwoTZTBfGwwFGLXIqDTAhoMy05moUqZk0l1Y4BLXrKlq0iaSnJZkXWgTDt1 uSl4SjmFoxBvzFy6Qpum7OtOJWTRxxaxCLeX3pGE/pJNy+AhsU+h2X6T9n8EUaORkA HgLS7oFU7VWRUAmXu4mHWrhkA9mZhKWyFPeWAAPhEipLtYAcWHFzJKqvGOVy4b11lY ods6g15dzKhYQ== From: Mauro Carvalho Chehab To: Michael S Tsirkin Cc: Jonathan Cameron , Shiju Jose , qemu-devel@nongnu.org, Igor Mammedov , Mauro Carvalho Chehab , Cleber Rosa , John Snow Subject: [PATCH v3 10/14] scripts/ghes_inject: add a handler for PCIe bus error Date: Mon, 23 Feb 2026 12:50:26 +0100 Message-ID: X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2600:3c0a:e001:78e:0:1991:8:25; envelope-from=mchehab+huawei@kernel.org; helo=sea.source.kernel.org 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1771847548497158500 Add a logic to do PCIe BUS error injection. On Linux Kernel, despite CPER_SEC_PCI_X_BUS macro is defined for such event, ghes.c doesn't implement support for it yet: [16950.077494] {26}[Hardware Error]: Hardware error from APEI Generic Hardw= are Error Source: 1 [16950.077866] {26}[Hardware Error]: event severity: recoverable [16950.078118] {26}[Hardware Error]: Error 0, type: recoverable [16950.078444] {26}[Hardware Error]: section type: unknown, c5753963-3b84= -4095-bf78-eddad3f9c9dd [16950.078800] {26}[Hardware Error]: section length: 0x48 [16950.079069] {26}[Hardware Error]: 00000000: 00000000 00000000 00000000= 00000000 ................ [16950.079442] {26}[Hardware Error]: 00000010: 00000001 00000000 00000000= 00000000 ................ [16950.079811] {26}[Hardware Error]: 00000020: 00000000 00000000 00000000= 00000000 ................ [16950.080181] {26}[Hardware Error]: 00000030: 00000000 00000000 00000000= 00000000 ................ [16950.080538] {26}[Hardware Error]: 00000040: 00000000 00000000 = ........ Signed-off-by: Mauro Carvalho Chehab --- MAINTAINERS | 1 + scripts/ghes_inject.py | 2 + scripts/pcie_bus_error.py | 146 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 149 insertions(+) create mode 100644 scripts/pcie_bus_error.py diff --git a/MAINTAINERS b/MAINTAINERS index a970c47dd089..48067a618523 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2228,6 +2228,7 @@ F: qapi/acpi-hest.json F: scripts/ghes_decode.py F: scripts/ghes_inject.py F: scripts/arm_processor_error.py +F: scripts/pcie_bus_error.py F: scripts/qmp_helper.py =20 ppc4xx diff --git a/scripts/ghes_inject.py b/scripts/ghes_inject.py index 6ac917d0b5db..29a6a57508cd 100755 --- a/scripts/ghes_inject.py +++ b/scripts/ghes_inject.py @@ -12,6 +12,7 @@ import sys =20 from arm_processor_error import ArmProcessorEinj +from pcie_bus_error import PcieBusError =20 EINJ_DESC =3D """ Handle ACPI GHESv2 error injection logic QEMU QMP interface. @@ -40,6 +41,7 @@ def main(): subparsers =3D parser.add_subparsers() =20 ArmProcessorEinj(subparsers) + PcieBusError(subparsers) =20 args =3D parser.parse_args() if "func" in args: diff --git a/scripts/pcie_bus_error.py b/scripts/pcie_bus_error.py new file mode 100644 index 000000000000..482b26db5e5f --- /dev/null +++ b/scripts/pcie_bus_error.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +# +# pylint: disable=3DC0114,R0903 +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2024 Mauro Carvalho Chehab + +from qmp_helper import qmp, util, cper_guid + +class PcieBusError: + """ + Implements PCI Express bus error injection via GHES + """ + + def __init__(self, subparsers): + """Initialize the error injection class and add subparser""" + + # Valid values + self.valid_bits =3D { + "status": util.bit(0), + "type": util.bit(1), + "bus-id": util.bit(2), + "bus-addr": util.bit(3), + "bus-data": util.bit(4), + "command": util.bit(5), + "requestor-id": util.bit(6), + "completer-id": util.bit(7), + "target-id": util.bit(8), + } + + self.bus_command_bits =3D { + "pci": 0, # Bit 56 is zero + "pci-x": util.bit(56) + } + + self.data =3D bytearray() + + parser =3D subparsers.add_parser("pcie-bus", + description=3D"Generate PCIe bus er= ror CPER") + g_pcie =3D parser.add_argument_group("PCIe bus error") + + valid_bits =3D ",".join(self.valid_bits.keys()) + bus_command_bits =3D ",".join(self.bus_command_bits.keys()) + + g_pcie.add_argument("-v", "--valid", + help=3Df"Valid bits: {valid_bits}") + g_pcie.add_argument("-s", "--error-status", + type=3Dlambda x: int(x, 0), + help=3D"Error Status") + g_pcie.add_argument("-t", "--error-type", + type=3Dlambda x: int(x, 0), + help=3D"Error type") + g_pcie.add_argument("-b", "--bus-number", + type=3Dlambda x: int(x, 0), + help=3D"Bus number") + g_pcie.add_argument("-S", "--segment-number", + type=3Dlambda x: int(x, 0), + help=3D"Segment number") + g_pcie.add_argument("-a", "--bus-address", + type=3Dlambda x: int(x, 0), + help=3D"Bus address") + g_pcie.add_argument("-d", "--bus-data", + type=3Dlambda x: int(x, 0), + help=3D"Bus data") + g_pcie.add_argument("-c", "--bus-command", + help=3Df"bus-command: {bus_command_bits}") + g_pcie.add_argument("-r", "--bus-requestor", + type=3Dlambda x: int(x, 0), + help=3D"Bus requestor ID") + g_pcie.add_argument("-C", "--bus-completer", + type=3Dlambda x: int(x, 0), + help=3D"Bus completer ID") + g_pcie.add_argument("-i", "--target-id", + type=3Dlambda x: int(x, 0), + help=3D"Target ID") + + parser.set_defaults(func=3Dself.send_cper) + + def send_cper(self, args): + """Parse subcommand arguments and send a CPER via QMP""" + + qmp_cmd =3D qmp(args.host, args.port, args.debug) + + cper =3D {} + arg =3D vars(args) + + # Handle global parameters + if args.valid: + valid_init =3D False + cper["valid"] =3D util.get_choice(name=3D"valid", + value=3Dargs.valid, + choices=3Dself.valid_bits) + else: + cper["valid"] =3D 0 + valid_init =3D True + + if args.bus_command: + cper["bus-command"] =3D util.get_choice(name=3D"bus-command", + value=3Dargs.bus_comma= nd, + choices=3Dself.bus_com= mand_bits) + if valid_init: + if args.error_status: + cper["valid"] |=3D self.valid_bits["status"] + + if args.error_type: + cper["valid"] |=3D self.valid_bits["type"] + + if args.bus_number and args.bus_segment: + cper["valid"] |=3D self.valid_bits["bus-id"] + + if args.bus_address: + cper["valid"] |=3D self.valid_bits["bus-address"] + + if args.bus_data: + cper["valid"] |=3D self.valid_bits["bus-data"] + + if args.bus_requestor: + cper["valid"] |=3D self.valid_bits["requestor-id"] + + if args.bus_completer: + cper["valid"] |=3D self.valid_bits["completer-id"] + + if args.target_id: + cper["valid"] |=3D self.valid_bits["target-id"] + + util.data_add(self.data, cper["valid"], 8) + util.data_add(self.data, arg.get("error-status", 0), 8) + util.data_add(self.data, arg.get("error-type", util.bit(0)), 2) + + # Bus ID + util.data_add(self.data, arg.get("bus-number", 0), 1) + util.data_add(self.data, arg.get("segment-number", 0), 1) + + # Reserved + util.data_add(self.data, 0, 4) + + util.data_add(self.data, arg.get("bus-address", 0), 8) + util.data_add(self.data, arg.get("bus-data", 0), 8) + + util.data_add(self.data, cper.get("bus-command", 0), 8) + + util.data_add(self.data, arg.get("bus-requestor", 0), 8) + util.data_add(self.data, arg.get("bus-completer", 0), 8) + util.data_add(self.data, arg.get("target-id", 0), 8) + + return qmp_cmd.send_cper(cper_guid.CPER_PCI_BUS, self.data) --=20 2.53.0 From nobody Sun Apr 12 00:53:17 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=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1771847510; cv=none; d=zohomail.com; s=zohoarc; b=NTVMLm6HOlxTzz3M35hFsXrTF/wZCxe97vcbRUI5uhSGEoJIyE7Erg0TWsahOoJcQPUH+k9uiTuZ344T1bcncZQhBuLVf2wZKJeBbLdPctOmAOavtrSCNgPwl1HrxbTfRTttkiPez+vGCOHLzmfukmBcMqd2WsoLrc8haHNBSNc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771847510; 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=LFXV0yZtZGaV7tRw1UP2+mUZdHi50PtIab69rMHCpxA=; b=Iu8eDUgTBXZZ05ZwI917uuaA6YX+menkCU4kz5XDbzBttuxalilWGg4by2/JvxRtc3zFkxwdl/iJjarL42yHxusd3uwAqdL247JWdr3Qe7XA7Q/nnRfI/h1SjpHSEofqCb4j2A/Q8jmA11LN+mBCIyZgVonTsnJY7f5r3v8UfsM= 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 1771847510193796.1958384388873; Mon, 23 Feb 2026 03:51:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vuUSg-0004Tk-Ge; Mon, 23 Feb 2026 06:50: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 1vuUSb-0004RJ-1I for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:45 -0500 Received: from sea.source.kernel.org ([172.234.252.31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vuUSV-0004rl-Vf for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:43 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 37D6344566; Mon, 23 Feb 2026 11:50:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6518C2BCB4; Mon, 23 Feb 2026 11:50:33 +0000 (UTC) Received: from mchehab by mail.kernel.org with local (Exim 4.99.1) (envelope-from ) id 1vuUSO-00000007Jok-0lkG; Mon, 23 Feb 2026 12:50:32 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771847434; bh=rjmDNNlvZkwC92TC2LUA0XsfeJyHDjXh9KUhvuqW8gc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VIvUzmFobk640zvGPlGMFWRQQAHl/stm5rw+wqaQD+wsZudNTPfBmZ/57SN8DmGkq RwDAp4at5wcRN5Ewl5J+5+KXGXanu+vz66DG42ijWSI4t1zSaHFQFhcoT2bJ0Hw2MD wrpcV55zA2NWA6Ij4sbmEkvyNS38gGDiT8Zr43EpVMRFJiJP+T0UB+ZfVDt4LSehU0 3vPCg++2i8rDnZZWi5C8N0h+LhZxEK6KewqrruQ/KQR7zVdrTvmEfK3hzJiPZ5aRm5 yeurWEXP4xks2LhqqL1mx+WmpcXtD+0OWFly+7qhEjm7dqPswhUH9twVhlObaDVT4G z4qPBMftUU6Og== From: Mauro Carvalho Chehab To: Michael S Tsirkin Cc: Jonathan Cameron , Shiju Jose , qemu-devel@nongnu.org, Igor Mammedov , Mauro Carvalho Chehab , Cleber Rosa , John Snow Subject: [PATCH v3 11/14] scripts/ghes_inject: add support for fuzzy logic testing Date: Mon, 23 Feb 2026 12:50:27 +0100 Message-ID: X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=172.234.252.31; envelope-from=mchehab+huawei@kernel.org; helo=sea.source.kernel.org X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 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_VALIDITY_CERTIFIED_BLOCKED=1.179, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.717, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1771847512351158500 Add a command to inject random errors for fuzzy logic testing. Signed-off-by: Mauro Carvalho Chehab --- MAINTAINERS | 1 + scripts/fuzzy_error.py | 206 +++++++++++++++++++++++++++++++++++++++++ scripts/ghes_inject.py | 2 + 3 files changed, 209 insertions(+) create mode 100644 scripts/fuzzy_error.py diff --git a/MAINTAINERS b/MAINTAINERS index 48067a618523..e553f8252f14 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2228,6 +2228,7 @@ F: qapi/acpi-hest.json F: scripts/ghes_decode.py F: scripts/ghes_inject.py F: scripts/arm_processor_error.py +F: scripts/fuzzy_error.py F: scripts/pcie_bus_error.py F: scripts/qmp_helper.py =20 diff --git a/scripts/fuzzy_error.py b/scripts/fuzzy_error.py new file mode 100644 index 000000000000..f816e47a5af8 --- /dev/null +++ b/scripts/fuzzy_error.py @@ -0,0 +1,206 @@ +#!/usr/bin/env python3 +# +# pylint: disable=3DC0114,R0903,R0912 +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2024 Mauro Carvalho Chehab + +import argparse +import sys + +from time import sleep +from random import randrange +from qmp_helper import qmp, util, cper_guid + +class FuzzyError: + """ + Implements Fuzzy error injection via GHES + """ + + def __init__(self, subparsers): + """Initialize the error injection class and add subparser""" + + # as defined at UEFI spec v2.10, section N.2.2 + # Sizes here are just hints to have some default + self.types =3D { + "proc-generic": { + "guid": cper_guid.CPER_PROC_GENERIC, + "default_size": 192 + }, + "proc-x86": { + "guid": cper_guid.CPER_PROC_X86, + "default_size": 64 + }, + "proc-itanium": { + "guid": cper_guid.CPER_PROC_ITANIUM, + "default_size": 64 + }, + "proc-arm": { + "guid": cper_guid.CPER_PROC_ARM, + "default_size": 72 + }, + "platform-mem": { + "guid": cper_guid.CPER_PLATFORM_MEM, + "default_size": 80 + }, + "platform-mem2": { + "guid": cper_guid.CPER_PLATFORM_MEM2, + "default_size": 96 + }, + "pcie": { + "guid": cper_guid.CPER_PCIE, + "default_size": 208 + }, + "pci-bus": { + "guid": cper_guid.CPER_PCI_BUS, + "default_size": 72 + }, + "pci-dev": { + "guid": cper_guid.CPER_PCI_DEV, + "default_size": 56 + }, + "firmware-error": { + "guid": cper_guid.CPER_FW_ERROR, + "default_size": 32 + }, + "dma-generic": { + "guid": cper_guid.CPER_DMA_GENERIC, + "default_size": 32 + }, + "dma-vt": { + "guid": cper_guid.CPER_DMA_VT, + "default_size": 144 + }, + "dma-iommu": { + "guid": cper_guid.CPER_DMA_IOMMU, + "default_size": 144 + }, + "ccix-per": { + "guid": cper_guid.CPER_CCIX_PER, + "default_size": 36 + }, + "cxl-prot-err": { + "guid": cper_guid.CPER_CXL_PROT_ERR, + "default_size": 116 + }, + "cxl-evt-media": { + "guid": cper_guid.CPER_CXL_EVT_GEN_MEDIA, + "default_size": 32 + }, + "cxl-evt-dram": { + "guid": cper_guid.CPER_CXL_EVT_DRAM, + "default_size": 64 + }, + "cxl-evt-mem-module": { + "guid": cper_guid.CPER_CXL_EVT_MEM_MODULE, + "default_size": 64 + }, + "cxl-evt-mem-sparing": { + "guid": cper_guid.CPER_CXL_EVT_MEM_SPARING, + "default_size": 64 + }, + "cxl-evt-phy-sw": { + "guid": cper_guid.CPER_CXL_EVT_PHY_SW, + "default_size": 64 + }, + "cxl-evt-virt-sw": { + "guid": cper_guid.CPER_CXL_EVT_VIRT_SW, + "default_size": 64 + }, + "cxl-evt-mdl-port": { + "guid": cper_guid.CPER_CXL_EVT_MLD_PORT, + "default_size": 64 + }, + "cxl-evt-dyna-cap": { + "guid": cper_guid.CPER_CXL_EVT_DYNA_CAP, + "default_size": 64 + }, + "fru-mem-poison": { + "guid": cper_guid.CPER_FRU_MEM_POISON, + "default_size": 72 + }, + } + + parser =3D subparsers.add_parser("fuzzy-test", aliases=3D['fuzzy'], + description=3D"Inject a fuzzy test = CPER", + formatter_class=3Dargparse.RawTextH= elpFormatter) + g_fuzzy =3D parser.add_argument_group("Fuzz testing error inject") + + + cper_types =3D ",".join(self.types.keys()) + + g_fuzzy.add_argument("-T", "--type", + help=3Df"Type of the error: {cper_types}") + g_fuzzy.add_argument("--min-size", + type=3Dlambda x: int(x, 0), + help=3D"Minimal size of the CPER") + g_fuzzy.add_argument("--max-size", + type=3Dlambda x: int(x, 0), + help=3D"Maximal size of the CPER") + g_fuzzy.add_argument("-z", "--zero", action=3D"store_true", + help=3D"Zero all bytes of the CPER payload (de= fault: %(default)s)") + g_fuzzy.add_argument("-t", "--timeout", type=3Dfloat, + default=3D30.0, + help=3D"Specify timeout for CPER send retries (default= : %(default)s seconds)") + g_fuzzy.add_argument("-d", "--delay", type=3Dfloat, + default=3D0, + help=3D"Specify a delay between multiple CPER (default= : %(default)s)") + g_fuzzy.add_argument("-c", "--count", type=3Dint, + default=3D1, + help=3D"Specify the number of CPER records to be sent = (default: %(default)s)") + + parser.set_defaults(func=3Dself.send_cper) + + def send_cper(self, args): + """Parse subcommand arguments and send a CPER via QMP""" + + qmp_cmd =3D qmp(args.host, args.port, args.debug) + + args.count =3D max(args.count, 1) + + for i in range(0, args.count): + if i: + if args.delay > 0: + sleep(args.delay) + + # Handle global parameters + if args.type: + if not args.type in self.types: + sys.exit(f"Invalid type: {args.type}") + + inj_type =3D args.type + else: + i =3D randrange(len(self.types)) + keys =3D list(self.types.keys()) + inj_type =3D keys[i] + + inject =3D self.types[inj_type] + + guid =3D inject["guid"] + min_size =3D inject["default_size"] + max_size =3D min_size + + if args.min_size: + min_size =3D args.min_size + + if args.max_size: + max_size =3D args.max_size + + size =3D min_size + + if min_size < max_size: + size +=3D randrange(max_size - min_size) + + data =3D bytearray() + + if not args.zero: + for i in range(size): + util.data_add(data, randrange(256), 1) + else: + for i in range(size): + util.data_add(data, 0, 1) + + print(f"Injecting {inj_type} with {size} bytes") + ret =3D qmp_cmd.send_cper(guid, data, timeout=3Dargs.timeout) + if ret and ret !=3D "OK": + return ret diff --git a/scripts/ghes_inject.py b/scripts/ghes_inject.py index 29a6a57508cd..9b0a2443fc97 100755 --- a/scripts/ghes_inject.py +++ b/scripts/ghes_inject.py @@ -13,6 +13,7 @@ =20 from arm_processor_error import ArmProcessorEinj from pcie_bus_error import PcieBusError +from fuzzy_error import FuzzyError =20 EINJ_DESC =3D """ Handle ACPI GHESv2 error injection logic QEMU QMP interface. @@ -42,6 +43,7 @@ def main(): =20 ArmProcessorEinj(subparsers) PcieBusError(subparsers) + FuzzyError(subparsers) =20 args =3D parser.parse_args() if "func" in args: --=20 2.53.0 From nobody Sun Apr 12 00:53:17 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=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1771847542; cv=none; d=zohomail.com; s=zohoarc; b=m4AVaJzKD+iFM+4PM3AZy+3bS1IEKCmH1IKHql+ydwVjG5TA7O0JOwHzfJ2nLl5zAwbj+trXrP1t+MGe2au9mXFSaZmGcl6yfy0obJnJiPtgaXhOyLIyokM3GrkD6h9XmWkHk70Wfuwqr6EBnKM1k4JYF0N9B6HpOJlNYA+C8Lo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771847542; 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=ZLKfPJaMVz8FEHB0VjuJKtK4VZG4dMFfx62/7ZQs8Lc=; b=PWTZe08WNTlVSgeWdG0uSOY7osFPoj8SafeKmy12kxn55m8fVN6GFdVaX1kTEREqOz7oMG2DFvxOrWHE8gPyNOZ11831jhYES1bfxcz05FVE9/y0JbnviAQxflRhD9cK+yqNDXxE2NKz4vCXxtgms9FNN2V3tnnOkdSl/dV5crQ= 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 1771847542458193.42638132722175; Mon, 23 Feb 2026 03:52:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vuUSp-0004VR-21; Mon, 23 Feb 2026 06:50:59 -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 1vuUSe-0004Sj-H6 for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:48 -0500 Received: from sea.source.kernel.org ([172.234.252.31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vuUSa-0004sZ-9D for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:47 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 476AB4456B; Mon, 23 Feb 2026 11:50:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02A1EC116C6; Mon, 23 Feb 2026 11:50:34 +0000 (UTC) Received: from mchehab by mail.kernel.org with local (Exim 4.99.1) (envelope-from ) id 1vuUSO-00000007Joz-0vnJ; Mon, 23 Feb 2026 12:50:32 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771847434; bh=Guhgq+hfI9g8CsVIoMrPzkV9dYROxSFNlKQmri6ehks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QT+hCBFrbSe9uhHFfuDQS8762M0reczlSvxQHfUq7rhXellCnbY/fYUasm6yAtOw8 /Fb8S6hn9ryMCHWhrIT3udgDxpGkRcnS1b3S+CxXya9zD+FClPgL/qjoiKr8HacvmT Ud0Nwg5RaI6QXTNijdkWSzRBJZbv0dioQbUd9TAVEDnndnZUtJOisknkKornfI64Us 6qPrQWgO6kQZ2vn16Zrlk6SaVzVX2Y7j+TW28rp8a1YRM/tGQ0j71vDB+mdL53Bs5N Yy9UOfQ+to89j8sEpE1OSxeVND9Aa1Z0R+LQEnRgtLzNmc7ILvITfxDtVeK6E3y3zZ /zH/JDMmc6d4w== From: Mauro Carvalho Chehab To: Michael S Tsirkin Cc: Jonathan Cameron , Shiju Jose , qemu-devel@nongnu.org, Igor Mammedov , Mauro Carvalho Chehab , Cleber Rosa , John Snow Subject: [PATCH v3 12/14] scripts/ghes_inject: add a raw error inject command Date: Mon, 23 Feb 2026 12:50:28 +0100 Message-ID: X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=172.234.252.31; envelope-from=mchehab+huawei@kernel.org; helo=sea.source.kernel.org X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 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_VALIDITY_CERTIFIED_BLOCKED=1.179, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.717, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1771847544371158500 Add a command to repeat a raw CPER record. This helps to reproduce some condition that happened before. The input format of the file is identical to the hexadecimal dump generated by ghes_inject tool. Signed-off-by: Mauro Carvalho Chehab --- MAINTAINERS | 1 + scripts/ghes_inject.py | 2 + scripts/raw_error.py | 175 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 178 insertions(+) create mode 100644 scripts/raw_error.py diff --git a/MAINTAINERS b/MAINTAINERS index e553f8252f14..9d74d057048e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2231,6 +2231,7 @@ F: scripts/arm_processor_error.py F: scripts/fuzzy_error.py F: scripts/pcie_bus_error.py F: scripts/qmp_helper.py +F: scripts/raw_error.py =20 ppc4xx L: qemu-ppc@nongnu.org diff --git a/scripts/ghes_inject.py b/scripts/ghes_inject.py index 9b0a2443fc97..781b37cc68af 100755 --- a/scripts/ghes_inject.py +++ b/scripts/ghes_inject.py @@ -14,6 +14,7 @@ from arm_processor_error import ArmProcessorEinj from pcie_bus_error import PcieBusError from fuzzy_error import FuzzyError +from raw_error import RawError =20 EINJ_DESC =3D """ Handle ACPI GHESv2 error injection logic QEMU QMP interface. @@ -44,6 +45,7 @@ def main(): ArmProcessorEinj(subparsers) PcieBusError(subparsers) FuzzyError(subparsers) + RawError(subparsers) =20 args =3D parser.parse_args() if "func" in args: diff --git a/scripts/raw_error.py b/scripts/raw_error.py new file mode 100644 index 000000000000..0490adb25042 --- /dev/null +++ b/scripts/raw_error.py @@ -0,0 +1,175 @@ +#!/usr/bin/env python3 +# +# pylint: disable=3DC0114,R0903,R0912,R0914,R0915,R1732 +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2024 Mauro Carvalho Chehab + +import argparse +import os +import re +import sys + +from time import sleep + +from qmp_helper import qmp, guid + +class RawError: + """ + Injects errors from a file containing raw data + """ + + SCRIPT_NAME =3D sys.argv[0] + + HELP=3Df""" + Inject a CPER record from a previously recorded one. + + One or more CPER records can be recorded. The records to be + injected are read from an specified file or from stdin and should + have the format produced by this script when using --debug, e.g.: + + GUID: e19e3d16-bc11-11e4-9caa-c2051d5d46b0 + CPER: + 00000000 04 00 00 00 02 00 01 00 88 00 00 00 00 00 00 00 ......= .......... + 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ......= .......... + 00000020 00 00 00 00 00 00 00 00 00 20 05 00 08 02 00 03 ......= ... ...... + 00000030 ff 0f 46 d6 80 00 00 00 ef be ad de 00 00 00 00 ..F...= .......... + 00000040 ad 0b ba ab 00 00 00 00 00 20 04 00 04 01 00 03 ......= ... ...... + 00000050 7f 00 54 00 00 00 00 00 ef be ad de 00 00 00 00 ..T...= .......... + 00000060 ad 0b ba ab 00 00 00 00 00 00 05 00 18 00 00 00 ......= .......... + 00000070 ef be ad de 00 00 00 00 ab ba ba ab 00 00 00 00 ......= .......... + 00000080 00 00 00 00 00 00 00 00 ......= .. + + Multiple such records can be used. On such case, a delay will + be introduced betewen them. + + All lines that can't be parsed will be silently ignored. + As such, the output of this help can be piped to the raw-error + generator with: + + {SCRIPT_NAME} -d raw-error -h | {SCRIPT_NAME} -d raw-error + """ + + def __init__(self, subparsers): + """Initialize the error injection class and add subparser""" + + self.payload =3D bytearray() + self.inj_type =3D None + self.size =3D 0 + + parser =3D subparsers.add_parser("raw-error", aliases=3D['raw'], + description=3Dself.HELP, + formatter_class=3Dargparse.RawTextH= elpFormatter) + + parser.add_argument("-f", "--file", + help=3D"File name with the raw error data. '-'= for stdin") + parser.add_argument("-d", "--delay", type=3Dlambda x: int(x, 0), + default=3D1, + help=3D"Specify a delay between multiple CPER.= Default=3D1") + + parser.set_defaults(func=3Dself.send_cper) + + def send_cper(self, args): + """Parse subcommand arguments and send a CPER via QMP""" + + if not args.file: + args.file=3D'-' + + is_guid =3D re.compile(r"^\s*guid:\s*(\w+\-\w+\-\w+\-\w+-\w+)", re= .I) + is_gesb =3D re.compile(r"^Generic Error Status Block.*:", re.I) + is_gede =3D re.compile(r"^Generic Error Data Entry.*:", re.I) + is_raw_data =3D re.compile(r"^Raw data.*:", re.I) + is_payload =3D re.compile(r"^(Payload|CPER).*:", re.I) + is_hexdump =3D re.compile(r"^(\s*[\da-f]........\s+)(.*)\s\s+.*", = re.I) + is_hex =3D re.compile(r"\b([\da-f].)\b", re.I) + + cper =3D [] + + if args.file =3D=3D "-": + fp =3D sys.stdin + if os.isatty(0): + print("Using stdin. Press CTRL-D to finish input.") + else: + print("Reading from stdin pipe") + else: + try: + fp =3D open(args.file, encoding=3D"utf-8") + except FileNotFoundError: + sys.exit('File Not Found') + + guid_obj =3D None + gebs =3D bytearray() + gede =3D bytearray() + raw_data =3D bytearray() + payload =3D bytearray() + ln_used =3D 0 + ln =3D 0 + + cur =3D payload + + for ln, line in enumerate(fp): + if match :=3D is_guid.search(line): + if guid_obj and payload: + cper.append({"guid": guid_obj, "raw-data": payload}) + guid_obj =3D None + payload =3D bytearray() + gebs =3D bytearray() + gede =3D bytearray() + + guid_obj =3D guid.UUID(match.group(1)) + + ln_used +=3D 1 + continue + + if match :=3D is_gesb.match(line): + cur =3D gebs + continue + + if match :=3D is_gede.match(line): + cur =3D gede + continue + + if match :=3D is_payload.match(line): + cur =3D payload + continue + + if match :=3D is_raw_data.match(line): + cur =3D raw_data + continue + + new =3D is_hexdump.sub(r"\2", line) + if new !=3D line: + if match :=3D is_hex.findall(new): + for m in match: + cur.extend(bytes.fromhex(m)) + ln_used +=3D 1 + continue + continue + + if guid_obj and payload: + cper.append({"guid": guid_obj, + "payload": payload, + "gede": gede, + "gebs": gebs, + "raw-data": raw_data}) + + print(f"{ln} lines read, {ln - ln_used} lines ignored.") + + if fp is not sys.stdin: + fp.close() + + qmp_cmd =3D qmp(args.host, args.port, args.debug) + + if not cper: + sys.exit("Format of the file not recognized.") + + for i, c in enumerate(cper): + if i: + sleep(args.delay) + + ret =3D qmp_cmd.send_cper(c["guid"], c["payload"], gede=3Dc["g= ede"], + gebs=3Dc["gebs"], raw_data=3Dc["raw-da= ta"]) + if not ret: + return ret + + return True --=20 2.53.0 From nobody Sun Apr 12 00:53:17 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=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1771847496; cv=none; d=zohomail.com; s=zohoarc; b=QWRxTxZvQNFp5NMNi6v/OrBvMoRApKnVmMZ855OZBKJiVCoE36YWQHjdEb+HS7O+AI+V+pTS5/RzqH4ouCzExGHpG0O/YMS8RJ1SaZwO/dFjtj1730GoOpIqiu1bYKvSh8eygcXl6xT7CEIJnX+gGhLauc5/cI3cYkWTPk5J7l4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771847496; 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=FXGPWWnS3GqIXkyUD+/m4x7OZYPulkGmWY2JDE9wKWE=; b=WCc1XHIsnFhabtu1gwkENm9vvkU0vit3fWBF4+u/upH03o+pVZnKPHAP9scYrf2GcFYKtIRhnOYSDbxkTcWz1Z9VsnvPWgRFZu+S1QjFGeN3FwhJGeqapCzts/FjzPqhBIcL1s4/FwshvT5zgtxmloR2tb3qnMuSif6MNyBXQaY= 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 1771847496241446.71499481012756; Mon, 23 Feb 2026 03:51:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vuUSi-0004Tr-7V; Mon, 23 Feb 2026 06:50: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 1vuUSb-0004RI-11 for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:45 -0500 Received: from sea.source.kernel.org ([172.234.252.31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vuUSV-0004rq-Vh for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:43 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 2C7CC444BA; Mon, 23 Feb 2026 11:50:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B5E8C2BC9E; Mon, 23 Feb 2026 11:50:34 +0000 (UTC) Received: from mchehab by mail.kernel.org with local (Exim 4.99.1) (envelope-from ) id 1vuUSO-00000007Jp3-15C4; Mon, 23 Feb 2026 12:50:32 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771847434; bh=8uItO1tBCDK9cbJY1YqaD7Ae5ZOfPLv8XnCqS8/3E6M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rj22aF4YxlsgP5Zmk2lHWR2E2KCDe6VreJ1F6sMc+uSB9cukA6wdwVDSG5IUXKBEY UPJzOjhLWJbxVnRwGuZ4WNCcW5KWheofCqfx225SEMWZeb69DW8yWPUgPoFoXS5c// UnjCOzGF6EBy14e4a+zA3gLCRe0ER+zQzJym3DCVXdpF/+2ip3lnBgFEUk0KGbvA2Z B61NarZrLEv5Wr3uJVyOuyxNJAlymLrezUeNCXB9Ni1yKQw4ns2zn4EqzBETlLL75E ltYCc+8DfU/eiFMnStsFfBGSg5jFSqdxwWY4epvfgyZ7v+NyZoFHoZRt+dF5y5sYwf dQj04W3v1t1fw== From: Mauro Carvalho Chehab To: Michael S Tsirkin Cc: Jonathan Cameron , Shiju Jose , qemu-devel@nongnu.org, Igor Mammedov , Mauro Carvalho Chehab , Cleber Rosa , John Snow Subject: [PATCH v3 13/14] scripts/ghes_inject: print help if no command specified Date: Mon, 23 Feb 2026 12:50:29 +0100 Message-ID: <1d5de20e8059de8749694e18430eacfcc3f409e7.1771847176.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=172.234.252.31; envelope-from=mchehab+huawei@kernel.org; helo=sea.source.kernel.org X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 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_VALIDITY_CERTIFIED_BLOCKED=1.179, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.717, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1771847498076158500 The first positional argument (command) is mandatory. If not specified, instead of a simple error message, show help as well. Signed-off-by: Mauro Carvalho Chehab --- scripts/ghes_inject.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/ghes_inject.py b/scripts/ghes_inject.py index 781b37cc68af..4028fdb15582 100755 --- a/scripts/ghes_inject.py +++ b/scripts/ghes_inject.py @@ -52,6 +52,9 @@ def main(): if not args.func(args): sys.exit(1) else: + print("Error: no command specified\n", file=3Dsys.stderr) + parser.print_help(file=3Dsys.stderr) + print(file=3Dsys.stderr) sys.exit(f"Please specify a valid command for {sys.argv[0]}") =20 if __name__ =3D=3D "__main__": --=20 2.53.0 From nobody Sun Apr 12 00:53:17 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=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1771847518; cv=none; d=zohomail.com; s=zohoarc; b=mco1C9te8Bw7caXXlGJN9mgkFWmW+SLI+C0a+YQHG5d8ACd9fwoeyQSwWhYbd/cMX3dvTM1UwNQyJMTlRMvwKrxyGeAlxIRuzBcaSz7Z6GHjkb1RtAW+W3jomeKA0pc50A4v9SKcC3/sFthWilHf9HIplJsd18bNOHePSQt5eeI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771847518; 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=nl5VP1LOJyoYPVbqzxTmFlZgOai4MYdnDAsStF+Lr0M=; b=h92cd4ci4sRdiV58UJK4+MEN+ueSvBe2FsMnYhjJi9rjw0s98DbQNCeuZ11Ne7F7EkdLYnRuCiPShCmdn7zi9sc+qk/aahZfhvgSekx8t1KthFTAngFpHajpuJ3vsreAAscr7ncLIhb2he0lzEYK8lKNqowWhDwJ4UDYreRKJ8Y= 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 1771847518579421.7235272287993; Mon, 23 Feb 2026 03:51:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vuUSf-0004TV-Oj; Mon, 23 Feb 2026 06:50:49 -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 1vuUSb-0004RL-3Y for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:45 -0500 Received: from sea.source.kernel.org ([172.234.252.31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vuUSV-0004rk-Vw for qemu-devel@nongnu.org; Mon, 23 Feb 2026 06:50:42 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 35D04444FB; Mon, 23 Feb 2026 11:50:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16094C2BCB2; Mon, 23 Feb 2026 11:50:34 +0000 (UTC) Received: from mchehab by mail.kernel.org with local (Exim 4.99.1) (envelope-from ) id 1vuUSO-00000007Jp7-1FdH; Mon, 23 Feb 2026 12:50:32 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771847434; bh=Dth8Faoh0/dwBB7alZe7q4QU3faEttLYXD3JAhyjqac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eRH/4OrbENX6+uERKqgWfTB2TRc79O0DqVNAoxloL7yc52o85itua5sAtbTkFSBSl k3Z6AFiu7mAaXurM7M1Wc4NXr3viZQWU+xK1Rd74pAyAMDbR9L2KKz8P19JJIMzskP QoTkvzcmVMuk3NOwDRCrHz7LN11H9lc9kMduask98RYcP1UA6hTTjUOsV0eOkaYpWO b+O0LrG37O8ZBnTjbrkklbdEm3rENeIOTmRRCM4REbrq701f/l5TUCt0u7v8wzciC8 FH1HbijfbM/KI9DlC3iHIzf8NbRUcKQUuXpjZo3QIjlbgpT2lYu2dFnP0rz7gBMijO lkH9Xga38phig== From: Mauro Carvalho Chehab To: Michael S Tsirkin Cc: Jonathan Cameron , Shiju Jose , qemu-devel@nongnu.org, Igor Mammedov , Mauro Carvalho Chehab , Cleber Rosa , John Snow Subject: [PATCH v3 14/14] scripts/ghes_inject: improve help message Date: Mon, 23 Feb 2026 12:50:30 +0100 Message-ID: <7edd91c64294cafeb4e5d7e155233914df81aae8.1771847176.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=172.234.252.31; envelope-from=mchehab+huawei@kernel.org; helo=sea.source.kernel.org X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 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_VALIDITY_CERTIFIED_BLOCKED=1.179, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.717, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1771847520239158500 Add a one-liner help message for each type of error inject command, and use raw formatter to keep line breaks. While here, use a more uniform language. With that, "ghes_inject -h" will now show: usage: ghes_inject.py [options] Handles ACPI GHESv2 error injection via the QEMU QMP interface. It uses UEFI=E2=80=AFBIOS=E2=80=AFAPEI features to generate GHES records,= which helps to test CPER and GHES drivers on the guest OS and see how user=E2=80=91space applications on that guest handle such errors. positional arguments: {arm,pcie-bus,fuzzy-test,fuzzy,raw-error,raw} arm Inject an ARM processor error CPER, compatible wi= th UEFI 2.9A Errata. pcie-bus Inject a PCIe bus error CPER fuzzy-test (fuzzy) Inject fuzzy test CPER packets raw-error (raw) Inject CPER records from previously recorded ones. options: -h, --help show this help message and exit QEMU QMP socket options: -H, --host HOST host name (default: localhost) -P, --port PORT TCP port number (default: 4445) -d, --debug enable debug output (default: False) Signed-off-by: Mauro Carvalho Chehab --- scripts/arm_processor_error.py | 6 ++++-- scripts/fuzzy_error.py | 4 +++- scripts/ghes_inject.py | 18 +++++++++--------- scripts/pcie_bus_error.py | 4 +++- scripts/raw_error.py | 6 +++--- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/scripts/arm_processor_error.py b/scripts/arm_processor_error.py index d9845adb0c0a..597382031ab8 100644 --- a/scripts/arm_processor_error.py +++ b/scripts/arm_processor_error.py @@ -122,7 +122,7 @@ class ArmProcessorEinj: """ =20 DESC =3D """ - Generates an ARM processor error CPER, compatible with + Inject an ARM processor error CPER, compatible with UEFI 2.9A Errata. """ =20 @@ -169,7 +169,9 @@ def __init__(self, subparsers): =20 self.data =3D bytearray() =20 - parser =3D subparsers.add_parser("arm", description=3Dself.DESC) + parser =3D subparsers.add_parser("arm", + help=3Dself.DESC, + description=3Dself.DESC) =20 arm_valid_bits =3D ",".join(self.arm_valid_bits.keys()) flags =3D ",".join(self.pei_flags.keys()) diff --git a/scripts/fuzzy_error.py b/scripts/fuzzy_error.py index f816e47a5af8..dc2b6bbe684d 100644 --- a/scripts/fuzzy_error.py +++ b/scripts/fuzzy_error.py @@ -121,8 +121,10 @@ def __init__(self, subparsers): }, } =20 + DESC =3D "Inject fuzzy test CPER packets" + parser =3D subparsers.add_parser("fuzzy-test", aliases=3D['fuzzy'], - description=3D"Inject a fuzzy test = CPER", + help=3DDESC, description=3DDESC, formatter_class=3Dargparse.RawTextH= elpFormatter) g_fuzzy =3D parser.add_argument_group("Fuzz testing error inject") =20 diff --git a/scripts/ghes_inject.py b/scripts/ghes_inject.py index 4028fdb15582..488d10ffcafd 100755 --- a/scripts/ghes_inject.py +++ b/scripts/ghes_inject.py @@ -17,28 +17,28 @@ from raw_error import RawError =20 EINJ_DESC =3D """ -Handle ACPI GHESv2 error injection logic QEMU QMP interface. +Handles ACPI GHESv2 error injection via the QEMU QMP interface. =20 -It allows using UEFI BIOS EINJ features to generate GHES records. - -It helps testing CPER and GHES drivers at the guest OS and how -userspace applications at the guest handle them. +It uses UEFI=E2=80=AFBIOS=E2=80=AFAPEI features to generate GHES records, = which helps to +test CPER and GHES drivers on the guest OS and see how user=E2=80=91space +applications on that guest handle such errors. """ =20 def main(): """Main program""" =20 # Main parser - handle generic args like QEMU QMP TCP socket options - parser =3D argparse.ArgumentParser(formatter_class=3Dargparse.Argument= DefaultsHelpFormatter, + parser =3D argparse.ArgumentParser(formatter_class=3Dargparse.RawDescr= iptionHelpFormatter, usage=3D"%(prog)s [options]", description=3DEINJ_DESC) =20 g_options =3D parser.add_argument_group("QEMU QMP socket options") g_options.add_argument("-H", "--host", default=3D"localhost", type=3Ds= tr, - help=3D"host name") + help=3D"host name (default: %(default)s)") g_options.add_argument("-P", "--port", default=3D4445, type=3Dint, - help=3D"TCP port number") - g_options.add_argument('-d', '--debug', action=3D'store_true') + help=3D"TCP port number (default: %(default)s)") + g_options.add_argument('-d', '--debug', action=3D'store_true', + help=3D"enable debug output (default: %(default= )s)") =20 subparsers =3D parser.add_subparsers() =20 diff --git a/scripts/pcie_bus_error.py b/scripts/pcie_bus_error.py index 482b26db5e5f..9825e9bace21 100644 --- a/scripts/pcie_bus_error.py +++ b/scripts/pcie_bus_error.py @@ -35,8 +35,10 @@ def __init__(self, subparsers): =20 self.data =3D bytearray() =20 + DESC =3D "Inject a PCIe bus error CPER" + parser =3D subparsers.add_parser("pcie-bus", - description=3D"Generate PCIe bus er= ror CPER") + help=3DDESC, description=3DDESC) g_pcie =3D parser.add_argument_group("PCIe bus error") =20 valid_bits =3D ",".join(self.valid_bits.keys()) diff --git a/scripts/raw_error.py b/scripts/raw_error.py index 0490adb25042..ab522c4b4615 100644 --- a/scripts/raw_error.py +++ b/scripts/raw_error.py @@ -21,8 +21,8 @@ class RawError: =20 SCRIPT_NAME =3D sys.argv[0] =20 - HELP=3Df""" - Inject a CPER record from a previously recorded one. + HELP=3D"Inject CPER records from previously recorded ones." + DESC=3DHELP + f""" =20 One or more CPER records can be recorded. The records to be injected are read from an specified file or from stdin and should @@ -58,7 +58,7 @@ def __init__(self, subparsers): self.size =3D 0 =20 parser =3D subparsers.add_parser("raw-error", aliases=3D['raw'], - description=3Dself.HELP, + help=3Dself.HELP, description=3Dsel= f.DESC, formatter_class=3Dargparse.RawTextH= elpFormatter) =20 parser.add_argument("-f", "--file", --=20 2.53.0