Re: [PATCH v4 6/6] acpi/ghes: Add a logic to inject ARM processor CPER

From: Markus Armbruster
Date: Wed Jul 31 2024 - 03:23:26 EST


Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> writes:

> Em Mon, 29 Jul 2024 17:31:09 +0100
> Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> escreveu:
>
>> On Mon, 29 Jul 2024 15:21:10 +0200
>> Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> wrote:
>
> ...
>
>> Markus suggested:
>>
>> > A target-specific command like this one should be conditional. Try
>> > this:
>> >
>> > { 'command': 'arm-inject-error',
>> > 'data': { 'errortypes': ['ArmProcessorErrorType'] },
>> > 'features': [ 'unstable' ],
>> > 'if': 'TARGET_ARM' }
>> >
>> > No need to provide a qmp_arm_inject_error() stub then.
>>
>> (I noticed because never knew you could do this.)
>>
>> Probably crossed with your v4 posting.
>
> Tried it, but can't figure out how to properly set it up at meson.build,
> as it is basically producing build time errors during qapi file generation
> on non-ARM platforms. For instance:
>
> FAILED: libqemuutil.a.p/meson-generated_.._qapi_qapi-visit-arm-error-inject.c.o

[...]

> In file included from qapi/qapi-visit-arm-error-inject.h:17,
> from qapi/qapi-visit-arm-error-inject.c:15:
> qapi/qapi-types-arm-error-inject.h:18:13: error: attempt to use poisoned "TARGET_ARM"
> 18 | #if defined(TARGET_ARM)
> | ^
> In file included from /new_devel/edac/qemu/include/exec/poison.h:7,
> from /new_devel/edac/qemu/include/qemu/osdep.h:38,
> from qapi/qapi-visit-arm-error-inject.c:13:
> ./config-poison.h:718:20: note: poisoned here
>
> Such error is created by two files generated from qapi, due
> to this change:
>
> diff --git a/qapi/meson.build b/qapi/meson.build
> index e7bc54e5d047..5927932c4be3 100644
> --- a/qapi/meson.build
> +++ b/qapi/meson.build
> @@ -24,2 +24,3 @@ endif
> qapi_all_modules = [
> + 'arm-error-inject',
> 'authz',
>
> No idea how to fix it.

Uh, I neglected to point out an important detail. Sorry about that!

The 'if' condition uses a symbol that is poisoned in target-independent
compiles. Such conditions work only in target modules. By convention,
these are named FOO-target.json.

So, you can either change new module's filename to end in -target.json,
or you stick the command into one of the two existing target modules,
machine-target.json and misc-target.json.

Speaking of modules: i'm not sure dedicating a module just to ARM error
injection is a good idea. Perhaps we could have arm-target.json for
things that will only ever make sense on ARM. Same for other targets.

But I recommend to first reach consensus on Igor's objection in review
of v3:

Message-ID: <20240730131709.10e72c7d@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
https://lore.kernel.org/qemu-devel/20240730131709.10e72c7d@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx/