qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] hw/riscv: shakti_c: Mark as not user creatable
@ 2021-09-27  7:13 Alistair Francis
  2021-09-27  7:27 ` Bin Meng
  2021-09-27 15:35 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 3+ messages in thread
From: Alistair Francis @ 2021-09-27  7:13 UTC (permalink / raw)
  To: qemu-devel, qemu-riscv
  Cc: bmeng.cn, palmer, alistair.francis, alistair23, f4bug

From: Alistair Francis <alistair.francis@wdc.com>

Mark the shakti_c machine as not user creatable as it uses serial_hd.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/639
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
 hw/riscv/shakti_c.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/riscv/shakti_c.c b/hw/riscv/shakti_c.c
index 2f084d3c8d..603992d442 100644
--- a/hw/riscv/shakti_c.c
+++ b/hw/riscv/shakti_c.c
@@ -150,6 +150,8 @@ static void shakti_c_soc_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
     dc->realize = shakti_c_soc_state_realize;
+    /* Reason: Uses serial_hds in realize function, thus can't be used twice */
+    dc->user_creatable = false;
 }
 
 static void shakti_c_soc_instance_init(Object *obj)
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] hw/riscv: shakti_c: Mark as not user creatable
  2021-09-27  7:13 [PATCH v1 1/1] hw/riscv: shakti_c: Mark as not user creatable Alistair Francis
@ 2021-09-27  7:27 ` Bin Meng
  2021-09-27 15:35 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 3+ messages in thread
From: Bin Meng @ 2021-09-27  7:27 UTC (permalink / raw)
  To: Alistair Francis
  Cc: open list:RISC-V, Philippe Mathieu-Daudé,
	qemu-devel@nongnu.org Developers, Palmer Dabbelt,
	Alistair Francis, Alistair Francis

On Mon, Sep 27, 2021 at 3:13 PM Alistair Francis
<alistair.francis@opensource.wdc.com> wrote:
>
> From: Alistair Francis <alistair.francis@wdc.com>
>
> Mark the shakti_c machine as not user creatable as it uses serial_hd.
>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/639
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> ---
>  hw/riscv/shakti_c.c | 2 ++
>  1 file changed, 2 insertions(+)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] hw/riscv: shakti_c: Mark as not user creatable
  2021-09-27  7:13 [PATCH v1 1/1] hw/riscv: shakti_c: Mark as not user creatable Alistair Francis
  2021-09-27  7:27 ` Bin Meng
@ 2021-09-27 15:35 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-09-27 15:35 UTC (permalink / raw)
  To: Alistair Francis, qemu-devel, qemu-riscv
  Cc: alistair.francis, bmeng.cn, palmer, alistair23

Hi Alistair,

On 9/27/21 09:13, Alistair Francis wrote:
> From: Alistair Francis <alistair.francis@wdc.com>
> 
> Mark the shakti_c machine as not user creatable as it uses serial_hd.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/639
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> ---
>  hw/riscv/shakti_c.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/hw/riscv/shakti_c.c b/hw/riscv/shakti_c.c
> index 2f084d3c8d..603992d442 100644
> --- a/hw/riscv/shakti_c.c
> +++ b/hw/riscv/shakti_c.c
> @@ -150,6 +150,8 @@ static void shakti_c_soc_class_init(ObjectClass *klass, void *data)
>  {
>      DeviceClass *dc = DEVICE_CLASS(klass);
>      dc->realize = shakti_c_soc_state_realize;
> +    /* Reason: Uses serial_hds in realize function, thus can't be used twice */
> +    dc->user_creatable = false;

I agree with the logical change, but not totally with the comment.
Well, the comment itself is not incorrect. But the error happens before:

ERROR:tcg/tcg.c:479:tcg_register_thread: assertion failed: (n <
tcg_max_ctxs)

The reason is TYPE_RISCV_HART_ARRAY creates CPUs in
riscv_hart_realize(), and this machine use the default CPU limit
of one CPU:

static void shakti_c_machine_class_init(ObjectClass *klass, void *data)
{
    MachineClass *mc = MACHINE_CLASS(klass);
    mc->desc = "RISC-V Board compatible with Shakti SDK";
    mc->init = shakti_c_machine_state_init;
    mc->default_cpu_type = TYPE_RISCV_CPU_SHAKTI_C;
}

The default values come from:

static void machine_class_base_init(ObjectClass *oc, void *data)
{
    MachineClass *mc = MACHINE_CLASS(oc);
    mc->max_cpus = mc->max_cpus ?: 1;
    mc->min_cpus = mc->min_cpus ?: 1;
    mc->default_cpus = mc->default_cpus ?: 1;

So the crash happens when we try to create the 2nd CPU.

>  }
>  
>  static void shakti_c_soc_instance_init(Object *obj)
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-27 15:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-27  7:13 [PATCH v1 1/1] hw/riscv: shakti_c: Mark as not user creatable Alistair Francis
2021-09-27  7:27 ` Bin Meng
2021-09-27 15:35 ` Philippe Mathieu-Daudé

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).