From nobody Fri Nov 14 22:22:08 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1CB13215767 for ; Tue, 7 Oct 2025 06:52:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759819946; cv=none; b=T9t7PUT7Jt7k/hfkWZDMwT+WIcCLIz9/CqlpU9Wmv7FjvYsT8GfuUcZJKFFnaWPlO36K1GtqNTepSdLcWczfEeDezDlr5D4Dq7X6uhHvckz+2DWypgf7tp9tEQ1MRuY/o+Qzzm4JoUBA/30Clu4tkcwT6Sllop/SWUKAUrZcWoI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759819946; c=relaxed/simple; bh=ljRIZcXVDsulZu38rOR6Abg5SbUHTniYuTY+SzLZI8g=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=JDJZWoxoH9krRoJmZhqROiSxJIyzGLs+EPDn/IfQcC86YbJBzNEwhjNwjL4c//3Fn5jnkN+41H3d034FHYK/tbMHhCWn7sO9YS2PZx/FcZCmzVcTsM52RSZz/WNodyRQOxs26kHZpb4O673OXdFNH3vI4MHJ71Z7M4tWDgubELY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iejNTuY4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iejNTuY4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80EBBC4CEF7; Tue, 7 Oct 2025 06:52:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1759819945; bh=ljRIZcXVDsulZu38rOR6Abg5SbUHTniYuTY+SzLZI8g=; h=From:To:Cc:Subject:Date:From; b=iejNTuY4GggfYpfh21eBR5X5L1Qy0kK8hjhzrUyo7ePAhd0zZd7hC0GrwC2dG//Id GYQGREtX+98qKZbJROSjIRJ33PwVZIF56/5k0uGgjCDs7rAWBXziMrIvO5vwntJ8Qf dqX+/D/7WNHepyBxPSp0UnfU9zd6nec9FFdzDM+63gMq17pt51ovC/hS63I/0Lpmz/ cHYBLjxL1/Ipkg5LVjVeAef0fRjE2VzT7M33pPCJY43OnK6iBUSkNNvp4pSQ86EH9P aLTvZzKA7UEQg4n0yIu7paPpLxNoHtkzXQR2lS5EM8riDVw/65NTp6mUw3Kcy6XLy+ cg3d9Kx7pfCQg== Received: from mchehab by mail.kernel.org with local (Exim 4.98.2) (envelope-from ) id 1v61Yd-0000000H0MH-2HA0; Tue, 07 Oct 2025 08:52:23 +0200 From: Mauro Carvalho Chehab To: Igor Mammedov , "Michael S . Tsirkin" Cc: Jonathan Cameron , Shiju Jose , qemu-arm@nongnu.org, qemu-devel@nongnu.org, Mauro Carvalho Chehab , Cleber Rosa , John Snow , linux-kernel@vger.kernel.org Subject: [PATCH] scripts/ghes_inject.py: avoid long lines inside the script Date: Tue, 7 Oct 2025 08:52:11 +0200 Message-ID: <5d75e5f2a9584d4c9235d5111b6402291ec8f616.1759819931.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" There are some lines that are too long, mostly at argparse, causing checkpatch warnings, plus a couple pylint disable lines. Make them honor 80 columns limit. No functional changes. While here, add a space after comma on help lines displaying possible alternatives. Requested-by: "Michael S. Tsirkin" Closes: https://lore.kernel.org/qemu-devel/20251005082027-mutt-send-email-m= st@kernel.org/ Signed-off-by: Mauro Carvalho Chehab --- scripts/arm_processor_error.py | 35 +++++++++++++++++++++------------- scripts/ghes_inject.py | 8 ++++---- scripts/qmp_helper.py | 23 +++++++++++++--------- 3 files changed, 40 insertions(+), 26 deletions(-) diff --git a/scripts/arm_processor_error.py b/scripts/arm_processor_error.py index 73d069f070d4..e4b6e11822af 100644 --- a/scripts/arm_processor_error.py +++ b/scripts/arm_processor_error.py @@ -80,12 +80,14 @@ [Hardware Error]: error_type: 0x08: bus error [Hardware Error]: error_info: 0x00000080d6460fff [Hardware Error]: transaction type: Generic -[Hardware Error]: bus error, operation type: Generic read (type of ins= truction or data request cannot be determined) +[Hardware Error]: bus error, operation type: Generic read + (type of instruction or data request cannot be deter= mined) [Hardware Error]: affinity level at which the bus error occurred: 1 [Hardware Error]: processor context corrupted [Hardware Error]: the error has been corrected [Hardware Error]: PC is imprecise -[Hardware Error]: Program execution can be restarted reliably at the P= C associated with the error. +[Hardware Error]: Program execution can be restarted reliably at the PC + associated with the error. [Hardware Error]: participation type: Local processor observed [Hardware Error]: request timed out [Hardware Error]: address space: External Memory Access @@ -102,12 +104,14 @@ [Hardware Error]: register context type: AArch64 EL1 context registers [Hardware Error]: 00000000: 00000000 00000000 [Hardware Error]: Vendor specific error info has 5 bytes: -[Hardware Error]: 00000000: 13 7b 04 05 01 = .{... +[Hardware Error]: 00000000: 13 7b 04 05 01 = .{... [Firmware Warn]: GHES: Unhandled processor error type 0x02: cache error [Firmware Warn]: GHES: Unhandled processor error type 0x04: TLB error [Firmware Warn]: GHES: Unhandled processor error type 0x08: bus error -[Firmware Warn]: GHES: Unhandled processor error type 0x10: micro-architec= tural error -[Firmware Warn]: GHES: Unhandled processor error type 0x14: TLB error|micr= o-architectural error +[Firmware Warn]: GHES: Unhandled processor error type 0x10: + micro-architectural error +[Firmware Warn]: GHES: Unhandled processor error type 0x14: + TLB error|micro-architectural error """ =20 import argparse @@ -171,10 +175,10 @@ def __init__(self, subparsers): =20 parser =3D subparsers.add_parser("arm", description=3Dself.DESC) =20 - arm_valid_bits =3D ",".join(self.arm_valid_bits.keys()) - flags =3D ",".join(self.pei_flags.keys()) - error_types =3D ",".join(self.pei_error_types.keys()) - pei_valid_bits =3D ",".join(self.pei_valid_bits.keys()) + arm_valid_bits =3D ", ".join(self.arm_valid_bits.keys()) + flags =3D ", ".join(self.pei_flags.keys()) + error_types =3D ", ".join(self.pei_error_types.keys()) + pei_valid_bits =3D ", ".join(self.pei_valid_bits.keys()) =20 # UEFI N.16 ARM Validation bits g_arm =3D parser.add_argument_group("ARM processor") @@ -193,7 +197,7 @@ def __init__(self, subparsers): help=3D"Indicates if the processor is running o= r not") g_arm.add_argument("--psci", "--psci-state", type=3Dlambda x: int(x, 0), - help=3D"Power State Coordination Interface - PS= CI state") + help=3D"Power State Coordination Interface stat= e") =20 # TODO: Add vendor-specific support =20 @@ -208,9 +212,12 @@ def __init__(self, subparsers): =20 # UEFI N.17 Integer values g_pei.add_argument("-m", "--multiple-error", nargs=3D"+", - help=3D"Number of errors: 0: Single error, 1: Mult= iple errors, 2-65535: Error count if known") + help=3D"Number of errors: " + "0: Single error, 1: Multiple errors, " + "2-65535: Error count if known") g_pei.add_argument("-e", "--error-info", nargs=3D"+", - help=3D"Error information (UEFI 2.10 tables N.18 t= o N.20)") + help=3D"Error information " + "(UEFI 2.10 tables N.18 to N.20)") g_pei.add_argument("-p", "--physical-address", nargs=3D"+", help=3D"Physical address") g_pei.add_argument("-v", "--virtual-address", nargs=3D"+", @@ -219,7 +226,9 @@ def __init__(self, subparsers): # UEFI N.21 Context g_ctx =3D parser.add_argument_group("Processor Context") g_ctx.add_argument("--ctx-type", "--context-type", nargs=3D"*", - help=3D"Type of the context (0=3DARM32 GPR, 5=3DAR= M64 EL1, other values supported)") + help=3D"Type of the context " + "(0=3DARM32 GPR, 5=3DARM64 EL1, " + "other values supported)") g_ctx.add_argument("--ctx-size", "--context-size", nargs=3D"*", help=3D"Minimal size of the context") g_ctx.add_argument("--ctx-array", "--context-array", nargs=3D"*", diff --git a/scripts/ghes_inject.py b/scripts/ghes_inject.py index 9a235201418b..1a2d60e9e16f 100755 --- a/scripts/ghes_inject.py +++ b/scripts/ghes_inject.py @@ -8,7 +8,7 @@ Handle ACPI GHESv2 error injection logic QEMU QMP interface. """ =20 -import argparse +from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter import sys =20 from arm_processor_error import ArmProcessorEinj @@ -26,9 +26,9 @@ 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, - usage=3D"%(prog)s [options]", - description=3DEINJ_DESC) + parser =3D ArgumentParser(formatter_class=3DArgumentDefaultsHelpFormat= ter, + 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, diff --git a/scripts/qmp_helper.py b/scripts/qmp_helper.py index c1e7e0fd80ce..18b99c01cd79 100755 --- a/scripts/qmp_helper.py +++ b/scripts/qmp_helper.py @@ -198,7 +198,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""" @@ -416,12 +417,14 @@ def _connect(self): def argparse(parser): """Prepare a parser group to query generic error data""" =20 - block_status_bits =3D ",".join(qmp.BLOCK_STATUS_BITS.keys()) - error_severity_enum =3D ",".join(qmp.ERROR_SEVERITY.keys()) - validation_bits =3D ",".join(qmp.VALIDATION_BITS.keys()) - gedb_flags_bits =3D ",".join(qmp.GEDB_FLAGS_BITS.keys()) + block_status_bits =3D ", ".join(qmp.BLOCK_STATUS_BITS.keys()) + error_severity_enum =3D ", ".join(qmp.ERROR_SEVERITY.keys()) + validation_bits =3D ", ".join(qmp.VALIDATION_BITS.keys()) + gedb_flags_bits =3D ", ".join(qmp.GEDB_FLAGS_BITS.keys()) + + # pylint: disable=3DE1101 + g_gen =3D parser.add_argument_group("Generic Error Data") =20 - g_gen =3D parser.add_argument_group("Generic Error Data") # pylin= t: disable=3DE1101 g_gen.add_argument("--block-status", help=3Df"block status bits: {block_status_bits}= ") g_gen.add_argument("--raw-data", nargs=3D"+", @@ -439,9 +442,10 @@ def argparse(parser): help=3D"Time when the error info was collected") g_gen.add_argument("--precise", "--precise-timestamp", action=3D'store_true', - help=3D"Marks the timestamp as precise if --tim= estamp is used") + help=3D"if --timestamp is used, timestamp is pr= ecise") g_gen.add_argument("--gedb-flags", - help=3Df"General Error Data Block flags: {gedb_= flags_bits}") + help=3D"General Error Data Block flags: " + f"{gedb_flags_bits}") =20 def set_args(self, args): """Set the arguments optionally defined via self.argparse()""" @@ -501,8 +505,9 @@ def set_args(self, args): self.validation_bits |=3D self.VALIDATION_BITS["timestamp"] =20 if args.gen_err_valid_bits: + gen_err_valid_bits =3D args.gen_err_valid_bits self.validation_bits =3D util.get_choice(name=3D"validation", - value=3Dargs.gen_err_va= lid_bits, + value=3Dgen_err_valid_b= its, choices=3Dself.VALIDATI= ON_BITS) =20 def __init__(self, host, port, debug=3DFalse): --=20 2.51.0