From: Richard Henderson <richard.henderson@linaro.org>
To: Daniel Henrique Barboza <dbarboza@ventanamicro.com>,
qemu-devel@nongnu.org
Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com,
bmeng@tinylab.org, liweiwei@iscas.ac.cn,
zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com
Subject: Re: [PATCH v2 3/4] target/riscv: add 'static' attribute of query-cpu-definitions
Date: Mon, 10 Apr 2023 19:03:42 -0700 [thread overview]
Message-ID: <7bdf0305-bd5f-68d2-525c-3ec8106f90c5@linaro.org> (raw)
In-Reply-To: <20230410165251.99107-4-dbarboza@ventanamicro.com>
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~
next prev parent reply other threads:[~2023-04-11 2:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-10 16:52 [PATCH v2 0/4] target/riscv: implement query-cpu-definitions Daniel Henrique Barboza
2023-04-10 16:52 ` [PATCH v2 1/4] target/riscv: add CPU QOM header Daniel Henrique Barboza
2023-04-11 1:56 ` Richard Henderson
2023-04-10 16:52 ` [PATCH v2 2/4] target/riscv: add query-cpy-definitions support Daniel Henrique Barboza
2023-04-11 1:56 ` Richard Henderson
2023-04-10 16:52 ` [PATCH v2 3/4] target/riscv: add 'static' attribute of query-cpu-definitions Daniel Henrique Barboza
2023-04-11 2:03 ` Richard Henderson [this message]
2023-04-11 12:23 ` Daniel Henrique Barboza
2023-04-10 16:52 ` [PATCH v2 4/4] target/riscv: make generic cpus not static Daniel Henrique Barboza
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7bdf0305-bd5f-68d2-525c-3ec8106f90c5@linaro.org \
--to=richard.henderson@linaro.org \
--cc=alistair.francis@wdc.com \
--cc=bmeng@tinylab.org \
--cc=dbarboza@ventanamicro.com \
--cc=liweiwei@iscas.ac.cn \
--cc=palmer@rivosinc.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=zhiwei_liu@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).