Hi, I am reviewing the existing code that sets has_dynamic_sysbus, and this patch confused me. I have a question below:
On Tue, Nov 22, 2016 at 07:10:58AM +0100, Juergen Gross wrote: > Create a qdev plugged to the xen-sysbus for each new backend device. > This device can be used as a parent for all needed devices of that > backend. The id of the new device will be "xen-<type>-<dev>" with > <type> being the xen backend type (e.g. "qdisk") and <dev> the xen > backend number of the type under which it is to be found in xenstore. > > Signed-off-by: Juergen Gross <jgr...@suse.com> > Reviewed-by: Stefano Stabellini <sstabell...@kernel.org> > --- > hw/xen/xen_backend.c | 47 > ++++++++++++++++++++++++++++++++++++++++++++ > hw/xen/xen_pvdev.c | 4 +++- > include/hw/xen/xen_backend.h | 4 ++++ > include/hw/xen/xen_pvdev.h | 1 + > 4 files changed, 55 insertions(+), 1 deletion(-) > [...] > +static void xen_set_dynamic_sysbus(void) > +{ > + Object *machine = qdev_get_machine(); > + ObjectClass *oc = object_get_class(machine); > + MachineClass *mc = MACHINE_CLASS(oc); > + > + mc->has_dynamic_sysbus = true; > +} > + Why exactly is this code necessary? I assume there's no current use case for "-device xen-sysdev" and "-device xen-backend", correct? The devices created by C code like xen_be_get_xendev() aren't supposed to be returned by foreach_dynamic_sysbus_device(). > int xen_be_register(const char *type, struct XenDevOps *ops) > { > char path[50]; > @@ -562,6 +579,8 @@ int xen_be_register(const char *type, struct XenDevOps > *ops) > > void xen_be_register_common(void) > { > + xen_set_dynamic_sysbus(); > + > xen_be_register("console", &xen_console_ops); > xen_be_register("vkbd", &xen_kbdmouse_ops); > xen_be_register("qdisk", &xen_blkdev_ops); [...] -- Eduardo