mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-11 16:00:50 -07:00
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>
This commit is contained in:
parent
ad1ea5ffa1
commit
558ee1ede6
4 changed files with 37 additions and 1 deletions
|
|
@ -1023,6 +1023,16 @@ const char *qdev_fw_name(DeviceState *dev);
|
|||
void qdev_assert_realized_properly(void);
|
||||
Object *qdev_get_machine(void);
|
||||
|
||||
/**
|
||||
* qdev_create_fake_machine(): Create a fake machine container.
|
||||
*
|
||||
* .. note::
|
||||
* This function is a kludge for user emulation (USER_ONLY)
|
||||
* because when thread (TYPE_CPU) are realized, qdev_realize()
|
||||
* access a machine container.
|
||||
*/
|
||||
void qdev_create_fake_machine(void);
|
||||
|
||||
/**
|
||||
* qdev_get_human_name() - Return a human-readable name for a device
|
||||
* @dev: The device. Must be a valid and non-NULL pointer.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue