From: Andrew Jones <ajones@ventanamicro.com>
To: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Cc: qemu-devel@nongnu.org, qemu-riscv@nongnu.org,
alistair.francis@wdc.com, liwei1518@gmail.com,
zhiwei_liu@linux.alibaba.com, palmer@dabbelt.com,
Fei Wu <wu.fei9@sanechips.com.cn>
Subject: Re: [PATCH v4 3/5] hw/riscv: experimental server platform reference machine
Date: Tue, 11 Nov 2025 17:36:55 -0600 [thread overview]
Message-ID: <20251111-a6e8ae9a0d6809ba0e62ba2e@orel> (raw)
In-Reply-To: <20251111182944.2895892-4-dbarboza@ventanamicro.com>
On Tue, Nov 11, 2025 at 03:29:42PM -0300, Daniel Henrique Barboza wrote:
> From: Fei Wu <wu.fei9@sanechips.com.cn>
...
> +static char *rvsp_ref_get_aia_guests(Object *obj, Error **errp)
> +{
> + RVSPMachineState *s = RVSP_REF_MACHINE(obj);
> + char val[32];
> +
> + sprintf(val, "%d", s->aia_guests);
> + return g_strdup(val);
> +}
> +
> +static void rvsp_ref_set_aia_guests(Object *obj, const char *val, Error **errp)
> +{
> + RVSPMachineState *s = RVSP_REF_MACHINE(obj);
> +
> + s->aia_guests = atoi(val);
> + if (s->aia_guests < 0 || s->aia_guests > RVSP_IRQCHIP_MAX_GUESTS) {
The minimum is 5 for the server platform, so we should enforce that. Also
I suggest we bump RVSP_IRQCHIP_MAX_GUESTS since it's only 7 right now.
> + error_setg(errp, "Invalid number of AIA IMSIC guests");
> + error_append_hint(errp, "Valid values be between 0 and %d.\n",
> + RVSP_IRQCHIP_MAX_GUESTS);
> + }
> +}
> +
> +static void rvsp_ref_machine_class_init(ObjectClass *oc, const void *data)
> +{
> + char str[128];
> + MachineClass *mc = MACHINE_CLASS(oc);
> + static const char * const valid_cpu_types[] = {
> + TYPE_RISCV_CPU_RVSP_REF,
> + };
> +
> + mc->desc = "RISC-V Server SoC Reference board (EXPERIMENTAL)";
We could (and probably should) version this machine type from the get go.
If we do that, then we could simply give it a version 0.9, which would
match the current spec. When the spec is ratified and this model is
complete, then it can be bumped to 1.0. Going that route would allow us
to avoid the EXPERIMENTAL "flag".
> + mc->init = rvsp_ref_machine_init;
> + mc->max_cpus = RVSP_CPUS_MAX;
> + mc->default_cpu_type = TYPE_RISCV_CPU_RVSP_REF;
> + mc->valid_cpu_types = valid_cpu_types;
> + mc->pci_allow_0_address = true;
> + mc->default_nic = "e1000e";
> + mc->possible_cpu_arch_ids = riscv_numa_possible_cpu_arch_ids;
> + mc->cpu_index_to_instance_props = riscv_numa_cpu_index_to_props;
> + mc->get_default_cpu_node_id = riscv_numa_get_default_cpu_node_id;
> + mc->numa_mem_supported = true;
> + /* platform instead of architectural choice */
> + mc->cpu_cluster_has_numa_boundary = true;
> + mc->default_ram_id = "riscv_rvsp_ref_board.ram";
> +
> + object_class_property_add_str(oc, "aia-guests",
> + rvsp_ref_get_aia_guests,
> + rvsp_ref_set_aia_guests);
> + sprintf(str, "Set number of guest MMIO pages for AIA IMSIC. Valid value "
> + "should be between 0 and %d.", RVSP_IRQCHIP_MAX_GUESTS);
Same comment about the guest file range as above (we shouldn't suggest
anything less than 5).
> + object_class_property_set_description(oc, "aia-guests", str);
> +}
> +
> +static const TypeInfo rvsp_ref_typeinfo = {
> + .name = TYPE_RVSP_REF_MACHINE,
> + .parent = TYPE_MACHINE,
> + .class_init = rvsp_ref_machine_class_init,
> + .instance_init = rvsp_ref_machine_instance_init,
> + .instance_size = sizeof(RVSPMachineState),
> +};
> +
> +static void rvsp_ref_init_register_types(void)
> +{
> + type_register_static(&rvsp_ref_typeinfo);
> +}
> +
> +type_init(rvsp_ref_init_register_types)
> --
> 2.51.1
>
>
Thanks,
drew
next prev parent reply other threads:[~2025-11-11 23:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-11 18:29 [PATCH v4 0/5] hw/riscv: Experimental Server Platform Reference Board Daniel Henrique Barboza
2025-11-11 18:29 ` [PATCH v4 1/5] target/riscv/cpu.c: remove 'bare' condition for .profile Daniel Henrique Barboza
2025-11-11 18:29 ` [PATCH v4 2/5] target/riscv: Add server platform reference cpu Daniel Henrique Barboza
2025-11-11 23:05 ` Andrew Jones
2025-11-17 17:57 ` Daniel Henrique Barboza
2025-11-11 18:29 ` [PATCH v4 3/5] hw/riscv: experimental server platform reference machine Daniel Henrique Barboza
2025-11-11 23:36 ` Andrew Jones [this message]
2025-11-18 20:15 ` Daniel Henrique Barboza
2025-11-18 20:50 ` Andrew Jones
2025-11-12 7:13 ` Philippe Mathieu-Daudé
2025-11-11 18:29 ` [PATCH v4 4/5] hw/riscv/server_platform_ref.c: add riscv-iommu-sys Daniel Henrique Barboza
2025-11-12 7:13 ` Philippe Mathieu-Daudé
2025-11-11 18:29 ` [PATCH v4 5/5] docs: add rvsp-ref.rst Daniel Henrique Barboza
2025-11-11 23:39 ` Andrew Jones
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=20251111-a6e8ae9a0d6809ba0e62ba2e@orel \
--to=ajones@ventanamicro.com \
--cc=alistair.francis@wdc.com \
--cc=dbarboza@ventanamicro.com \
--cc=liwei1518@gmail.com \
--cc=palmer@dabbelt.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=wu.fei9@sanechips.com.cn \
--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).