mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-26 11:53:53 -06:00

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>
19 lines
495 B
C
19 lines
495 B
C
/*
|
|
* QDev helpers specific to user emulation.
|
|
*
|
|
* Copyright 2025 Linaro, Ltd.
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
#include "qemu/osdep.h"
|
|
#include "qom/object.h"
|
|
#include "hw/qdev-core.h"
|
|
|
|
void qdev_create_fake_machine(void)
|
|
{
|
|
Object *fake_machine_obj;
|
|
|
|
fake_machine_obj = object_property_add_new_container(object_get_root(),
|
|
"machine");
|
|
object_property_add_new_container(fake_machine_obj, "unattached");
|
|
}
|