]> www.infradead.org Git - users/dwmw2/qemu.git/commit
qdev: Implement qdev_create_fake_machine() for user emulation
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Thu, 2 Jan 2025 13:50:19 +0000 (14:50 +0100)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Thu, 9 Jan 2025 17:16:24 +0000 (18:16 +0100)
commit558ee1ede6cc95d3dde806f0ac323911c5dbb4b4
treef476b8d90a1382579c0ebb159d5719b55a4c0d44
parentad1ea5ffa10d4cf365c142caf627f2c43b3592c2
qdev: Implement qdev_create_fake_machine() for user emulation

When a QDev instance is realized, qdev_get_machine() ends up called.
In the next commit, qdev_get_machine() will require a "machine"
container to be always present. To satisfy this QOM containers design,
Implement qdev_create_fake_machine() which creates a fake "machine"
container for user emulation.

On system emulation, qemu_create_machine() is called from qemu_init().
For user emulation, since the TCG accelerator always calls
tcg_init_machine(), we use it to hook our fake machine creation.

Suggested-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250102211800.79235-2-philmd@linaro.org>
accel/tcg/tcg-all.c
hw/core/meson.build
hw/core/qdev-user.c [new file with mode: 0644]
include/hw/qdev-core.h