On Thu, 12 Mar 2026 at 04:33, <[email protected]> wrote:
>
> From: Alistair Francis <[email protected]>
>
> Calling qdev_get_machine() in the soc_init function would result in
> the following assert
>
>     ../hw/core/qdev.c:858: qdev_get_machine: Assertion `dev' failed.
>
> when trying to run
>
>     ./qemu-system-riscv64 -S -display none -M virt -device 
> riscv.sifive.e.soc,help
>
> as the machine wasn't created yet. We call qdev_get_machine() to obtain
> the number of CPUs in the machine. So instead of setting the CPU
> num-harts in the init function let's set it in realise where the machine
> will exist.
>
> Signed-off-by: Alistair Francis <[email protected]>

I think our general intended pattern is:
 * init the child in init
 * configure and realize the child in realize

So unless there's a specific reason to be setting properties on
the child in init, moving them to realize is the right thing.

thanks
-- PMM

Reply via email to