Em Mon, 22 Sep 2025 08:48:03 -0400 "Michael S. Tsirkin" <[email protected]> escreveu:
> On Fri, Sep 05, 2025 at 05:09:24PM +0200, Mauro Carvalho Chehab wrote: > > diff --git a/scripts/arm_processor_error.py b/scripts/arm_processor_error.py > > new file mode 100644 > > index 000000000000..1dd42e42a877 > > --- /dev/null > > +++ b/scripts/arm_processor_error.py > > @@ -0,0 +1,476 @@ > > Malformed patch: script only has 474 lines. Sorry for that. This time I sent the series with a new (not so) shiny mailbomb script, I rewrote in Python. It turned to be a big headache to use python EmailMessage class: it always ended badly encoding something. It also affected patches I sent to the Kernel, badly handling utf-8 chars and "\" characters. I gave up on it and I'm reusing my 10+ years old Perl script again. Sorry for that. > > +#!/usr/bin/env python3 > > +# > > +# pylint: disable=C0301,C0114,R0903,R0912,R0913,R0914,R0915,W0511 > > +# SPDX-License-Identifier: GPL-2.0-or-later > > +# > > +# Copyright (C) 2024-2025 Mauro Carvalho Chehab <[email protected]> > > + > > +# TODO: current implementation has dummy defaults. > > +# > > +# For a better implementation, a QMP addition/call is needed to > > +# retrieve some data for ARM Processor Error injection: > > +# > > +# - ARM registers: power_state, mpidr. > > + > > +""" > > +Generates an ARM processor error CPER, compatible with > > Generates -> Generate > > prefer imperative mood > > > +UEFI 2.9A Errata. > > + > > +Injecting such errors can be done using: > > + > > + $ ./scripts/ghes_inject.py arm > > + Error injected. > > + > > +Produces a simple CPER register, as detected on a Linux guest: > > + > > +[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 1 > > +[Hardware Error]: event severity: recoverable > > +[Hardware Error]: Error 0, type: recoverable > > +[Hardware Error]: section_type: ARM processor error > > +[Hardware Error]: MIDR: 0x0000000000000000 > > +[Hardware Error]: running state: 0x0 > > +[Hardware Error]: Power State Coordination Interface state: 0 > > +[Hardware Error]: Error info structure 0: > > +[Hardware Error]: num errors: 2 > > +[Hardware Error]: error_type: 0x02: cache error > > +[Hardware Error]: error_info: 0x000000000091000f > > +[Hardware Error]: transaction type: Data Access > > +[Hardware Error]: cache error, operation type: Data write > > +[Hardware Error]: cache level: 2 > > +[Hardware Error]: processor context not corrupted > > +[Firmware Warn]: GHES: Unhandled processor error type 0x02: cache error > > + > > +The ARM Processor Error message can be customized via command line > > +parameters. For instance: > > + > > + $ ./scripts/ghes_inject.py arm --mpidr 0x444 --running --affinity 1 + > > --error-info 12345678 --vendor 0x13,123,4,5,1 --ctx-array 0,1,2,3,4,5 > > + -t cache tlb bus micro-arch tlb,micro-arch > > Weird formatting. Are these + signs intentional here? > Oh, maybe that is where the 2 missing lines are hiding. Nope. Broken mailbomb script: EmailMessage decided to handle itself lines ended with "\", even after being asked to parse an e-mail as binary. For v12 I'll be using the old script which doesn't corrupt patches. Thanks, Mauro
