On 8/5/25 01:14, Pierrick Bouvier wrote:
Signed-off-by: Pierrick Bouvier <pierrick.bouv...@linaro.org>
---
qapi/machine-target.json | 84 ++++++++++++++++++++++++----------------
qapi/misc-target.json | 48 ++++++++++++-----------
scripts/qapi/expr.py | 9 +++--
3 files changed, 81 insertions(+), 60 deletions(-)
@@ -378,13 +384,18 @@
'typename': 'str',
'*alias-of' : 'str',
'deprecated' : 'bool' },
- 'if': { 'any': [ 'TARGET_PPC',
- 'TARGET_ARM',
- 'TARGET_I386',
- 'TARGET_S390X',
- 'TARGET_MIPS',
- 'TARGET_LOONGARCH64',
- 'TARGET_RISCV' ] } }
+ 'runtime_if': { 'any': [ 'target_ppc()',
+ 'target_ppc64()',
+ 'target_arm()',
+ 'target_aarch64()',
+ 'target_i386()',
+ 'target_x86_64()',
+ 'target_s390x()',
+ 'target_mips()',
+ 'target_mips64()',
+ 'target_loongarch64()',
+ 'target_riscv32()',
+ 'target_riscv64()' ] } }
I'd keep target_riscv() for "any RISC-V".
target_arm() and target_aarch64() could be merged as
target_arm_based()?
@@ -272,7 +272,7 @@
{ 'command': 'query-sev-attestation-report',
'data': { 'mnonce': 'str' },
'returns': 'SevAttestationReport',
- 'if': 'TARGET_I386' }
+ 'runtime_if': { 'any': [ 'target_i386()', 'target_x86_64()' ] } }
Suggested as target_x86().
##
# @GICCapability:
@@ -297,7 +297,7 @@
'data': { 'version': 'int',
'emulated': 'bool',
'kernel': 'bool' },
- 'if': 'TARGET_ARM' }
+ 'runtime_if': { 'any': [ 'target_arm()', 'target_aarch64()' ] } }
Up to here:
Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org>
diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
index 5ae26395964..f31f28ecb10 100644
--- a/scripts/qapi/expr.py
+++ b/scripts/qapi/expr.py
@@ -638,7 +638,8 @@ def check_exprs(exprs: List[QAPIExpression]) ->
List[QAPIExpression]:
if meta == 'enum':
check_keys(expr, info, meta,
- ['enum', 'data'], ['if', 'features', 'prefix'])
+ ['enum', 'data'], ['if', 'runtime_if', 'features',
+ 'prefix'])
check_enum(expr)
elif meta == 'union':
check_keys(expr, info, meta,
@@ -654,7 +655,8 @@ def check_exprs(exprs: List[QAPIExpression]) ->
List[QAPIExpression]:
check_alternate(expr)
elif meta == 'struct':
check_keys(expr, info, meta,
- ['struct', 'data'], ['base', 'if', 'features'])
+ ['struct', 'data'], ['base', 'if', 'runtime_if',
+ 'features'])
normalize_members(expr['data'])
check_struct(expr)
elif meta == 'command':
@@ -667,7 +669,8 @@ def check_exprs(exprs: List[QAPIExpression]) ->
List[QAPIExpression]:
check_command(expr)
elif meta == 'event':
check_keys(expr, info, meta,
- ['event'], ['data', 'boxed', 'if', 'features'])
+ ['event'], ['data', 'boxed', 'if', 'runtime_if',
+ 'features'])
normalize_members(expr.get('data'))
check_event(expr)
else:
Changes in scripts/qapi/expr.py seem to belong to a previous
patch (existing or not).