OSDN Git Service

target/riscv: handle custom props in qmp_query_cpu_model_expansion
authorDaniel Henrique Barboza <dbarboza@ventanamicro.com>
Wed, 18 Oct 2023 19:56:36 +0000 (16:56 -0300)
committerAlistair Francis <alistair.francis@wdc.com>
Tue, 7 Nov 2023 01:06:02 +0000 (11:06 +1000)
commit1df4f540d6352131cefa7ca48b637ccb774ce9e0
tree2dfba94a978a4b8951deed6899dfb5fde5a5894d
parenta13a6082c7488d4393453d383676ae423b38b4d8
target/riscv: handle custom props in qmp_query_cpu_model_expansion

Callers can add 'props' when querying for a cpu model expansion to see
if a given CPU model supports a certain criteria, and what's the
resulting CPU object.

If we have 'props' to handle, gather it in a QDict and use the new
riscv_cpuobj_validate_qdict_in() helper to validate it. This helper will
add the custom properties in the CPU object and validate it using
riscv_cpu_finalize_features(). Users will be aware of validation errors
if any occur, if not a CPU object with 'props' will be returned.

Here's an example with the veyron-v1 vendor CPU. Disabling vendor CPU
extensions is allowed, assuming the final config is valid. Disabling
'smstateen' is a valid expansion:

(QEMU) query-cpu-model-expansion type=full model={"name":"veyron-v1","props":{"smstateen":false}}
{"return": {"model": {"name": "veyron-v1", "props": {"zicond": false, ..., "smstateen": false, ...}

But enabling extensions isn't allowed for vendor CPUs. E.g. enabling 'V'
for the veyron-v1 CPU isn't allowed:

(QEMU) query-cpu-model-expansion type=full model={"name":"veyron-v1","props":{"v":true}}
{"error": {"class": "GenericError", "desc": "'veyron-v1' CPU does not allow enabling extensions"}}

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20231018195638.211151-5-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
target/riscv/riscv-qmp-cmds.c