[<prev] [next>] [day] [month] [year] [list]
Message-ID: <5d75e5f2a9584d4c9235d5111b6402291ec8f616.1759819931.git.mchehab+huawei@kernel.org>
Date: Tue, 7 Oct 2025 08:52:11 +0200
From: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
To: Igor Mammedov <imammedo@...hat.com>,
"Michael S . Tsirkin" <mst@...hat.com>
Cc: Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Shiju Jose <shiju.jose@...wei.com>,
qemu-arm@...gnu.org,
qemu-devel@...gnu.org,
Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
Cleber Rosa <crosa@...hat.com>,
John Snow <jsnow@...hat.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH] scripts/ghes_inject.py: avoid long lines inside the script
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" <mst@...hat.com>
Closes: https://lore.kernel.org/qemu-devel/20251005082027-mutt-send-email-mst@kernel.org/
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
---
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 instruction or data request cannot be determined)
+[Hardware Error]: bus error, operation type: Generic read
+ (type of instruction or data request cannot be determined)
[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 PC 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-architectural error
-[Firmware Warn]: GHES: Unhandled processor error type 0x14: TLB error|micro-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
"""
import argparse
@@ -171,10 +175,10 @@ def __init__(self, subparsers):
parser = subparsers.add_parser("arm", description=self.DESC)
- arm_valid_bits = ",".join(self.arm_valid_bits.keys())
- flags = ",".join(self.pei_flags.keys())
- error_types = ",".join(self.pei_error_types.keys())
- pei_valid_bits = ",".join(self.pei_valid_bits.keys())
+ arm_valid_bits = ", ".join(self.arm_valid_bits.keys())
+ flags = ", ".join(self.pei_flags.keys())
+ error_types = ", ".join(self.pei_error_types.keys())
+ pei_valid_bits = ", ".join(self.pei_valid_bits.keys())
# UEFI N.16 ARM Validation bits
g_arm = parser.add_argument_group("ARM processor")
@@ -193,7 +197,7 @@ def __init__(self, subparsers):
help="Indicates if the processor is running or not")
g_arm.add_argument("--psci", "--psci-state",
type=lambda x: int(x, 0),
- help="Power State Coordination Interface - PSCI state")
+ help="Power State Coordination Interface state")
# TODO: Add vendor-specific support
@@ -208,9 +212,12 @@ def __init__(self, subparsers):
# UEFI N.17 Integer values
g_pei.add_argument("-m", "--multiple-error", nargs="+",
- help="Number of errors: 0: Single error, 1: Multiple errors, 2-65535: Error count if known")
+ help="Number of errors: "
+ "0: Single error, 1: Multiple errors, "
+ "2-65535: Error count if known")
g_pei.add_argument("-e", "--error-info", nargs="+",
- help="Error information (UEFI 2.10 tables N.18 to N.20)")
+ help="Error information "
+ "(UEFI 2.10 tables N.18 to N.20)")
g_pei.add_argument("-p", "--physical-address", nargs="+",
help="Physical address")
g_pei.add_argument("-v", "--virtual-address", nargs="+",
@@ -219,7 +226,9 @@ def __init__(self, subparsers):
# UEFI N.21 Context
g_ctx = parser.add_argument_group("Processor Context")
g_ctx.add_argument("--ctx-type", "--context-type", nargs="*",
- help="Type of the context (0=ARM32 GPR, 5=ARM64 EL1, other values supported)")
+ help="Type of the context "
+ "(0=ARM32 GPR, 5=ARM64 EL1, "
+ "other values supported)")
g_ctx.add_argument("--ctx-size", "--context-size", nargs="*",
help="Minimal size of the context")
g_ctx.add_argument("--ctx-array", "--context-array", nargs="*",
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.
"""
-import argparse
+from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
import sys
from arm_processor_error import ArmProcessorEinj
@@ -26,9 +26,9 @@ def main():
"""Main program"""
# Main parser - handle generic args like QEMU QMP TCP socket options
- parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter,
- usage="%(prog)s [options]",
- description=EINJ_DESC)
+ parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter,
+ usage="%(prog)s [options]",
+ description=EINJ_DESC)
g_options = parser.add_argument_group("QEMU QMP socket options")
g_options.add_argument("-H", "--host", default="localhost", type=str,
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"""
- data.extend(value.to_bytes(num_bytes, byteorder="little")) # pylint: disable=E1101
+ # pylint: disable=E1101
+ data.extend(value.to_bytes(num_bytes, byteorder="little"))
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"""
- block_status_bits = ",".join(qmp.BLOCK_STATUS_BITS.keys())
- error_severity_enum = ",".join(qmp.ERROR_SEVERITY.keys())
- validation_bits = ",".join(qmp.VALIDATION_BITS.keys())
- gedb_flags_bits = ",".join(qmp.GEDB_FLAGS_BITS.keys())
+ block_status_bits = ", ".join(qmp.BLOCK_STATUS_BITS.keys())
+ error_severity_enum = ", ".join(qmp.ERROR_SEVERITY.keys())
+ validation_bits = ", ".join(qmp.VALIDATION_BITS.keys())
+ gedb_flags_bits = ", ".join(qmp.GEDB_FLAGS_BITS.keys())
+
+ # pylint: disable=E1101
+ g_gen = parser.add_argument_group("Generic Error Data")
- g_gen = parser.add_argument_group("Generic Error Data") # pylint: disable=E1101
g_gen.add_argument("--block-status",
help=f"block status bits: {block_status_bits}")
g_gen.add_argument("--raw-data", nargs="+",
@@ -439,9 +442,10 @@ def argparse(parser):
help="Time when the error info was collected")
g_gen.add_argument("--precise", "--precise-timestamp",
action='store_true',
- help="Marks the timestamp as precise if --timestamp is used")
+ help="if --timestamp is used, timestamp is precise")
g_gen.add_argument("--gedb-flags",
- help=f"General Error Data Block flags: {gedb_flags_bits}")
+ help="General Error Data Block flags: "
+ f"{gedb_flags_bits}")
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 |= self.VALIDATION_BITS["timestamp"]
if args.gen_err_valid_bits:
+ gen_err_valid_bits = args.gen_err_valid_bits
self.validation_bits = util.get_choice(name="validation",
- value=args.gen_err_valid_bits,
+ value=gen_err_valid_bits,
choices=self.VALIDATION_BITS)
def __init__(self, host, port, debug=False):
--
2.51.0
Powered by blists - more mailing lists