machine: Deprecate machine_init()
Subsystems (2)
cover machine: Deprecate machine_init()
Hello,
Based on my pending qom-next pull, this series continues Eduardo's machine cleanups. Having eliminated QEMUMachine and qemu_machine_register(), this series eliminates machine_init() and MODULE_INIT_MACHINE.
As a side effect a few non-machine callers had to be updated, mostly for QemuOpts.
It goes on to update Exynos4 machines for QOM, demonstrating that DEFINE_MACHINE() can be inferior to inlining the QOM boilerplate code in case of multiple machines.
Independently, I noticed a nit in the PC machine macro I'm touching that could probably even be cherry-picked.
Regards,
Andreas
Andreas Färber (6):
Use type_init() for all machine QOM types hw/s390x/css: Use type_init() instead of machine_init() Introduce config_init() for QemuOpts
Drop machine_init() and MODULE_INIT_MACHINE
exynos4: Further QOM'ify machines
pc: Use type_register_static() for machine types
fsdev/qemu-fsdev-opts.c | 2 +- hw/acpi/core.c | 2 +- hw/arm/exynos4_boards.c | 73 ++++++++++++++++++++++++++----------------------- 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 | 15 ++++------ hw/arm/stellaris.c | 11 ++------ hw/arm/versatilepb.c | 11 ++------ 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/s390x/css.c | 2 +- hw/smbios/smbios.c | 2 +- hw/sparc/sun4m.c | 14 ++++------ hw/sparc64/sun4u.c | 12 +++----- hw/xtensa/xtfpga.c | 2 +- include/hw/boards.h | 2 +- include/hw/i386/pc.h | 4 +-- include/qemu/module.h | 4 +-- ui/spice-core.c | 2 +- ui/vnc.c | 2 +- vl.c | 3 +- 27 files changed, 83 insertions(+), 100 deletions(-)
Signature · 1 line
2.1.4
PATCH 2/6 hw/s390x/css: Use type_init() instead of machine_init()
Here, machine_init() is being misused to initialize global variables. Being all local, it's safe to use the slightly earlier type_init().
This prepares for dropping machine_init().
--- hw/s390x/css.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/s390x/css.c +1 -1
@@ -1509,7 +1509,7 @@ static void css_init(void) channel_subsys->chnmon_active = false;QTAILQ_INIT (&channel_subsys->io_adapters); } -machine_init (css_init); +type_init (css_init) void css_reset_sch(SubchDev *sch) {
Signature · 1 line
2.1.4
PATCH 3/6 Introduce config_init() for QemuOpts
In reply to Andreas FärberThis untangles QemuOpts from machine_init(), which is to be dropped.
--- fsdev/qemu-fsdev-opts.c | 2 +- hw/acpi/core.c | 2 +- hw/smbios/smbios.c | 2 +- include/qemu/module.h | 2 ++ ui/spice-core.c | 2 +- ui/vnc.c | 2 +- vl.c | 2 ++ 7 files changed, 9 insertions(+), 5 deletions(-)
fsdev/qemu-fsdev-opts.c +1 -1
@@ -82,4 +82,4 @@ static void fsdev_register_config(void)qemu_add_opts (&qemu_fsdev_opts);qemu_add_opts (&qemu_virtfs_opts); } -machine_init (fsdev_register_config); +config_init (fsdev_register_config)
hw/acpi/core.c +1 -1
@@ -67,7 +67,7 @@ static void acpi_register_config(void)qemu_add_opts (&qemu_acpi_opts); } -machine_init (acpi_register_config); +config_init (acpi_register_config) static int acpi_checksum(const uint8_t *data, int len) {
hw/smbios/smbios.c +1 -1
@@ -319,7 +319,7 @@ static void smbios_register_config(void)qemu_add_opts (&qemu_smbios_opts); } -machine_init (smbios_register_config); +config_init (smbios_register_config) static void smbios_validate_table(void) {
include/qemu/module.h +2 -0
@@ -42,6 +42,7 @@ static void __attribute__((constructor)) do_qemu_init_ ## function(void) \ typedef enum { MODULE_INIT_BLOCK, + MODULE_INIT_CONFIG, MODULE_INIT_MACHINE, MODULE_INIT_QAPI, MODULE_INIT_QOM,
@@ -49,6 +50,7 @@ typedef enum { } module_init_type;#define block_init (function) module_init(function, MODULE_INIT_BLOCK) +#define config_init (function) module_init(function, MODULE_INIT_CONFIG)#define machine_init (function) module_init(function, MODULE_INIT_MACHINE)#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
@@ -927,4 +927,4 @@ static void spice_register_config(void) {qemu_add_opts (&qemu_spice_opts); } -machine_init (spice_register_config); +config_init (spice_register_config)
ui/vnc.c +1 -1
@@ -3883,4 +3883,4 @@ static void vnc_register_config(void) {qemu_add_opts (&qemu_vnc_opts); } -machine_init (vnc_register_config); +config_init (vnc_register_config)
vl.c +2 -0
@@ -2996,6 +2996,8 @@ int main(int argc, char **argv, char **envp)qemu_add_opts (&qemu_semihosting_config_opts);qemu_add_opts (&qemu_fw_cfg_opts); +module_call_init (MODULE_INIT_CONFIG ); +runstate_init ();if (qcrypto_init (&err) <0 ) {
Signature · 1 line
2.1.4
PATCH 4/6 Drop machine_init() and MODULE_INIT_MACHINE
In reply to Andreas FärberMODULE_INIT_MACHINE was used to register QEMUMachines. Now that those have been converted to QOM we no longer need this separate registration.
For registering QemuOpts config_init() has been introduced.
--- include/qemu/module.h | 2 -- vl.c | 1 - 2 files changed, 3 deletions(-)
include/qemu/module.h +0 -2
@@ -43,7 +43,6 @@ static void __attribute__((constructor)) do_qemu_init_ ## function(void) \ typedef enum { MODULE_INIT_BLOCK, MODULE_INIT_CONFIG, - MODULE_INIT_MACHINE, MODULE_INIT_QAPI, MODULE_INIT_QOM, MODULE_INIT_MAX
@@ -51,7 +50,6 @@ typedef enum {#define block_init (function) module_init(function, MODULE_INIT_BLOCK)#define config_init (function) module_init(function, MODULE_INIT_CONFIG) -#define machine_init (function) module_init(function, MODULE_INIT_MACHINE)#define qapi_init (function) module_init(function, MODULE_INIT_QAPI)#define type_init (function) module_init(function, MODULE_INIT_QOM)
vl.c +0 -1
@@ -3010,7 +3010,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.4
PATCH 1/6 Use type_init() for all machine QOM types
In reply to Andreas FärberThis prepares for dropping machine_init(), now that QEMUMachine is gone.
--- 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 | 15 +++++---------- hw/arm/stellaris.c | 11 +++-------- hw/arm/versatilepb.c | 11 +++-------- 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/sparc/sun4m.c | 14 +++++--------- hw/sparc64/sun4u.c | 12 ++++-------- hw/xtensa/xtfpga.c | 2 +- include/hw/boards.h | 2 +- include/hw/i386/pc.h | 2 +- 19 files changed, 34 insertions(+), 57 deletions(-)
hw/arm/exynos4_boards.c +1 -1
@@ -180,4 +180,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
@@ -155,4 +155,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
@@ -429,4 +429,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
@@ -1449,4 +1449,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
@@ -251,4 +251,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
@@ -468,4 +468,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 +5 -10
@@ -1028,16 +1028,6 @@ static const TypeInfo terrierpda_type = { .class_init = terrierpda_class_init, }; -static void spitz_machine_init (void ) -{ -type_register_static (&akitapda_type); -type_register_static (&spitzpda_type); -type_register_static (&borzoipda_type); -type_register_static (&terrierpda_type); -} - -machine_init (spitz_machine_init) -static bool is_version_0 (void *opaque,int version_id) {return version_id ==0 ;
@@ -1167,6 +1157,11 @@ static const TypeInfo spitz_lcdtg_info = {static void spitz_register_types (void ) { +type_register_static (&akitapda_type); +type_register_static (&spitzpda_type); +type_register_static (&borzoipda_type); +type_register_static (&terrierpda_type); +type_register_static (&corgi_ssp_info);type_register_static (&spitz_lcdtg_info);type_register_static (&spitz_keyboard_info);
hw/arm/stellaris.c +3 -8
@@ -1394,14 +1394,6 @@ static const TypeInfo lm3s6965evb_type = { .class_init = lm3s6965evb_class_init, }; -static void stellaris_machine_init (void ) -{ -type_register_static (&lm3s811evb_type); -type_register_static (&lm3s6965evb_type); -} - -machine_init (stellaris_machine_init) -static void stellaris_i2c_class_init (ObjectClass *klass,void *data) {SysBusDeviceClass *sdc =SYS_BUS_DEVICE_CLASS (klass);
@@ -1446,6 +1438,9 @@ static const TypeInfo stellaris_adc_info = {static void stellaris_register_types (void ) { +type_register_static (&lm3s811evb_type); +type_register_static (&lm3s6965evb_type); +type_register_static (&stellaris_i2c_info);type_register_static (&stellaris_gptm_info);type_register_static (&stellaris_adc_info);
hw/arm/versatilepb.c +3 -8
@@ -421,14 +421,6 @@ static const TypeInfo versatileab_type = { .class_init = versatileab_class_init, }; -static void versatile_machine_init (void ) -{ -type_register_static (&versatilepb_type); -type_register_static (&versatileab_type); -} - -machine_init (versatile_machine_init) -static void vpb_sic_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -447,6 +439,9 @@ static const TypeInfo vpb_sic_info = {static void versatilepb_register_types (void ) { +type_register_static (&versatilepb_type); +type_register_static (&versatileab_type); +type_register_static (&vpb_sic_info); }
hw/arm/vexpress.c +1 -1
@@ -802,4 +802,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
@@ -1095,4 +1095,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
@@ -328,4 +328,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
@@ -385,4 +385,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
@@ -693,4 +693,4 @@ static void ppc405_machine_init(void)type_register_static (&taihu_type); } -machine_init (ppc405_machine_init) +type_init (ppc405_machine_init)
hw/sparc/sun4m.c +5 -9
@@ -1570,14 +1570,6 @@ static const TypeInfo sbook_type = {static void sun4m_register_types (void ) { -type_register_static (&idreg_info); -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);
@@ -1587,7 +1579,11 @@ static void sun4m_machine_init(void)type_register_static (&ss4_type);type_register_static (&scls_type);type_register_static (&sbook_type); + +type_register_static (&idreg_info); +type_register_static (&afx_info); +type_register_static (&prom_info); +type_register_static (&ram_info); }type_init (sun4m_register_types) -machine_init (sun4m_machine_init)
hw/sparc64/sun4u.c +4 -8
@@ -1016,17 +1016,13 @@ static const TypeInfo niagara_type = {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_register_static (&ebus_info); +type_register_static (&prom_info); +type_register_static (&ram_info); }type_init (sun4u_register_types) -machine_init (sun4u_machine_init)
hw/xtensa/xtfpga.c +1 -1
@@ -496,4 +496,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
@@ -147,6 +147,6 @@ struct MachineState { { \ type_register_static(&machine_initfn##_typeinfo); \ } \ - machine_init(machine_initfn##_register_types) + type_init(machine_initfn##_register_types)#endif
include/hw/i386/pc.h +1 -1
@@ -717,7 +717,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)#define SET_MACHINE_COMPAT (m,COMPAT ) do { \ static GlobalProperty props[] = { \
Signature · 1 line
2.1.4
PATCH 6/6 pc: Use type_register_static() for machine types
In reply to Andreas FärberThe TypeInfos are being generated statically and the name is a constant.
--- include/hw/i386/pc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/i386/pc.h +1 -1
@@ -715,7 +715,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); }; \ static void pc_machine_init_##suffix(void) \ { \ - type_register(&pc_machine_type_##suffix); \ + type_register_static(&pc_machine_type_##suffix); \ } \ type_init(pc_machine_init_##suffix)
Signature · 1 line
2.1.4
PATCH 5/6 exynos4: Further QOM'ify machines
In reply to Andreas FärberDrop board enumeration in favor of an abstract type, and move static tables into class initialization.
--- hw/arm/exynos4_boards.c | 71 ++++++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 33 deletions(-)
hw/arm/exynos4_boards.c +38 -33
@@ -46,26 +46,17 @@#define SMDK_LAN9118_BASE_ADDR 0x05000000 -typedef enum Exynos4BoardType { -EXYNOS4_BOARD_NURI , -EXYNOS4_BOARD_SMDKC210 , -EXYNOS4_NUM_OF_BOARDS -}Exynos4BoardType ; - -static int exynos4_board_id[EXYNOS4_NUM_OF_BOARDS ] = { - [EXYNOS4_BOARD_NURI ] =0xD33 , - [EXYNOS4_BOARD_SMDKC210 ] =0xB16 , -}; +typedef struct Exynos4MachineClass { +MachineClass parent_class; -static int exynos4_board_smp_bootreg_addr[EXYNOS4_NUM_OF_BOARDS ] = { - [EXYNOS4_BOARD_NURI ] =EXYNOS4210_SECOND_CPU_BOOTREG , - [EXYNOS4_BOARD_SMDKC210 ] =EXYNOS4210_SECOND_CPU_BOOTREG , -}; +int id; +int smp_bootreg_addr; +unsigned long ram_size; +}Exynos4MachineClass ; -static unsigned long exynos4_board_ram_size[EXYNOS4_NUM_OF_BOARDS ] = { - [EXYNOS4_BOARD_NURI ] =0x40000000 , - [EXYNOS4_BOARD_SMDKC210 ] =0x40000000 , -}; +#define TYPE_EXYNOS4_MACHINE MACHINE_TYPE_NAME("exynos4") +#define EXYNOS4_MACHINE_CLASS (cls) \ + OBJECT_CLASS_CHECK(Exynos4MachineClass, (cls), TYPE_EXYNOS4_MACHINE)static struct arm_boot_info exynos4_board_binfo = { .loader_start =EXYNOS4210_BASE_BOOT_ADDR ,
@@ -92,10 +83,10 @@ static void lan9215_init(uint32_t base, qemu_irq irq) } } -static Exynos4210State *exynos4_boards_init_common (MachineState *machine, -Exynos4BoardType board_type) +static Exynos4210State *exynos4_boards_init_common (MachineState *machine) {MachineClass *mc =MACHINE_GET_CLASS (machine); +Exynos4MachineClass *emc =EXYNOS4_MACHINE_CLASS (mc);if (smp_cpus !=EXYNOS4210_NCPUS && !qtest_enabled ()) { fprintf(stderr, "%s board supports only %d CPU cores. Ignoring smp_cpus"
@@ -103,10 +94,9 @@ static Exynos4210State *exynos4_boards_init_common(MachineState *machine, mc->name, EXYNOS4210_NCPUS); } - exynos4_board_binfo.ram_size = exynos4_board_ram_size[board_type]; - exynos4_board_binfo.board_id = exynos4_board_id[board_type]; - exynos4_board_binfo.smp_bootreg_addr = - exynos4_board_smp_bootreg_addr[board_type]; + exynos4_board_binfo.ram_size = emc->ram_size; + exynos4_board_binfo.board_id = emc->id; + exynos4_board_binfo.smp_bootreg_addr = emc->smp_bootreg_addr; exynos4_board_binfo.kernel_filename = machine->kernel_filename; exynos4_board_binfo.initrd_filename = machine->initrd_filename; exynos4_board_binfo.kernel_cmdline = machine->kernel_cmdline;
@@ -117,27 +107,24 @@ static Exynos4210State *exynos4_boards_init_common(MachineState *machine," kernel_filename: %s\n" " kernel_cmdline: %s\n" " initrd_filename: %s\n" , - exynos4_board_ram_size[board_type] /1048576 , - exynos4_board_ram_size[board_type], + emc->ram_size /1048576 , emc->ram_size, machine->kernel_filename, machine->kernel_cmdline, machine->initrd_filename); -return exynos4210_init (get_system_memory (), - exynos4_board_ram_size[board_type]); +return exynos4210_init (get_system_memory (), emc->ram_size); }static void nuri_init (MachineState *machine) { -exynos4_boards_init_common (machine,EXYNOS4_BOARD_NURI ); +exynos4_boards_init_common (machine);arm_load_kernel (ARM_CPU (first_cpu), &exynos4_board_binfo); }static void smdkc210_init (MachineState *machine) { -Exynos4210State *s =exynos4_boards_init_common (machine, -EXYNOS4_BOARD_SMDKC210 ); +Exynos4210State *s =exynos4_boards_init_common (machine);lan9215_init (SMDK_LAN9118_BASE_ADDR ,qemu_irq_invert (s->irq_table[exynos4210_get_irq (37 ,1 )]));
@@ -147,35 +134,53 @@ static void smdkc210_init(MachineState *machine)static void nuri_class_init (ObjectClass *oc,void *data) {MachineClass *mc =MACHINE_CLASS (oc); +Exynos4MachineClass *emc =EXYNOS4_MACHINE_CLASS (oc); mc->desc ="Samsung NURI board (Exynos4210)" ; mc->init = nuri_init; mc->max_cpus =EXYNOS4210_NCPUS ; + + emc->id =0xD33 ; + emc->smp_bootreg_addr =EXYNOS4210_SECOND_CPU_BOOTREG ; + emc->ram_size =0x40000000 ; }static const TypeInfo nuri_type = { .name =MACHINE_TYPE_NAME ("nuri" ), - .parent =TYPE_MACHINE , + .parent =TYPE_EXYNOS4_MACHINE , .class_init = nuri_class_init, };static void smdkc210_class_init (ObjectClass *oc,void *data) {MachineClass *mc =MACHINE_CLASS (oc); +Exynos4MachineClass *emc =EXYNOS4_MACHINE_CLASS (oc); mc->desc ="Samsung SMDKC210 board (Exynos4210)" ; mc->init = smdkc210_init; mc->max_cpus =EXYNOS4210_NCPUS ; + + emc->id =0xB16 ; + emc->smp_bootreg_addr =EXYNOS4210_SECOND_CPU_BOOTREG ; + emc->ram_size =0x40000000 ; }static const TypeInfo smdkc210_type = { .name =MACHINE_TYPE_NAME ("smdkc210" ), - .parent =TYPE_MACHINE , + .parent =TYPE_EXYNOS4_MACHINE , .class_init = smdkc210_class_init, }; +static const TypeInfo exynos4_machine_type = { + .name =TYPE_EXYNOS4_MACHINE , + .parent =TYPE_MACHINE , + .abstract = true, + .class_size =sizeof (Exynos4MachineClass), +}; +static void exynos4_machines_init (void ) { +type_register_static (&exynos4_machine_type);type_register_static (&nuri_type);type_register_static (&smdkc210_type); }
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 2/6] hw/s390x/css: Use type_init() instead of machine_init()
In reply to Andreas FärberAm 19.09.2015 um 17:36 schrieb Andreas Färber:
Quoted 6 lines
Here,
machine_init()is being misused to initialize global variables. Being all local, it's safe to use the slightly earliertype_init().This prepares for dropping
machine_init().Signed-off-by Andreas Färber <[email protected]>
I think this should go via your tree to coordinate with machine_init removal.
Quoted 18 lines
--- hw/s390x/css.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/s390x/css.c +1
-1@@ -1509,7 +1509,7 @@ static void css_init(void) channel_subsys->chnmon_active = false;QTAILQ_INIT (&channel_subsys->io_adapters); } -machine_init (css_init); +type_init (css_init) void css_reset_sch(SubchDev *sch) {
Quoted 10 lines · Andreas Färber
Hello,
Based on my pending qom-next pull, this series continues Eduardo's machine cleanups. Having eliminated QEMUMachine and
qemu_machine_register(), this series eliminatesmachine_init()andMODULE_INIT_MACHINE.As a side effect a few non-machine callers had to be updated, mostly for QemuOpts.
It goes on to update Exynos4 machines for QOM, demonstrating that
DEFINE_MACHINE()can be inferior to inlining the QOM boilerplate code in case of multiple machines.
Marcel once asked me if we could call DEFINE_MACHINE something like DEFINE_SIMPLE_MACHINE, to clarify that it's supposed to be used only on very simple cases that don't require anything except initializing some MachineClass fields.
Initially, I assumed that almost every machine class would use DEFINE_MACHINE, but then I noticed that it is not enough when one extra inheritance level or a different class_size is involved. So I think Marcel was right and we could rename DEFINE_MACHINE to DEFINE_SIMPLE_MACHINE.
Quoted 3 lines
Independently, I noticed a nit in the PC machine macro I'm touching that could probably even be cherry-picked.
Thanks!
Signature · 1 line
Eduardo