On Fri, Dec 20, 2024 at 10:38:40PM +0100, Philippe Mathieu-Daudé wrote: > > OTOH, this works for me: > > > > ===8<=== > > diff --git a/linux-user/main.c b/linux-user/main.c > > index b09af8d436..009b7695f2 100644 > > --- a/linux-user/main.c > > +++ b/linux-user/main.c > > @@ -819,6 +819,11 @@ int main(int argc, char **argv, char **envp) > > set_preferred_target_page_bits(ctz32(host_page_size)); > > finalize_target_page_bits(); > > + Object *fake_obj = object_property_add_new_container(object_get_root(), > > + "machine"); > > + object_property_add_new_container(fake_obj, "unattached"); > > + > > cpu = cpu_create(cpu_type); > > env = cpu_env(cpu); > > cpu_reset(cpu); > > ===8<=== > > I like it, simple enough, allowing to remove container_get() now. > > > > > So we need both "/machine" and "/machine/unattached" so far to make > > linux-user work. Not sure if bsd-user/main.c needs similar care, but none > > of these look as clean. > > Maybe add a common method in hw/core/qdev-user.c? > qemu_create_machine() or qdev_create_fake_machine()?
Sounds good at least to me. I'd vote for the latter to reflect it's unreal. Thanks, -- Peter Xu