machine: Eliminate machine_init()/MODULE_INIT_MACHINE
Subsystems (2)
cover machine: Eliminate machine_init()/MODULE_INIT_MACHINE
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(-)
Signature · 1 line
2.1.0
PATCH 1/4 machine: Use type_init() to register machine classes
Change all machine_init() users that simply call type_register*() to use type_init().
--- 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(-)
hw/arm/exynos4_boards.c +1 -1
@@ -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)
hw/arm/gumstix.c +1 -1
@@ -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)
hw/arm/highbank.c +1 -1
@@ -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)
hw/arm/nseries.c +1 -1
@@ -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)
hw/arm/omap_sx1.c +1 -1
@@ -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)
hw/arm/realview.c +1 -1
@@ -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)
hw/arm/spitz.c +1 -1
@@ -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) {
hw/arm/stellaris.c +1 -1
@@ -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) {
hw/arm/versatilepb.c +1 -1
@@ -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) {
hw/arm/vexpress.c +1 -1
@@ -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);
hw/arm/virt.c +1 -1
@@ -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);
hw/lm32/lm32_boards.c +1 -1
@@ -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)
hw/mips/mips_jazz.c +1 -1
@@ -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)
hw/ppc/ppc405_boards.c +1 -1
@@ -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)
hw/ppc/spapr.c +1 -1
@@ -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
hw/sparc/sun4m.c +0 -4
@@ -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)
hw/sparc64/sun4u.c +0 -4
@@ -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)
hw/xtensa/xtfpga.c +1 -1
@@ -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)
include/hw/boards.h +1 -1
@@ -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 { \
include/hw/i386/pc.h +1 -1
@@ -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
Signature · 1 line
2.1.0
Re: [Qemu-devel] [PATCH 1/4] machine: Use type_init() to register machine classes
Quoted 2 lines · Eduardo Habkost
Change all
machine_init()users that simply call type_register*() to usetype_init().
If all machines are QOM objects this makes sense.
Thanks,
Marcel
Quoted 280 lines
Cc Evgeny Voevodin <[email protected]>Cc Maksim Kozlov <[email protected]>Cc Igor Mitsyanko <[email protected]>Cc Dmitry Solodkiy <[email protected]>Cc Peter Maydell <[email protected]>Cc Rob Herring <[email protected]>Cc Andrzej Zaborowski <[email protected]>Cc Michael Walle <[email protected]>Cc "Hervé Poussineau" <[email protected]>Cc Aurelien Jarno <[email protected]>Cc Leon Alrae <[email protected]>Cc Alexander Graf <[email protected]>Cc David Gibson <[email protected]>Cc Blue Swirl <[email protected]>Cc Mark Cave-Ayland <[email protected]>Cc Max Filippov <[email protected]>Cc "Michael S. Tsirkin" <[email protected]>Signed-off-by Eduardo Habkost <[email protected]>--- 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(-)hw/arm/exynos4_boards.c +1
-1@@ -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)hw/arm/gumstix.c +1
-1@@ -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)hw/arm/highbank.c +1
-1@@ -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)hw/arm/nseries.c +1
-1@@ -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)hw/arm/omap_sx1.c +1
-1@@ -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)hw/arm/realview.c +1
-1@@ -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)hw/arm/spitz.c +1
-1@@ -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) {hw/arm/stellaris.c +1
-1@@ -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) {hw/arm/versatilepb.c +1
-1@@ -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) {hw/arm/vexpress.c +1
-1@@ -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);hw/arm/virt.c +1
-1@@ -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);hw/lm32/lm32_boards.c +1
-1@@ -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)hw/mips/mips_jazz.c +1
-1@@ -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)hw/ppc/ppc405_boards.c +1
-1@@ -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)hw/ppc/spapr.c +1
-1@@ -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 hw/sparc/sun4m.c +0
-4@@ -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)hw/sparc64/sun4u.c +0
-4@@ -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)hw/xtensa/xtfpga.c +1
-1@@ -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)include/hw/boards.h +1
-1@@ -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 { \include/hw/i386/pc.h +1
-1@@ -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
Re: [Qemu-devel] [PATCH 1/4] machine: Use type_init() to register machine classes
In reply to Eduardo HabkostQuoted 13 lines · Eduardo Habkost
Change all
machine_init()users that simply call type_register*() to usetype_init().Cc Evgeny Voevodin <[email protected]>Cc Maksim Kozlov <[email protected]>Cc Igor Mitsyanko <[email protected]>Cc Dmitry Solodkiy <[email protected]>Cc Peter Maydell <[email protected]>Cc Rob Herring <[email protected]>Cc Andrzej Zaborowski <[email protected]>Cc Michael Walle <[email protected]>Cc "Hervé Poussineau" <[email protected]>Cc Aurelien Jarno <[email protected]>
Quoted 8 lines
Cc Leon Alrae <[email protected]>Cc Alexander Graf <[email protected]>Cc David Gibson <[email protected]>Cc Blue Swirl <[email protected]>Cc Mark Cave-Ayland <[email protected]>Cc Max Filippov <[email protected]>Cc "Michael S. Tsirkin" <[email protected]>Signed-off-by Eduardo Habkost <[email protected]>
For pc:
Quoted 262 lines
--- 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(-)hw/arm/exynos4_boards.c +1
-1@@ -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)hw/arm/gumstix.c +1
-1@@ -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)hw/arm/highbank.c +1
-1@@ -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)hw/arm/nseries.c +1
-1@@ -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)hw/arm/omap_sx1.c +1
-1@@ -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)hw/arm/realview.c +1
-1@@ -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)hw/arm/spitz.c +1
-1@@ -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) {hw/arm/stellaris.c +1
-1@@ -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) {hw/arm/versatilepb.c +1
-1@@ -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) {hw/arm/vexpress.c +1
-1@@ -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);hw/arm/virt.c +1
-1@@ -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);hw/lm32/lm32_boards.c +1
-1@@ -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)hw/mips/mips_jazz.c +1
-1@@ -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)hw/ppc/ppc405_boards.c +1
-1@@ -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)hw/ppc/spapr.c +1
-1@@ -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 hw/sparc/sun4m.c +0
-4@@ -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)hw/sparc64/sun4u.c +0
-4@@ -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)hw/xtensa/xtfpga.c +1
-1@@ -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)include/hw/boards.h +1
-1@@ -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 { \include/hw/i386/pc.h +1
-1@@ -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); #endifSignature · 1 line
2.1.0
Re: [Qemu-devel] [PATCH 1/4] machine: Use type_init() to register machine classes
In reply to Eduardo HabkostQuoted 35 lines · Eduardo Habkost
Change all
machine_init()users that simply call type_register*() to usetype_init().Cc Evgeny Voevodin <[email protected]>Cc Maksim Kozlov <[email protected]>Cc Igor Mitsyanko <[email protected]>Cc Dmitry Solodkiy <[email protected]>Cc Peter Maydell <[email protected]>Cc Rob Herring <[email protected]>Cc Andrzej Zaborowski <[email protected]>Cc Michael Walle <[email protected]>Cc "Hervé Poussineau" <[email protected]>Cc Aurelien Jarno <[email protected]>Cc Leon Alrae <[email protected]>Cc Alexander Graf <[email protected]>Cc David Gibson <[email protected]>Cc Blue Swirl <[email protected]>Cc Mark Cave-Ayland <[email protected]>Cc Max Filippov <[email protected]>Cc "Michael S. Tsirkin" <[email protected]>Signed-off-by Eduardo Habkost <[email protected]>--- 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 +-
Quoted 8 lines
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,
Signature · 4 lines
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
PATCH 2/4 s390x/css: Allocate channel_subsys statically
In reply to Eduardo HabkostThere's no need to use g_malloc0() to allocate the channel_subsys struct, just use a static variable.
--- hw/s390x/css.c | 177 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 88 insertions(+), 89 deletions(-)
hw/s390x/css.c +88 -89
@@ -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 ; }
Signature · 1 line
2.1.0
Re: [Qemu-devel] [PATCH 2/4] s390x/css: Allocate channel_subsys statically
Quoted 2 lines · On Tue, 16 Feb 2016 18:59:05 -0200 Eduardo Habkost <[email protected]> wrote:
There's no need to use
g_malloc0()to allocate thechannel_subsysstruct, 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.
Quoted 9 lines
Cc Cornelia Huck <[email protected]>Cc Christian Borntraeger <[email protected]>Cc Richard Henderson <[email protected]>Cc Alexander Graf <[email protected]>Signed-off-by Eduardo Habkost <[email protected]>--- 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
Re: [Qemu-devel] [PATCH 2/4] s390x/css: Allocate channel_subsys statically
Quoted 19 lines · Cornelia Huck
Quoted 2 lines · On Tue, 16 Feb 2016 18:59:05 -0200 Eduardo Habkost <[email protected]> wrote:
There's no need to use
g_malloc0()to allocate thechannel_subsysstruct, 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.
Quoted 9 lines
Cc Cornelia Huck <[email protected]>Cc Christian Borntraeger <[email protected]>Cc Richard Henderson <[email protected]>Cc Alexander Graf <[email protected]>Signed-off-by Eduardo Habkost <[email protected]>--- hw/s390x/css.c | 177 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 88 insertions(+), 89 deletions(-)
Quoted 6 lines
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 <[email protected]>
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.
Signature · 1 line
Eduardo
Cornelia Huck
AppliedRe: [Qemu-devel] [PATCH 2/4] s390x/css: Allocate channel_subsys statically
Quoted 25 lines · On Wed, 17 Feb 2016 19:03:12 -0200 Eduardo Habkost <[email protected]> wrote:
Quoted 24 lines · Cornelia Huck
Quoted 2 lines · On Tue, 16 Feb 2016 18:59:05 -0200 Eduardo Habkost <[email protected]> wrote:
There's no need to use
g_malloc0()to allocate thechannel_subsysstruct, 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.
Quoted 9 lines
Cc Cornelia Huck <[email protected]>Cc Christian Borntraeger <[email protected]>Cc Richard Henderson <[email protected]>Cc Alexander Graf <[email protected]>Signed-off-by Eduardo Habkost <[email protected]>--- 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
Quoted 9 lines
Quoted 1 line
Reviewed-by Cornelia Huck <[email protected]>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).
PATCH 3/4 s390x/css: Use static initialization for channel_subsys fields
In reply to Eduardo Habkostmachine_init() will be gone, but we don't need it if we just initialize the channel_subsys fields statically.
--- hw/s390x/css.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)
hw/s390x/css.c +9 -13
@@ -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;
Signature · 1 line
2.1.0
Re: [Qemu-devel] [PATCH 3/4] s390x/css: Use static initialization for channel_subsys fields
Quoted 11 lines · On Tue, 16 Feb 2016 18:59:06 -0200 Eduardo Habkost <[email protected]> wrote:
machine_init()will be gone, but we don't need it if we just initialize thechannel_subsysfields statically.Cc Cornelia Huck <[email protected]>Cc Christian Borntraeger <[email protected]>Cc Richard Henderson <[email protected]>Cc Alexander Graf <[email protected]>Signed-off-by Eduardo Habkost <[email protected]>--- hw/s390x/css.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)
Same comment as for the other patch.
PATCH 4/4 module: Rename machine_init() to opts_init()
In reply to Eduardo HabkostThe 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.
--- 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(-)
fsdev/qemu-fsdev-opts.c +1 -1
@@ -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);
hw/acpi/core.c +1 -1
@@ -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) {
hw/smbios/smbios.c +1 -1
@@ -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 ) {
include/qemu/module.h +2 -2
@@ -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)
ui/spice-core.c +1 -1
@@ -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);
ui/vnc.c +1 -1
@@ -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);
vl.c +1 -1
@@ -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 ;
Signature · 1 line
2.1.0
Re: [Qemu-devel] [PATCH 4/4] module: Rename machine_init() to opts_init()
Quoted 109 lines · Eduardo Habkost
The only remaining users of
machine_init()only callqemu_add_opts(). Renamemachine_init()toopts_init()and move it closer to theqemu_add_opts()calls onvl.c.Cc "Michael S. Tsirkin" <[email protected]>Cc Igor Mammedov <[email protected]>Cc Gerd Hoffmann <[email protected]>Signed-off-by Eduardo Habkost <[email protected]>--- 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(-)fsdev/qemu-fsdev-opts.c +1
-1@@ -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);hw/acpi/core.c +1
-1@@ -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) {hw/smbios/smbios.c +1
-1@@ -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 ) {include/qemu/module.h +2
-2@@ -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)ui/spice-core.c +1
-1@@ -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);ui/vnc.c +1
-1@@ -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);vl.c +1
-0@@ -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 ();
vl.c int main(int argc, char **argv, char **envp) · line 3005
Quoted 7 lines
vl.c +0
-1@@ -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 ;
Thanks,
Marcel
Re: [Qemu-devel] [PATCH 4/4] module: Rename machine_init() to opts_init()
In reply to Eduardo HabkostQuoted 8 lines · Eduardo Habkost
The only remaining users of
machine_init()only callqemu_add_opts(). Renamemachine_init()toopts_init()and move it closer to theqemu_add_opts()calls onvl.c.Cc "Michael S. Tsirkin" <[email protected]>Cc Igor Mammedov <[email protected]>Cc Gerd Hoffmann <[email protected]>Signed-off-by Eduardo Habkost <[email protected]>
Quoted 109 lines
--- 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(-)fsdev/qemu-fsdev-opts.c +1
-1@@ -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);hw/acpi/core.c +1
-1@@ -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) {hw/smbios/smbios.c +1
-1@@ -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 ) {include/qemu/module.h +2
-2@@ -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)ui/spice-core.c +1
-1@@ -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);ui/vnc.c +1
-1@@ -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);vl.c +1
-1@@ -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 ;Signature · 1 line
2.1.0