* [Qemu-devel] [PATCH 0/4] machine: Eliminate machine_init()/MODULE_INIT_MACHINE @ 2016-02-16 20:59 Eduardo Habkost 2016-02-16 20:59 ` [Qemu-devel] [PATCH 1/4] machine: Use type_init() to register machine classes Eduardo Habkost ` (3 more replies) 0 siblings, 4 replies; 14+ messages in thread From: Eduardo Habkost @ 2016-02-16 20:59 UTC (permalink / raw) To: qemu-devel; +Cc: Marcel Apfelbaum There are currently three types of users of machine_init(): * type_register*() callers * The channel_subsys initialization of at hw/s390x/css.c * qemu_add_opts() callers This series: * Changes type_register*() callers to use type_init() * Changes s390x/css to simply initialize channel_subsys fields statically * Replaces machine_init() with a new opts_init() helper, after all remaining machine_init() users are just qemu_add_opts() callers Eduardo Habkost (4): machine: Use type_init() to register machine classes s390x/css: Allocate channel_subsys statically s390x/css: Use static initialization for channel_subsys fields module: Rename machine_init() to opts_init() fsdev/qemu-fsdev-opts.c | 2 +- hw/acpi/core.c | 2 +- hw/arm/exynos4_boards.c | 2 +- hw/arm/gumstix.c | 2 +- hw/arm/highbank.c | 2 +- hw/arm/nseries.c | 2 +- hw/arm/omap_sx1.c | 2 +- hw/arm/realview.c | 2 +- hw/arm/spitz.c | 2 +- hw/arm/stellaris.c | 2 +- hw/arm/versatilepb.c | 2 +- hw/arm/vexpress.c | 2 +- hw/arm/virt.c | 2 +- hw/lm32/lm32_boards.c | 2 +- hw/mips/mips_jazz.c | 2 +- hw/ppc/ppc405_boards.c | 2 +- hw/ppc/spapr.c | 2 +- hw/s390x/css.c | 185 +++++++++++++++++++++++------------------------- hw/smbios/smbios.c | 2 +- hw/sparc/sun4m.c | 4 -- hw/sparc64/sun4u.c | 4 -- hw/xtensa/xtfpga.c | 2 +- include/hw/boards.h | 2 +- include/hw/i386/pc.h | 2 +- include/qemu/module.h | 4 +- ui/spice-core.c | 2 +- ui/vnc.c | 2 +- vl.c | 2 +- 28 files changed, 116 insertions(+), 129 deletions(-) -- 2.1.0 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 1/4] machine: Use type_init() to register machine classes 2016-02-16 20:59 [Qemu-devel] [PATCH 0/4] machine: Eliminate machine_init()/MODULE_INIT_MACHINE Eduardo Habkost @ 2016-02-16 20:59 ` Eduardo Habkost 2016-02-17 15:32 ` Marcel Apfelbaum ` (2 more replies) 2016-02-16 20:59 ` [Qemu-devel] [PATCH 2/4] s390x/css: Allocate channel_subsys statically Eduardo Habkost ` (2 subsequent siblings) 3 siblings, 3 replies; 14+ messages in thread From: Eduardo Habkost @ 2016-02-16 20:59 UTC (permalink / raw) To: qemu-devel Cc: Peter Maydell, Evgeny Voevodin, Marcel Apfelbaum, Igor Mitsyanko, Leon Alrae, Michael S. Tsirkin, Mark Cave-Ayland, Alexander Graf, Blue Swirl, Max Filippov, Michael Walle, Hervé Poussineau, Dmitry Solodkiy, Maksim Kozlov, Rob Herring, Aurelien Jarno, David Gibson Change all machine_init() users that simply call type_register*() to use type_init(). Cc: Evgeny Voevodin <e.voevodin@samsung.com> Cc: Maksim Kozlov <m.kozlov@samsung.com> Cc: Igor Mitsyanko <i.mitsyanko@gmail.com> Cc: Dmitry Solodkiy <d.solodkiy@samsung.com> Cc: Peter Maydell <peter.maydell@linaro.org> Cc: Rob Herring <robh@kernel.org> Cc: Andrzej Zaborowski <balrogg@gmail.com> Cc: Michael Walle <michael@walle.cc> Cc: "Hervé Poussineau" <hpoussin@reactos.org> Cc: Aurelien Jarno <aurelien@aurel32.net> Cc: Leon Alrae <leon.alrae@imgtec.com> Cc: Alexander Graf <agraf@suse.de> Cc: David Gibson <david@gibson.dropbear.id.au> Cc: Blue Swirl <blauwirbel@gmail.com> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Cc: Max Filippov <jcmvbkbc@gmail.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- hw/arm/exynos4_boards.c | 2 +- hw/arm/gumstix.c | 2 +- hw/arm/highbank.c | 2 +- hw/arm/nseries.c | 2 +- hw/arm/omap_sx1.c | 2 +- hw/arm/realview.c | 2 +- hw/arm/spitz.c | 2 +- hw/arm/stellaris.c | 2 +- hw/arm/versatilepb.c | 2 +- hw/arm/vexpress.c | 2 +- hw/arm/virt.c | 2 +- hw/lm32/lm32_boards.c | 2 +- hw/mips/mips_jazz.c | 2 +- hw/ppc/ppc405_boards.c | 2 +- hw/ppc/spapr.c | 2 +- hw/sparc/sun4m.c | 4 ---- hw/sparc64/sun4u.c | 4 ---- hw/xtensa/xtfpga.c | 2 +- include/hw/boards.h | 2 +- include/hw/i386/pc.h | 2 +- 20 files changed, 18 insertions(+), 26 deletions(-) diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c index 42faa8c..5b11cd9 100644 --- a/hw/arm/exynos4_boards.c +++ b/hw/arm/exynos4_boards.c @@ -181,4 +181,4 @@ static void exynos4_machines_init(void) type_register_static(&smdkc210_type); } -machine_init(exynos4_machines_init) +type_init(exynos4_machines_init) diff --git a/hw/arm/gumstix.c b/hw/arm/gumstix.c index 626d338..d59d9ba 100644 --- a/hw/arm/gumstix.c +++ b/hw/arm/gumstix.c @@ -156,4 +156,4 @@ static void gumstix_machine_init(void) type_register_static(&verdex_type); } -machine_init(gumstix_machine_init) +type_init(gumstix_machine_init) diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c index e25cf5e..e37378c 100644 --- a/hw/arm/highbank.c +++ b/hw/arm/highbank.c @@ -437,4 +437,4 @@ static void calxeda_machines_init(void) type_register_static(&midway_type); } -machine_init(calxeda_machines_init) +type_init(calxeda_machines_init) diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c index d9e61f7..9a5f33b 100644 --- a/hw/arm/nseries.c +++ b/hw/arm/nseries.c @@ -1450,4 +1450,4 @@ static void nseries_machine_init(void) type_register_static(&n810_type); } -machine_init(nseries_machine_init) +type_init(nseries_machine_init) diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c index 68236a3..cd50691 100644 --- a/hw/arm/omap_sx1.c +++ b/hw/arm/omap_sx1.c @@ -252,4 +252,4 @@ static void sx1_machine_init(void) type_register_static(&sx1_machine_v2_type); } -machine_init(sx1_machine_init) +type_init(sx1_machine_init) diff --git a/hw/arm/realview.c b/hw/arm/realview.c index 90429fc..481ae00 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -457,4 +457,4 @@ static void realview_machine_init(void) type_register_static(&realview_pbx_a9_type); } -machine_init(realview_machine_init) +type_init(realview_machine_init) diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c index 607cb58..c3048f3 100644 --- a/hw/arm/spitz.c +++ b/hw/arm/spitz.c @@ -1037,7 +1037,7 @@ static void spitz_machine_init(void) type_register_static(&terrierpda_type); } -machine_init(spitz_machine_init) +type_init(spitz_machine_init) static bool is_version_0(void *opaque, int version_id) { diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index de8dbb2..c3c72f1 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -1420,7 +1420,7 @@ static void stellaris_machine_init(void) type_register_static(&lm3s6965evb_type); } -machine_init(stellaris_machine_init) +type_init(stellaris_machine_init) static void stellaris_i2c_class_init(ObjectClass *klass, void *data) { diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c index d061f0f..5f7523e 100644 --- a/hw/arm/versatilepb.c +++ b/hw/arm/versatilepb.c @@ -419,7 +419,7 @@ static void versatile_machine_init(void) type_register_static(&versatileab_type); } -machine_init(versatile_machine_init) +type_init(versatile_machine_init) static void vpb_sic_class_init(ObjectClass *klass, void *data) { diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index 3154aea..9eca64c 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -798,4 +798,4 @@ static void vexpress_machine_init(void) type_register_static(&vexpress_a15_info); } -machine_init(vexpress_machine_init); +type_init(vexpress_machine_init); diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 44bbbea..69eef0b 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1315,4 +1315,4 @@ static void machvirt_machine_init(void) type_register_static(&machvirt_info); } -machine_init(machvirt_machine_init); +type_init(machvirt_machine_init); diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c index efa6f91..8d67657 100644 --- a/hw/lm32/lm32_boards.c +++ b/hw/lm32/lm32_boards.c @@ -329,4 +329,4 @@ static void lm32_machine_init(void) type_register_static(&lm32_uclinux_type); } -machine_init(lm32_machine_init) +type_init(lm32_machine_init) diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index d6d8058..4931cb1 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -387,4 +387,4 @@ static void mips_jazz_machine_init(void) type_register_static(&mips_pica61_type); } -machine_init(mips_jazz_machine_init) +type_init(mips_jazz_machine_init) diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c index 6797808..d8db319 100644 --- a/hw/ppc/ppc405_boards.c +++ b/hw/ppc/ppc405_boards.c @@ -658,4 +658,4 @@ static void ppc405_machine_init(void) type_register_static(&taihu_type); } -machine_init(ppc405_machine_init) +type_init(ppc405_machine_init) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 5bd8fd3..8b3b584 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2370,7 +2370,7 @@ static const TypeInfo spapr_machine_info = { { \ type_register(&spapr_machine_##suffix##_info); \ } \ - machine_init(spapr_machine_register_##suffix) + type_init(spapr_machine_register_##suffix) /* * pseries-2.6 diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 20dc341..081dcdd 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -1553,10 +1553,7 @@ static void sun4m_register_types(void) type_register_static(&afx_info); type_register_static(&prom_info); type_register_static(&ram_info); -} -static void sun4m_machine_init(void) -{ type_register_static(&ss5_type); type_register_static(&ss10_type); type_register_static(&ss600mp_type); @@ -1569,4 +1566,3 @@ static void sun4m_machine_init(void) } type_init(sun4m_register_types) -machine_init(sun4m_machine_init) diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index add1e75..5c4111d 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -997,14 +997,10 @@ static void sun4u_register_types(void) type_register_static(&ebus_info); type_register_static(&prom_info); type_register_static(&ram_info); -} -static void sun4u_machine_init(void) -{ type_register_static(&sun4u_type); type_register_static(&sun4v_type); type_register_static(&niagara_type); } type_init(sun4u_register_types) -machine_init(sun4u_machine_init) diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index fe7684d..af353dc 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -510,4 +510,4 @@ static void xtensa_lx_machines_init(void) type_register_static(&xtensa_kc705_type); } -machine_init(xtensa_lx_machines_init) +type_init(xtensa_lx_machines_init) diff --git a/include/hw/boards.h b/include/hw/boards.h index 0f30959..2624420 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -155,7 +155,7 @@ struct MachineState { { \ type_register_static(&machine_initfn##_typeinfo); \ } \ - machine_init(machine_initfn##_register_types) + type_init(machine_initfn##_register_types) #define SET_MACHINE_COMPAT(m, COMPAT) \ do { \ diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 8b3546e..2d00002 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -852,7 +852,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); { \ type_register(&pc_machine_type_##suffix); \ } \ - machine_init(pc_machine_init_##suffix) + type_init(pc_machine_init_##suffix) extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id); #endif -- 2.1.0 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 1/4] machine: Use type_init() to register machine classes 2016-02-16 20:59 ` [Qemu-devel] [PATCH 1/4] machine: Use type_init() to register machine classes Eduardo Habkost @ 2016-02-17 15:32 ` Marcel Apfelbaum 2016-02-17 15:57 ` Michael S. Tsirkin 2016-02-18 2:35 ` David Gibson 2 siblings, 0 replies; 14+ messages in thread From: Marcel Apfelbaum @ 2016-02-17 15:32 UTC (permalink / raw) To: Eduardo Habkost, qemu-devel Cc: Peter Maydell, Evgeny Voevodin, Marcel Apfelbaum, Igor Mitsyanko, Leon Alrae, Michael S. Tsirkin, Mark Cave-Ayland, Alexander Graf, Blue Swirl, Max Filippov, Michael Walle, Hervé Poussineau, Dmitry Solodkiy, Maksim Kozlov, Rob Herring, Aurelien Jarno, David Gibson On 02/16/2016 10:59 PM, Eduardo Habkost wrote: > Change all machine_init() users that simply call type_register*() > to use type_init(). If all machines are QOM objects this makes sense. Acked-by: Marcel Apfelbaum <marcel@redhat.com> Thanks, Marcel > > Cc: Evgeny Voevodin <e.voevodin@samsung.com> > Cc: Maksim Kozlov <m.kozlov@samsung.com> > Cc: Igor Mitsyanko <i.mitsyanko@gmail.com> > Cc: Dmitry Solodkiy <d.solodkiy@samsung.com> > Cc: Peter Maydell <peter.maydell@linaro.org> > Cc: Rob Herring <robh@kernel.org> > Cc: Andrzej Zaborowski <balrogg@gmail.com> > Cc: Michael Walle <michael@walle.cc> > Cc: "Hervé Poussineau" <hpoussin@reactos.org> > Cc: Aurelien Jarno <aurelien@aurel32.net> > Cc: Leon Alrae <leon.alrae@imgtec.com> > Cc: Alexander Graf <agraf@suse.de> > Cc: David Gibson <david@gibson.dropbear.id.au> > Cc: Blue Swirl <blauwirbel@gmail.com> > Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> > Cc: Max Filippov <jcmvbkbc@gmail.com> > Cc: "Michael S. Tsirkin" <mst@redhat.com> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> > --- > hw/arm/exynos4_boards.c | 2 +- > hw/arm/gumstix.c | 2 +- > hw/arm/highbank.c | 2 +- > hw/arm/nseries.c | 2 +- > hw/arm/omap_sx1.c | 2 +- > hw/arm/realview.c | 2 +- > hw/arm/spitz.c | 2 +- > hw/arm/stellaris.c | 2 +- > hw/arm/versatilepb.c | 2 +- > hw/arm/vexpress.c | 2 +- > hw/arm/virt.c | 2 +- > hw/lm32/lm32_boards.c | 2 +- > hw/mips/mips_jazz.c | 2 +- > hw/ppc/ppc405_boards.c | 2 +- > hw/ppc/spapr.c | 2 +- > hw/sparc/sun4m.c | 4 ---- > hw/sparc64/sun4u.c | 4 ---- > hw/xtensa/xtfpga.c | 2 +- > include/hw/boards.h | 2 +- > include/hw/i386/pc.h | 2 +- > 20 files changed, 18 insertions(+), 26 deletions(-) > > diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c > index 42faa8c..5b11cd9 100644 > --- a/hw/arm/exynos4_boards.c > +++ b/hw/arm/exynos4_boards.c > @@ -181,4 +181,4 @@ static void exynos4_machines_init(void) > type_register_static(&smdkc210_type); > } > > -machine_init(exynos4_machines_init) > +type_init(exynos4_machines_init) > diff --git a/hw/arm/gumstix.c b/hw/arm/gumstix.c > index 626d338..d59d9ba 100644 > --- a/hw/arm/gumstix.c > +++ b/hw/arm/gumstix.c > @@ -156,4 +156,4 @@ static void gumstix_machine_init(void) > type_register_static(&verdex_type); > } > > -machine_init(gumstix_machine_init) > +type_init(gumstix_machine_init) > diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c > index e25cf5e..e37378c 100644 > --- a/hw/arm/highbank.c > +++ b/hw/arm/highbank.c > @@ -437,4 +437,4 @@ static void calxeda_machines_init(void) > type_register_static(&midway_type); > } > > -machine_init(calxeda_machines_init) > +type_init(calxeda_machines_init) > diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c > index d9e61f7..9a5f33b 100644 > --- a/hw/arm/nseries.c > +++ b/hw/arm/nseries.c > @@ -1450,4 +1450,4 @@ static void nseries_machine_init(void) > type_register_static(&n810_type); > } > > -machine_init(nseries_machine_init) > +type_init(nseries_machine_init) > diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c > index 68236a3..cd50691 100644 > --- a/hw/arm/omap_sx1.c > +++ b/hw/arm/omap_sx1.c > @@ -252,4 +252,4 @@ static void sx1_machine_init(void) > type_register_static(&sx1_machine_v2_type); > } > > -machine_init(sx1_machine_init) > +type_init(sx1_machine_init) > diff --git a/hw/arm/realview.c b/hw/arm/realview.c > index 90429fc..481ae00 100644 > --- a/hw/arm/realview.c > +++ b/hw/arm/realview.c > @@ -457,4 +457,4 @@ static void realview_machine_init(void) > type_register_static(&realview_pbx_a9_type); > } > > -machine_init(realview_machine_init) > +type_init(realview_machine_init) > diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c > index 607cb58..c3048f3 100644 > --- a/hw/arm/spitz.c > +++ b/hw/arm/spitz.c > @@ -1037,7 +1037,7 @@ static void spitz_machine_init(void) > type_register_static(&terrierpda_type); > } > > -machine_init(spitz_machine_init) > +type_init(spitz_machine_init) > > static bool is_version_0(void *opaque, int version_id) > { > diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c > index de8dbb2..c3c72f1 100644 > --- a/hw/arm/stellaris.c > +++ b/hw/arm/stellaris.c > @@ -1420,7 +1420,7 @@ static void stellaris_machine_init(void) > type_register_static(&lm3s6965evb_type); > } > > -machine_init(stellaris_machine_init) > +type_init(stellaris_machine_init) > > static void stellaris_i2c_class_init(ObjectClass *klass, void *data) > { > diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c > index d061f0f..5f7523e 100644 > --- a/hw/arm/versatilepb.c > +++ b/hw/arm/versatilepb.c > @@ -419,7 +419,7 @@ static void versatile_machine_init(void) > type_register_static(&versatileab_type); > } > > -machine_init(versatile_machine_init) > +type_init(versatile_machine_init) > > static void vpb_sic_class_init(ObjectClass *klass, void *data) > { > diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c > index 3154aea..9eca64c 100644 > --- a/hw/arm/vexpress.c > +++ b/hw/arm/vexpress.c > @@ -798,4 +798,4 @@ static void vexpress_machine_init(void) > type_register_static(&vexpress_a15_info); > } > > -machine_init(vexpress_machine_init); > +type_init(vexpress_machine_init); > diff --git a/hw/arm/virt.c b/hw/arm/virt.c > index 44bbbea..69eef0b 100644 > --- a/hw/arm/virt.c > +++ b/hw/arm/virt.c > @@ -1315,4 +1315,4 @@ static void machvirt_machine_init(void) > type_register_static(&machvirt_info); > } > > -machine_init(machvirt_machine_init); > +type_init(machvirt_machine_init); > diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c > index efa6f91..8d67657 100644 > --- a/hw/lm32/lm32_boards.c > +++ b/hw/lm32/lm32_boards.c > @@ -329,4 +329,4 @@ static void lm32_machine_init(void) > type_register_static(&lm32_uclinux_type); > } > > -machine_init(lm32_machine_init) > +type_init(lm32_machine_init) > diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c > index d6d8058..4931cb1 100644 > --- a/hw/mips/mips_jazz.c > +++ b/hw/mips/mips_jazz.c > @@ -387,4 +387,4 @@ static void mips_jazz_machine_init(void) > type_register_static(&mips_pica61_type); > } > > -machine_init(mips_jazz_machine_init) > +type_init(mips_jazz_machine_init) > diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c > index 6797808..d8db319 100644 > --- a/hw/ppc/ppc405_boards.c > +++ b/hw/ppc/ppc405_boards.c > @@ -658,4 +658,4 @@ static void ppc405_machine_init(void) > type_register_static(&taihu_type); > } > > -machine_init(ppc405_machine_init) > +type_init(ppc405_machine_init) > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 5bd8fd3..8b3b584 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -2370,7 +2370,7 @@ static const TypeInfo spapr_machine_info = { > { \ > type_register(&spapr_machine_##suffix##_info); \ > } \ > - machine_init(spapr_machine_register_##suffix) > + type_init(spapr_machine_register_##suffix) > > /* > * pseries-2.6 > diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c > index 20dc341..081dcdd 100644 > --- a/hw/sparc/sun4m.c > +++ b/hw/sparc/sun4m.c > @@ -1553,10 +1553,7 @@ static void sun4m_register_types(void) > type_register_static(&afx_info); > type_register_static(&prom_info); > type_register_static(&ram_info); > -} > > -static void sun4m_machine_init(void) > -{ > type_register_static(&ss5_type); > type_register_static(&ss10_type); > type_register_static(&ss600mp_type); > @@ -1569,4 +1566,3 @@ static void sun4m_machine_init(void) > } > > type_init(sun4m_register_types) > -machine_init(sun4m_machine_init) > diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c > index add1e75..5c4111d 100644 > --- a/hw/sparc64/sun4u.c > +++ b/hw/sparc64/sun4u.c > @@ -997,14 +997,10 @@ static void sun4u_register_types(void) > type_register_static(&ebus_info); > type_register_static(&prom_info); > type_register_static(&ram_info); > -} > > -static void sun4u_machine_init(void) > -{ > type_register_static(&sun4u_type); > type_register_static(&sun4v_type); > type_register_static(&niagara_type); > } > > type_init(sun4u_register_types) > -machine_init(sun4u_machine_init) > diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c > index fe7684d..af353dc 100644 > --- a/hw/xtensa/xtfpga.c > +++ b/hw/xtensa/xtfpga.c > @@ -510,4 +510,4 @@ static void xtensa_lx_machines_init(void) > type_register_static(&xtensa_kc705_type); > } > > -machine_init(xtensa_lx_machines_init) > +type_init(xtensa_lx_machines_init) > diff --git a/include/hw/boards.h b/include/hw/boards.h > index 0f30959..2624420 100644 > --- a/include/hw/boards.h > +++ b/include/hw/boards.h > @@ -155,7 +155,7 @@ struct MachineState { > { \ > type_register_static(&machine_initfn##_typeinfo); \ > } \ > - machine_init(machine_initfn##_register_types) > + type_init(machine_initfn##_register_types) > > #define SET_MACHINE_COMPAT(m, COMPAT) \ > do { \ > diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h > index 8b3546e..2d00002 100644 > --- a/include/hw/i386/pc.h > +++ b/include/hw/i386/pc.h > @@ -852,7 +852,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > { \ > type_register(&pc_machine_type_##suffix); \ > } \ > - machine_init(pc_machine_init_##suffix) > + type_init(pc_machine_init_##suffix) > > extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id); > #endif > ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 1/4] machine: Use type_init() to register machine classes 2016-02-16 20:59 ` [Qemu-devel] [PATCH 1/4] machine: Use type_init() to register machine classes Eduardo Habkost 2016-02-17 15:32 ` Marcel Apfelbaum @ 2016-02-17 15:57 ` Michael S. Tsirkin 2016-02-18 2:35 ` David Gibson 2 siblings, 0 replies; 14+ messages in thread From: Michael S. Tsirkin @ 2016-02-17 15:57 UTC (permalink / raw) To: Eduardo Habkost Cc: Peter Maydell, Evgeny Voevodin, Marcel Apfelbaum, Igor Mitsyanko, Leon Alrae, Mark Cave-Ayland, qemu-devel, Alexander Graf, Blue Swirl, Max Filippov, Michael Walle, Hervé Poussineau, Dmitry Solodkiy, Maksim Kozlov, Rob Herring, Aurelien Jarno, David Gibson On Tue, Feb 16, 2016 at 06:59:04PM -0200, Eduardo Habkost wrote: > Change all machine_init() users that simply call type_register*() > to use type_init(). > > Cc: Evgeny Voevodin <e.voevodin@samsung.com> > Cc: Maksim Kozlov <m.kozlov@samsung.com> > Cc: Igor Mitsyanko <i.mitsyanko@gmail.com> > Cc: Dmitry Solodkiy <d.solodkiy@samsung.com> > Cc: Peter Maydell <peter.maydell@linaro.org> > Cc: Rob Herring <robh@kernel.org> > Cc: Andrzej Zaborowski <balrogg@gmail.com> > Cc: Michael Walle <michael@walle.cc> > Cc: "Hervé Poussineau" <hpoussin@reactos.org> > Cc: Aurelien Jarno <aurelien@aurel32.net> > Cc: Leon Alrae <leon.alrae@imgtec.com> > Cc: Alexander Graf <agraf@suse.de> > Cc: David Gibson <david@gibson.dropbear.id.au> > Cc: Blue Swirl <blauwirbel@gmail.com> > Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> > Cc: Max Filippov <jcmvbkbc@gmail.com> > Cc: "Michael S. Tsirkin" <mst@redhat.com> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> For pc: Reviewed-by: Michael S. Tsirkin <mst@redhat.com> > --- > hw/arm/exynos4_boards.c | 2 +- > hw/arm/gumstix.c | 2 +- > hw/arm/highbank.c | 2 +- > hw/arm/nseries.c | 2 +- > hw/arm/omap_sx1.c | 2 +- > hw/arm/realview.c | 2 +- > hw/arm/spitz.c | 2 +- > hw/arm/stellaris.c | 2 +- > hw/arm/versatilepb.c | 2 +- > hw/arm/vexpress.c | 2 +- > hw/arm/virt.c | 2 +- > hw/lm32/lm32_boards.c | 2 +- > hw/mips/mips_jazz.c | 2 +- > hw/ppc/ppc405_boards.c | 2 +- > hw/ppc/spapr.c | 2 +- > hw/sparc/sun4m.c | 4 ---- > hw/sparc64/sun4u.c | 4 ---- > hw/xtensa/xtfpga.c | 2 +- > include/hw/boards.h | 2 +- > include/hw/i386/pc.h | 2 +- > 20 files changed, 18 insertions(+), 26 deletions(-) > > diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c > index 42faa8c..5b11cd9 100644 > --- a/hw/arm/exynos4_boards.c > +++ b/hw/arm/exynos4_boards.c > @@ -181,4 +181,4 @@ static void exynos4_machines_init(void) > type_register_static(&smdkc210_type); > } > > -machine_init(exynos4_machines_init) > +type_init(exynos4_machines_init) > diff --git a/hw/arm/gumstix.c b/hw/arm/gumstix.c > index 626d338..d59d9ba 100644 > --- a/hw/arm/gumstix.c > +++ b/hw/arm/gumstix.c > @@ -156,4 +156,4 @@ static void gumstix_machine_init(void) > type_register_static(&verdex_type); > } > > -machine_init(gumstix_machine_init) > +type_init(gumstix_machine_init) > diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c > index e25cf5e..e37378c 100644 > --- a/hw/arm/highbank.c > +++ b/hw/arm/highbank.c > @@ -437,4 +437,4 @@ static void calxeda_machines_init(void) > type_register_static(&midway_type); > } > > -machine_init(calxeda_machines_init) > +type_init(calxeda_machines_init) > diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c > index d9e61f7..9a5f33b 100644 > --- a/hw/arm/nseries.c > +++ b/hw/arm/nseries.c > @@ -1450,4 +1450,4 @@ static void nseries_machine_init(void) > type_register_static(&n810_type); > } > > -machine_init(nseries_machine_init) > +type_init(nseries_machine_init) > diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c > index 68236a3..cd50691 100644 > --- a/hw/arm/omap_sx1.c > +++ b/hw/arm/omap_sx1.c > @@ -252,4 +252,4 @@ static void sx1_machine_init(void) > type_register_static(&sx1_machine_v2_type); > } > > -machine_init(sx1_machine_init) > +type_init(sx1_machine_init) > diff --git a/hw/arm/realview.c b/hw/arm/realview.c > index 90429fc..481ae00 100644 > --- a/hw/arm/realview.c > +++ b/hw/arm/realview.c > @@ -457,4 +457,4 @@ static void realview_machine_init(void) > type_register_static(&realview_pbx_a9_type); > } > > -machine_init(realview_machine_init) > +type_init(realview_machine_init) > diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c > index 607cb58..c3048f3 100644 > --- a/hw/arm/spitz.c > +++ b/hw/arm/spitz.c > @@ -1037,7 +1037,7 @@ static void spitz_machine_init(void) > type_register_static(&terrierpda_type); > } > > -machine_init(spitz_machine_init) > +type_init(spitz_machine_init) > > static bool is_version_0(void *opaque, int version_id) > { > diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c > index de8dbb2..c3c72f1 100644 > --- a/hw/arm/stellaris.c > +++ b/hw/arm/stellaris.c > @@ -1420,7 +1420,7 @@ static void stellaris_machine_init(void) > type_register_static(&lm3s6965evb_type); > } > > -machine_init(stellaris_machine_init) > +type_init(stellaris_machine_init) > > static void stellaris_i2c_class_init(ObjectClass *klass, void *data) > { > diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c > index d061f0f..5f7523e 100644 > --- a/hw/arm/versatilepb.c > +++ b/hw/arm/versatilepb.c > @@ -419,7 +419,7 @@ static void versatile_machine_init(void) > type_register_static(&versatileab_type); > } > > -machine_init(versatile_machine_init) > +type_init(versatile_machine_init) > > static void vpb_sic_class_init(ObjectClass *klass, void *data) > { > diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c > index 3154aea..9eca64c 100644 > --- a/hw/arm/vexpress.c > +++ b/hw/arm/vexpress.c > @@ -798,4 +798,4 @@ static void vexpress_machine_init(void) > type_register_static(&vexpress_a15_info); > } > > -machine_init(vexpress_machine_init); > +type_init(vexpress_machine_init); > diff --git a/hw/arm/virt.c b/hw/arm/virt.c > index 44bbbea..69eef0b 100644 > --- a/hw/arm/virt.c > +++ b/hw/arm/virt.c > @@ -1315,4 +1315,4 @@ static void machvirt_machine_init(void) > type_register_static(&machvirt_info); > } > > -machine_init(machvirt_machine_init); > +type_init(machvirt_machine_init); > diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c > index efa6f91..8d67657 100644 > --- a/hw/lm32/lm32_boards.c > +++ b/hw/lm32/lm32_boards.c > @@ -329,4 +329,4 @@ static void lm32_machine_init(void) > type_register_static(&lm32_uclinux_type); > } > > -machine_init(lm32_machine_init) > +type_init(lm32_machine_init) > diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c > index d6d8058..4931cb1 100644 > --- a/hw/mips/mips_jazz.c > +++ b/hw/mips/mips_jazz.c > @@ -387,4 +387,4 @@ static void mips_jazz_machine_init(void) > type_register_static(&mips_pica61_type); > } > > -machine_init(mips_jazz_machine_init) > +type_init(mips_jazz_machine_init) > diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c > index 6797808..d8db319 100644 > --- a/hw/ppc/ppc405_boards.c > +++ b/hw/ppc/ppc405_boards.c > @@ -658,4 +658,4 @@ static void ppc405_machine_init(void) > type_register_static(&taihu_type); > } > > -machine_init(ppc405_machine_init) > +type_init(ppc405_machine_init) > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 5bd8fd3..8b3b584 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -2370,7 +2370,7 @@ static const TypeInfo spapr_machine_info = { > { \ > type_register(&spapr_machine_##suffix##_info); \ > } \ > - machine_init(spapr_machine_register_##suffix) > + type_init(spapr_machine_register_##suffix) > > /* > * pseries-2.6 > diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c > index 20dc341..081dcdd 100644 > --- a/hw/sparc/sun4m.c > +++ b/hw/sparc/sun4m.c > @@ -1553,10 +1553,7 @@ static void sun4m_register_types(void) > type_register_static(&afx_info); > type_register_static(&prom_info); > type_register_static(&ram_info); > -} > > -static void sun4m_machine_init(void) > -{ > type_register_static(&ss5_type); > type_register_static(&ss10_type); > type_register_static(&ss600mp_type); > @@ -1569,4 +1566,3 @@ static void sun4m_machine_init(void) > } > > type_init(sun4m_register_types) > -machine_init(sun4m_machine_init) > diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c > index add1e75..5c4111d 100644 > --- a/hw/sparc64/sun4u.c > +++ b/hw/sparc64/sun4u.c > @@ -997,14 +997,10 @@ static void sun4u_register_types(void) > type_register_static(&ebus_info); > type_register_static(&prom_info); > type_register_static(&ram_info); > -} > > -static void sun4u_machine_init(void) > -{ > type_register_static(&sun4u_type); > type_register_static(&sun4v_type); > type_register_static(&niagara_type); > } > > type_init(sun4u_register_types) > -machine_init(sun4u_machine_init) > diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c > index fe7684d..af353dc 100644 > --- a/hw/xtensa/xtfpga.c > +++ b/hw/xtensa/xtfpga.c > @@ -510,4 +510,4 @@ static void xtensa_lx_machines_init(void) > type_register_static(&xtensa_kc705_type); > } > > -machine_init(xtensa_lx_machines_init) > +type_init(xtensa_lx_machines_init) > diff --git a/include/hw/boards.h b/include/hw/boards.h > index 0f30959..2624420 100644 > --- a/include/hw/boards.h > +++ b/include/hw/boards.h > @@ -155,7 +155,7 @@ struct MachineState { > { \ > type_register_static(&machine_initfn##_typeinfo); \ > } \ > - machine_init(machine_initfn##_register_types) > + type_init(machine_initfn##_register_types) > > #define SET_MACHINE_COMPAT(m, COMPAT) \ > do { \ > diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h > index 8b3546e..2d00002 100644 > --- a/include/hw/i386/pc.h > +++ b/include/hw/i386/pc.h > @@ -852,7 +852,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > { \ > type_register(&pc_machine_type_##suffix); \ > } \ > - machine_init(pc_machine_init_##suffix) > + type_init(pc_machine_init_##suffix) > > extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id); > #endif > -- > 2.1.0 ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 1/4] machine: Use type_init() to register machine classes 2016-02-16 20:59 ` [Qemu-devel] [PATCH 1/4] machine: Use type_init() to register machine classes Eduardo Habkost 2016-02-17 15:32 ` Marcel Apfelbaum 2016-02-17 15:57 ` Michael S. Tsirkin @ 2016-02-18 2:35 ` David Gibson 2 siblings, 0 replies; 14+ messages in thread From: David Gibson @ 2016-02-18 2:35 UTC (permalink / raw) To: Eduardo Habkost Cc: Peter Maydell, Evgeny Voevodin, Marcel Apfelbaum, Igor Mitsyanko, Leon Alrae, Michael S. Tsirkin, Mark Cave-Ayland, qemu-devel, Alexander Graf, Blue Swirl, Max Filippov, Michael Walle, Hervé Poussineau, Dmitry Solodkiy, Maksim Kozlov, Rob Herring, Aurelien Jarno [-- Attachment #1: Type: text/plain, Size: 2015 bytes --] On Tue, Feb 16, 2016 at 06:59:04PM -0200, Eduardo Habkost wrote: > Change all machine_init() users that simply call type_register*() > to use type_init(). > > Cc: Evgeny Voevodin <e.voevodin@samsung.com> > Cc: Maksim Kozlov <m.kozlov@samsung.com> > Cc: Igor Mitsyanko <i.mitsyanko@gmail.com> > Cc: Dmitry Solodkiy <d.solodkiy@samsung.com> > Cc: Peter Maydell <peter.maydell@linaro.org> > Cc: Rob Herring <robh@kernel.org> > Cc: Andrzej Zaborowski <balrogg@gmail.com> > Cc: Michael Walle <michael@walle.cc> > Cc: "Hervé Poussineau" <hpoussin@reactos.org> > Cc: Aurelien Jarno <aurelien@aurel32.net> > Cc: Leon Alrae <leon.alrae@imgtec.com> > Cc: Alexander Graf <agraf@suse.de> > Cc: David Gibson <david@gibson.dropbear.id.au> > Cc: Blue Swirl <blauwirbel@gmail.com> > Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> > Cc: Max Filippov <jcmvbkbc@gmail.com> > Cc: "Michael S. Tsirkin" <mst@redhat.com> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> > --- > hw/arm/exynos4_boards.c | 2 +- > hw/arm/gumstix.c | 2 +- > hw/arm/highbank.c | 2 +- > hw/arm/nseries.c | 2 +- > hw/arm/omap_sx1.c | 2 +- > hw/arm/realview.c | 2 +- > hw/arm/spitz.c | 2 +- > hw/arm/stellaris.c | 2 +- > hw/arm/versatilepb.c | 2 +- > hw/arm/vexpress.c | 2 +- > hw/arm/virt.c | 2 +- > hw/lm32/lm32_boards.c | 2 +- > hw/mips/mips_jazz.c | 2 +- > hw/ppc/ppc405_boards.c | 2 +- > hw/ppc/spapr.c | 2 +- > hw/sparc/sun4m.c | 4 ---- > hw/sparc64/sun4u.c | 4 ---- > hw/xtensa/xtfpga.c | 2 +- > include/hw/boards.h | 2 +- > include/hw/i386/pc.h | 2 +- > 20 files changed, 18 insertions(+), 26 deletions(-) For spapr, Acked-by: David Gibson <david@gibson.dropbear.id.au> -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 2/4] s390x/css: Allocate channel_subsys statically 2016-02-16 20:59 [Qemu-devel] [PATCH 0/4] machine: Eliminate machine_init()/MODULE_INIT_MACHINE Eduardo Habkost 2016-02-16 20:59 ` [Qemu-devel] [PATCH 1/4] machine: Use type_init() to register machine classes Eduardo Habkost @ 2016-02-16 20:59 ` Eduardo Habkost 2016-02-17 11:43 ` Cornelia Huck 2016-02-16 20:59 ` [Qemu-devel] [PATCH 3/4] s390x/css: Use static initialization for channel_subsys fields Eduardo Habkost 2016-02-16 20:59 ` [Qemu-devel] [PATCH 4/4] module: Rename machine_init() to opts_init() Eduardo Habkost 3 siblings, 1 reply; 14+ messages in thread From: Eduardo Habkost @ 2016-02-16 20:59 UTC (permalink / raw) To: qemu-devel Cc: Cornelia Huck, Christian Borntraeger, Richard Henderson, Alexander Graf, Marcel Apfelbaum There's no need to use g_malloc0() to allocate the channel_subsys struct, just use a static variable. Cc: Cornelia Huck <cornelia.huck@de.ibm.com> Cc: Christian Borntraeger <borntraeger@de.ibm.com> Cc: Richard Henderson <rth@twiddle.net> Cc: Alexander Graf <agraf@suse.de> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- hw/s390x/css.c | 177 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 88 insertions(+), 89 deletions(-) diff --git a/hw/s390x/css.c b/hw/s390x/css.c index c29068b..2e9659a 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -62,7 +62,7 @@ typedef struct ChannelSubSys { QTAILQ_HEAD(, IoAdapter) io_adapters; } ChannelSubSys; -static ChannelSubSys *channel_subsys; +static ChannelSubSys channel_subsys; int css_create_css_image(uint8_t cssid, bool default_image) { @@ -70,12 +70,12 @@ int css_create_css_image(uint8_t cssid, bool default_image) if (cssid > MAX_CSSID) { return -EINVAL; } - if (channel_subsys->css[cssid]) { + if (channel_subsys.css[cssid]) { return -EBUSY; } - channel_subsys->css[cssid] = g_malloc0(sizeof(CssImage)); + channel_subsys.css[cssid] = g_malloc0(sizeof(CssImage)); if (default_image) { - channel_subsys->default_cssid = cssid; + channel_subsys.default_cssid = cssid; } return 0; } @@ -90,7 +90,7 @@ int css_register_io_adapter(uint8_t type, uint8_t isc, bool swap, S390FLICStateClass *fsc = S390_FLIC_COMMON_GET_CLASS(fs); *id = 0; - QTAILQ_FOREACH(adapter, &channel_subsys->io_adapters, sibling) { + QTAILQ_FOREACH(adapter, &channel_subsys.io_adapters, sibling) { if ((adapter->type == type) && (adapter->isc == isc)) { *id = adapter->id; found = true; @@ -110,7 +110,7 @@ int css_register_io_adapter(uint8_t type, uint8_t isc, bool swap, adapter->id = *id; adapter->isc = isc; adapter->type = type; - QTAILQ_INSERT_TAIL(&channel_subsys->io_adapters, adapter, sibling); + QTAILQ_INSERT_TAIL(&channel_subsys.io_adapters, adapter, sibling); } else { g_free(adapter); fprintf(stderr, "Unexpected error %d when registering adapter %d\n", @@ -122,7 +122,7 @@ out: uint16_t css_build_subchannel_id(SubchDev *sch) { - if (channel_subsys->max_cssid > 0) { + if (channel_subsys.max_cssid > 0) { return (sch->cssid << 8) | (1 << 3) | (sch->ssid << 1) | 1; } return (sch->ssid << 1) | 1; @@ -778,12 +778,12 @@ static void css_update_chnmon(SubchDev *sch) offset = sch->curr_status.pmcw.mbi << 5; count = address_space_lduw(&address_space_memory, - channel_subsys->chnmon_area + offset, + channel_subsys.chnmon_area + offset, MEMTXATTRS_UNSPECIFIED, NULL); count++; address_space_stw(&address_space_memory, - channel_subsys->chnmon_area + offset, count, + channel_subsys.chnmon_area + offset, count, MEMTXATTRS_UNSPECIFIED, NULL); } } @@ -812,7 +812,7 @@ int css_do_ssch(SubchDev *sch, ORB *orb) } /* If monitoring is active, update counter. */ - if (channel_subsys->chnmon_active) { + if (channel_subsys.chnmon_active) { css_update_chnmon(sch); } sch->channel_prog = orb->cpa; @@ -971,16 +971,16 @@ int css_do_stcrw(CRW *crw) CrwContainer *crw_cont; int ret; - crw_cont = QTAILQ_FIRST(&channel_subsys->pending_crws); + crw_cont = QTAILQ_FIRST(&channel_subsys.pending_crws); if (crw_cont) { - QTAILQ_REMOVE(&channel_subsys->pending_crws, crw_cont, sibling); + QTAILQ_REMOVE(&channel_subsys.pending_crws, crw_cont, sibling); copy_crw_to_guest(crw, &crw_cont->crw); g_free(crw_cont); ret = 0; } else { /* List was empty, turn crw machine checks on again. */ memset(crw, 0, sizeof(*crw)); - channel_subsys->do_crw_mchk = true; + channel_subsys.do_crw_mchk = true; ret = 1; } @@ -999,12 +999,12 @@ void css_undo_stcrw(CRW *crw) crw_cont = g_try_malloc0(sizeof(CrwContainer)); if (!crw_cont) { - channel_subsys->crws_lost = true; + channel_subsys.crws_lost = true; return; } copy_crw_from_guest(&crw_cont->crw, crw); - QTAILQ_INSERT_HEAD(&channel_subsys->pending_crws, crw_cont, sibling); + QTAILQ_INSERT_HEAD(&channel_subsys.pending_crws, crw_cont, sibling); } int css_do_tpi(IOIntCode *int_code, int lowcore) @@ -1022,9 +1022,9 @@ int css_collect_chp_desc(int m, uint8_t cssid, uint8_t f_chpid, uint8_t l_chpid, CssImage *css; if (!m && !cssid) { - css = channel_subsys->css[channel_subsys->default_cssid]; + css = channel_subsys.css[channel_subsys.default_cssid]; } else { - css = channel_subsys->css[cssid]; + css = channel_subsys.css[cssid]; } if (!css) { return 0; @@ -1059,15 +1059,15 @@ void css_do_schm(uint8_t mbk, int update, int dct, uint64_t mbo) { /* dct is currently ignored (not really meaningful for our devices) */ /* TODO: Don't ignore mbk. */ - if (update && !channel_subsys->chnmon_active) { + if (update && !channel_subsys.chnmon_active) { /* Enable measuring. */ - channel_subsys->chnmon_area = mbo; - channel_subsys->chnmon_active = true; + channel_subsys.chnmon_area = mbo; + channel_subsys.chnmon_active = true; } - if (!update && channel_subsys->chnmon_active) { + if (!update && channel_subsys.chnmon_active) { /* Disable measuring. */ - channel_subsys->chnmon_area = 0; - channel_subsys->chnmon_active = false; + channel_subsys.chnmon_area = 0; + channel_subsys.chnmon_active = false; } } @@ -1095,7 +1095,7 @@ int css_do_rsch(SubchDev *sch) } /* If monitoring is active, update counter. */ - if (channel_subsys->chnmon_active) { + if (channel_subsys.chnmon_active) { css_update_chnmon(sch); } @@ -1111,23 +1111,23 @@ int css_do_rchp(uint8_t cssid, uint8_t chpid) { uint8_t real_cssid; - if (cssid > channel_subsys->max_cssid) { + if (cssid > channel_subsys.max_cssid) { return -EINVAL; } - if (channel_subsys->max_cssid == 0) { - real_cssid = channel_subsys->default_cssid; + if (channel_subsys.max_cssid == 0) { + real_cssid = channel_subsys.default_cssid; } else { real_cssid = cssid; } - if (!channel_subsys->css[real_cssid]) { + if (!channel_subsys.css[real_cssid]) { return -EINVAL; } - if (!channel_subsys->css[real_cssid]->chpids[chpid].in_use) { + if (!channel_subsys.css[real_cssid]->chpids[chpid].in_use) { return -ENODEV; } - if (!channel_subsys->css[real_cssid]->chpids[chpid].is_virtual) { + if (!channel_subsys.css[real_cssid]->chpids[chpid].is_virtual) { fprintf(stderr, "rchp unsupported for non-virtual chpid %x.%02x!\n", real_cssid, chpid); @@ -1136,8 +1136,8 @@ int css_do_rchp(uint8_t cssid, uint8_t chpid) /* We don't really use a channel path, so we're done here. */ css_queue_crw(CRW_RSC_CHP, CRW_ERC_INIT, - channel_subsys->max_cssid > 0 ? 1 : 0, chpid); - if (channel_subsys->max_cssid > 0) { + channel_subsys.max_cssid > 0 ? 1 : 0, chpid); + if (channel_subsys.max_cssid > 0) { css_queue_crw(CRW_RSC_CHP, CRW_ERC_INIT, 0, real_cssid << 8); } return 0; @@ -1148,13 +1148,13 @@ bool css_schid_final(int m, uint8_t cssid, uint8_t ssid, uint16_t schid) SubchSet *set; uint8_t real_cssid; - real_cssid = (!m && (cssid == 0)) ? channel_subsys->default_cssid : cssid; + real_cssid = (!m && (cssid == 0)) ? channel_subsys.default_cssid : cssid; if (real_cssid > MAX_CSSID || ssid > MAX_SSID || - !channel_subsys->css[real_cssid] || - !channel_subsys->css[real_cssid]->sch_set[ssid]) { + !channel_subsys.css[real_cssid] || + !channel_subsys.css[real_cssid]->sch_set[ssid]) { return true; } - set = channel_subsys->css[real_cssid]->sch_set[ssid]; + set = channel_subsys.css[real_cssid]->sch_set[ssid]; return schid > find_last_bit(set->schids_used, (MAX_SCHID + 1) / sizeof(unsigned long)); } @@ -1167,7 +1167,7 @@ static int css_add_virtual_chpid(uint8_t cssid, uint8_t chpid, uint8_t type) if (cssid > MAX_CSSID) { return -EINVAL; } - css = channel_subsys->css[cssid]; + css = channel_subsys.css[cssid]; if (!css) { return -EINVAL; } @@ -1188,7 +1188,7 @@ void css_sch_build_virtual_schib(SubchDev *sch, uint8_t chpid, uint8_t type) PMCW *p = &sch->curr_status.pmcw; SCSW *s = &sch->curr_status.scsw; int i; - CssImage *css = channel_subsys->css[sch->cssid]; + CssImage *css = channel_subsys.css[sch->cssid]; assert(css != NULL); memset(p, 0, sizeof(PMCW)); @@ -1214,27 +1214,27 @@ SubchDev *css_find_subch(uint8_t m, uint8_t cssid, uint8_t ssid, uint16_t schid) { uint8_t real_cssid; - real_cssid = (!m && (cssid == 0)) ? channel_subsys->default_cssid : cssid; + real_cssid = (!m && (cssid == 0)) ? channel_subsys.default_cssid : cssid; - if (!channel_subsys->css[real_cssid]) { + if (!channel_subsys.css[real_cssid]) { return NULL; } - if (!channel_subsys->css[real_cssid]->sch_set[ssid]) { + if (!channel_subsys.css[real_cssid]->sch_set[ssid]) { return NULL; } - return channel_subsys->css[real_cssid]->sch_set[ssid]->sch[schid]; + return channel_subsys.css[real_cssid]->sch_set[ssid]->sch[schid]; } bool css_subch_visible(SubchDev *sch) { - if (sch->ssid > channel_subsys->max_ssid) { + if (sch->ssid > channel_subsys.max_ssid) { return false; } - if (sch->cssid != channel_subsys->default_cssid) { - return (channel_subsys->max_cssid > 0); + if (sch->cssid != channel_subsys.default_cssid) { + return (channel_subsys.max_cssid > 0); } return true; @@ -1242,20 +1242,20 @@ bool css_subch_visible(SubchDev *sch) bool css_present(uint8_t cssid) { - return (channel_subsys->css[cssid] != NULL); + return (channel_subsys.css[cssid] != NULL); } bool css_devno_used(uint8_t cssid, uint8_t ssid, uint16_t devno) { - if (!channel_subsys->css[cssid]) { + if (!channel_subsys.css[cssid]) { return false; } - if (!channel_subsys->css[cssid]->sch_set[ssid]) { + if (!channel_subsys.css[cssid]->sch_set[ssid]) { return false; } return !!test_bit(devno, - channel_subsys->css[cssid]->sch_set[ssid]->devnos_used); + channel_subsys.css[cssid]->sch_set[ssid]->devnos_used); } void css_subch_assign(uint8_t cssid, uint8_t ssid, uint16_t schid, @@ -1266,13 +1266,13 @@ void css_subch_assign(uint8_t cssid, uint8_t ssid, uint16_t schid, trace_css_assign_subch(sch ? "assign" : "deassign", cssid, ssid, schid, devno); - if (!channel_subsys->css[cssid]) { + if (!channel_subsys.css[cssid]) { fprintf(stderr, "Suspicious call to %s (%x.%x.%04x) for non-existing css!\n", __func__, cssid, ssid, schid); return; } - css = channel_subsys->css[cssid]; + css = channel_subsys.css[cssid]; if (!css->sch_set[ssid]) { css->sch_set[ssid] = g_malloc0(sizeof(SubchSet)); @@ -1297,7 +1297,7 @@ void css_queue_crw(uint8_t rsc, uint8_t erc, int chain, uint16_t rsid) /* TODO: Maybe use a static crw pool? */ crw_cont = g_try_malloc0(sizeof(CrwContainer)); if (!crw_cont) { - channel_subsys->crws_lost = true; + channel_subsys.crws_lost = true; return; } crw_cont->crw.flags = (rsc << 8) | erc; @@ -1305,15 +1305,15 @@ void css_queue_crw(uint8_t rsc, uint8_t erc, int chain, uint16_t rsid) crw_cont->crw.flags |= CRW_FLAGS_MASK_C; } crw_cont->crw.rsid = rsid; - if (channel_subsys->crws_lost) { + if (channel_subsys.crws_lost) { crw_cont->crw.flags |= CRW_FLAGS_MASK_R; - channel_subsys->crws_lost = false; + channel_subsys.crws_lost = false; } - QTAILQ_INSERT_TAIL(&channel_subsys->pending_crws, crw_cont, sibling); + QTAILQ_INSERT_TAIL(&channel_subsys.pending_crws, crw_cont, sibling); - if (channel_subsys->do_crw_mchk) { - channel_subsys->do_crw_mchk = false; + if (channel_subsys.do_crw_mchk) { + channel_subsys.do_crw_mchk = false; /* Inject crw pending machine check. */ s390_crw_mchk(); } @@ -1328,9 +1328,9 @@ void css_generate_sch_crws(uint8_t cssid, uint8_t ssid, uint16_t schid, if (add && !hotplugged) { return; } - if (channel_subsys->max_cssid == 0) { + if (channel_subsys.max_cssid == 0) { /* Default cssid shows up as 0. */ - guest_cssid = (cssid == channel_subsys->default_cssid) ? 0 : cssid; + guest_cssid = (cssid == channel_subsys.default_cssid) ? 0 : cssid; } else { /* Show real cssid to the guest. */ guest_cssid = cssid; @@ -1339,14 +1339,14 @@ void css_generate_sch_crws(uint8_t cssid, uint8_t ssid, uint16_t schid, * Only notify for higher subchannel sets/channel subsystems if the * guest has enabled it. */ - if ((ssid > channel_subsys->max_ssid) || - (guest_cssid > channel_subsys->max_cssid) || - ((channel_subsys->max_cssid == 0) && - (cssid != channel_subsys->default_cssid))) { + if ((ssid > channel_subsys.max_ssid) || + (guest_cssid > channel_subsys.max_cssid) || + ((channel_subsys.max_cssid == 0) && + (cssid != channel_subsys.default_cssid))) { return; } - chain_crw = (channel_subsys->max_ssid > 0) || - (channel_subsys->max_cssid > 0); + chain_crw = (channel_subsys.max_ssid > 0) || + (channel_subsys.max_cssid > 0); css_queue_crw(CRW_RSC_SUBCH, CRW_ERC_IPI, chain_crw ? 1 : 0, schid); if (chain_crw) { css_queue_crw(CRW_RSC_SUBCH, CRW_ERC_IPI, 0, @@ -1361,28 +1361,28 @@ void css_generate_chp_crws(uint8_t cssid, uint8_t chpid) void css_generate_css_crws(uint8_t cssid) { - if (!channel_subsys->sei_pending) { + if (!channel_subsys.sei_pending) { css_queue_crw(CRW_RSC_CSS, 0, 0, cssid); } - channel_subsys->sei_pending = true; + channel_subsys.sei_pending = true; } void css_clear_sei_pending(void) { - channel_subsys->sei_pending = false; + channel_subsys.sei_pending = false; } int css_enable_mcsse(void) { trace_css_enable_facility("mcsse"); - channel_subsys->max_cssid = MAX_CSSID; + channel_subsys.max_cssid = MAX_CSSID; return 0; } int css_enable_mss(void) { trace_css_enable_facility("mss"); - channel_subsys->max_ssid = MAX_SSID; + channel_subsys.max_ssid = MAX_SSID; return 0; } @@ -1505,10 +1505,10 @@ int subch_device_load(SubchDev *s, QEMUFile *f) */ if (s->curr_status.pmcw.flags & PMCW_FLAGS_MASK_ENA) { if (s->ssid) { - channel_subsys->max_ssid = MAX_SSID; + channel_subsys.max_ssid = MAX_SSID; } - if (s->cssid != channel_subsys->default_cssid) { - channel_subsys->max_cssid = MAX_CSSID; + if (s->cssid != channel_subsys.default_cssid) { + channel_subsys.max_cssid = MAX_CSSID; } } return 0; @@ -1517,13 +1517,12 @@ int subch_device_load(SubchDev *s, QEMUFile *f) static void css_init(void) { - channel_subsys = g_malloc0(sizeof(*channel_subsys)); - QTAILQ_INIT(&channel_subsys->pending_crws); - channel_subsys->sei_pending = false; - channel_subsys->do_crw_mchk = true; - channel_subsys->crws_lost = false; - channel_subsys->chnmon_active = false; - QTAILQ_INIT(&channel_subsys->io_adapters); + QTAILQ_INIT(&channel_subsys.pending_crws); + channel_subsys.sei_pending = false; + channel_subsys.do_crw_mchk = true; + channel_subsys.crws_lost = false; + channel_subsys.chnmon_active = false; + QTAILQ_INIT(&channel_subsys.io_adapters); } machine_init(css_init); @@ -1564,19 +1563,19 @@ void css_reset(void) CrwContainer *crw_cont; /* Clean up monitoring. */ - channel_subsys->chnmon_active = false; - channel_subsys->chnmon_area = 0; + channel_subsys.chnmon_active = false; + channel_subsys.chnmon_area = 0; /* Clear pending CRWs. */ - while ((crw_cont = QTAILQ_FIRST(&channel_subsys->pending_crws))) { - QTAILQ_REMOVE(&channel_subsys->pending_crws, crw_cont, sibling); + while ((crw_cont = QTAILQ_FIRST(&channel_subsys.pending_crws))) { + QTAILQ_REMOVE(&channel_subsys.pending_crws, crw_cont, sibling); g_free(crw_cont); } - channel_subsys->sei_pending = false; - channel_subsys->do_crw_mchk = true; - channel_subsys->crws_lost = false; + channel_subsys.sei_pending = false; + channel_subsys.do_crw_mchk = true; + channel_subsys.crws_lost = false; /* Reset maximum ids. */ - channel_subsys->max_cssid = 0; - channel_subsys->max_ssid = 0; + channel_subsys.max_cssid = 0; + channel_subsys.max_ssid = 0; } -- 2.1.0 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 2/4] s390x/css: Allocate channel_subsys statically 2016-02-16 20:59 ` [Qemu-devel] [PATCH 2/4] s390x/css: Allocate channel_subsys statically Eduardo Habkost @ 2016-02-17 11:43 ` Cornelia Huck 2016-02-17 21:03 ` Eduardo Habkost 0 siblings, 1 reply; 14+ messages in thread From: Cornelia Huck @ 2016-02-17 11:43 UTC (permalink / raw) To: Eduardo Habkost Cc: Christian Borntraeger, Alexander Graf, Richard Henderson, qemu-devel, Marcel Apfelbaum On Tue, 16 Feb 2016 18:59:05 -0200 Eduardo Habkost <ehabkost@redhat.com> wrote: > There's no need to use g_malloc0() to allocate the channel_subsys > struct, just use a static variable. The original intention was to model that dynamically somehow, but I don't see that happening anytime soon, so we can just keep it simple. > > Cc: Cornelia Huck <cornelia.huck@de.ibm.com> > Cc: Christian Borntraeger <borntraeger@de.ibm.com> > Cc: Richard Henderson <rth@twiddle.net> > Cc: Alexander Graf <agraf@suse.de> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> > --- > hw/s390x/css.c | 177 ++++++++++++++++++++++++++++----------------------------- > 1 file changed, 88 insertions(+), 89 deletions(-) Seems fine. Should this go through the s390x tree, or will it go through another tree together with the other patches? In any case, have a Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 2/4] s390x/css: Allocate channel_subsys statically 2016-02-17 11:43 ` Cornelia Huck @ 2016-02-17 21:03 ` Eduardo Habkost 2016-02-23 11:12 ` Cornelia Huck 0 siblings, 1 reply; 14+ messages in thread From: Eduardo Habkost @ 2016-02-17 21:03 UTC (permalink / raw) To: Cornelia Huck Cc: Christian Borntraeger, Alexander Graf, Richard Henderson, qemu-devel, Marcel Apfelbaum On Wed, Feb 17, 2016 at 12:43:13PM +0100, Cornelia Huck wrote: > On Tue, 16 Feb 2016 18:59:05 -0200 > Eduardo Habkost <ehabkost@redhat.com> wrote: > > > There's no need to use g_malloc0() to allocate the channel_subsys > > struct, just use a static variable. > > The original intention was to model that dynamically somehow, but I > don't see that happening anytime soon, so we can just keep it simple. > > > > > Cc: Cornelia Huck <cornelia.huck@de.ibm.com> > > Cc: Christian Borntraeger <borntraeger@de.ibm.com> > > Cc: Richard Henderson <rth@twiddle.net> > > Cc: Alexander Graf <agraf@suse.de> > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> > > --- > > hw/s390x/css.c | 177 ++++++++++++++++++++++++++++----------------------------- > > 1 file changed, 88 insertions(+), 89 deletions(-) > > Seems fine. > > Should this go through the s390x tree, or will it go through another > tree together with the other patches? In any case, have a > > Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Thanks! I was planning to merge it through the (to be created) machine-core tree. But it may take some days until I can do that, so feel free to merge patches 2-3 through the s390x tree if you want to. -- Eduardo ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 2/4] s390x/css: Allocate channel_subsys statically 2016-02-17 21:03 ` Eduardo Habkost @ 2016-02-23 11:12 ` Cornelia Huck 0 siblings, 0 replies; 14+ messages in thread From: Cornelia Huck @ 2016-02-23 11:12 UTC (permalink / raw) To: Eduardo Habkost Cc: Christian Borntraeger, Alexander Graf, Richard Henderson, qemu-devel, Marcel Apfelbaum On Wed, 17 Feb 2016 19:03:12 -0200 Eduardo Habkost <ehabkost@redhat.com> wrote: > On Wed, Feb 17, 2016 at 12:43:13PM +0100, Cornelia Huck wrote: > > On Tue, 16 Feb 2016 18:59:05 -0200 > > Eduardo Habkost <ehabkost@redhat.com> wrote: > > > > > There's no need to use g_malloc0() to allocate the channel_subsys > > > struct, just use a static variable. > > > > The original intention was to model that dynamically somehow, but I > > don't see that happening anytime soon, so we can just keep it simple. > > > > > > > > Cc: Cornelia Huck <cornelia.huck@de.ibm.com> > > > Cc: Christian Borntraeger <borntraeger@de.ibm.com> > > > Cc: Richard Henderson <rth@twiddle.net> > > > Cc: Alexander Graf <agraf@suse.de> > > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> > > > --- > > > hw/s390x/css.c | 177 ++++++++++++++++++++++++++++----------------------------- > > > 1 file changed, 88 insertions(+), 89 deletions(-) > > > > Seems fine. > > > > Should this go through the s390x tree, or will it go through another > > tree together with the other patches? In any case, have a > > > > Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> > > Thanks! > > I was planning to merge it through the (to be created) > machine-core tree. But it may take some days until I can do that, > so feel free to merge patches 2-3 through the s390x tree if you > want to. > Applied patches 2&3 to my s390-next branch (with some small modifications on top of another change I have queued there). ^ permalink raw reply [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 3/4] s390x/css: Use static initialization for channel_subsys fields 2016-02-16 20:59 [Qemu-devel] [PATCH 0/4] machine: Eliminate machine_init()/MODULE_INIT_MACHINE Eduardo Habkost 2016-02-16 20:59 ` [Qemu-devel] [PATCH 1/4] machine: Use type_init() to register machine classes Eduardo Habkost 2016-02-16 20:59 ` [Qemu-devel] [PATCH 2/4] s390x/css: Allocate channel_subsys statically Eduardo Habkost @ 2016-02-16 20:59 ` Eduardo Habkost 2016-02-17 11:44 ` Cornelia Huck 2016-02-16 20:59 ` [Qemu-devel] [PATCH 4/4] module: Rename machine_init() to opts_init() Eduardo Habkost 3 siblings, 1 reply; 14+ messages in thread From: Eduardo Habkost @ 2016-02-16 20:59 UTC (permalink / raw) To: qemu-devel Cc: Cornelia Huck, Christian Borntraeger, Richard Henderson, Alexander Graf, Marcel Apfelbaum machine_init() will be gone, but we don't need it if we just initialize the channel_subsys fields statically. Cc: Cornelia Huck <cornelia.huck@de.ibm.com> Cc: Christian Borntraeger <borntraeger@de.ibm.com> Cc: Richard Henderson <rth@twiddle.net> Cc: Alexander Graf <agraf@suse.de> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- hw/s390x/css.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 2e9659a..15eb154 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -62,7 +62,15 @@ typedef struct ChannelSubSys { QTAILQ_HEAD(, IoAdapter) io_adapters; } ChannelSubSys; -static ChannelSubSys channel_subsys; +static ChannelSubSys channel_subsys = { + .pending_crws = QTAILQ_HEAD_INITIALIZER(channel_subsys.pending_crws), + .do_crw_mchk = true, + .sei_pending = false, + .do_crw_mchk = true, + .crws_lost = false, + .chnmon_active = false, + .io_adapters = QTAILQ_HEAD_INITIALIZER(channel_subsys.io_adapters), +}; int css_create_css_image(uint8_t cssid, bool default_image) { @@ -1514,18 +1522,6 @@ int subch_device_load(SubchDev *s, QEMUFile *f) return 0; } - -static void css_init(void) -{ - QTAILQ_INIT(&channel_subsys.pending_crws); - channel_subsys.sei_pending = false; - channel_subsys.do_crw_mchk = true; - channel_subsys.crws_lost = false; - channel_subsys.chnmon_active = false; - QTAILQ_INIT(&channel_subsys.io_adapters); -} -machine_init(css_init); - void css_reset_sch(SubchDev *sch) { PMCW *p = &sch->curr_status.pmcw; -- 2.1.0 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 3/4] s390x/css: Use static initialization for channel_subsys fields 2016-02-16 20:59 ` [Qemu-devel] [PATCH 3/4] s390x/css: Use static initialization for channel_subsys fields Eduardo Habkost @ 2016-02-17 11:44 ` Cornelia Huck 0 siblings, 0 replies; 14+ messages in thread From: Cornelia Huck @ 2016-02-17 11:44 UTC (permalink / raw) To: Eduardo Habkost Cc: Christian Borntraeger, Alexander Graf, Richard Henderson, qemu-devel, Marcel Apfelbaum On Tue, 16 Feb 2016 18:59:06 -0200 Eduardo Habkost <ehabkost@redhat.com> wrote: > machine_init() will be gone, but we don't need it if we just > initialize the channel_subsys fields statically. > > Cc: Cornelia Huck <cornelia.huck@de.ibm.com> > Cc: Christian Borntraeger <borntraeger@de.ibm.com> > Cc: Richard Henderson <rth@twiddle.net> > Cc: Alexander Graf <agraf@suse.de> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> > --- > hw/s390x/css.c | 22 +++++++++------------- > 1 file changed, 9 insertions(+), 13 deletions(-) Same comment as for the other patch. Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> ^ permalink raw reply [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 4/4] module: Rename machine_init() to opts_init() 2016-02-16 20:59 [Qemu-devel] [PATCH 0/4] machine: Eliminate machine_init()/MODULE_INIT_MACHINE Eduardo Habkost ` (2 preceding siblings ...) 2016-02-16 20:59 ` [Qemu-devel] [PATCH 3/4] s390x/css: Use static initialization for channel_subsys fields Eduardo Habkost @ 2016-02-16 20:59 ` Eduardo Habkost 2016-02-17 15:36 ` Marcel Apfelbaum 2016-02-17 15:58 ` Michael S. Tsirkin 3 siblings, 2 replies; 14+ messages in thread From: Eduardo Habkost @ 2016-02-16 20:59 UTC (permalink / raw) To: qemu-devel Cc: Igor Mammedov, Michael S. Tsirkin, Gerd Hoffmann, Marcel Apfelbaum The only remaining users of machine_init() only call qemu_add_opts(). Rename machine_init() to opts_init() and move it closer to the qemu_add_opts() calls on vl.c. Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Igor Mammedov <imammedo@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- fsdev/qemu-fsdev-opts.c | 2 +- hw/acpi/core.c | 2 +- hw/smbios/smbios.c | 2 +- include/qemu/module.h | 4 ++-- ui/spice-core.c | 2 +- ui/vnc.c | 2 +- vl.c | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fsdev/qemu-fsdev-opts.c b/fsdev/qemu-fsdev-opts.c index 0b4619f..88a4ac3 100644 --- a/fsdev/qemu-fsdev-opts.c +++ b/fsdev/qemu-fsdev-opts.c @@ -83,4 +83,4 @@ static void fsdev_register_config(void) qemu_add_opts(&qemu_fsdev_opts); qemu_add_opts(&qemu_virtfs_opts); } -machine_init(fsdev_register_config); +opts_init(fsdev_register_config); diff --git a/hw/acpi/core.c b/hw/acpi/core.c index 3a14e90..714bc68 100644 --- a/hw/acpi/core.c +++ b/hw/acpi/core.c @@ -68,7 +68,7 @@ static void acpi_register_config(void) qemu_add_opts(&qemu_acpi_opts); } -machine_init(acpi_register_config); +opts_init(acpi_register_config); static int acpi_checksum(const uint8_t *data, int len) { diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index 3b5f9bd..1362e79 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -320,7 +320,7 @@ static void smbios_register_config(void) qemu_add_opts(&qemu_smbios_opts); } -machine_init(smbios_register_config); +opts_init(smbios_register_config); static void smbios_validate_table(void) { diff --git a/include/qemu/module.h b/include/qemu/module.h index 72d9498..24b61ec 100644 --- a/include/qemu/module.h +++ b/include/qemu/module.h @@ -42,14 +42,14 @@ static void __attribute__((constructor)) do_qemu_init_ ## function(void) \ typedef enum { MODULE_INIT_BLOCK, - MODULE_INIT_MACHINE, + MODULE_INIT_OPTS, MODULE_INIT_QAPI, MODULE_INIT_QOM, MODULE_INIT_MAX } module_init_type; #define block_init(function) module_init(function, MODULE_INIT_BLOCK) -#define machine_init(function) module_init(function, MODULE_INIT_MACHINE) +#define opts_init(function) module_init(function, MODULE_INIT_OPTS) #define qapi_init(function) module_init(function, MODULE_INIT_QAPI) #define type_init(function) module_init(function, MODULE_INIT_QOM) diff --git a/ui/spice-core.c b/ui/spice-core.c index 4dbd99a..0038169 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -931,4 +931,4 @@ static void spice_register_config(void) { qemu_add_opts(&qemu_spice_opts); } -machine_init(spice_register_config); +opts_init(spice_register_config); diff --git a/ui/vnc.c b/ui/vnc.c index b6bbea5..2d06ca4 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -3878,4 +3878,4 @@ static void vnc_register_config(void) { qemu_add_opts(&qemu_vnc_opts); } -machine_init(vnc_register_config); +opts_init(vnc_register_config); diff --git a/vl.c b/vl.c index 18e6086..6f7772c 100644 --- a/vl.c +++ b/vl.c @@ -2987,6 +2987,7 @@ int main(int argc, char **argv, char **envp) qemu_add_opts(&qemu_icount_opts); qemu_add_opts(&qemu_semihosting_config_opts); qemu_add_opts(&qemu_fw_cfg_opts); + module_call_init(MODULE_INIT_OPTS); runstate_init(); @@ -2999,7 +3000,6 @@ int main(int argc, char **argv, char **envp) QLIST_INIT (&vm_change_state_head); os_setup_early_signal_handling(); - module_call_init(MODULE_INIT_MACHINE); machine_class = find_default_machine(); cpu_model = NULL; snapshot = 0; -- 2.1.0 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 4/4] module: Rename machine_init() to opts_init() 2016-02-16 20:59 ` [Qemu-devel] [PATCH 4/4] module: Rename machine_init() to opts_init() Eduardo Habkost @ 2016-02-17 15:36 ` Marcel Apfelbaum 2016-02-17 15:58 ` Michael S. Tsirkin 1 sibling, 0 replies; 14+ messages in thread From: Marcel Apfelbaum @ 2016-02-17 15:36 UTC (permalink / raw) To: Eduardo Habkost, qemu-devel Cc: Igor Mammedov, Michael S. Tsirkin, Gerd Hoffmann, Marcel Apfelbaum On 02/16/2016 10:59 PM, Eduardo Habkost wrote: > The only remaining users of machine_init() only call > qemu_add_opts(). Rename machine_init() to opts_init() and move it > closer to the qemu_add_opts() calls on vl.c. > > Cc: "Michael S. Tsirkin" <mst@redhat.com> > Cc: Igor Mammedov <imammedo@redhat.com> > Cc: Gerd Hoffmann <kraxel@redhat.com> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> > --- > fsdev/qemu-fsdev-opts.c | 2 +- > hw/acpi/core.c | 2 +- > hw/smbios/smbios.c | 2 +- > include/qemu/module.h | 4 ++-- > ui/spice-core.c | 2 +- > ui/vnc.c | 2 +- > vl.c | 2 +- > 7 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/fsdev/qemu-fsdev-opts.c b/fsdev/qemu-fsdev-opts.c > index 0b4619f..88a4ac3 100644 > --- a/fsdev/qemu-fsdev-opts.c > +++ b/fsdev/qemu-fsdev-opts.c > @@ -83,4 +83,4 @@ static void fsdev_register_config(void) > qemu_add_opts(&qemu_fsdev_opts); > qemu_add_opts(&qemu_virtfs_opts); > } > -machine_init(fsdev_register_config); > +opts_init(fsdev_register_config); > diff --git a/hw/acpi/core.c b/hw/acpi/core.c > index 3a14e90..714bc68 100644 > --- a/hw/acpi/core.c > +++ b/hw/acpi/core.c > @@ -68,7 +68,7 @@ static void acpi_register_config(void) > qemu_add_opts(&qemu_acpi_opts); > } > > -machine_init(acpi_register_config); > +opts_init(acpi_register_config); > > static int acpi_checksum(const uint8_t *data, int len) > { > diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c > index 3b5f9bd..1362e79 100644 > --- a/hw/smbios/smbios.c > +++ b/hw/smbios/smbios.c > @@ -320,7 +320,7 @@ static void smbios_register_config(void) > qemu_add_opts(&qemu_smbios_opts); > } > > -machine_init(smbios_register_config); > +opts_init(smbios_register_config); > > static void smbios_validate_table(void) > { > diff --git a/include/qemu/module.h b/include/qemu/module.h > index 72d9498..24b61ec 100644 > --- a/include/qemu/module.h > +++ b/include/qemu/module.h > @@ -42,14 +42,14 @@ static void __attribute__((constructor)) do_qemu_init_ ## function(void) \ > > typedef enum { > MODULE_INIT_BLOCK, > - MODULE_INIT_MACHINE, > + MODULE_INIT_OPTS, > MODULE_INIT_QAPI, > MODULE_INIT_QOM, > MODULE_INIT_MAX > } module_init_type; > > #define block_init(function) module_init(function, MODULE_INIT_BLOCK) > -#define machine_init(function) module_init(function, MODULE_INIT_MACHINE) > +#define opts_init(function) module_init(function, MODULE_INIT_OPTS) > #define qapi_init(function) module_init(function, MODULE_INIT_QAPI) > #define type_init(function) module_init(function, MODULE_INIT_QOM) > > diff --git a/ui/spice-core.c b/ui/spice-core.c > index 4dbd99a..0038169 100644 > --- a/ui/spice-core.c > +++ b/ui/spice-core.c > @@ -931,4 +931,4 @@ static void spice_register_config(void) > { > qemu_add_opts(&qemu_spice_opts); > } > -machine_init(spice_register_config); > +opts_init(spice_register_config); > diff --git a/ui/vnc.c b/ui/vnc.c > index b6bbea5..2d06ca4 100644 > --- a/ui/vnc.c > +++ b/ui/vnc.c > @@ -3878,4 +3878,4 @@ static void vnc_register_config(void) > { > qemu_add_opts(&qemu_vnc_opts); > } > -machine_init(vnc_register_config); > +opts_init(vnc_register_config); > diff --git a/vl.c b/vl.c > index 18e6086..6f7772c 100644 > --- a/vl.c > +++ b/vl.c > @@ -2987,6 +2987,7 @@ int main(int argc, char **argv, char **envp) > qemu_add_opts(&qemu_icount_opts); > qemu_add_opts(&qemu_semihosting_config_opts); > qemu_add_opts(&qemu_fw_cfg_opts); > + module_call_init(MODULE_INIT_OPTS); > > runstate_init(); > > @@ -2999,7 +3000,6 @@ int main(int argc, char **argv, char **envp) > QLIST_INIT (&vm_change_state_head); > os_setup_early_signal_handling(); > > - module_call_init(MODULE_INIT_MACHINE); > machine_class = find_default_machine(); > cpu_model = NULL; > snapshot = 0; > Reviewed-by: Marcel Apfelbaum <marcel@redhat.com> Thanks, Marcel ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 4/4] module: Rename machine_init() to opts_init() 2016-02-16 20:59 ` [Qemu-devel] [PATCH 4/4] module: Rename machine_init() to opts_init() Eduardo Habkost 2016-02-17 15:36 ` Marcel Apfelbaum @ 2016-02-17 15:58 ` Michael S. Tsirkin 1 sibling, 0 replies; 14+ messages in thread From: Michael S. Tsirkin @ 2016-02-17 15:58 UTC (permalink / raw) To: Eduardo Habkost Cc: Igor Mammedov, Gerd Hoffmann, qemu-devel, Marcel Apfelbaum On Tue, Feb 16, 2016 at 06:59:07PM -0200, Eduardo Habkost wrote: > The only remaining users of machine_init() only call > qemu_add_opts(). Rename machine_init() to opts_init() and move it > closer to the qemu_add_opts() calls on vl.c. > > Cc: "Michael S. Tsirkin" <mst@redhat.com> > Cc: Igor Mammedov <imammedo@redhat.com> > Cc: Gerd Hoffmann <kraxel@redhat.com> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> > --- > fsdev/qemu-fsdev-opts.c | 2 +- > hw/acpi/core.c | 2 +- > hw/smbios/smbios.c | 2 +- > include/qemu/module.h | 4 ++-- > ui/spice-core.c | 2 +- > ui/vnc.c | 2 +- > vl.c | 2 +- > 7 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/fsdev/qemu-fsdev-opts.c b/fsdev/qemu-fsdev-opts.c > index 0b4619f..88a4ac3 100644 > --- a/fsdev/qemu-fsdev-opts.c > +++ b/fsdev/qemu-fsdev-opts.c > @@ -83,4 +83,4 @@ static void fsdev_register_config(void) > qemu_add_opts(&qemu_fsdev_opts); > qemu_add_opts(&qemu_virtfs_opts); > } > -machine_init(fsdev_register_config); > +opts_init(fsdev_register_config); > diff --git a/hw/acpi/core.c b/hw/acpi/core.c > index 3a14e90..714bc68 100644 > --- a/hw/acpi/core.c > +++ b/hw/acpi/core.c > @@ -68,7 +68,7 @@ static void acpi_register_config(void) > qemu_add_opts(&qemu_acpi_opts); > } > > -machine_init(acpi_register_config); > +opts_init(acpi_register_config); > > static int acpi_checksum(const uint8_t *data, int len) > { > diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c > index 3b5f9bd..1362e79 100644 > --- a/hw/smbios/smbios.c > +++ b/hw/smbios/smbios.c > @@ -320,7 +320,7 @@ static void smbios_register_config(void) > qemu_add_opts(&qemu_smbios_opts); > } > > -machine_init(smbios_register_config); > +opts_init(smbios_register_config); > > static void smbios_validate_table(void) > { > diff --git a/include/qemu/module.h b/include/qemu/module.h > index 72d9498..24b61ec 100644 > --- a/include/qemu/module.h > +++ b/include/qemu/module.h > @@ -42,14 +42,14 @@ static void __attribute__((constructor)) do_qemu_init_ ## function(void) \ > > typedef enum { > MODULE_INIT_BLOCK, > - MODULE_INIT_MACHINE, > + MODULE_INIT_OPTS, > MODULE_INIT_QAPI, > MODULE_INIT_QOM, > MODULE_INIT_MAX > } module_init_type; > > #define block_init(function) module_init(function, MODULE_INIT_BLOCK) > -#define machine_init(function) module_init(function, MODULE_INIT_MACHINE) > +#define opts_init(function) module_init(function, MODULE_INIT_OPTS) > #define qapi_init(function) module_init(function, MODULE_INIT_QAPI) > #define type_init(function) module_init(function, MODULE_INIT_QOM) > > diff --git a/ui/spice-core.c b/ui/spice-core.c > index 4dbd99a..0038169 100644 > --- a/ui/spice-core.c > +++ b/ui/spice-core.c > @@ -931,4 +931,4 @@ static void spice_register_config(void) > { > qemu_add_opts(&qemu_spice_opts); > } > -machine_init(spice_register_config); > +opts_init(spice_register_config); > diff --git a/ui/vnc.c b/ui/vnc.c > index b6bbea5..2d06ca4 100644 > --- a/ui/vnc.c > +++ b/ui/vnc.c > @@ -3878,4 +3878,4 @@ static void vnc_register_config(void) > { > qemu_add_opts(&qemu_vnc_opts); > } > -machine_init(vnc_register_config); > +opts_init(vnc_register_config); > diff --git a/vl.c b/vl.c > index 18e6086..6f7772c 100644 > --- a/vl.c > +++ b/vl.c > @@ -2987,6 +2987,7 @@ int main(int argc, char **argv, char **envp) > qemu_add_opts(&qemu_icount_opts); > qemu_add_opts(&qemu_semihosting_config_opts); > qemu_add_opts(&qemu_fw_cfg_opts); > + module_call_init(MODULE_INIT_OPTS); > > runstate_init(); > > @@ -2999,7 +3000,6 @@ int main(int argc, char **argv, char **envp) > QLIST_INIT (&vm_change_state_head); > os_setup_early_signal_handling(); > > - module_call_init(MODULE_INIT_MACHINE); > machine_class = find_default_machine(); > cpu_model = NULL; > snapshot = 0; > -- > 2.1.0 ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2016-02-23 11:12 UTC | newest] Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-02-16 20:59 [Qemu-devel] [PATCH 0/4] machine: Eliminate machine_init()/MODULE_INIT_MACHINE Eduardo Habkost 2016-02-16 20:59 ` [Qemu-devel] [PATCH 1/4] machine: Use type_init() to register machine classes Eduardo Habkost 2016-02-17 15:32 ` Marcel Apfelbaum 2016-02-17 15:57 ` Michael S. Tsirkin 2016-02-18 2:35 ` David Gibson 2016-02-16 20:59 ` [Qemu-devel] [PATCH 2/4] s390x/css: Allocate channel_subsys statically Eduardo Habkost 2016-02-17 11:43 ` Cornelia Huck 2016-02-17 21:03 ` Eduardo Habkost 2016-02-23 11:12 ` Cornelia Huck 2016-02-16 20:59 ` [Qemu-devel] [PATCH 3/4] s390x/css: Use static initialization for channel_subsys fields Eduardo Habkost 2016-02-17 11:44 ` Cornelia Huck 2016-02-16 20:59 ` [Qemu-devel] [PATCH 4/4] module: Rename machine_init() to opts_init() Eduardo Habkost 2016-02-17 15:36 ` Marcel Apfelbaum 2016-02-17 15:58 ` Michael S. Tsirkin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).