qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 3/4] target/riscv: add 'static' attribute of query-cpu-def


From: Richard Henderson
Subject: Re: [PATCH v2 3/4] target/riscv: add 'static' attribute of query-cpu-definitions
Date: Mon, 10 Apr 2023 19:03:42 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0

On 4/10/23 09:52, Daniel Henrique Barboza wrote:
'static' is defined in the QMP doc as:

"whether a CPU definition is static and will not change depending on
QEMU version, machine type, machine options and accelerator options. A
static model is always migration-safe."

For RISC-V we'll consider all named CPUs as static since their
extensions can't be changed by user input. Generic CPUs will be
considered non-static.

We aren't ready to make the change for generic CPUs yet because we're
using the same class init for every CPU. We'll deal with it next.

Signed-off-by: Daniel Henrique Barboza<dbarboza@ventanamicro.com>
---
  target/riscv/cpu-qom.h        | 3 +++
  target/riscv/cpu.c            | 6 ++++++
  target/riscv/riscv-qmp-cmds.c | 2 ++
  3 files changed, 11 insertions(+)

Is 'static = true' really what you want as default?
Perhaps 'dynamic = false' (considering zero initialization) would be better?
Do you want an attribute that can be changed at all?

You could plausibly implement this via class inheritance instead.
E.g.

static const TypeInfo dynamic_cpu_type_info = {
    .name = TYPE_RISCV_DYN_CPU,
    .parent = TYPE_RISCV_CPU,
    .abstract = true,
    ...
};

and then the dynamic cpus inherit from that. Your dynamic attribute becomes object_dynamic_cast(OBJECT(cpu), TYPE_RISCV_DYN_CPU) != NULL.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]