Skip to contentSkip to conversation

machine: QemuOpts per machine

PATCH In review Marcel Apfelbaum 12 participants 36 messages May 7, 2014 – May 18, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover machine: QemuOpts per machine

This series continues 'machine as QOM' targeting two related issues:
- Patch 1/4 completly removes QEMUMachineInitArgs from the code with a big mechanical patch. It removes QEMUMachineInitArgs from MachineState and gets rid of duplicated fields.
- I am perfectly aware that patches touching a lot of files

     are not desirable, but this one is a very simple replacement
     patch:
       QEMUMachineInitArgs -> MachineState
       args -> ms

- This is the simplest way to get rid of QEMUMachineInitArgs fast.
- Patch 4/4 aims to enable QemuOpts per machine by automatically filling in the machine opts into the current machine. Subclassing MachineClass and adding options mapped into properties is a better way than using global options.

Patches 2/4 and 3/4 fix little bugs needed by 4/4.

Marcel Apfelbaum (4):
machine: conversion of QEMUMachineInitArgs to MachineState
qapi: output visitor crashes qemu if it encounters a NULL value vl.c: do not set 'type' property in obj_set_property hw/machine: qemu machine opts as properties to QemuMachineState

 hw/alpha/dp264.c                         |  12 +-
 hw/arm/collie.c                          |  10 +-
 hw/arm/cubieboard.c                      |  10 +-
 hw/arm/digic_boards.c                    |   2 +-
 hw/arm/exynos4_boards.c                  |  16 +-
 hw/arm/gumstix.c                         |   6 +-
 hw/arm/highbank.c                        |  20 +--
 hw/arm/integratorcp.c                    |  12 +-
 hw/arm/kzm.c                             |  12 +-
 hw/arm/mainstone.c                       |  14 +-
 hw/arm/musicpal.c                        |  10 +-
 hw/arm/nseries.c                         |  22 +--
 hw/arm/omap_sx1.c                        |  20 +--
 hw/arm/palm.c                            |  10 +-
 hw/arm/realview.c                        |  44 +++---
 hw/arm/spitz.c                           |  26 ++--
 hw/arm/stellaris.c                       |  12 +-
 hw/arm/tosa.c                            |  10 +-
 hw/arm/versatilepb.c                     |  26 ++--
 hw/arm/vexpress.c                        |  20 +--
 hw/arm/virt.c                            |  16 +-
 hw/arm/xilinx_zynq.c                     |  12 +-
 hw/arm/z2.c                              |  10 +-
 hw/core/machine.c                        | 256 +++++++++++++++++++++++++++++++
 hw/core/null-machine.c                   |   2 +-
 hw/cris/axis_dev88.c                     |  10 +-
 hw/i386/pc_piix.c                        | 108 ++++++-------
 hw/i386/pc_q35.c                         |  66 ++++----
 hw/i386/xen_machine_pv.c                 |   8 +-
 hw/lm32/lm32_boards.c                    |  16 +-
 hw/lm32/milkymist.c                      |  10 +-
 hw/m68k/an5206.c                         |   8 +-
 hw/m68k/dummy_m68k.c                     |   8 +-
 hw/m68k/mcf5208.c                        |   8 +-
 hw/microblaze/petalogix_ml605_mmu.c      |   6 +-
 hw/microblaze/petalogix_s3adsp1800_mmu.c |   8 +-
 hw/mips/mips_fulong2e.c                  |  12 +-
 hw/mips/mips_jazz.c                      |  12 +-
 hw/mips/mips_malta.c                     |  12 +-
 hw/mips/mips_mipssim.c                   |  12 +-
 hw/mips/mips_r4k.c                       |  12 +-
 hw/moxie/moxiesim.c                      |  12 +-
 hw/openrisc/openrisc_sim.c               |   8 +-
 hw/ppc/e500.c                            |  44 +++---
 hw/ppc/e500.h                            |   2 +-
 hw/ppc/e500plat.c                        |   4 +-
 hw/ppc/mac_newworld.c                    |  14 +-
 hw/ppc/mac_oldworld.c                    |  14 +-
 hw/ppc/mpc8544ds.c                       |   4 +-
 hw/ppc/ppc405_boards.c                   |  18 +--
 hw/ppc/ppc440_bamboo.c                   |  12 +-
 hw/ppc/prep.c                            |  14 +-
 hw/ppc/spapr.c                           |  14 +-
 hw/ppc/virtex_ml507.c                    |  16 +-
 hw/s390x/s390-virtio-ccw.c               |  10 +-
 hw/s390x/s390-virtio.c                   |  10 +-
 hw/sh4/r2d.c                             |  10 +-
 hw/sh4/shix.c                            |   4 +-
 hw/sparc/leon3.c                         |   8 +-
 hw/sparc/sun4m.c                         |  64 ++++----
 hw/sparc64/sun4u.c                       |  36 ++---
 hw/unicore32/puv3.c                      |  10 +-
 hw/xtensa/xtensa_lx60.c                  |  26 ++--
 hw/xtensa/xtensa_sim.c                   |   8 +-
 include/hw/boards.h                      |  28 ++--
 qapi/qmp-output-visitor.c                |   5 +
 vl.c                                     |  23 +--
 67 files changed, 801 insertions(+), 543 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/4 machine: conversion of QEMUMachineInitArgs to MachineState

Total removal of QEMUMachineInitArgs struct. QEMUMachineInitArgs's fields are copied into MachineState. Removed duplicated fields from MachineState.

All the other changes are only mechanical refactoring, no semantic changes.

---
- I am perfectly aware that patches touching a lot of files

     are not desirable, but this one is a very simple replacement
     patch:
       QEMUMachineInitArgs -> MachineState
       args -> ms

- This is the simplest way to get rid of QEMUMachineInitArgs fast.

 hw/alpha/dp264.c                         |  12 ++--
 hw/arm/collie.c                          |  10 +--
 hw/arm/cubieboard.c                      |  10 +--
 hw/arm/digic_boards.c                    |   2 +-
 hw/arm/exynos4_boards.c                  |  16 ++---
 hw/arm/gumstix.c                         |   6 +-
 hw/arm/highbank.c                        |  20 +++---
 hw/arm/integratorcp.c                    |  12 ++--
 hw/arm/kzm.c                             |  12 ++--
 hw/arm/mainstone.c                       |  14 ++--
 hw/arm/musicpal.c                        |  10 +--
 hw/arm/nseries.c                         |  22 +++----
 hw/arm/omap_sx1.c                        |  20 +++---
 hw/arm/palm.c                            |  10 +--
 hw/arm/realview.c                        |  44 ++++++-------
 hw/arm/spitz.c                           |  26 ++++----
 hw/arm/stellaris.c                       |  12 ++--
 hw/arm/tosa.c                            |  10 +--
 hw/arm/versatilepb.c                     |  26 ++++----
 hw/arm/vexpress.c                        |  20 +++---
 hw/arm/virt.c                            |  16 ++---
 hw/arm/xilinx_zynq.c                     |  12 ++--
 hw/arm/z2.c                              |  10 +--
 hw/core/null-machine.c                   |   2 +-
 hw/cris/axis_dev88.c                     |  10 +--
 hw/i386/pc_piix.c                        | 108 +++++++++++++++----------------
 hw/i386/pc_q35.c                         |  66 +++++++++----------
 hw/i386/xen_machine_pv.c                 |   8 +--
 hw/lm32/lm32_boards.c                    |  16 ++---
 hw/lm32/milkymist.c                      |  10 +--
 hw/m68k/an5206.c                         |   8 +--
 hw/m68k/dummy_m68k.c                     |   8 +--
 hw/m68k/mcf5208.c                        |   8 +--
 hw/microblaze/petalogix_ml605_mmu.c      |   6 +-
 hw/microblaze/petalogix_s3adsp1800_mmu.c |   8 +--
 hw/mips/mips_fulong2e.c                  |  12 ++--
 hw/mips/mips_jazz.c                      |  12 ++--
 hw/mips/mips_malta.c                     |  12 ++--
 hw/mips/mips_mipssim.c                   |  12 ++--
 hw/mips/mips_r4k.c                       |  12 ++--
 hw/moxie/moxiesim.c                      |  12 ++--
 hw/openrisc/openrisc_sim.c               |   8 +--
 hw/ppc/e500.c                            |  44 ++++++-------
 hw/ppc/e500.h                            |   2 +-
 hw/ppc/e500plat.c                        |   4 +-
 hw/ppc/mac_newworld.c                    |  14 ++--
 hw/ppc/mac_oldworld.c                    |  14 ++--
 hw/ppc/mpc8544ds.c                       |   4 +-
 hw/ppc/ppc405_boards.c                   |  18 +++---
 hw/ppc/ppc440_bamboo.c                   |  12 ++--
 hw/ppc/prep.c                            |  14 ++--
 hw/ppc/spapr.c                           |  14 ++--
 hw/ppc/virtex_ml507.c                    |  16 ++---
 hw/s390x/s390-virtio-ccw.c               |  10 +--
 hw/s390x/s390-virtio.c                   |  10 +--
 hw/sh4/r2d.c                             |  10 +--
 hw/sh4/shix.c                            |   4 +-
 hw/sparc/leon3.c                         |   8 +--
 hw/sparc/sun4m.c                         |  64 +++++++++---------
 hw/sparc64/sun4u.c                       |  36 +++++------
 hw/unicore32/puv3.c                      |  10 +--
 hw/xtensa/xtensa_lx60.c                  |  26 ++++----
 hw/xtensa/xtensa_sim.c                   |   8 +--
 include/hw/boards.h                      |  28 ++++----
 vl.c                                     |  19 +++---
 65 files changed, 536 insertions(+), 543 deletions(-)
hw/alpha/dp264.c +6 -6
index 1351ba5..ab4647a 100644
@@ -43,13 +43,13 @@ static int clipper_pci_map_irq(PCIDevice *d, int irq_num)
     return (slot + 1) * 4 + irq_num;
 }
 
-static void clipper_init(QEMUMachineInitArgs *args)
+static void clipper_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     AlphaCPU *cpus[4];
     PCIBus *pci_bus;
     ISABus *isa_bus;
hw/arm/collie.c +5 -5
index 8878b0e..59715e1 100644
@@ -23,12 +23,12 @@ static struct arm_boot_info collie_binfo = {
     .ram_size = 0x20000000,
 };
 
-static void collie_init(QEMUMachineInitArgs *args)
+static void collie_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     StrongARMState *s;
     DriveInfo *dinfo;
     MemoryRegion *sysmem = get_system_memory();
hw/arm/cubieboard.c +5 -5
index 9d158c7..ea4c2ab 100644
@@ -30,7 +30,7 @@ typedef struct CubieBoardState {
     MemoryRegion sdram;
 } CubieBoardState;
 
-static void cubieboard_init(QEMUMachineInitArgs *args)
+static void cubieboard_init(MachineState *ms)
 {
     CubieBoardState *s = g_new(CubieBoardState, 1);
     Error *err = NULL;
@@ -63,14 +63,14 @@ static void cubieboard_init(QEMUMachineInitArgs *args)
         exit(1);
     }
 
-    memory_region_init_ram(&s->sdram, NULL, "cubieboard.ram", args->ram_size);
+    memory_region_init_ram(&s->sdram, NULL, "cubieboard.ram", ms->ram_size);
     vmstate_register_ram_global(&s->sdram);
     memory_region_add_subregion(get_system_memory(), AW_A10_SDRAM_BASE,
                                 &s->sdram);
 
-    cubieboard_binfo.ram_size = args->ram_size;
-    cubieboard_binfo.kernel_filename = args->kernel_filename;
-    cubieboard_binfo.kernel_cmdline = args->kernel_cmdline;
+    cubieboard_binfo.ram_size = ms->ram_size;
+    cubieboard_binfo.kernel_filename = ms->kernel_filename;
+    cubieboard_binfo.kernel_cmdline = ms->kernel_cmdline;
     arm_load_kernel(&s->a10->cpu, &cubieboard_binfo);
 }
 
hw/arm/digic_boards.c +1 -1
index 32fc30a..cb905f9 100644
@@ -143,7 +143,7 @@ static DigicBoard digic4_board_canon_a1100 = {
     .rom1_def_filename = "canon-a1100-rom1.bin",
 };
 
-static void canon_a1100_init(QEMUMachineInitArgs *args)
+static void canon_a1100_init(MachineState *ms)
 {
     digic4_board_init(&digic4_board_canon_a1100);
 }
hw/arm/exynos4_boards.c +8 -8
index 26cedec..688f117 100644
@@ -94,7 +94,7 @@ static void lan9215_init(uint32_t base, qemu_irq irq)
     }
 }
 
-static Exynos4210State *exynos4_boards_init_common(QEMUMachineInitArgs *args,
+static Exynos4210State *exynos4_boards_init_common(MachineState *ms,
                                                    Exynos4BoardType board_type)
 {
     if (smp_cpus != EXYNOS4210_NCPUS && !qtest_enabled()) {
@@ -108,9 +108,9 @@ static Exynos4210State *exynos4_boards_init_common(QEMUMachineInitArgs *args,
     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.kernel_filename = args->kernel_filename;
-    exynos4_board_binfo.initrd_filename = args->initrd_filename;
-    exynos4_board_binfo.kernel_cmdline = args->kernel_cmdline;
+    exynos4_board_binfo.kernel_filename = ms->kernel_filename;
+    exynos4_board_binfo.initrd_filename = ms->initrd_filename;
+    exynos4_board_binfo.kernel_cmdline = ms->kernel_cmdline;
     exynos4_board_binfo.gic_cpu_if_addr =
             EXYNOS4210_SMP_PRIVATE_BASE_ADDR + 0x100;
 
@@ -128,16 +128,16 @@ static Exynos4210State *exynos4_boards_init_common(QEMUMachineInitArgs *args,
             exynos4_board_ram_size[board_type]);
 }
 
-static void nuri_init(QEMUMachineInitArgs *args)
+static void nuri_init(MachineState *ms)
 {
-    exynos4_boards_init_common(args, EXYNOS4_BOARD_NURI);
+    exynos4_boards_init_common(ms, EXYNOS4_BOARD_NURI);
 
     arm_load_kernel(ARM_CPU(first_cpu), &exynos4_board_binfo);
 }
 
-static void smdkc210_init(QEMUMachineInitArgs *args)
+static void smdkc210_init(MachineState *ms)
 {
-    Exynos4210State *s = exynos4_boards_init_common(args,
+    Exynos4210State *s = exynos4_boards_init_common(ms,
                                                     EXYNOS4_BOARD_SMDKC210);
 
     lan9215_init(SMDK_LAN9118_BASE_ADDR,
hw/arm/gumstix.c +3 -3
index aeea172..9caf554 100644
@@ -46,7 +46,7 @@
 
 static const int sector_len = 128 * 1024;
 
-static void connex_init(QEMUMachineInitArgs *args)
+static void connex_init(MachineState *ms)
 {
     PXA2xxState *cpu;
     DriveInfo *dinfo;
@@ -83,9 +83,9 @@ static void connex_init(QEMUMachineInitArgs *args)
                     qdev_get_gpio_in(cpu->gpio, 36));
 }
 
-static void verdex_init(QEMUMachineInitArgs *args)
+static void verdex_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
+    const char *cpu_model = ms->cpu_model;
     PXA2xxState *cpu;
     DriveInfo *dinfo;
     int be;
hw/arm/highbank.c +10 -10
index 46b9f1e..78d112c 100644
@@ -200,13 +200,13 @@ enum cxmachines {
  * 32-bit host, set the reg value of memory to 0xf7ff00000 in the
  * device tree and pass -m 2047 to QEMU.
  */
-static void calxeda_init(QEMUMachineInitArgs *args, enum cxmachines machine)
+static void calxeda_init(MachineState *ms, enum cxmachines machine)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     DeviceState *dev = NULL;
     SysBusDevice *busdev;
     qemu_irq pic[128];
@@ -360,14 +360,14 @@ static void calxeda_init(QEMUMachineInitArgs *args, enum cxmachines machine)
     arm_load_kernel(ARM_CPU(first_cpu), &highbank_binfo);
 }
 
-static void highbank_init(QEMUMachineInitArgs *args)
+static void highbank_init(MachineState *ms)
 {
-    calxeda_init(args, CALXEDA_HIGHBANK);
+    calxeda_init(ms, CALXEDA_HIGHBANK);
 }
 
-static void midway_init(QEMUMachineInitArgs *args)
+static void midway_init(MachineState *ms)
 {
-    calxeda_init(args, CALXEDA_MIDWAY);
+    calxeda_init(ms, CALXEDA_MIDWAY);
 }
 
 static QEMUMachine highbank_machine = {
hw/arm/integratorcp.c +6 -6
index 912af96..05884e4 100644
@@ -461,13 +461,13 @@ static struct arm_boot_info integrator_binfo = {
     .board_id = 0x113,
 };
 
-static void integratorcp_init(QEMUMachineInitArgs *args)
+static void integratorcp_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     ARMCPU *cpu;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
hw/arm/kzm.c +6 -6
index 99d33cb..dca3b74 100644
@@ -70,13 +70,13 @@ static struct arm_boot_info kzm_binfo = {
     .board_id = 1722,
 };
 
-static void kzm_init(QEMUMachineInitArgs *args)
+static void kzm_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     ARMCPU *cpu;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
hw/arm/mainstone.c +7 -7
index d8e075e..de1cdcb 100644
@@ -105,7 +105,7 @@ static struct arm_boot_info mainstone_binfo = {
 };
 
 static void mainstone_common_init(MemoryRegion *address_space_mem,
-                                  QEMUMachineInitArgs *args,
+                                  MachineState *ms,
                                   enum mainstone_model_e model, int arm_id)
 {
     uint32_t sector_len = 256 * 1024;
@@ -116,7 +116,7 @@ static void mainstone_common_init(MemoryRegion *address_space_mem,
     int i;
     int be;
     MemoryRegion *rom = g_new(MemoryRegion, 1);
-    const char *cpu_model = args->cpu_model;
+    const char *cpu_model = ms->cpu_model;
 
     if (!cpu_model)
         cpu_model = "pxa270-c5";
@@ -175,16 +175,16 @@ static void mainstone_common_init(MemoryRegion *address_space_mem,
     smc91c111_init(&nd_table[0], MST_ETH_PHYS,
                     qdev_get_gpio_in(mst_irq, ETHERNET_IRQ));
 
-    mainstone_binfo.kernel_filename = args->kernel_filename;
-    mainstone_binfo.kernel_cmdline = args->kernel_cmdline;
-    mainstone_binfo.initrd_filename = args->initrd_filename;
+    mainstone_binfo.kernel_filename = ms->kernel_filename;
+    mainstone_binfo.kernel_cmdline = ms->kernel_cmdline;
+    mainstone_binfo.initrd_filename = ms->initrd_filename;
     mainstone_binfo.board_id = arm_id;
     arm_load_kernel(mpu->cpu, &mainstone_binfo);
 }
 
-static void mainstone_init(QEMUMachineInitArgs *args)
+static void mainstone_init(MachineState *ms)
 {
-    mainstone_common_init(get_system_memory(), args, mainstone, 0x196);
+    mainstone_common_init(get_system_memory(), ms, mainstone, 0x196);
 }
 
 static QEMUMachine mainstone2_machine = {
hw/arm/musicpal.c +5 -5
index de54201..54590ec 100644
@@ -1577,12 +1577,12 @@ static struct arm_boot_info musicpal_binfo = {
     .board_id = 0x20e,
 };
 
-static void musicpal_init(QEMUMachineInitArgs *args)
+static void musicpal_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     ARMCPU *cpu;
     qemu_irq pic[32];
     DeviceState *dev;
hw/arm/nseries.c +11 -11
index c28f895..ae097d6 100644
@@ -1278,14 +1278,14 @@ static int n810_atag_setup(const struct arm_boot_info *info, void *p)
     return n8x0_atag_setup(p, 810);
 }
 
-static void n8x0_init(QEMUMachineInitArgs *args,
+static void n8x0_init(MachineState *ms,
                       struct arm_boot_info *binfo, int model)
 {
     MemoryRegion *sysmem = get_system_memory();
     struct n800_s *s = (struct n800_s *) g_malloc0(sizeof(*s));
     int sdram_size = binfo->ram_size;
 
-    s->mpu = omap2420_mpu_init(sysmem, sdram_size, args->cpu_model);
+    s->mpu = omap2420_mpu_init(sysmem, sdram_size, ms->cpu_model);
 
     /* Setup peripherals
      *
@@ -1329,18 +1329,18 @@ static void n8x0_init(QEMUMachineInitArgs *args,
         n8x0_usb_setup(s);
     }
 
-    if (args->kernel_filename) {
+    if (ms->kernel_filename) {
         /* Or at the linux loader.  */
-        binfo->kernel_filename = args->kernel_filename;
-        binfo->kernel_cmdline = args->kernel_cmdline;
-        binfo->initrd_filename = args->initrd_filename;
+        binfo->kernel_filename = ms->kernel_filename;
+        binfo->kernel_cmdline = ms->kernel_cmdline;
+        binfo->initrd_filename = ms->initrd_filename;
         arm_load_kernel(s->mpu->cpu, binfo);
 
         qemu_register_reset(n8x0_boot_init, s);
     }
 
     if (option_rom[0].name &&
-        (args->boot_order[0] == 'n' || !args->kernel_filename)) {
+        (ms->boot_order[0] == 'n' || !ms->kernel_filename)) {
         uint8_t nolo_tags[0x10000];
         /* No, wait, better start at the ROM.  */
         s->mpu->cpu->env.regs[15] = OMAP2_Q2_BASE + 0x400000;
@@ -1382,14 +1382,14 @@ static struct arm_boot_info n810_binfo = {
     .atag_board = n810_atag_setup,
 };
 
-static void n800_init(QEMUMachineInitArgs *args)
+static void n800_init(MachineState *ms)
 {
-    return n8x0_init(args, &n800_binfo, 800);
+    return n8x0_init(ms, &n800_binfo, 800);
 }
 
-static void n810_init(QEMUMachineInitArgs *args)
+static void n810_init(MachineState *ms)
 {
-    return n8x0_init(args, &n810_binfo, 810);
+    return n8x0_init(ms, &n810_binfo, 810);
 }
 
 static QEMUMachine n800_machine = {
hw/arm/omap_sx1.c +10 -10
index 3ba263a..75b414b 100644
@@ -98,7 +98,7 @@ static struct arm_boot_info sx1_binfo = {
     .board_id = 0x265,
 };
 
-static void sx1_init(QEMUMachineInitArgs *args, const int version)
+static void sx1_init(MachineState *ms, const int version)
 {
     struct omap_mpu_state_s *mpu;
     MemoryRegion *address_space = get_system_memory();
@@ -118,7 +118,7 @@ static void sx1_init(QEMUMachineInitArgs *args, const int version)
         flash_size = flash2_size;
     }
 
-    mpu = omap310_mpu_init(address_space, sx1_binfo.ram_size, args->cpu_model);
+    mpu = omap310_mpu_init(address_space, sx1_binfo.ram_size, ms->cpu_model);
 
     /* External Flash (EMIFS) */
     memory_region_init_ram(flash, NULL, "omap_sx1.flash0-0", flash_size);
@@ -189,29 +189,29 @@ static void sx1_init(QEMUMachineInitArgs *args, const int version)
                                 OMAP_CS1_BASE, &cs[1]);
     }
 
-    if (!args->kernel_filename && !fl_idx && !qtest_enabled()) {
+    if (!ms->kernel_filename && !fl_idx && !qtest_enabled()) {
         fprintf(stderr, "Kernel or Flash image must be specified\n");
         exit(1);
     }
 
     /* Load the kernel.  */
-    sx1_binfo.kernel_filename = args->kernel_filename;
-    sx1_binfo.kernel_cmdline = args->kernel_cmdline;
-    sx1_binfo.initrd_filename = args->initrd_filename;
+    sx1_binfo.kernel_filename = ms->kernel_filename;
+    sx1_binfo.kernel_cmdline = ms->kernel_cmdline;
+    sx1_binfo.initrd_filename = ms->initrd_filename;
     arm_load_kernel(mpu->cpu, &sx1_binfo);
 
     /* TODO: fix next line */
     //~ qemu_console_resize(ds, 640, 480);
 }
 
-static void sx1_init_v1(QEMUMachineInitArgs *args)
+static void sx1_init_v1(MachineState *ms)
 {
-    sx1_init(args, 1);
+    sx1_init(ms, 1);
 }
 
-static void sx1_init_v2(QEMUMachineInitArgs *args)
+static void sx1_init_v2(MachineState *ms)
 {
-    sx1_init(args, 2);
+    sx1_init(ms, 2);
 }
 
 static QEMUMachine sx1_machine_v2 = {
hw/arm/palm.c +5 -5
index fac4f69..1e1f47d 100644
@@ -191,12 +191,12 @@ static struct arm_boot_info palmte_binfo = {
     .board_id = 0x331,
 };
 
-static void palmte_init(QEMUMachineInitArgs *args)
+static void palmte_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     MemoryRegion *address_space_mem = get_system_memory();
     struct omap_mpu_state_s *mpu;
     int flash_size = 0x00800000;
hw/arm/realview.c +22 -22

88 lines not on this page · raw message

hw/arm/spitz.c +13 -13
index 392ca84..f35c31f 100644
@@ -887,14 +887,14 @@ static struct arm_boot_info spitz_binfo = {
     .ram_size = 0x04000000,
 };
 
-static void spitz_common_init(QEMUMachineInitArgs *args,
+static void spitz_common_init(MachineState *ms,
                               enum spitz_model_e model, int arm_id)
 {
     PXA2xxState *mpu;
     DeviceState *scp0, *scp1 = NULL;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *rom = g_new(MemoryRegion, 1);
-    const char *cpu_model = args->cpu_model;
+    const char *cpu_model = ms->cpu_model;
 
     if (!cpu_model)
         cpu_model = (model == terrier) ? "pxa270-c5" : "pxa270-c0";
@@ -935,32 +935,32 @@ static void spitz_common_init(QEMUMachineInitArgs *args,
         /* A 4.0 GB microdrive is permanently sitting in CF slot 0.  */
         spitz_microdrive_attach(mpu, 0);
 
-    spitz_binfo.kernel_filename = args->kernel_filename;
-    spitz_binfo.kernel_cmdline = args->kernel_cmdline;
-    spitz_binfo.initrd_filename = args->initrd_filename;
+    spitz_binfo.kernel_filename = ms->kernel_filename;
+    spitz_binfo.kernel_cmdline = ms->kernel_cmdline;
+    spitz_binfo.initrd_filename = ms->initrd_filename;
     spitz_binfo.board_id = arm_id;
     arm_load_kernel(mpu->cpu, &spitz_binfo);
     sl_bootparam_write(SL_PXA_PARAM_BASE);
 }
 
-static void spitz_init(QEMUMachineInitArgs *args)
+static void spitz_init(MachineState *ms)
 {
-    spitz_common_init(args, spitz, 0x2c9);
+    spitz_common_init(ms, spitz, 0x2c9);
 }
 
-static void borzoi_init(QEMUMachineInitArgs *args)
+static void borzoi_init(MachineState *ms)
 {
-    spitz_common_init(args, borzoi, 0x33f);
+    spitz_common_init(ms, borzoi, 0x33f);
 }
 
-static void akita_init(QEMUMachineInitArgs *args)
+static void akita_init(MachineState *ms)
 {
-    spitz_common_init(args, akita, 0x2e8);
+    spitz_common_init(ms, akita, 0x2e8);
 }
 
-static void terrier_init(QEMUMachineInitArgs *args)
+static void terrier_init(MachineState *ms)
 {
-    spitz_common_init(args, terrier, 0x33f);
+    spitz_common_init(ms, terrier, 0x33f);
 }
 
 static QEMUMachine akitapda_machine = {
hw/arm/stellaris.c +6 -6
index d6cc77b..5d268aa 100644
@@ -1330,17 +1330,17 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model,
 }
 
 /* FIXME: Figure out how to generate these from stellaris_boards.  */
-static void lm3s811evb_init(QEMUMachineInitArgs *args)
+static void lm3s811evb_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
     stellaris_init(kernel_filename, cpu_model, &stellaris_boards[0]);
 }
 
-static void lm3s6965evb_init(QEMUMachineInitArgs *args)
+static void lm3s6965evb_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
     stellaris_init(kernel_filename, cpu_model, &stellaris_boards[1]);
 }
 
hw/arm/tosa.c +5 -5
index 2069f55..2fbeaf5 100644
@@ -211,12 +211,12 @@ static struct arm_boot_info tosa_binfo = {
     .ram_size = 0x04000000,
 };
 
-static void tosa_init(QEMUMachineInitArgs *args)
+static void tosa_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *rom = g_new(MemoryRegion, 1);
     PXA2xxState *mpu;
hw/arm/versatilepb.c +13 -13
index e5493b4..acca596 100644
@@ -173,7 +173,7 @@ static int vpb_sic_init(SysBusDevice *sbd)
 
 static struct arm_boot_info versatile_binfo;
 
-static void versatile_init(QEMUMachineInitArgs *args, int board_id)
+static void versatile_init(MachineState *ms, int board_id)
 {
     ARMCPU *cpu;
     MemoryRegion *sysmem = get_system_memory();
@@ -190,15 +190,15 @@ static void versatile_init(QEMUMachineInitArgs *args, int board_id)
     int done_smc = 0;
     DriveInfo *dinfo;
 
-    if (!args->cpu_model) {
-        args->cpu_model = "arm926";
+    if (!ms->cpu_model) {
+        ms->cpu_model = "arm926";
     }
-    cpu = cpu_arm_init(args->cpu_model);
+    cpu = cpu_arm_init(ms->cpu_model);
     if (!cpu) {
         fprintf(stderr, "Unable to find CPU definition\n");
         exit(1);
     }
-    memory_region_init_ram(ram, NULL, "versatile.ram", args->ram_size);
+    memory_region_init_ram(ram, NULL, "versatile.ram", ms->ram_size);
     vmstate_register_ram_global(ram);
     /* ??? RAM should repeat to fill physical memory space.  */
     /* SDRAM at address zero.  */
@@ -344,22 +344,22 @@ static void versatile_init(QEMUMachineInitArgs *args, int board_id)
         fprintf(stderr, "qemu: Error registering flash memory.\n");
     }
 
-    versatile_binfo.ram_size = args->ram_size;
-    versatile_binfo.kernel_filename = args->kernel_filename;
-    versatile_binfo.kernel_cmdline = args->kernel_cmdline;
-    versatile_binfo.initrd_filename = args->initrd_filename;
+    versatile_binfo.ram_size = ms->ram_size;
+    versatile_binfo.kernel_filename = ms->kernel_filename;
+    versatile_binfo.kernel_cmdline = ms->kernel_cmdline;
+    versatile_binfo.initrd_filename = ms->initrd_filename;
     versatile_binfo.board_id = board_id;
     arm_load_kernel(cpu, &versatile_binfo);
 }
 
-static void vpb_init(QEMUMachineInitArgs *args)
+static void vpb_init(MachineState *ms)
 {
-    versatile_init(args, 0x183);
+    versatile_init(ms, 0x183);
 }
 
-static void vab_init(QEMUMachineInitArgs *args)
+static void vab_init(MachineState *ms)
 {
-    versatile_init(args, 0x25e);
+    versatile_init(ms, 0x25e);
 }
 
 static QEMUMachine versatilepb_machine = {
hw/arm/vexpress.c +10 -10
index 169eb06..1051387 100644
@@ -509,7 +509,7 @@ static pflash_t *ve_pflash_cfi01_register(hwaddr base, const char *name,
 }
 
 static void vexpress_common_init(VEDBoardInfo *daughterboard,
-                                 QEMUMachineInitArgs *args)
+                                 MachineState *ms)
 {
     DeviceState *dev, *sysctl, *pl041;
     qemu_irq pic[64];
@@ -525,7 +525,7 @@ static void vexpress_common_init(VEDBoardInfo *daughterboard,
     const hwaddr *map = daughterboard->motherboard_map;
     int i;
 
-    daughterboard->init(daughterboard, args->ram_size, args->cpu_model, pic);
+    daughterboard->init(daughterboard, ms->ram_size, ms->cpu_model, pic);
 
     /* Motherboard peripherals: the wiring is the same but the
      * addresses vary between the legacy and A-Series memory maps.
@@ -639,10 +639,10 @@ static void vexpress_common_init(VEDBoardInfo *daughterboard,
                              pic[40 + i]);
     }
 
-    daughterboard->bootinfo.ram_size = args->ram_size;
-    daughterboard->bootinfo.kernel_filename = args->kernel_filename;
-    daughterboard->bootinfo.kernel_cmdline = args->kernel_cmdline;
-    daughterboard->bootinfo.initrd_filename = args->initrd_filename;
+    daughterboard->bootinfo.ram_size = ms->ram_size;
+    daughterboard->bootinfo.kernel_filename = ms->kernel_filename;
+    daughterboard->bootinfo.kernel_cmdline = ms->kernel_cmdline;
+    daughterboard->bootinfo.initrd_filename = ms->initrd_filename;
     daughterboard->bootinfo.nb_cpus = smp_cpus;
     daughterboard->bootinfo.board_id = VEXPRESS_BOARD_ID;
     daughterboard->bootinfo.loader_start = daughterboard->loader_start;
@@ -653,14 +653,14 @@ static void vexpress_common_init(VEDBoardInfo *daughterboard,
     arm_load_kernel(ARM_CPU(first_cpu), &daughterboard->bootinfo);
 }
 
-static void vexpress_a9_init(QEMUMachineInitArgs *args)
+static void vexpress_a9_init(MachineState *ms)
 {
-    vexpress_common_init(&a9_daughterboard, args);
+    vexpress_common_init(&a9_daughterboard, ms);
 }
 
-static void vexpress_a15_init(QEMUMachineInitArgs *args)
+static void vexpress_a15_init(MachineState *ms)
 {
-    vexpress_common_init(&a15_daughterboard, args);
+    vexpress_common_init(&a15_daughterboard, ms);
 }
 
 static QEMUMachine vexpress_a9_machine = {
hw/arm/virt.c +8 -8
index ea4f02d..8399e81 100644
@@ -383,13 +383,13 @@ static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size)
     return board->fdt;
 }
 
-static void machvirt_init(QEMUMachineInitArgs *args)
+static void machvirt_init(MachineState *ms)
 {
     qemu_irq pic[NUM_IRQS];
     MemoryRegion *sysmem = get_system_memory();
     int n;
     MemoryRegion *ram = g_new(MemoryRegion, 1);
-    const char *cpu_model = args->cpu_model;
+    const char *cpu_model = ms->cpu_model;
     VirtBoardInfo *vbi;
 
     if (!cpu_model) {
@@ -415,7 +415,7 @@ static void machvirt_init(QEMUMachineInitArgs *args)
         exit(1);
     }
 
-    if (args->ram_size > vbi->memmap[VIRT_MEM].size) {
+    if (ms->ram_size > vbi->memmap[VIRT_MEM].size) {
         error_report("mach-virt: cannot model more than 30GB RAM");
         exit(1);
     }
@@ -447,7 +447,7 @@ static void machvirt_init(QEMUMachineInitArgs *args)
     }
     fdt_add_cpu_nodes(vbi);
 
-    memory_region_init_ram(ram, NULL, "mach-virt.ram", args->ram_size);
+    memory_region_init_ram(ram, NULL, "mach-virt.ram", ms->ram_size);
     vmstate_register_ram_global(ram);
     memory_region_add_subregion(sysmem, vbi->memmap[VIRT_MEM].base, ram);
 
@@ -461,10 +461,10 @@ static void machvirt_init(QEMUMachineInitArgs *args)
      */
     create_virtio_devices(vbi, pic);
 
-    vbi->bootinfo.ram_size = args->ram_size;
-    vbi->bootinfo.kernel_filename = args->kernel_filename;
-    vbi->bootinfo.kernel_cmdline = args->kernel_cmdline;
-    vbi->bootinfo.initrd_filename = args->initrd_filename;
+    vbi->bootinfo.ram_size = ms->ram_size;
+    vbi->bootinfo.kernel_filename = ms->kernel_filename;
+    vbi->bootinfo.kernel_cmdline = ms->kernel_cmdline;
+    vbi->bootinfo.initrd_filename = ms->initrd_filename;
     vbi->bootinfo.nb_cpus = smp_cpus;
     vbi->bootinfo.board_id = -1;
     vbi->bootinfo.loader_start = vbi->memmap[VIRT_MEM].base;
hw/arm/xilinx_zynq.c +6 -6
index 9ee21e7..bf64968 100644
@@ -101,13 +101,13 @@ static inline void zynq_init_spi_flashes(uint32_t base_addr, qemu_irq irq,
 
 }
 
-static void zynq_init(QEMUMachineInitArgs *args)
+static void zynq_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     ObjectClass *cpu_oc;
     ARMCPU *cpu;
     MemoryRegion *address_space_mem = get_system_memory();
hw/arm/z2.c +5 -5
index 67c1be8..52a80db 100644
@@ -302,12 +302,12 @@ static const TypeInfo aer915_info = {
     .class_init    = aer915_class_init,
 };
 
-static void z2_init(QEMUMachineInitArgs *args)
+static void z2_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     MemoryRegion *address_space_mem = get_system_memory();
     uint32_t sector_len = 0x10000;
     PXA2xxState *mpu;
hw/core/null-machine.c +1 -1
index d813c08..6409bea 100644
@@ -15,7 +15,7 @@
 #include "hw/hw.h"
 #include "hw/boards.h"
 
-static void machine_none_init(QEMUMachineInitArgs *args)
+static void machine_none_init(MachineState *ms)
 {
 }
 
hw/cris/axis_dev88.c +5 -5
index 645e45c..e20161e 100644
@@ -243,12 +243,12 @@ static const MemoryRegionOps gpio_ops = {
 static struct cris_load_info li;
 
 static
-void axisdev88_init(QEMUMachineInitArgs *args)
+void axisdev88_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
     CRISCPU *cpu;
     CPUCRISState *env;
     DeviceState *dev;
hw/i386/pc_piix.c +54 -54

240 lines not on this page · raw message

hw/i386/pc_q35.c +33 -33

149 lines not on this page · raw message

hw/i386/xen_machine_pv.c +4 -4
index 9adb57f..fb7a817 100644
@@ -28,11 +28,11 @@
 #include "xen_domainbuild.h"
 #include "sysemu/blockdev.h"
 
-static void xen_init_pv(QEMUMachineInitArgs *args)
+static void xen_init_pv(MachineState *ms)
 {
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     DriveInfo *dinfo;
     int i;
 
hw/lm32/lm32_boards.c +8 -8
index 5e22e9b..fb66f67 100644
@@ -69,10 +69,10 @@ static void main_cpu_reset(void *opaque)
     env->deba = reset_info->flash_base;
 }
 
-static void lm32_evr_init(QEMUMachineInitArgs *args)
+static void lm32_evr_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
     LM32CPU *cpu;
     CPULM32State *env;
     DriveInfo *dinfo;
@@ -162,12 +162,12 @@ static void lm32_evr_init(QEMUMachineInitArgs *args)
     qemu_register_reset(main_cpu_reset, reset_info);
 }
 
-static void lm32_uclinux_init(QEMUMachineInitArgs *args)
+static void lm32_uclinux_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     LM32CPU *cpu;
     CPULM32State *env;
     DriveInfo *dinfo;
hw/lm32/milkymist.c +5 -5
index baf234c..7438a79 100644
@@ -74,12 +74,12 @@ static void main_cpu_reset(void *opaque)
 }
 
 static void
-milkymist_init(QEMUMachineInitArgs *args)
+milkymist_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     LM32CPU *cpu;
     CPULM32State *env;
     int kernel_size;
hw/m68k/an5206.c +4 -4
index 24f2068..7814dc9 100644
@@ -20,11 +20,11 @@
 
 /* Board init.  */
 
-static void an5206_init(QEMUMachineInitArgs *args)
+static void an5206_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
     M68kCPU *cpu;
     CPUM68KState *env;
     int kernel_size;
hw/m68k/dummy_m68k.c +4 -4
index 86e2e6e..e87f8b6 100644
@@ -16,11 +16,11 @@
 
 /* Board init.  */
 
-static void dummy_m68k_init(QEMUMachineInitArgs *args)
+static void dummy_m68k_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
     CPUM68KState *env;
     MemoryRegion *address_space_mem =  get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
hw/m68k/mcf5208.c +4 -4
index 6e30c0b..26c6ee9 100644
@@ -188,11 +188,11 @@ static void mcf5208_sys_init(MemoryRegion *address_space, qemu_irq *pic)
     }
 }
 
-static void mcf5208evb_init(QEMUMachineInitArgs *args)
+static void mcf5208evb_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
     M68kCPU *cpu;
     CPUM68KState *env;
     int kernel_size;
hw/microblaze/petalogix_ml605_mmu.c +3 -3
index 40a9f5c..1b3d3ed 100644
@@ -79,9 +79,9 @@ static void machine_cpu_reset(MicroBlazeCPU *cpu)
 }
 
 static void
-petalogix_ml605_init(QEMUMachineInitArgs *args)
+petalogix_ml605_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
+    ram_addr_t ram_size = ms->ram_size;
     MemoryRegion *address_space_mem = get_system_memory();
     DeviceState *dev, *dma, *eth0;
     Object *ds, *cs;
@@ -202,7 +202,7 @@ petalogix_ml605_init(QEMUMachineInitArgs *args)
     }
 
     microblaze_load_kernel(cpu, ddr_base, ram_size,
-                           args->initrd_filename,
+                           ms->initrd_filename,
                            BINARY_DEVICE_TREE_FILE,
                            machine_cpu_reset);
 
hw/microblaze/petalogix_s3adsp1800_mmu.c +4 -4
index 6c45e20..683f7b3 100644
@@ -59,10 +59,10 @@ static void machine_cpu_reset(MicroBlazeCPU *cpu)
 }
 
 static void
-petalogix_s3adsp1800_init(QEMUMachineInitArgs *args)
+petalogix_s3adsp1800_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
     DeviceState *dev;
     MicroBlazeCPU *cpu;
     DriveInfo *dinfo;
@@ -128,7 +128,7 @@ petalogix_s3adsp1800_init(QEMUMachineInitArgs *args)
     sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq[ETHLITE_IRQ]);
 
     microblaze_load_kernel(cpu, ddr_base, ram_size,
-                           args->initrd_filename,
+                           ms->initrd_filename,
                            BINARY_DEVICE_TREE_FILE,
                            machine_cpu_reset);
 }
hw/mips/mips_fulong2e.c +6 -6
index e1551aa..e065883 100644
@@ -259,13 +259,13 @@ static void cpu_request_exit(void *opaque, int irq, int level)
     }
 }
 
-static void mips_fulong2e_init(QEMUMachineInitArgs *args)
+static void mips_fulong2e_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     char *filename;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
hw/mips/mips_jazz.c +6 -6
index 5f6dd9f..53cad58 100644
@@ -329,19 +329,19 @@ static void mips_jazz_init(MemoryRegion *address_space,
 }
 
 static
-void mips_magnum_init(QEMUMachineInitArgs *args)
+void mips_magnum_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
         mips_jazz_init(get_system_memory(), get_system_io(),
                        ram_size, cpu_model, JAZZ_MAGNUM);
 }
 
 static
-void mips_pica61_init(QEMUMachineInitArgs *args)
+void mips_pica61_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
     mips_jazz_init(get_system_memory(), get_system_io(),
                    ram_size, cpu_model, JAZZ_PICA61);
 }
hw/mips/mips_malta.c +6 -6
index ac5ec44..a16ee92 100644
@@ -875,13 +875,13 @@ static void cpu_request_exit(void *opaque, int irq, int level)
 }
 
 static
-void mips_malta_init(QEMUMachineInitArgs *args)
+void mips_malta_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     char *filename;
     pflash_t *fl;
     MemoryRegion *system_memory = get_system_memory();
hw/mips/mips_mipssim.c +6 -6
index 239aa6a..7254adf 100644
@@ -133,13 +133,13 @@ static void mipsnet_init(int base, qemu_irq irq, NICInfo *nd)
 }
 
 static void
-mips_mipssim_init(QEMUMachineInitArgs *args)
+mips_mipssim_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     char *filename;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *isa = g_new(MemoryRegion, 1);
hw/mips/mips_r4k.c +6 -6
index e94b543..7a69514 100644
@@ -153,13 +153,13 @@ static void main_cpu_reset(void *opaque)
 
 static const int sector_len = 32 * 1024;
 static
-void mips_r4k_init(QEMUMachineInitArgs *args)
+void mips_r4k_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     char *filename;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
hw/moxie/moxiesim.c +6 -6
index a87ca6d..6114478 100644
@@ -107,14 +107,14 @@ moxie_intc_create(hwaddr base, qemu_irq irq, int kind_of_intr)
     return dev;
 }
 
-static void moxiesim_init(QEMUMachineInitArgs *args)
+static void moxiesim_init(MachineState *ms)
 {
     MoxieCPU *cpu = NULL;
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     CPUMoxieState *env;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
hw/openrisc/openrisc_sim.c +4 -4
index 8e1af8b..24bd3c3 100644
@@ -90,11 +90,11 @@ static void cpu_openrisc_load_kernel(ram_addr_t ram_size,
     }
 }
 
-static void openrisc_sim_init(QEMUMachineInitArgs *args)
+static void openrisc_sim_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
     OpenRISCCPU *cpu = NULL;
     MemoryRegion *ram;
     int n;
hw/ppc/e500.c +22 -22

147 lines not on this page · raw message

hw/ppc/e500.h +1 -1
index 52726a2..579f1bf 100644
@@ -13,6 +13,6 @@ typedef struct PPCE500Params {
     int mpic_version;
 } PPCE500Params;
 
-void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params);
+void ppce500_init(MachineState *ms, PPCE500Params *params);
 
 #endif
hw/ppc/e500plat.c +2 -2
index 7d5357e..71e93d3 100644
@@ -28,7 +28,7 @@ static void e500plat_fixup_devtree(PPCE500Params *params, void *fdt)
                      sizeof(compatible));
 }
 
-static void e500plat_init(QEMUMachineInitArgs *args)
+static void e500plat_init(MachineState *ms)
 {
     PPCE500Params params = {
         .pci_first_slot = 0x1,
@@ -43,7 +43,7 @@ static void e500plat_init(QEMUMachineInitArgs *args)
         params.mpic_version = OPENPIC_MODEL_FSL_MPIC_20;
     }
 
-    ppce500_init(args, &params);
+    ppce500_init(ms, &params);
 }
 
 static QEMUMachine e500plat_machine = {
hw/ppc/mac_newworld.c +7 -7
index 5e79575..4e9000d 100644
@@ -140,14 +140,14 @@ static void ppc_core99_reset(void *opaque)
 }
 
 /* PowerPC Mac99 hardware initialisation */
-static void ppc_core99_init(QEMUMachineInitArgs *args)
+static void ppc_core99_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
-    const char *boot_device = args->boot_order;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
+    const char *boot_device = ms->boot_order;
     PowerPCCPU *cpu = NULL;
     CPUPPCState *env = NULL;
     char *filename;
hw/ppc/mac_oldworld.c +7 -7
index 2f27754..465fd37 100644
@@ -71,14 +71,14 @@ static void ppc_heathrow_reset(void *opaque)
     cpu_reset(CPU(cpu));
 }
 
-static void ppc_heathrow_init(QEMUMachineInitArgs *args)
+static void ppc_heathrow_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
-    const char *boot_device = args->boot_order;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
+    const char *boot_device = ms->boot_order;
     MemoryRegion *sysmem = get_system_memory();
     PowerPCCPU *cpu = NULL;
     CPUPPCState *env = NULL;
hw/ppc/mpc8544ds.c +2 -2
index 292c709..2f6b1e3 100644
@@ -26,7 +26,7 @@ static void mpc8544ds_fixup_devtree(PPCE500Params *params, void *fdt)
                      sizeof(compatible));
 }
 
-static void mpc8544ds_init(QEMUMachineInitArgs *args)
+static void mpc8544ds_init(MachineState *ms)
 {
     PPCE500Params params = {
         .pci_first_slot = 0x11,
@@ -35,7 +35,7 @@ static void mpc8544ds_init(QEMUMachineInitArgs *args)
         .mpic_version = OPENPIC_MODEL_FSL_MPIC_20,
     };
 
-    ppce500_init(args, &params);
+    ppce500_init(ms, &params);
 }
 
 
hw/ppc/ppc405_boards.c +9 -9
index f1a8f67..b925343 100644
@@ -172,12 +172,12 @@ static void ref405ep_fpga_init(MemoryRegion *sysmem, uint32_t base)
     qemu_register_reset(&ref405ep_fpga_reset, fpga);
 }
 
-static void ref405ep_init(QEMUMachineInitArgs *args)
+static void ref405ep_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     char *filename;
     ppc4xx_bd_info_t bd;
     CPUPPCState *env;
@@ -499,11 +499,11 @@ static void taihu_cpld_init(MemoryRegion *sysmem, uint32_t base)
     qemu_register_reset(&taihu_cpld_reset, cpld);
 }
 
-static void taihu_405ep_init(QEMUMachineInitArgs *args)
+static void taihu_405ep_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *kernel_filename = args->kernel_filename;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *initrd_filename = ms->initrd_filename;
     char *filename;
     qemu_irq *pic;
     MemoryRegion *sysmem = get_system_memory();
hw/ppc/ppc440_bamboo.c +6 -6
index 2ddc2ed..2b94750 100644
@@ -156,13 +156,13 @@ static void main_cpu_reset(void *opaque)
     mmubooke_create_initial_mapping(env, 0, 0);
 }
 
-static void bamboo_init(QEMUMachineInitArgs *args)
+static void bamboo_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     unsigned int pci_irq_nrs[4] = { 28, 27, 26, 25 };
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *isa = g_new(MemoryRegion, 1);
hw/ppc/prep.c +7 -7
index e243651..f236198 100644
@@ -362,14 +362,14 @@ static const MemoryRegionPortio prep_portio_list[] = {
 };
 
 /* PowerPC PREP hardware initialisation */
-static void ppc_prep_init(QEMUMachineInitArgs *args)
+static void ppc_prep_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
-    const char *boot_device = args->boot_order;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
+    const char *boot_device = ms->boot_order;
     MemoryRegion *sysmem = get_system_memory();
     PowerPCCPU *cpu = NULL;
     CPUPPCState *env = NULL;
hw/ppc/spapr.c +7 -7
index b4ce950..6b2dfd5 100644
@@ -1140,14 +1140,14 @@ static SaveVMHandlers savevm_htab_handlers = {
 };
 
 /* pSeries LPAR / sPAPR hardware init */
-static void ppc_spapr_init(QEMUMachineInitArgs *args)
+static void ppc_spapr_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
-    const char *boot_device = args->boot_order;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
+    const char *boot_device = ms->boot_order;
     PowerPCCPU *cpu;
     CPUPPCState *env;
     PCIHostState *phb;
hw/ppc/virtex_ml507.c +8 -8
index 3e3569d..b816b3c 100644
@@ -194,12 +194,12 @@ static int xilinx_load_device_tree(hwaddr addr,
     return fdt_size;
 }
 
-static void virtex_init(QEMUMachineInitArgs *args)
+static void virtex_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
     hwaddr initrd_base = 0;
     int initrd_size = 0;
     MemoryRegion *address_space_mem = get_system_memory();
@@ -275,14 +275,14 @@ static void virtex_init(QEMUMachineInitArgs *args)
         boot_info.ima_size = kernel_size;
 
         /* Load initrd. */
-        if (args->initrd_filename) {
+        if (ms->initrd_filename) {
             initrd_base = high = ROUND_UP(high, 4);
-            initrd_size = load_image_targphys(args->initrd_filename,
+            initrd_size = load_image_targphys(ms->initrd_filename,
                                               high, ram_size - high);
 
             if (initrd_size < 0) {
                 error_report("couldn't load ram disk '%s'",
-                             args->initrd_filename);
+                             ms->initrd_filename);
                 exit(1);
             }
             high = ROUND_UP(high + initrd_size, 4);
hw/s390x/s390-virtio-ccw.c +5 -5
index 0d4f6ae..3d28045 100644
@@ -79,9 +79,9 @@ static void virtio_ccw_register_hcalls(void)
                                    virtio_ccw_hcall_early_printk);
 }
 
-static void ccw_init(QEMUMachineInitArgs *args)
+static void ccw_init(MachineState *ms)
 {
-    ram_addr_t my_ram_size = args->ram_size;
+    ram_addr_t my_ram_size = ms->ram_size;
     MemoryRegion *sysmem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
     int shift = 0;
@@ -102,8 +102,8 @@ static void ccw_init(QEMUMachineInitArgs *args)
     /* get a BUS */
     css_bus = virtual_css_bus_init();
     s390_sclp_init();
-    s390_init_ipl_dev(args->kernel_filename, args->kernel_cmdline,
-                      args->initrd_filename, "s390-ccw.img");
+    s390_init_ipl_dev(ms->kernel_filename, ms->kernel_cmdline,
+                      ms->initrd_filename, "s390-ccw.img");
     s390_flic_init();
 
     /* register hypercalls */
@@ -118,7 +118,7 @@ static void ccw_init(QEMUMachineInitArgs *args)
     storage_keys = g_malloc0(my_ram_size / TARGET_PAGE_SIZE);
 
     /* init CPUs */
-    s390_init_cpus(args->cpu_model, storage_keys);
+    s390_init_cpus(ms->cpu_model, storage_keys);
 
     if (kvm_enabled()) {
         kvm_s390_enable_css_support(s390_cpu_addr2state(0));
hw/s390x/s390-virtio.c +5 -5
index aef2003..19443d2 100644
@@ -224,9 +224,9 @@ void s390_create_virtio_net(BusState *bus, const char *name)
 }
 
 /* PC hardware initialisation */
-static void s390_init(QEMUMachineInitArgs *args)
+static void s390_init(MachineState *ms)
 {
-    ram_addr_t my_ram_size = args->ram_size;
+    ram_addr_t my_ram_size = ms->ram_size;
     MemoryRegion *sysmem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
     int shift = 0;
@@ -248,8 +248,8 @@ static void s390_init(QEMUMachineInitArgs *args)
     /* get a BUS */
     s390_bus = s390_virtio_bus_init(&my_ram_size);
     s390_sclp_init();
-    s390_init_ipl_dev(args->kernel_filename, args->kernel_cmdline,
-                      args->initrd_filename, ZIPL_FILENAME);
+    s390_init_ipl_dev(ms->kernel_filename, ms->kernel_cmdline,
+                      ms->initrd_filename, ZIPL_FILENAME);
     s390_flic_init();
 
     /* register hypercalls */
@@ -273,7 +273,7 @@ static void s390_init(QEMUMachineInitArgs *args)
     storage_keys = g_malloc0(my_ram_size / TARGET_PAGE_SIZE);
 
     /* init CPUs */
-    s390_init_cpus(args->cpu_model, storage_keys);
+    s390_init_cpus(ms->cpu_model, storage_keys);
 
     /* Create VirtIO network adapters */
     s390_create_virtio_net((BusState *)s390_bus, "virtio-net-s390");
hw/sh4/r2d.c +5 -5
index eaeb7ed..298c7a2 100644
@@ -219,12 +219,12 @@ static struct QEMU_PACKED
     char kernel_cmdline[256];
 } boot_params;
 
-static void r2d_init(QEMUMachineInitArgs *args)
+static void r2d_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     SuperHCPU *cpu;
     CPUSH4State *env;
     ResetData *reset_info;
hw/sh4/shix.c +2 -2
index 904a966..1c2c744 100644
@@ -39,9 +39,9 @@
 #define BIOS_FILENAME "shix_bios.bin"
 #define BIOS_ADDRESS 0xA0000000
 
-static void shix_init(QEMUMachineInitArgs *args)
+static void shix_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
+    const char *cpu_model = ms->cpu_model;
     int ret;
     SuperHCPU *cpu;
     struct SH7750State *s;
hw/sparc/leon3.c +4 -4
index c16e9e4..2a283a3 100644
@@ -101,11 +101,11 @@ static void leon3_set_pil_in(void *opaque, uint32_t pil_in)
     }
 }
 
-static void leon3_generic_hw_init(QEMUMachineInitArgs *args)
+static void leon3_generic_hw_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
     SPARCCPU *cpu;
     CPUSPARCState   *env;
     MemoryRegion *address_space_mem = get_system_memory();
hw/sparc/sun4m.c +32 -32

140 lines not on this page · raw message

hw/sparc64/sun4u.c +18 -18
index 6f271d9..036e8c9 100644
@@ -811,7 +811,7 @@ static SPARCCPU *cpu_devinit(const char *cpu_model, const struct hwdef *hwdef)
 }
 
 static void sun4uv_init(MemoryRegion *address_space_mem,
-                        QEMUMachineInitArgs *args,
+                        MachineState *ms,
                         const struct hwdef *hwdef)
 {
     SPARCCPU *cpu;
@@ -826,10 +826,10 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
     FWCfgState *fw_cfg;
 
     /* init CPUs */
-    cpu = cpu_devinit(args->cpu_model, hwdef);
+    cpu = cpu_devinit(ms->cpu_model, hwdef);
 
     /* set up devices */
-    ram_init(0, args->ram_size);
+    ram_init(0, ms->ram_size);
 
     prom_init(hwdef->prom_addr, bios_name);
 
@@ -875,15 +875,15 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
 
     initrd_size = 0;
     initrd_addr = 0;
-    kernel_size = sun4u_load_kernel(args->kernel_filename,
-                                    args->initrd_filename,
+    kernel_size = sun4u_load_kernel(ms->kernel_filename,
+                                    ms->initrd_filename,
                                     ram_size, &initrd_size, &initrd_addr,
                                     &kernel_addr, &kernel_entry);
 
-    sun4u_NVRAM_set_params(nvram, NVRAM_SIZE, "Sun4u", args->ram_size,
-                           args->boot_order,
+    sun4u_NVRAM_set_params(nvram, NVRAM_SIZE, "Sun4u", ms->ram_size,
+                           ms->boot_order,
                            kernel_addr, kernel_size,
-                           args->kernel_cmdline,
+                           ms->kernel_cmdline,
                            initrd_addr, initrd_size,
                            /* XXX: need an option to load a NVRAM image */
                            0,
@@ -897,16 +897,16 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
     fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, hwdef->machine_id);
     fw_cfg_add_i64(fw_cfg, FW_CFG_KERNEL_ADDR, kernel_entry);
     fw_cfg_add_i64(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size);
-    if (args->kernel_cmdline) {
+    if (ms->kernel_cmdline) {
         fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE,
-                       strlen(args->kernel_cmdline) + 1);
-        fw_cfg_add_string(fw_cfg, FW_CFG_CMDLINE_DATA, args->kernel_cmdline);
+                       strlen(ms->kernel_cmdline) + 1);
+        fw_cfg_add_string(fw_cfg, FW_CFG_CMDLINE_DATA, ms->kernel_cmdline);
     } else {
         fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE, 0);
     }
     fw_cfg_add_i64(fw_cfg, FW_CFG_INITRD_ADDR, initrd_addr);
     fw_cfg_add_i64(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size);
-    fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, args->boot_order[0]);
+    fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ms->boot_order[0]);
 
     fw_cfg_add_i16(fw_cfg, FW_CFG_SPARC64_WIDTH, graphic_width);
     fw_cfg_add_i16(fw_cfg, FW_CFG_SPARC64_HEIGHT, graphic_height);
@@ -946,21 +946,21 @@ static const struct hwdef hwdefs[] = {
 };
 
 /* Sun4u hardware initialisation */
-static void sun4u_init(QEMUMachineInitArgs *args)
+static void sun4u_init(MachineState *ms)
 {
-    sun4uv_init(get_system_memory(), args, &hwdefs[0]);
+    sun4uv_init(get_system_memory(), ms, &hwdefs[0]);
 }
 
 /* Sun4v hardware initialisation */
-static void sun4v_init(QEMUMachineInitArgs *args)
+static void sun4v_init(MachineState *ms)
 {
-    sun4uv_init(get_system_memory(), args, &hwdefs[1]);
+    sun4uv_init(get_system_memory(), ms, &hwdefs[1]);
 }
 
 /* Niagara hardware initialisation */
-static void niagara_init(QEMUMachineInitArgs *args)
+static void niagara_init(MachineState *ms)
 {
-    sun4uv_init(get_system_memory(), args, &hwdefs[2]);
+    sun4uv_init(get_system_memory(), ms, &hwdefs[2]);
 }
 
 static QEMUMachine sun4u_machine = {
hw/unicore32/puv3.c +5 -5
index 42913b6..532f196 100644
@@ -101,12 +101,12 @@ static void puv3_load_kernel(const char *kernel_filename)
     graphic_console_init(NULL, 0, &no_ops, NULL);
 }
 
-static void puv3_init(QEMUMachineInitArgs *args)
+static void puv3_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *initrd_filename = ms->initrd_filename;
     CPUUniCore32State *env;
 
     if (initrd_filename) {
hw/xtensa/xtensa_lx60.c +13 -13
index 49c58d1..6168a5c 100644
@@ -159,7 +159,7 @@ static void lx60_reset(void *opaque)
     cpu_reset(CPU(cpu));
 }
 
-static void lx_init(const LxBoardDesc *board, QEMUMachineInitArgs *args)
+static void lx_init(const LxBoardDesc *board, MachineState *ms)
 {
 #ifdef TARGET_WORDS_BIGENDIAN
     int be = 1;
@@ -172,9 +172,9 @@ static void lx_init(const LxBoardDesc *board, QEMUMachineInitArgs *args)
     MemoryRegion *ram, *rom, *system_io;
     DriveInfo *dinfo;
     pflash_t *flash = NULL;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
     int n;
 
     if (!cpu_model) {
@@ -198,7 +198,7 @@ static void lx_init(const LxBoardDesc *board, QEMUMachineInitArgs *args)
     }
 
     ram = g_malloc(sizeof(*ram));
-    memory_region_init_ram(ram, NULL, "lx60.dram", args->ram_size);
+    memory_region_init_ram(ram, NULL, "lx60.dram", ms->ram_size);
     vmstate_register_ram_global(ram);
     memory_region_add_subregion(system_memory, 0, ram);
 
@@ -275,7 +275,7 @@ static void lx_init(const LxBoardDesc *board, QEMUMachineInitArgs *args)
     }
 }
 
-static void xtensa_lx60_init(QEMUMachineInitArgs *args)
+static void xtensa_lx60_init(MachineState *ms)
 {
     static const LxBoardDesc lx60_board = {
         .flash_base = 0xf8000000,
@@ -283,10 +283,10 @@ static void xtensa_lx60_init(QEMUMachineInitArgs *args)
         .flash_sector_size = 0x10000,
         .sram_size = 0x20000,
     };
-    lx_init(&lx60_board, args);
+    lx_init(&lx60_board, ms);
 }
 
-static void xtensa_lx200_init(QEMUMachineInitArgs *args)
+static void xtensa_lx200_init(MachineState *ms)
 {
     static const LxBoardDesc lx200_board = {
         .flash_base = 0xf8000000,
@@ -294,10 +294,10 @@ static void xtensa_lx200_init(QEMUMachineInitArgs *args)
         .flash_sector_size = 0x20000,
         .sram_size = 0x2000000,
     };
-    lx_init(&lx200_board, args);
+    lx_init(&lx200_board, ms);
 }
 
-static void xtensa_ml605_init(QEMUMachineInitArgs *args)
+static void xtensa_ml605_init(MachineState *ms)
 {
     static const LxBoardDesc ml605_board = {
         .flash_base = 0xf8000000,
@@ -305,10 +305,10 @@ static void xtensa_ml605_init(QEMUMachineInitArgs *args)
         .flash_sector_size = 0x20000,
         .sram_size = 0x2000000,
     };
-    lx_init(&ml605_board, args);
+    lx_init(&ml605_board, ms);
 }
 
-static void xtensa_kc705_init(QEMUMachineInitArgs *args)
+static void xtensa_kc705_init(MachineState *ms)
 {
     static const LxBoardDesc kc705_board = {
         .flash_base = 0xf0000000,
@@ -316,7 +316,7 @@ static void xtensa_kc705_init(QEMUMachineInitArgs *args)
         .flash_sector_size = 0x20000,
         .sram_size = 0x2000000,
     };
-    lx_init(&kc705_board, args);
+    lx_init(&kc705_board, ms);
 }
 
 static QEMUMachine xtensa_lx60_machine = {
hw/xtensa/xtensa_sim.c +4 -4
index 1192ce7..3470087 100644
@@ -46,14 +46,14 @@ static void sim_reset(void *opaque)
     cpu_reset(CPU(cpu));
 }
 
-static void xtensa_sim_init(QEMUMachineInitArgs *args)
+static void xtensa_sim_init(MachineState *ms)
 {
     XtensaCPU *cpu = NULL;
     CPUXtensaState *env = NULL;
     MemoryRegion *ram, *rom;
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
     int n;
 
     if (!cpu_model) {
include/hw/boards.h +11 -17
index 28f0047..eba0574 100644
@@ -7,17 +7,10 @@
 #include "hw/qdev.h"
 #include "qom/object.h"
 
-typedef struct QEMUMachineInitArgs {
-    const MachineClass *machine;
-    ram_addr_t ram_size;
-    const char *boot_order;
-    const char *kernel_filename;
-    const char *kernel_cmdline;
-    const char *initrd_filename;
-    const char *cpu_model;
-} QEMUMachineInitArgs;
 
-typedef void QEMUMachineInitFunc(QEMUMachineInitArgs *args);
+typedef struct MachineState MachineState;
+
+typedef void QEMUMachineInitFunc(MachineState *ms);
 
 typedef void QEMUMachineResetFunc(void);
 
@@ -61,8 +54,6 @@ int qemu_register_machine(QEMUMachine *m);
 #define MACHINE_CLASS(klass) \
     OBJECT_CLASS_CHECK(MachineClass, (klass), TYPE_MACHINE)
 
-typedef struct MachineState MachineState;
-
 MachineClass *find_default_machine(void);
 extern MachineState *current_machine;
 
@@ -79,7 +70,7 @@ struct MachineClass {
     const char *alias;
     const char *desc;
 
-    void (*init)(QEMUMachineInitArgs *args);
+    void (*init)(MachineState *state);
     void (*reset)(void);
     void (*hot_add_cpu)(const int64_t id, Error **errp);
     int (*kvm_type)(const char *arg);
@@ -111,9 +102,6 @@ struct MachineState {
     char *accel;
     bool kernel_irqchip;
     int kvm_shadow_mem;
-    char *kernel;
-    char *initrd;
-    char *append;
     char *dtb;
     char *dumpdtb;
     int phandle_start;
@@ -123,7 +111,13 @@ struct MachineState {
     bool usb;
     char *firmware;
 
-    QEMUMachineInitArgs init_args;
+    const MachineClass *machine;
+    ram_addr_t ram_size;
+    const char *boot_order;
+    const char *kernel_filename;
+    const char *kernel_cmdline;
+    const char *initrd_filename;
+    const char *cpu_model;
 };
 
 #endif
vl.c +9 -10
index c4505dc..58673bd 100644
@@ -4422,16 +4422,15 @@ int main(int argc, char **argv, char **envp)
 
     qdev_machine_init();
 
-    current_machine->init_args = (QEMUMachineInitArgs) {
-        .machine = machine_class,
-        .ram_size = ram_size,
-        .boot_order = boot_order,
-        .kernel_filename = kernel_filename,
-        .kernel_cmdline = kernel_cmdline,
-        .initrd_filename = initrd_filename,
-        .cpu_model = cpu_model };
-
-    machine_class->init(&current_machine->init_args);
+    current_machine->machine = machine_class;
+    current_machine->ram_size = ram_size;
+    current_machine->boot_order = boot_order;
+    current_machine->kernel_filename = kernel_filename;
+    current_machine->kernel_cmdline = kernel_cmdline;
+    current_machine->initrd_filename = initrd_filename;
+    current_machine->cpu_model = cpu_model;
+
+    machine_class->init(current_machine);
 
     audio_init();
 
Signature · 1 line
1.8.3.1
#2 lore raw

Re: [Qemu-devel] [PATCH 1/4] machine: conversion of QEMUMachineInitArgs to MachineState

Quoted 5 lines · Marcel Apfelbaum

Total removal of QEMUMachineInitArgs struct. QEMUMachineInitArgs's fields are copied into MachineState. Removed duplicated fields from MachineState.

All the other changes are only mechanical refactoring, no semantic changes.

Quoted 8 lines

---
- I am perfectly aware that patches touching a lot of files

     are not desirable, but this one is a very simple replacement
     patch:
       QEMUMachineInitArgs -> MachineState
       args -> ms

- This is the simplest way to get rid of QEMUMachineInitArgs fast.

I think I only ever touched the following two files, from the files changed by this patch:

Quoted 277 lines
 hw/i386/pc_piix.c                        | 108 +++++++++++++++----------------
 vl.c                                     |  19 +++---
hw/i386/pc_piix.c +54 -54
index ea72502..173c875 100644
@@ -69,7 +69,7 @@ static bool smbios_legacy_mode;
 static bool gigabyte_align = true;
 
 /* PC hardware initialisation */
-static void pc_init1(QEMUMachineInitArgs *args,
+static void pc_init1(MachineState *ms,
                      int pci_enabled,
                      int kvmclock_enabled)
 {
@@ -106,7 +106,7 @@ static void pc_init1(QEMUMachineInitArgs *args,
     object_property_add_child(qdev_get_machine(), "icc-bridge",
                               OBJECT(icc_bridge), NULL);
 
-    pc_cpus_init(args->cpu_model, icc_bridge);
+    pc_cpus_init(ms->cpu_model, icc_bridge);
 
     if (kvm_enabled() && kvmclock_enabled) {
         kvmclock_create();
@@ -119,13 +119,13 @@ static void pc_init1(QEMUMachineInitArgs *args,
      * For old machine types, use whatever split we used historically to avoid
      * breaking migration.
      */
-    if (args->ram_size >= 0xe0000000) {
+    if (ms->ram_size >= 0xe0000000) {
         ram_addr_t lowmem = gigabyte_align ? 0xc0000000 : 0xe0000000;
-        above_4g_mem_size = args->ram_size - lowmem;
+        above_4g_mem_size = ms->ram_size - lowmem;
         below_4g_mem_size = lowmem;
     } else {
         above_4g_mem_size = 0;
-        below_4g_mem_size = args->ram_size;
+        below_4g_mem_size = ms->ram_size;
     }
 
     if (pci_enabled) {
@@ -147,14 +147,14 @@ static void pc_init1(QEMUMachineInitArgs *args,
     if (smbios_defaults) {
         /* These values are guest ABI, do not change */
         smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)",
-                            args->machine->name, smbios_legacy_mode);
+                            ms->machine->name, smbios_legacy_mode);
     }
 
     /* allocate ram and load rom/bios */
     if (!xen_enabled()) {
         fw_cfg = pc_memory_init(system_memory,
-                       args->kernel_filename, args->kernel_cmdline,
-                       args->initrd_filename,
+                       ms->kernel_filename, ms->kernel_cmdline,
+                       ms->initrd_filename,
                        below_4g_mem_size, above_4g_mem_size,
                        rom_memory, &ram_memory, guest_info);
     }
@@ -170,7 +170,7 @@ static void pc_init1(QEMUMachineInitArgs *args,
 
     if (pci_enabled) {
         pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi,
-                              system_memory, system_io, args->ram_size,
+                              system_memory, system_io, ms->ram_size,
                               below_4g_mem_size,
                               above_4g_mem_size,
                               pci_memory, ram_memory);
@@ -235,7 +235,7 @@ static void pc_init1(QEMUMachineInitArgs *args,
         }
     }
 
-    pc_cmos_init(below_4g_mem_size, above_4g_mem_size, args->boot_order,
+    pc_cmos_init(below_4g_mem_size, above_4g_mem_size, ms->boot_order,
                  floppy, idebus[0], idebus[1], rtc_state);
 
     if (pci_enabled && usb_enabled(false)) {
@@ -258,131 +258,131 @@ static void pc_init1(QEMUMachineInitArgs *args,
     }
 }
 
-static void pc_init_pci(QEMUMachineInitArgs *args)
+static void pc_init_pci(MachineState *ms)
 {
-    pc_init1(args, 1, 1);
+    pc_init1(ms, 1, 1);
 }
 
-static void pc_compat_2_0(QEMUMachineInitArgs *args)
+static void pc_compat_2_0(MachineState *ms)
 {
     smbios_legacy_mode = true;
 }
 
-static void pc_compat_1_7(QEMUMachineInitArgs *args)
+static void pc_compat_1_7(MachineState *ms)
 {
-    pc_compat_2_0(args);
+    pc_compat_2_0(ms);
     smbios_defaults = false;
     gigabyte_align = false;
     option_rom_has_mr = true;
     x86_cpu_compat_disable_kvm_features(FEAT_1_ECX, CPUID_EXT_X2APIC);
 }
 
-static void pc_compat_1_6(QEMUMachineInitArgs *args)
+static void pc_compat_1_6(MachineState *ms)
 {
-    pc_compat_1_7(args);
+    pc_compat_1_7(ms);
     has_pci_info = false;
     rom_file_has_mr = false;
     has_acpi_build = false;
 }
 
-static void pc_compat_1_5(QEMUMachineInitArgs *args)
+static void pc_compat_1_5(MachineState *ms)
 {
-    pc_compat_1_6(args);
+    pc_compat_1_6(ms);
 }
 
-static void pc_compat_1_4(QEMUMachineInitArgs *args)
+static void pc_compat_1_4(MachineState *ms)
 {
-    pc_compat_1_5(args);
+    pc_compat_1_5(ms);
     x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE);
     x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, 0, CPUID_EXT_PCLMULQDQ);
 }
 
-static void pc_compat_1_3(QEMUMachineInitArgs *args)
+static void pc_compat_1_3(MachineState *ms)
 {
-    pc_compat_1_4(args);
+    pc_compat_1_4(ms);
     enable_compat_apic_id_mode();
 }
 
 /* PC compat function for pc-0.14 to pc-1.2 */
-static void pc_compat_1_2(QEMUMachineInitArgs *args)
+static void pc_compat_1_2(MachineState *ms)
 {
-    pc_compat_1_3(args);
+    pc_compat_1_3(ms);
     x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI);
 }
 
-static void pc_init_pci_2_0(QEMUMachineInitArgs *args)
+static void pc_init_pci_2_0(MachineState *ms)
 {
-    pc_compat_2_0(args);
-    pc_init_pci(args);
+    pc_compat_2_0(ms);
+    pc_init_pci(ms);
 }
 
-static void pc_init_pci_1_7(QEMUMachineInitArgs *args)
+static void pc_init_pci_1_7(MachineState *ms)
 {
-    pc_compat_1_7(args);
-    pc_init_pci(args);
+    pc_compat_1_7(ms);
+    pc_init_pci(ms);
 }
 
-static void pc_init_pci_1_6(QEMUMachineInitArgs *args)
+static void pc_init_pci_1_6(MachineState *ms)
 {
-    pc_compat_1_6(args);
-    pc_init_pci(args);
+    pc_compat_1_6(ms);
+    pc_init_pci(ms);
 }
 
-static void pc_init_pci_1_5(QEMUMachineInitArgs *args)
+static void pc_init_pci_1_5(MachineState *ms)
 {
-    pc_compat_1_5(args);
-    pc_init_pci(args);
+    pc_compat_1_5(ms);
+    pc_init_pci(ms);
 }
 
-static void pc_init_pci_1_4(QEMUMachineInitArgs *args)
+static void pc_init_pci_1_4(MachineState *ms)
 {
-    pc_compat_1_4(args);
-    pc_init_pci(args);
+    pc_compat_1_4(ms);
+    pc_init_pci(ms);
 }
 
-static void pc_init_pci_1_3(QEMUMachineInitArgs *args)
+static void pc_init_pci_1_3(MachineState *ms)
 {
-    pc_compat_1_3(args);
-    pc_init_pci(args);
+    pc_compat_1_3(ms);
+    pc_init_pci(ms);
 }
 
 /* PC machine init function for pc-0.14 to pc-1.2 */
-static void pc_init_pci_1_2(QEMUMachineInitArgs *args)
+static void pc_init_pci_1_2(MachineState *ms)
 {
-    pc_compat_1_2(args);
-    pc_init_pci(args);
+    pc_compat_1_2(ms);
+    pc_init_pci(ms);
 }
 
 /* PC init function for pc-0.10 to pc-0.13, and reused by xenfv */
-static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)
+static void pc_init_pci_no_kvmclock(MachineState *ms)
 {
     has_pci_info = false;
     has_acpi_build = false;
     smbios_defaults = false;
     x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI);
     enable_compat_apic_id_mode();
-    pc_init1(args, 1, 0);
+    pc_init1(ms, 1, 0);
 }
 
-static void pc_init_isa(QEMUMachineInitArgs *args)
+static void pc_init_isa(MachineState *ms)
 {
     has_pci_info = false;
     has_acpi_build = false;
     smbios_defaults = false;
-    if (!args->cpu_model) {
-        args->cpu_model = "486";
+    if (!ms->cpu_model) {
+        ms->cpu_model = "486";
     }
     x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI);
     enable_compat_apic_id_mode();
-    pc_init1(args, 0, 1);
+    pc_init1(ms, 0, 1);
 }
 
 #ifdef CONFIG_XEN
-static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
+static void pc_xen_hvm_init(MachineState *ms)
 {
     PCIBus *bus;
 
-    pc_init_pci(args);
+    pc_init_pci(ms);
 
     bus = pci_find_primary_bus();
     if (bus != NULL) {
vl.c +2 -10
index c4505dc..58673bd 100644
@@ -4422,16 +4422,15 @@ int main(int argc, char **argv, char **envp)
 
     qdev_machine_init();
 
-    current_machine->init_args = (QEMUMachineInitArgs) {
-        .machine = machine_class,
-        .ram_size = ram_size,
-        .boot_order = boot_order,
-        .kernel_filename = kernel_filename,
-        .kernel_cmdline = kernel_cmdline,
-        .initrd_filename = initrd_filename,
-        .cpu_model = cpu_model };
-
-    machine_class->init(&current_machine->init_args);
+    current_machine->machine = machine_class;
+    current_machine->ram_size = ram_size;

vl.c int main(int argc, char **argv, char **envp) · line 4436

Quoted 10 lines
vl.c +7 -0
+    current_machine->boot_order = boot_order;
+    current_machine->kernel_filename = kernel_filename;
+    current_machine->kernel_cmdline = kernel_cmdline;
+    current_machine->initrd_filename = initrd_filename;
+    current_machine->cpu_model = cpu_model;
+
+    machine_class->init(current_machine);
 
     audio_init();
 

These look OK to me. I also checked the "include/hw/boards.h" hunks (I already snipped them from the reply and I'm too lazy to restore them), they should be fine too.

Laszlo

Acked-by on v1 1/4
#3 lore raw

Re: [Qemu-devel] [PATCH 1/4] machine: conversion of QEMUMachineInitArgs to MachineState

In reply to Marcel Apfelbaum
Quoted 82 lines · On Wed, 7 May 2014 17:42:57 +0300 Marcel Apfelbaum <[email protected]> wrote:

Total removal of QEMUMachineInitArgs struct. QEMUMachineInitArgs's fields are copied into MachineState. Removed duplicated fields from MachineState.

All the other changes are only mechanical refactoring, no semantic changes.

---
- I am perfectly aware that patches touching a lot of files

     are not desirable, but this one is a very simple replacement
     patch:
       QEMUMachineInitArgs -> MachineState
       args -> ms

- This is the simplest way to get rid of QEMUMachineInitArgs fast.

 hw/s390x/s390-virtio-ccw.c               |  10 +--
 hw/s390x/s390-virtio.c                   |  10 +--
hw/s390x/s390-virtio-ccw.c +5 -5
index 0d4f6ae..3d28045 100644
@@ -79,9 +79,9 @@ static void virtio_ccw_register_hcalls(void)
                                    virtio_ccw_hcall_early_printk);
 }
 
-static void ccw_init(QEMUMachineInitArgs *args)
+static void ccw_init(MachineState *ms)
 {
-    ram_addr_t my_ram_size = args->ram_size;
+    ram_addr_t my_ram_size = ms->ram_size;
     MemoryRegion *sysmem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
     int shift = 0;
@@ -102,8 +102,8 @@ static void ccw_init(QEMUMachineInitArgs *args)
     /* get a BUS */
     css_bus = virtual_css_bus_init();
     s390_sclp_init();
-    s390_init_ipl_dev(args->kernel_filename, args->kernel_cmdline,
-                      args->initrd_filename, "s390-ccw.img");
+    s390_init_ipl_dev(ms->kernel_filename, ms->kernel_cmdline,
+                      ms->initrd_filename, "s390-ccw.img");
     s390_flic_init();
 
     /* register hypercalls */
@@ -118,7 +118,7 @@ static void ccw_init(QEMUMachineInitArgs *args)
     storage_keys = g_malloc0(my_ram_size / TARGET_PAGE_SIZE);
 
     /* init CPUs */
-    s390_init_cpus(args->cpu_model, storage_keys);
+    s390_init_cpus(ms->cpu_model, storage_keys);
 
     if (kvm_enabled()) {
         kvm_s390_enable_css_support(s390_cpu_addr2state(0));
hw/s390x/s390-virtio.c +4 -4
index aef2003..19443d2 100644
@@ -224,9 +224,9 @@ void s390_create_virtio_net(BusState *bus, const char *name)
 }
 
 /* PC hardware initialisation */
-static void s390_init(QEMUMachineInitArgs *args)
+static void s390_init(MachineState *ms)
 {
-    ram_addr_t my_ram_size = args->ram_size;
+    ram_addr_t my_ram_size = ms->ram_size;
     MemoryRegion *sysmem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
     int shift = 0;
@@ -248,8 +248,8 @@ static void s390_init(QEMUMachineInitArgs *args)
     /* get a BUS */
     s390_bus = s390_virtio_bus_init(&my_ram_size);
     s390_sclp_init();
-    s390_init_ipl_dev(args->kernel_filename, args->kernel_cmdline,
-                      args->initrd_filename, ZIPL_FILENAME);
+    s390_init_ipl_dev(ms->kernel_filename, ms->kernel_cmdline,
+                      ms->initrd_filename, ZIPL_FILENAME);
     s390_flic_init();
 
     /* register hypercalls */

hw/s390x/s390-virtio.c static void s390_init(QEMUMachineInitArgs *args) · line 279

Quoted 8 lines
hw/s390x/s390-virtio.c +1 -1
@@ -273,7 +273,7 @@ static void s390_init(QEMUMachineInitArgs *args)
     storage_keys = g_malloc0(my_ram_size / TARGET_PAGE_SIZE);
 
     /* init CPUs */
-    s390_init_cpus(args->cpu_model, storage_keys);
+    s390_init_cpus(ms->cpu_model, storage_keys);
 
     /* Create VirtIO network adapters */
     s390_create_virtio_net((BusState *)s390_bus, "virtio-net-s390");

The changes to the s390 machines look sane to me.

Reviewed-by on v1 1/4
#4 lore raw

Re: [Qemu-devel] [PATCH 1/4] machine: conversion of QEMUMachineInitArgs to MachineState

In reply to Marcel Apfelbaum
Quoted 6 lines · Marcel Apfelbaum

Total removal of QEMUMachineInitArgs struct. QEMUMachineInitArgs's fields are copied into MachineState. Removed duplicated fields from MachineState.

All the other changes are only mechanical refactoring, no semantic changes.

For PC changes:

Quoted 2,816 lines

---
- I am perfectly aware that patches touching a lot of files

     are not desirable, but this one is a very simple replacement
     patch:
       QEMUMachineInitArgs -> MachineState
       args -> ms

- This is the simplest way to get rid of QEMUMachineInitArgs fast.

 hw/alpha/dp264.c                         |  12 ++--
 hw/arm/collie.c                          |  10 +--
 hw/arm/cubieboard.c                      |  10 +--
 hw/arm/digic_boards.c                    |   2 +-
 hw/arm/exynos4_boards.c                  |  16 ++---
 hw/arm/gumstix.c                         |   6 +-
 hw/arm/highbank.c                        |  20 +++---
 hw/arm/integratorcp.c                    |  12 ++--
 hw/arm/kzm.c                             |  12 ++--
 hw/arm/mainstone.c                       |  14 ++--
 hw/arm/musicpal.c                        |  10 +--
 hw/arm/nseries.c                         |  22 +++----
 hw/arm/omap_sx1.c                        |  20 +++---
 hw/arm/palm.c                            |  10 +--
 hw/arm/realview.c                        |  44 ++++++-------
 hw/arm/spitz.c                           |  26 ++++----
 hw/arm/stellaris.c                       |  12 ++--
 hw/arm/tosa.c                            |  10 +--
 hw/arm/versatilepb.c                     |  26 ++++----
 hw/arm/vexpress.c                        |  20 +++---
 hw/arm/virt.c                            |  16 ++---
 hw/arm/xilinx_zynq.c                     |  12 ++--
 hw/arm/z2.c                              |  10 +--
 hw/core/null-machine.c                   |   2 +-
 hw/cris/axis_dev88.c                     |  10 +--
 hw/i386/pc_piix.c                        | 108 +++++++++++++++----------------
 hw/i386/pc_q35.c                         |  66 +++++++++----------
 hw/i386/xen_machine_pv.c                 |   8 +--
 hw/lm32/lm32_boards.c                    |  16 ++---
 hw/lm32/milkymist.c                      |  10 +--
 hw/m68k/an5206.c                         |   8 +--
 hw/m68k/dummy_m68k.c                     |   8 +--
 hw/m68k/mcf5208.c                        |   8 +--
 hw/microblaze/petalogix_ml605_mmu.c      |   6 +-
 hw/microblaze/petalogix_s3adsp1800_mmu.c |   8 +--
 hw/mips/mips_fulong2e.c                  |  12 ++--
 hw/mips/mips_jazz.c                      |  12 ++--
 hw/mips/mips_malta.c                     |  12 ++--
 hw/mips/mips_mipssim.c                   |  12 ++--
 hw/mips/mips_r4k.c                       |  12 ++--
 hw/moxie/moxiesim.c                      |  12 ++--
 hw/openrisc/openrisc_sim.c               |   8 +--
 hw/ppc/e500.c                            |  44 ++++++-------
 hw/ppc/e500.h                            |   2 +-
 hw/ppc/e500plat.c                        |   4 +-
 hw/ppc/mac_newworld.c                    |  14 ++--
 hw/ppc/mac_oldworld.c                    |  14 ++--
 hw/ppc/mpc8544ds.c                       |   4 +-
 hw/ppc/ppc405_boards.c                   |  18 +++---
 hw/ppc/ppc440_bamboo.c                   |  12 ++--
 hw/ppc/prep.c                            |  14 ++--
 hw/ppc/spapr.c                           |  14 ++--
 hw/ppc/virtex_ml507.c                    |  16 ++---
 hw/s390x/s390-virtio-ccw.c               |  10 +--
 hw/s390x/s390-virtio.c                   |  10 +--
 hw/sh4/r2d.c                             |  10 +--
 hw/sh4/shix.c                            |   4 +-
 hw/sparc/leon3.c                         |   8 +--
 hw/sparc/sun4m.c                         |  64 +++++++++---------
 hw/sparc64/sun4u.c                       |  36 +++++------
 hw/unicore32/puv3.c                      |  10 +--
 hw/xtensa/xtensa_lx60.c                  |  26 ++++----
 hw/xtensa/xtensa_sim.c                   |   8 +--
 include/hw/boards.h                      |  28 ++++----
 vl.c                                     |  19 +++---
 65 files changed, 536 insertions(+), 543 deletions(-)
hw/alpha/dp264.c +6 -6
index 1351ba5..ab4647a 100644
@@ -43,13 +43,13 @@ static int clipper_pci_map_irq(PCIDevice *d, int irq_num)
     return (slot + 1) * 4 + irq_num;
 }
 
-static void clipper_init(QEMUMachineInitArgs *args)
+static void clipper_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     AlphaCPU *cpus[4];
     PCIBus *pci_bus;
     ISABus *isa_bus;
hw/arm/collie.c +5 -5
index 8878b0e..59715e1 100644
@@ -23,12 +23,12 @@ static struct arm_boot_info collie_binfo = {
     .ram_size = 0x20000000,
 };
 
-static void collie_init(QEMUMachineInitArgs *args)
+static void collie_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     StrongARMState *s;
     DriveInfo *dinfo;
     MemoryRegion *sysmem = get_system_memory();
hw/arm/cubieboard.c +5 -5
index 9d158c7..ea4c2ab 100644
@@ -30,7 +30,7 @@ typedef struct CubieBoardState {
     MemoryRegion sdram;
 } CubieBoardState;
 
-static void cubieboard_init(QEMUMachineInitArgs *args)
+static void cubieboard_init(MachineState *ms)
 {
     CubieBoardState *s = g_new(CubieBoardState, 1);
     Error *err = NULL;
@@ -63,14 +63,14 @@ static void cubieboard_init(QEMUMachineInitArgs *args)
         exit(1);
     }
 
-    memory_region_init_ram(&s->sdram, NULL, "cubieboard.ram", args->ram_size);
+    memory_region_init_ram(&s->sdram, NULL, "cubieboard.ram", ms->ram_size);
     vmstate_register_ram_global(&s->sdram);
     memory_region_add_subregion(get_system_memory(), AW_A10_SDRAM_BASE,
                                 &s->sdram);
 
-    cubieboard_binfo.ram_size = args->ram_size;
-    cubieboard_binfo.kernel_filename = args->kernel_filename;
-    cubieboard_binfo.kernel_cmdline = args->kernel_cmdline;
+    cubieboard_binfo.ram_size = ms->ram_size;
+    cubieboard_binfo.kernel_filename = ms->kernel_filename;
+    cubieboard_binfo.kernel_cmdline = ms->kernel_cmdline;
     arm_load_kernel(&s->a10->cpu, &cubieboard_binfo);
 }
 
hw/arm/digic_boards.c +1 -1
index 32fc30a..cb905f9 100644
@@ -143,7 +143,7 @@ static DigicBoard digic4_board_canon_a1100 = {
     .rom1_def_filename = "canon-a1100-rom1.bin",
 };
 
-static void canon_a1100_init(QEMUMachineInitArgs *args)
+static void canon_a1100_init(MachineState *ms)
 {
     digic4_board_init(&digic4_board_canon_a1100);
 }
hw/arm/exynos4_boards.c +8 -8
index 26cedec..688f117 100644
@@ -94,7 +94,7 @@ static void lan9215_init(uint32_t base, qemu_irq irq)
     }
 }
 
-static Exynos4210State *exynos4_boards_init_common(QEMUMachineInitArgs *args,
+static Exynos4210State *exynos4_boards_init_common(MachineState *ms,
                                                    Exynos4BoardType board_type)
 {
     if (smp_cpus != EXYNOS4210_NCPUS && !qtest_enabled()) {
@@ -108,9 +108,9 @@ static Exynos4210State *exynos4_boards_init_common(QEMUMachineInitArgs *args,
     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.kernel_filename = args->kernel_filename;
-    exynos4_board_binfo.initrd_filename = args->initrd_filename;
-    exynos4_board_binfo.kernel_cmdline = args->kernel_cmdline;
+    exynos4_board_binfo.kernel_filename = ms->kernel_filename;
+    exynos4_board_binfo.initrd_filename = ms->initrd_filename;
+    exynos4_board_binfo.kernel_cmdline = ms->kernel_cmdline;
     exynos4_board_binfo.gic_cpu_if_addr =
             EXYNOS4210_SMP_PRIVATE_BASE_ADDR + 0x100;
 
@@ -128,16 +128,16 @@ static Exynos4210State *exynos4_boards_init_common(QEMUMachineInitArgs *args,
             exynos4_board_ram_size[board_type]);
 }
 
-static void nuri_init(QEMUMachineInitArgs *args)
+static void nuri_init(MachineState *ms)
 {
-    exynos4_boards_init_common(args, EXYNOS4_BOARD_NURI);
+    exynos4_boards_init_common(ms, EXYNOS4_BOARD_NURI);
 
     arm_load_kernel(ARM_CPU(first_cpu), &exynos4_board_binfo);
 }
 
-static void smdkc210_init(QEMUMachineInitArgs *args)
+static void smdkc210_init(MachineState *ms)
 {
-    Exynos4210State *s = exynos4_boards_init_common(args,
+    Exynos4210State *s = exynos4_boards_init_common(ms,
                                                     EXYNOS4_BOARD_SMDKC210);
 
     lan9215_init(SMDK_LAN9118_BASE_ADDR,
hw/arm/gumstix.c +3 -3
index aeea172..9caf554 100644
@@ -46,7 +46,7 @@
 
 static const int sector_len = 128 * 1024;
 
-static void connex_init(QEMUMachineInitArgs *args)
+static void connex_init(MachineState *ms)
 {
     PXA2xxState *cpu;
     DriveInfo *dinfo;
@@ -83,9 +83,9 @@ static void connex_init(QEMUMachineInitArgs *args)
                     qdev_get_gpio_in(cpu->gpio, 36));
 }
 
-static void verdex_init(QEMUMachineInitArgs *args)
+static void verdex_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
+    const char *cpu_model = ms->cpu_model;
     PXA2xxState *cpu;
     DriveInfo *dinfo;
     int be;
hw/arm/highbank.c +10 -10
index 46b9f1e..78d112c 100644
@@ -200,13 +200,13 @@ enum cxmachines {
  * 32-bit host, set the reg value of memory to 0xf7ff00000 in the
  * device tree and pass -m 2047 to QEMU.
  */
-static void calxeda_init(QEMUMachineInitArgs *args, enum cxmachines machine)
+static void calxeda_init(MachineState *ms, enum cxmachines machine)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     DeviceState *dev = NULL;
     SysBusDevice *busdev;
     qemu_irq pic[128];
@@ -360,14 +360,14 @@ static void calxeda_init(QEMUMachineInitArgs *args, enum cxmachines machine)
     arm_load_kernel(ARM_CPU(first_cpu), &highbank_binfo);
 }
 
-static void highbank_init(QEMUMachineInitArgs *args)
+static void highbank_init(MachineState *ms)
 {
-    calxeda_init(args, CALXEDA_HIGHBANK);
+    calxeda_init(ms, CALXEDA_HIGHBANK);
 }
 
-static void midway_init(QEMUMachineInitArgs *args)
+static void midway_init(MachineState *ms)
 {
-    calxeda_init(args, CALXEDA_MIDWAY);
+    calxeda_init(ms, CALXEDA_MIDWAY);
 }
 
 static QEMUMachine highbank_machine = {
hw/arm/integratorcp.c +6 -6
index 912af96..05884e4 100644
@@ -461,13 +461,13 @@ static struct arm_boot_info integrator_binfo = {
     .board_id = 0x113,
 };
 
-static void integratorcp_init(QEMUMachineInitArgs *args)
+static void integratorcp_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     ARMCPU *cpu;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
hw/arm/kzm.c +6 -6
index 99d33cb..dca3b74 100644
@@ -70,13 +70,13 @@ static struct arm_boot_info kzm_binfo = {
     .board_id = 1722,
 };
 
-static void kzm_init(QEMUMachineInitArgs *args)
+static void kzm_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     ARMCPU *cpu;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
hw/arm/mainstone.c +7 -7
index d8e075e..de1cdcb 100644
@@ -105,7 +105,7 @@ static struct arm_boot_info mainstone_binfo = {
 };
 
 static void mainstone_common_init(MemoryRegion *address_space_mem,
-                                  QEMUMachineInitArgs *args,
+                                  MachineState *ms,
                                   enum mainstone_model_e model, int arm_id)
 {
     uint32_t sector_len = 256 * 1024;
@@ -116,7 +116,7 @@ static void mainstone_common_init(MemoryRegion *address_space_mem,
     int i;
     int be;
     MemoryRegion *rom = g_new(MemoryRegion, 1);
-    const char *cpu_model = args->cpu_model;
+    const char *cpu_model = ms->cpu_model;
 
     if (!cpu_model)
         cpu_model = "pxa270-c5";
@@ -175,16 +175,16 @@ static void mainstone_common_init(MemoryRegion *address_space_mem,
     smc91c111_init(&nd_table[0], MST_ETH_PHYS,
                     qdev_get_gpio_in(mst_irq, ETHERNET_IRQ));
 
-    mainstone_binfo.kernel_filename = args->kernel_filename;
-    mainstone_binfo.kernel_cmdline = args->kernel_cmdline;
-    mainstone_binfo.initrd_filename = args->initrd_filename;
+    mainstone_binfo.kernel_filename = ms->kernel_filename;
+    mainstone_binfo.kernel_cmdline = ms->kernel_cmdline;
+    mainstone_binfo.initrd_filename = ms->initrd_filename;
     mainstone_binfo.board_id = arm_id;
     arm_load_kernel(mpu->cpu, &mainstone_binfo);
 }
 
-static void mainstone_init(QEMUMachineInitArgs *args)
+static void mainstone_init(MachineState *ms)
 {
-    mainstone_common_init(get_system_memory(), args, mainstone, 0x196);
+    mainstone_common_init(get_system_memory(), ms, mainstone, 0x196);
 }
 
 static QEMUMachine mainstone2_machine = {
hw/arm/musicpal.c +5 -5
index de54201..54590ec 100644
@@ -1577,12 +1577,12 @@ static struct arm_boot_info musicpal_binfo = {
     .board_id = 0x20e,
 };
 
-static void musicpal_init(QEMUMachineInitArgs *args)
+static void musicpal_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     ARMCPU *cpu;
     qemu_irq pic[32];
     DeviceState *dev;
hw/arm/nseries.c +11 -11
index c28f895..ae097d6 100644
@@ -1278,14 +1278,14 @@ static int n810_atag_setup(const struct arm_boot_info *info, void *p)
     return n8x0_atag_setup(p, 810);
 }
 
-static void n8x0_init(QEMUMachineInitArgs *args,
+static void n8x0_init(MachineState *ms,
                       struct arm_boot_info *binfo, int model)
 {
     MemoryRegion *sysmem = get_system_memory();
     struct n800_s *s = (struct n800_s *) g_malloc0(sizeof(*s));
     int sdram_size = binfo->ram_size;
 
-    s->mpu = omap2420_mpu_init(sysmem, sdram_size, args->cpu_model);
+    s->mpu = omap2420_mpu_init(sysmem, sdram_size, ms->cpu_model);
 
     /* Setup peripherals
      *
@@ -1329,18 +1329,18 @@ static void n8x0_init(QEMUMachineInitArgs *args,
         n8x0_usb_setup(s);
     }
 
-    if (args->kernel_filename) {
+    if (ms->kernel_filename) {
         /* Or at the linux loader.  */
-        binfo->kernel_filename = args->kernel_filename;
-        binfo->kernel_cmdline = args->kernel_cmdline;
-        binfo->initrd_filename = args->initrd_filename;
+        binfo->kernel_filename = ms->kernel_filename;
+        binfo->kernel_cmdline = ms->kernel_cmdline;
+        binfo->initrd_filename = ms->initrd_filename;
         arm_load_kernel(s->mpu->cpu, binfo);
 
         qemu_register_reset(n8x0_boot_init, s);
     }
 
     if (option_rom[0].name &&
-        (args->boot_order[0] == 'n' || !args->kernel_filename)) {
+        (ms->boot_order[0] == 'n' || !ms->kernel_filename)) {
         uint8_t nolo_tags[0x10000];
         /* No, wait, better start at the ROM.  */
         s->mpu->cpu->env.regs[15] = OMAP2_Q2_BASE + 0x400000;
@@ -1382,14 +1382,14 @@ static struct arm_boot_info n810_binfo = {
     .atag_board = n810_atag_setup,
 };
 
-static void n800_init(QEMUMachineInitArgs *args)
+static void n800_init(MachineState *ms)
 {
-    return n8x0_init(args, &n800_binfo, 800);
+    return n8x0_init(ms, &n800_binfo, 800);
 }
 
-static void n810_init(QEMUMachineInitArgs *args)
+static void n810_init(MachineState *ms)
 {
-    return n8x0_init(args, &n810_binfo, 810);
+    return n8x0_init(ms, &n810_binfo, 810);
 }
 
 static QEMUMachine n800_machine = {
hw/arm/omap_sx1.c +10 -10
index 3ba263a..75b414b 100644
@@ -98,7 +98,7 @@ static struct arm_boot_info sx1_binfo = {
     .board_id = 0x265,
 };
 
-static void sx1_init(QEMUMachineInitArgs *args, const int version)
+static void sx1_init(MachineState *ms, const int version)
 {
     struct omap_mpu_state_s *mpu;
     MemoryRegion *address_space = get_system_memory();
@@ -118,7 +118,7 @@ static void sx1_init(QEMUMachineInitArgs *args, const int version)
         flash_size = flash2_size;
     }
 
-    mpu = omap310_mpu_init(address_space, sx1_binfo.ram_size, args->cpu_model);
+    mpu = omap310_mpu_init(address_space, sx1_binfo.ram_size, ms->cpu_model);
 
     /* External Flash (EMIFS) */
     memory_region_init_ram(flash, NULL, "omap_sx1.flash0-0", flash_size);
@@ -189,29 +189,29 @@ static void sx1_init(QEMUMachineInitArgs *args, const int version)
                                 OMAP_CS1_BASE, &cs[1]);
     }
 
-    if (!args->kernel_filename && !fl_idx && !qtest_enabled()) {
+    if (!ms->kernel_filename && !fl_idx && !qtest_enabled()) {
         fprintf(stderr, "Kernel or Flash image must be specified\n");
         exit(1);
     }
 
     /* Load the kernel.  */
-    sx1_binfo.kernel_filename = args->kernel_filename;
-    sx1_binfo.kernel_cmdline = args->kernel_cmdline;
-    sx1_binfo.initrd_filename = args->initrd_filename;
+    sx1_binfo.kernel_filename = ms->kernel_filename;
+    sx1_binfo.kernel_cmdline = ms->kernel_cmdline;
+    sx1_binfo.initrd_filename = ms->initrd_filename;
     arm_load_kernel(mpu->cpu, &sx1_binfo);
 
     /* TODO: fix next line */
     //~ qemu_console_resize(ds, 640, 480);
 }
 
-static void sx1_init_v1(QEMUMachineInitArgs *args)
+static void sx1_init_v1(MachineState *ms)
 {
-    sx1_init(args, 1);
+    sx1_init(ms, 1);
 }
 
-static void sx1_init_v2(QEMUMachineInitArgs *args)
+static void sx1_init_v2(MachineState *ms)
 {
-    sx1_init(args, 2);
+    sx1_init(ms, 2);
 }
 
 static QEMUMachine sx1_machine_v2 = {
hw/arm/palm.c +5 -5
index fac4f69..1e1f47d 100644
@@ -191,12 +191,12 @@ static struct arm_boot_info palmte_binfo = {
     .board_id = 0x331,
 };
 
-static void palmte_init(QEMUMachineInitArgs *args)
+static void palmte_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     MemoryRegion *address_space_mem = get_system_memory();
     struct omap_mpu_state_s *mpu;
     int flash_size = 0x00800000;
hw/arm/realview.c +22 -22
index 7e04e50..8b2fe38 100644
@@ -45,7 +45,7 @@ static const int realview_board_id[] = {
     0x76d
 };
 
-static void realview_init(QEMUMachineInitArgs *args,
+static void realview_init(MachineState *ms,
                           enum realview_board_type board_type)
 {
     ARMCPU *cpu = NULL;
@@ -71,7 +71,7 @@ static void realview_init(QEMUMachineInitArgs *args,
     uint32_t proc_id = 0;
     uint32_t sys_id;
     ram_addr_t low_ram_size;
-    ram_addr_t ram_size = args->ram_size;
+    ram_addr_t ram_size = ms->ram_size;
     hwaddr periphbase = 0;
 
     switch (board_type) {
@@ -91,7 +91,7 @@ static void realview_init(QEMUMachineInitArgs *args,
         break;
     }
 
-    cpu_oc = cpu_class_by_name(TYPE_ARM_CPU, args->cpu_model);
+    cpu_oc = cpu_class_by_name(TYPE_ARM_CPU, ms->cpu_model);
     if (!cpu_oc) {
         fprintf(stderr, "Unable to find CPU definition\n");
         exit(1);
@@ -342,45 +342,45 @@ static void realview_init(QEMUMachineInitArgs *args,
     memory_region_add_subregion(sysmem, SMP_BOOT_ADDR, ram_hack);
 
     realview_binfo.ram_size = ram_size;
-    realview_binfo.kernel_filename = args->kernel_filename;
-    realview_binfo.kernel_cmdline = args->kernel_cmdline;
-    realview_binfo.initrd_filename = args->initrd_filename;
+    realview_binfo.kernel_filename = ms->kernel_filename;
+    realview_binfo.kernel_cmdline = ms->kernel_cmdline;
+    realview_binfo.initrd_filename = ms->initrd_filename;
     realview_binfo.nb_cpus = smp_cpus;
     realview_binfo.board_id = realview_board_id[board_type];
     realview_binfo.loader_start = (board_type == BOARD_PB_A8 ? 0x70000000 : 0);
     arm_load_kernel(ARM_CPU(first_cpu), &realview_binfo);
 }
 
-static void realview_eb_init(QEMUMachineInitArgs *args)
+static void realview_eb_init(MachineState *ms)
 {
-    if (!args->cpu_model) {
-        args->cpu_model = "arm926";
+    if (!ms->cpu_model) {
+        ms->cpu_model = "arm926";
     }
-    realview_init(args, BOARD_EB);
+    realview_init(ms, BOARD_EB);
 }
 
-static void realview_eb_mpcore_init(QEMUMachineInitArgs *args)
+static void realview_eb_mpcore_init(MachineState *ms)
 {
-    if (!args->cpu_model) {
-        args->cpu_model = "arm11mpcore";
+    if (!ms->cpu_model) {
+        ms->cpu_model = "arm11mpcore";
     }
-    realview_init(args, BOARD_EB_MPCORE);
+    realview_init(ms, BOARD_EB_MPCORE);
 }
 
-static void realview_pb_a8_init(QEMUMachineInitArgs *args)
+static void realview_pb_a8_init(MachineState *ms)
 {
-    if (!args->cpu_model) {
-        args->cpu_model = "cortex-a8";
+    if (!ms->cpu_model) {
+        ms->cpu_model = "cortex-a8";
     }
-    realview_init(args, BOARD_PB_A8);
+    realview_init(ms, BOARD_PB_A8);
 }
 
-static void realview_pbx_a9_init(QEMUMachineInitArgs *args)
+static void realview_pbx_a9_init(MachineState *ms)
 {
-    if (!args->cpu_model) {
-        args->cpu_model = "cortex-a9";
+    if (!ms->cpu_model) {
+        ms->cpu_model = "cortex-a9";
     }
-    realview_init(args, BOARD_PBX_A9);
+    realview_init(ms, BOARD_PBX_A9);
 }
 
 static QEMUMachine realview_eb_machine = {
hw/arm/spitz.c +13 -13
index 392ca84..f35c31f 100644
@@ -887,14 +887,14 @@ static struct arm_boot_info spitz_binfo = {
     .ram_size = 0x04000000,
 };
 
-static void spitz_common_init(QEMUMachineInitArgs *args,
+static void spitz_common_init(MachineState *ms,
                               enum spitz_model_e model, int arm_id)
 {
     PXA2xxState *mpu;
     DeviceState *scp0, *scp1 = NULL;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *rom = g_new(MemoryRegion, 1);
-    const char *cpu_model = args->cpu_model;
+    const char *cpu_model = ms->cpu_model;
 
     if (!cpu_model)
         cpu_model = (model == terrier) ? "pxa270-c5" : "pxa270-c0";
@@ -935,32 +935,32 @@ static void spitz_common_init(QEMUMachineInitArgs *args,
         /* A 4.0 GB microdrive is permanently sitting in CF slot 0.  */
         spitz_microdrive_attach(mpu, 0);
 
-    spitz_binfo.kernel_filename = args->kernel_filename;
-    spitz_binfo.kernel_cmdline = args->kernel_cmdline;
-    spitz_binfo.initrd_filename = args->initrd_filename;
+    spitz_binfo.kernel_filename = ms->kernel_filename;
+    spitz_binfo.kernel_cmdline = ms->kernel_cmdline;
+    spitz_binfo.initrd_filename = ms->initrd_filename;
     spitz_binfo.board_id = arm_id;
     arm_load_kernel(mpu->cpu, &spitz_binfo);
     sl_bootparam_write(SL_PXA_PARAM_BASE);
 }
 
-static void spitz_init(QEMUMachineInitArgs *args)
+static void spitz_init(MachineState *ms)
 {
-    spitz_common_init(args, spitz, 0x2c9);
+    spitz_common_init(ms, spitz, 0x2c9);
 }
 
-static void borzoi_init(QEMUMachineInitArgs *args)
+static void borzoi_init(MachineState *ms)
 {
-    spitz_common_init(args, borzoi, 0x33f);
+    spitz_common_init(ms, borzoi, 0x33f);
 }
 
-static void akita_init(QEMUMachineInitArgs *args)
+static void akita_init(MachineState *ms)
 {
-    spitz_common_init(args, akita, 0x2e8);
+    spitz_common_init(ms, akita, 0x2e8);
 }
 
-static void terrier_init(QEMUMachineInitArgs *args)
+static void terrier_init(MachineState *ms)
 {
-    spitz_common_init(args, terrier, 0x33f);
+    spitz_common_init(ms, terrier, 0x33f);
 }
 
 static QEMUMachine akitapda_machine = {
hw/arm/stellaris.c +6 -6
index d6cc77b..5d268aa 100644
@@ -1330,17 +1330,17 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model,
 }
 
 /* FIXME: Figure out how to generate these from stellaris_boards.  */
-static void lm3s811evb_init(QEMUMachineInitArgs *args)
+static void lm3s811evb_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
     stellaris_init(kernel_filename, cpu_model, &stellaris_boards[0]);
 }
 
-static void lm3s6965evb_init(QEMUMachineInitArgs *args)
+static void lm3s6965evb_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
     stellaris_init(kernel_filename, cpu_model, &stellaris_boards[1]);
 }
 
hw/arm/tosa.c +5 -5
index 2069f55..2fbeaf5 100644
@@ -211,12 +211,12 @@ static struct arm_boot_info tosa_binfo = {
     .ram_size = 0x04000000,
 };
 
-static void tosa_init(QEMUMachineInitArgs *args)
+static void tosa_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *rom = g_new(MemoryRegion, 1);
     PXA2xxState *mpu;
hw/arm/versatilepb.c +13 -13
index e5493b4..acca596 100644
@@ -173,7 +173,7 @@ static int vpb_sic_init(SysBusDevice *sbd)
 
 static struct arm_boot_info versatile_binfo;
 
-static void versatile_init(QEMUMachineInitArgs *args, int board_id)
+static void versatile_init(MachineState *ms, int board_id)
 {
     ARMCPU *cpu;
     MemoryRegion *sysmem = get_system_memory();
@@ -190,15 +190,15 @@ static void versatile_init(QEMUMachineInitArgs *args, int board_id)
     int done_smc = 0;
     DriveInfo *dinfo;
 
-    if (!args->cpu_model) {
-        args->cpu_model = "arm926";
+    if (!ms->cpu_model) {
+        ms->cpu_model = "arm926";
     }
-    cpu = cpu_arm_init(args->cpu_model);
+    cpu = cpu_arm_init(ms->cpu_model);
     if (!cpu) {
         fprintf(stderr, "Unable to find CPU definition\n");
         exit(1);
     }
-    memory_region_init_ram(ram, NULL, "versatile.ram", args->ram_size);
+    memory_region_init_ram(ram, NULL, "versatile.ram", ms->ram_size);
     vmstate_register_ram_global(ram);
     /* ??? RAM should repeat to fill physical memory space.  */
     /* SDRAM at address zero.  */
@@ -344,22 +344,22 @@ static void versatile_init(QEMUMachineInitArgs *args, int board_id)
         fprintf(stderr, "qemu: Error registering flash memory.\n");
     }
 
-    versatile_binfo.ram_size = args->ram_size;
-    versatile_binfo.kernel_filename = args->kernel_filename;
-    versatile_binfo.kernel_cmdline = args->kernel_cmdline;
-    versatile_binfo.initrd_filename = args->initrd_filename;
+    versatile_binfo.ram_size = ms->ram_size;
+    versatile_binfo.kernel_filename = ms->kernel_filename;
+    versatile_binfo.kernel_cmdline = ms->kernel_cmdline;
+    versatile_binfo.initrd_filename = ms->initrd_filename;
     versatile_binfo.board_id = board_id;
     arm_load_kernel(cpu, &versatile_binfo);
 }
 
-static void vpb_init(QEMUMachineInitArgs *args)
+static void vpb_init(MachineState *ms)
 {
-    versatile_init(args, 0x183);
+    versatile_init(ms, 0x183);
 }
 
-static void vab_init(QEMUMachineInitArgs *args)
+static void vab_init(MachineState *ms)
 {
-    versatile_init(args, 0x25e);
+    versatile_init(ms, 0x25e);
 }
 
 static QEMUMachine versatilepb_machine = {
hw/arm/vexpress.c +10 -10
index 169eb06..1051387 100644
@@ -509,7 +509,7 @@ static pflash_t *ve_pflash_cfi01_register(hwaddr base, const char *name,
 }
 
 static void vexpress_common_init(VEDBoardInfo *daughterboard,
-                                 QEMUMachineInitArgs *args)
+                                 MachineState *ms)
 {
     DeviceState *dev, *sysctl, *pl041;
     qemu_irq pic[64];
@@ -525,7 +525,7 @@ static void vexpress_common_init(VEDBoardInfo *daughterboard,
     const hwaddr *map = daughterboard->motherboard_map;
     int i;
 
-    daughterboard->init(daughterboard, args->ram_size, args->cpu_model, pic);
+    daughterboard->init(daughterboard, ms->ram_size, ms->cpu_model, pic);
 
     /* Motherboard peripherals: the wiring is the same but the
      * addresses vary between the legacy and A-Series memory maps.
@@ -639,10 +639,10 @@ static void vexpress_common_init(VEDBoardInfo *daughterboard,
                              pic[40 + i]);
     }
 
-    daughterboard->bootinfo.ram_size = args->ram_size;
-    daughterboard->bootinfo.kernel_filename = args->kernel_filename;
-    daughterboard->bootinfo.kernel_cmdline = args->kernel_cmdline;
-    daughterboard->bootinfo.initrd_filename = args->initrd_filename;
+    daughterboard->bootinfo.ram_size = ms->ram_size;
+    daughterboard->bootinfo.kernel_filename = ms->kernel_filename;
+    daughterboard->bootinfo.kernel_cmdline = ms->kernel_cmdline;
+    daughterboard->bootinfo.initrd_filename = ms->initrd_filename;
     daughterboard->bootinfo.nb_cpus = smp_cpus;
     daughterboard->bootinfo.board_id = VEXPRESS_BOARD_ID;
     daughterboard->bootinfo.loader_start = daughterboard->loader_start;
@@ -653,14 +653,14 @@ static void vexpress_common_init(VEDBoardInfo *daughterboard,
     arm_load_kernel(ARM_CPU(first_cpu), &daughterboard->bootinfo);
 }
 
-static void vexpress_a9_init(QEMUMachineInitArgs *args)
+static void vexpress_a9_init(MachineState *ms)
 {
-    vexpress_common_init(&a9_daughterboard, args);
+    vexpress_common_init(&a9_daughterboard, ms);
 }
 
-static void vexpress_a15_init(QEMUMachineInitArgs *args)
+static void vexpress_a15_init(MachineState *ms)
 {
-    vexpress_common_init(&a15_daughterboard, args);
+    vexpress_common_init(&a15_daughterboard, ms);
 }
 
 static QEMUMachine vexpress_a9_machine = {
hw/arm/virt.c +8 -8
index ea4f02d..8399e81 100644
@@ -383,13 +383,13 @@ static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size)
     return board->fdt;
 }
 
-static void machvirt_init(QEMUMachineInitArgs *args)
+static void machvirt_init(MachineState *ms)
 {
     qemu_irq pic[NUM_IRQS];
     MemoryRegion *sysmem = get_system_memory();
     int n;
     MemoryRegion *ram = g_new(MemoryRegion, 1);
-    const char *cpu_model = args->cpu_model;
+    const char *cpu_model = ms->cpu_model;
     VirtBoardInfo *vbi;
 
     if (!cpu_model) {
@@ -415,7 +415,7 @@ static void machvirt_init(QEMUMachineInitArgs *args)
         exit(1);
     }
 
-    if (args->ram_size > vbi->memmap[VIRT_MEM].size) {
+    if (ms->ram_size > vbi->memmap[VIRT_MEM].size) {
         error_report("mach-virt: cannot model more than 30GB RAM");
         exit(1);
     }
@@ -447,7 +447,7 @@ static void machvirt_init(QEMUMachineInitArgs *args)
     }
     fdt_add_cpu_nodes(vbi);
 
-    memory_region_init_ram(ram, NULL, "mach-virt.ram", args->ram_size);
+    memory_region_init_ram(ram, NULL, "mach-virt.ram", ms->ram_size);
     vmstate_register_ram_global(ram);
     memory_region_add_subregion(sysmem, vbi->memmap[VIRT_MEM].base, ram);
 
@@ -461,10 +461,10 @@ static void machvirt_init(QEMUMachineInitArgs *args)
      */
     create_virtio_devices(vbi, pic);
 
-    vbi->bootinfo.ram_size = args->ram_size;
-    vbi->bootinfo.kernel_filename = args->kernel_filename;
-    vbi->bootinfo.kernel_cmdline = args->kernel_cmdline;
-    vbi->bootinfo.initrd_filename = args->initrd_filename;
+    vbi->bootinfo.ram_size = ms->ram_size;
+    vbi->bootinfo.kernel_filename = ms->kernel_filename;
+    vbi->bootinfo.kernel_cmdline = ms->kernel_cmdline;
+    vbi->bootinfo.initrd_filename = ms->initrd_filename;
     vbi->bootinfo.nb_cpus = smp_cpus;
     vbi->bootinfo.board_id = -1;
     vbi->bootinfo.loader_start = vbi->memmap[VIRT_MEM].base;
hw/arm/xilinx_zynq.c +6 -6
index 9ee21e7..bf64968 100644
@@ -101,13 +101,13 @@ static inline void zynq_init_spi_flashes(uint32_t base_addr, qemu_irq irq,
 
 }
 
-static void zynq_init(QEMUMachineInitArgs *args)
+static void zynq_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     ObjectClass *cpu_oc;
     ARMCPU *cpu;
     MemoryRegion *address_space_mem = get_system_memory();
hw/arm/z2.c +5 -5
index 67c1be8..52a80db 100644
@@ -302,12 +302,12 @@ static const TypeInfo aer915_info = {
     .class_init    = aer915_class_init,
 };
 
-static void z2_init(QEMUMachineInitArgs *args)
+static void z2_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     MemoryRegion *address_space_mem = get_system_memory();
     uint32_t sector_len = 0x10000;
     PXA2xxState *mpu;
hw/core/null-machine.c +1 -1
index d813c08..6409bea 100644
@@ -15,7 +15,7 @@
 #include "hw/hw.h"
 #include "hw/boards.h"
 
-static void machine_none_init(QEMUMachineInitArgs *args)
+static void machine_none_init(MachineState *ms)
 {
 }
 
hw/cris/axis_dev88.c +5 -5
index 645e45c..e20161e 100644
@@ -243,12 +243,12 @@ static const MemoryRegionOps gpio_ops = {
 static struct cris_load_info li;
 
 static
-void axisdev88_init(QEMUMachineInitArgs *args)
+void axisdev88_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
     CRISCPU *cpu;
     CPUCRISState *env;
     DeviceState *dev;
hw/i386/pc_piix.c +54 -54
index ea72502..173c875 100644
@@ -69,7 +69,7 @@ static bool smbios_legacy_mode;
 static bool gigabyte_align = true;
 
 /* PC hardware initialisation */
-static void pc_init1(QEMUMachineInitArgs *args,
+static void pc_init1(MachineState *ms,
                      int pci_enabled,
                      int kvmclock_enabled)
 {
@@ -106,7 +106,7 @@ static void pc_init1(QEMUMachineInitArgs *args,
     object_property_add_child(qdev_get_machine(), "icc-bridge",
                               OBJECT(icc_bridge), NULL);
 
-    pc_cpus_init(args->cpu_model, icc_bridge);
+    pc_cpus_init(ms->cpu_model, icc_bridge);
 
     if (kvm_enabled() && kvmclock_enabled) {
         kvmclock_create();
@@ -119,13 +119,13 @@ static void pc_init1(QEMUMachineInitArgs *args,
      * For old machine types, use whatever split we used historically to avoid
      * breaking migration.
      */
-    if (args->ram_size >= 0xe0000000) {
+    if (ms->ram_size >= 0xe0000000) {
         ram_addr_t lowmem = gigabyte_align ? 0xc0000000 : 0xe0000000;
-        above_4g_mem_size = args->ram_size - lowmem;
+        above_4g_mem_size = ms->ram_size - lowmem;
         below_4g_mem_size = lowmem;
     } else {
         above_4g_mem_size = 0;
-        below_4g_mem_size = args->ram_size;
+        below_4g_mem_size = ms->ram_size;
     }
 
     if (pci_enabled) {
@@ -147,14 +147,14 @@ static void pc_init1(QEMUMachineInitArgs *args,
     if (smbios_defaults) {
         /* These values are guest ABI, do not change */
         smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)",
-                            args->machine->name, smbios_legacy_mode);
+                            ms->machine->name, smbios_legacy_mode);
     }
 
     /* allocate ram and load rom/bios */
     if (!xen_enabled()) {
         fw_cfg = pc_memory_init(system_memory,
-                       args->kernel_filename, args->kernel_cmdline,
-                       args->initrd_filename,
+                       ms->kernel_filename, ms->kernel_cmdline,
+                       ms->initrd_filename,
                        below_4g_mem_size, above_4g_mem_size,
                        rom_memory, &ram_memory, guest_info);
     }
@@ -170,7 +170,7 @@ static void pc_init1(QEMUMachineInitArgs *args,
 
     if (pci_enabled) {
         pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi,
-                              system_memory, system_io, args->ram_size,
+                              system_memory, system_io, ms->ram_size,
                               below_4g_mem_size,
                               above_4g_mem_size,
                               pci_memory, ram_memory);
@@ -235,7 +235,7 @@ static void pc_init1(QEMUMachineInitArgs *args,
         }
     }
 
-    pc_cmos_init(below_4g_mem_size, above_4g_mem_size, args->boot_order,
+    pc_cmos_init(below_4g_mem_size, above_4g_mem_size, ms->boot_order,
                  floppy, idebus[0], idebus[1], rtc_state);
 
     if (pci_enabled && usb_enabled(false)) {
@@ -258,131 +258,131 @@ static void pc_init1(QEMUMachineInitArgs *args,
     }
 }
 
-static void pc_init_pci(QEMUMachineInitArgs *args)
+static void pc_init_pci(MachineState *ms)
 {
-    pc_init1(args, 1, 1);
+    pc_init1(ms, 1, 1);
 }
 
-static void pc_compat_2_0(QEMUMachineInitArgs *args)
+static void pc_compat_2_0(MachineState *ms)
 {
     smbios_legacy_mode = true;
 }
 
-static void pc_compat_1_7(QEMUMachineInitArgs *args)
+static void pc_compat_1_7(MachineState *ms)
 {
-    pc_compat_2_0(args);
+    pc_compat_2_0(ms);
     smbios_defaults = false;
     gigabyte_align = false;
     option_rom_has_mr = true;
     x86_cpu_compat_disable_kvm_features(FEAT_1_ECX, CPUID_EXT_X2APIC);
 }
 
-static void pc_compat_1_6(QEMUMachineInitArgs *args)
+static void pc_compat_1_6(MachineState *ms)
 {
-    pc_compat_1_7(args);
+    pc_compat_1_7(ms);
     has_pci_info = false;
     rom_file_has_mr = false;
     has_acpi_build = false;
 }
 
-static void pc_compat_1_5(QEMUMachineInitArgs *args)
+static void pc_compat_1_5(MachineState *ms)
 {
-    pc_compat_1_6(args);
+    pc_compat_1_6(ms);
 }
 
-static void pc_compat_1_4(QEMUMachineInitArgs *args)
+static void pc_compat_1_4(MachineState *ms)
 {
-    pc_compat_1_5(args);
+    pc_compat_1_5(ms);
     x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE);
     x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, 0, CPUID_EXT_PCLMULQDQ);
 }
 
-static void pc_compat_1_3(QEMUMachineInitArgs *args)
+static void pc_compat_1_3(MachineState *ms)
 {
-    pc_compat_1_4(args);
+    pc_compat_1_4(ms);
     enable_compat_apic_id_mode();
 }
 
 /* PC compat function for pc-0.14 to pc-1.2 */
-static void pc_compat_1_2(QEMUMachineInitArgs *args)
+static void pc_compat_1_2(MachineState *ms)
 {
-    pc_compat_1_3(args);
+    pc_compat_1_3(ms);
     x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI);
 }
 
-static void pc_init_pci_2_0(QEMUMachineInitArgs *args)
+static void pc_init_pci_2_0(MachineState *ms)
 {
-    pc_compat_2_0(args);
-    pc_init_pci(args);
+    pc_compat_2_0(ms);
+    pc_init_pci(ms);
 }
 
-static void pc_init_pci_1_7(QEMUMachineInitArgs *args)
+static void pc_init_pci_1_7(MachineState *ms)
 {
-    pc_compat_1_7(args);
-    pc_init_pci(args);
+    pc_compat_1_7(ms);
+    pc_init_pci(ms);
 }
 
-static void pc_init_pci_1_6(QEMUMachineInitArgs *args)
+static void pc_init_pci_1_6(MachineState *ms)
 {
-    pc_compat_1_6(args);
-    pc_init_pci(args);
+    pc_compat_1_6(ms);
+    pc_init_pci(ms);
 }
 
-static void pc_init_pci_1_5(QEMUMachineInitArgs *args)
+static void pc_init_pci_1_5(MachineState *ms)
 {
-    pc_compat_1_5(args);
-    pc_init_pci(args);
+    pc_compat_1_5(ms);
+    pc_init_pci(ms);
 }
 
-static void pc_init_pci_1_4(QEMUMachineInitArgs *args)
+static void pc_init_pci_1_4(MachineState *ms)
 {
-    pc_compat_1_4(args);
-    pc_init_pci(args);
+    pc_compat_1_4(ms);
+    pc_init_pci(ms);
 }
 
-static void pc_init_pci_1_3(QEMUMachineInitArgs *args)
+static void pc_init_pci_1_3(MachineState *ms)
 {
-    pc_compat_1_3(args);
-    pc_init_pci(args);
+    pc_compat_1_3(ms);
+    pc_init_pci(ms);
 }
 
 /* PC machine init function for pc-0.14 to pc-1.2 */
-static void pc_init_pci_1_2(QEMUMachineInitArgs *args)
+static void pc_init_pci_1_2(MachineState *ms)
 {
-    pc_compat_1_2(args);
-    pc_init_pci(args);
+    pc_compat_1_2(ms);
+    pc_init_pci(ms);
 }
 
 /* PC init function for pc-0.10 to pc-0.13, and reused by xenfv */
-static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)
+static void pc_init_pci_no_kvmclock(MachineState *ms)
 {
     has_pci_info = false;
     has_acpi_build = false;
     smbios_defaults = false;
     x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI);
     enable_compat_apic_id_mode();
-    pc_init1(args, 1, 0);
+    pc_init1(ms, 1, 0);
 }
 
-static void pc_init_isa(QEMUMachineInitArgs *args)
+static void pc_init_isa(MachineState *ms)
 {
     has_pci_info = false;
     has_acpi_build = false;
     smbios_defaults = false;
-    if (!args->cpu_model) {
-        args->cpu_model = "486";
+    if (!ms->cpu_model) {
+        ms->cpu_model = "486";
     }
     x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI);
     enable_compat_apic_id_mode();
-    pc_init1(args, 0, 1);
+    pc_init1(ms, 0, 1);
 }
 
 #ifdef CONFIG_XEN
-static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
+static void pc_xen_hvm_init(MachineState *ms)
 {
     PCIBus *bus;
 
-    pc_init_pci(args);
+    pc_init_pci(ms);
 
     bus = pci_find_primary_bus();
     if (bus != NULL) {
hw/i386/pc_q35.c +33 -33
index 3306f89..edad391 100644
@@ -59,7 +59,7 @@ static bool smbios_legacy_mode;
 static bool gigabyte_align = true;
 
 /* PC hardware initialisation */
-static void pc_q35_init(QEMUMachineInitArgs *args)
+static void pc_q35_init(MachineState *ms)
 {
     ram_addr_t below_4g_mem_size, above_4g_mem_size;
     Q35PCIHost *q35_host;
@@ -93,7 +93,7 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
     object_property_add_child(qdev_get_machine(), "icc-bridge",
                               OBJECT(icc_bridge), NULL);
 
-    pc_cpus_init(args->cpu_model, icc_bridge);
+    pc_cpus_init(ms->cpu_model, icc_bridge);
     pc_acpi_init("q35-acpi-dsdt.aml");
 
     kvmclock_create();
@@ -107,13 +107,13 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
      * For old machine types, use whatever split we used historically to avoid
      * breaking migration.
      */
-    if (args->ram_size >= 0xb0000000) {
+    if (ms->ram_size >= 0xb0000000) {
         ram_addr_t lowmem = gigabyte_align ? 0x80000000 : 0xb0000000;
-        above_4g_mem_size = args->ram_size - lowmem;
+        above_4g_mem_size = ms->ram_size - lowmem;
         below_4g_mem_size = lowmem;
     } else {
         above_4g_mem_size = 0;
-        below_4g_mem_size = args->ram_size;
+        below_4g_mem_size = ms->ram_size;
     }
 
     /* pci enabled */
@@ -134,14 +134,14 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
     if (smbios_defaults) {
         /* These values are guest ABI, do not change */
         smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)",
-                            args->machine->name, smbios_legacy_mode);
+                            ms->machine->name, smbios_legacy_mode);
     }
 
     /* allocate ram and load rom/bios */
     if (!xen_enabled()) {
         pc_memory_init(get_system_memory(),
-                       args->kernel_filename, args->kernel_cmdline,
-                       args->initrd_filename,
+                       ms->kernel_filename, ms->kernel_cmdline,
+                       ms->initrd_filename,
                        below_4g_mem_size, above_4g_mem_size,
                        rom_memory, &ram_memory, guest_info);
     }
@@ -230,7 +230,7 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
                                     0xb100),
                       8, NULL, 0);
 
-    pc_cmos_init(below_4g_mem_size, above_4g_mem_size, args->boot_order,
+    pc_cmos_init(below_4g_mem_size, above_4g_mem_size, ms->boot_order,
                  floppy, idebus[0], idebus[1], rtc_state);
 
     /* the rest devices to which pci devfn is automatically assigned */
@@ -241,68 +241,68 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
     }
 }
 
-static void pc_compat_2_0(QEMUMachineInitArgs *args)
+static void pc_compat_2_0(MachineState *ms)
 {
     smbios_legacy_mode = true;
 }
 
-static void pc_compat_1_7(QEMUMachineInitArgs *args)
+static void pc_compat_1_7(MachineState *ms)
 {
-    pc_compat_2_0(args);
+    pc_compat_2_0(ms);
     smbios_defaults = false;
     gigabyte_align = false;
     option_rom_has_mr = true;
     x86_cpu_compat_disable_kvm_features(FEAT_1_ECX, CPUID_EXT_X2APIC);
 }
 
-static void pc_compat_1_6(QEMUMachineInitArgs *args)
+static void pc_compat_1_6(MachineState *ms)
 {
-    pc_compat_1_7(args);
+    pc_compat_1_7(ms);
     has_pci_info = false;
     rom_file_has_mr = false;
     has_acpi_build = false;
 }
 
-static void pc_compat_1_5(QEMUMachineInitArgs *args)
+static void pc_compat_1_5(MachineState *ms)
 {
-    pc_compat_1_6(args);
+    pc_compat_1_6(ms);
 }
 
-static void pc_compat_1_4(QEMUMachineInitArgs *args)
+static void pc_compat_1_4(MachineState *ms)
 {
-    pc_compat_1_5(args);
+    pc_compat_1_5(ms);
     x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE);
     x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, 0, CPUID_EXT_PCLMULQDQ);
 }
 
-static void pc_q35_init_2_0(QEMUMachineInitArgs *args)
+static void pc_q35_init_2_0(MachineState *ms)
 {
-    pc_compat_2_0(args);
-    pc_q35_init(args);
+    pc_compat_2_0(ms);
+    pc_q35_init(ms);
 }
 
-static void pc_q35_init_1_7(QEMUMachineInitArgs *args)
+static void pc_q35_init_1_7(MachineState *ms)
 {
-    pc_compat_1_7(args);
-    pc_q35_init(args);
+    pc_compat_1_7(ms);
+    pc_q35_init(ms);
 }
 
-static void pc_q35_init_1_6(QEMUMachineInitArgs *args)
+static void pc_q35_init_1_6(MachineState *ms)
 {
-    pc_compat_1_6(args);
-    pc_q35_init(args);
+    pc_compat_1_6(ms);
+    pc_q35_init(ms);
 }
 
-static void pc_q35_init_1_5(QEMUMachineInitArgs *args)
+static void pc_q35_init_1_5(MachineState *ms)
 {
-    pc_compat_1_5(args);
-    pc_q35_init(args);
+    pc_compat_1_5(ms);
+    pc_q35_init(ms);
 }
 
-static void pc_q35_init_1_4(QEMUMachineInitArgs *args)
+static void pc_q35_init_1_4(MachineState *ms)
 {
-    pc_compat_1_4(args);
-    pc_q35_init(args);
+    pc_compat_1_4(ms);
+    pc_q35_init(ms);
 }
 
 #define PC_Q35_MACHINE_OPTIONS \
hw/i386/xen_machine_pv.c +4 -4
index 9adb57f..fb7a817 100644
@@ -28,11 +28,11 @@
 #include "xen_domainbuild.h"
 #include "sysemu/blockdev.h"
 
-static void xen_init_pv(QEMUMachineInitArgs *args)
+static void xen_init_pv(MachineState *ms)
 {
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     DriveInfo *dinfo;
     int i;
 
hw/lm32/lm32_boards.c +8 -8
index 5e22e9b..fb66f67 100644
@@ -69,10 +69,10 @@ static void main_cpu_reset(void *opaque)
     env->deba = reset_info->flash_base;
 }
 
-static void lm32_evr_init(QEMUMachineInitArgs *args)
+static void lm32_evr_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
     LM32CPU *cpu;
     CPULM32State *env;
     DriveInfo *dinfo;
@@ -162,12 +162,12 @@ static void lm32_evr_init(QEMUMachineInitArgs *args)
     qemu_register_reset(main_cpu_reset, reset_info);
 }
 
-static void lm32_uclinux_init(QEMUMachineInitArgs *args)
+static void lm32_uclinux_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     LM32CPU *cpu;
     CPULM32State *env;
     DriveInfo *dinfo;
hw/lm32/milkymist.c +5 -5
index baf234c..7438a79 100644
@@ -74,12 +74,12 @@ static void main_cpu_reset(void *opaque)
 }
 
 static void
-milkymist_init(QEMUMachineInitArgs *args)
+milkymist_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     LM32CPU *cpu;
     CPULM32State *env;
     int kernel_size;
hw/m68k/an5206.c +4 -4
index 24f2068..7814dc9 100644
@@ -20,11 +20,11 @@
 
 /* Board init.  */
 
-static void an5206_init(QEMUMachineInitArgs *args)
+static void an5206_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
     M68kCPU *cpu;
     CPUM68KState *env;
     int kernel_size;
hw/m68k/dummy_m68k.c +4 -4
index 86e2e6e..e87f8b6 100644
@@ -16,11 +16,11 @@
 
 /* Board init.  */
 
-static void dummy_m68k_init(QEMUMachineInitArgs *args)
+static void dummy_m68k_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
     CPUM68KState *env;
     MemoryRegion *address_space_mem =  get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
hw/m68k/mcf5208.c +4 -4
index 6e30c0b..26c6ee9 100644
@@ -188,11 +188,11 @@ static void mcf5208_sys_init(MemoryRegion *address_space, qemu_irq *pic)
     }
 }
 
-static void mcf5208evb_init(QEMUMachineInitArgs *args)
+static void mcf5208evb_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
     M68kCPU *cpu;
     CPUM68KState *env;
     int kernel_size;
hw/microblaze/petalogix_ml605_mmu.c +3 -3
index 40a9f5c..1b3d3ed 100644
@@ -79,9 +79,9 @@ static void machine_cpu_reset(MicroBlazeCPU *cpu)
 }
 
 static void
-petalogix_ml605_init(QEMUMachineInitArgs *args)
+petalogix_ml605_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
+    ram_addr_t ram_size = ms->ram_size;
     MemoryRegion *address_space_mem = get_system_memory();
     DeviceState *dev, *dma, *eth0;
     Object *ds, *cs;
@@ -202,7 +202,7 @@ petalogix_ml605_init(QEMUMachineInitArgs *args)
     }
 
     microblaze_load_kernel(cpu, ddr_base, ram_size,
-                           args->initrd_filename,
+                           ms->initrd_filename,
                            BINARY_DEVICE_TREE_FILE,
                            machine_cpu_reset);
 
hw/microblaze/petalogix_s3adsp1800_mmu.c +4 -4
index 6c45e20..683f7b3 100644
@@ -59,10 +59,10 @@ static void machine_cpu_reset(MicroBlazeCPU *cpu)
 }
 
 static void
-petalogix_s3adsp1800_init(QEMUMachineInitArgs *args)
+petalogix_s3adsp1800_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
     DeviceState *dev;
     MicroBlazeCPU *cpu;
     DriveInfo *dinfo;
@@ -128,7 +128,7 @@ petalogix_s3adsp1800_init(QEMUMachineInitArgs *args)
     sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq[ETHLITE_IRQ]);
 
     microblaze_load_kernel(cpu, ddr_base, ram_size,
-                           args->initrd_filename,
+                           ms->initrd_filename,
                            BINARY_DEVICE_TREE_FILE,
                            machine_cpu_reset);
 }
hw/mips/mips_fulong2e.c +6 -6
index e1551aa..e065883 100644
@@ -259,13 +259,13 @@ static void cpu_request_exit(void *opaque, int irq, int level)
     }
 }
 
-static void mips_fulong2e_init(QEMUMachineInitArgs *args)
+static void mips_fulong2e_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     char *filename;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
hw/mips/mips_jazz.c +6 -6
index 5f6dd9f..53cad58 100644
@@ -329,19 +329,19 @@ static void mips_jazz_init(MemoryRegion *address_space,
 }
 
 static
-void mips_magnum_init(QEMUMachineInitArgs *args)
+void mips_magnum_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
         mips_jazz_init(get_system_memory(), get_system_io(),
                        ram_size, cpu_model, JAZZ_MAGNUM);
 }
 
 static
-void mips_pica61_init(QEMUMachineInitArgs *args)
+void mips_pica61_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
     mips_jazz_init(get_system_memory(), get_system_io(),
                    ram_size, cpu_model, JAZZ_PICA61);
 }
hw/mips/mips_malta.c +6 -6
index ac5ec44..a16ee92 100644
@@ -875,13 +875,13 @@ static void cpu_request_exit(void *opaque, int irq, int level)
 }
 
 static
-void mips_malta_init(QEMUMachineInitArgs *args)
+void mips_malta_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     char *filename;
     pflash_t *fl;
     MemoryRegion *system_memory = get_system_memory();
hw/mips/mips_mipssim.c +6 -6
index 239aa6a..7254adf 100644
@@ -133,13 +133,13 @@ static void mipsnet_init(int base, qemu_irq irq, NICInfo *nd)
 }
 
 static void
-mips_mipssim_init(QEMUMachineInitArgs *args)
+mips_mipssim_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     char *filename;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *isa = g_new(MemoryRegion, 1);
hw/mips/mips_r4k.c +6 -6
index e94b543..7a69514 100644
@@ -153,13 +153,13 @@ static void main_cpu_reset(void *opaque)
 
 static const int sector_len = 32 * 1024;
 static
-void mips_r4k_init(QEMUMachineInitArgs *args)
+void mips_r4k_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     char *filename;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
hw/moxie/moxiesim.c +6 -6
index a87ca6d..6114478 100644
@@ -107,14 +107,14 @@ moxie_intc_create(hwaddr base, qemu_irq irq, int kind_of_intr)
     return dev;
 }
 
-static void moxiesim_init(QEMUMachineInitArgs *args)
+static void moxiesim_init(MachineState *ms)
 {
     MoxieCPU *cpu = NULL;
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     CPUMoxieState *env;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
hw/openrisc/openrisc_sim.c +4 -4
index 8e1af8b..24bd3c3 100644
@@ -90,11 +90,11 @@ static void cpu_openrisc_load_kernel(ram_addr_t ram_size,
     }
 }
 
-static void openrisc_sim_init(QEMUMachineInitArgs *args)
+static void openrisc_sim_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
     OpenRISCCPU *cpu = NULL;
     MemoryRegion *ram;
     int n;
hw/ppc/e500.c +22 -22
index f984b3e..0c378ce 100644
@@ -123,7 +123,7 @@ static void dt_serial_create(void *fdt, unsigned long long offset,
     }
 }
 
-static int ppce500_load_device_tree(QEMUMachineInitArgs *args,
+static int ppce500_load_device_tree(MachineState *ms,
                                     PPCE500Params *params,
                                     hwaddr addr,
                                     hwaddr initrd_base,
@@ -132,7 +132,7 @@ static int ppce500_load_device_tree(QEMUMachineInitArgs *args,
 {
     CPUPPCState *env = first_cpu->env_ptr;
     int ret = -1;
-    uint64_t mem_reg_property[] = { 0, cpu_to_be64(args->ram_size) };
+    uint64_t mem_reg_property[] = { 0, cpu_to_be64(ms->ram_size) };
     int fdt_size;
     void *fdt;
     uint8_t hypercall[16];
@@ -207,7 +207,7 @@ static int ppce500_load_device_tree(QEMUMachineInitArgs *args,
     }
 
     ret = qemu_fdt_setprop_string(fdt, "/chosen", "bootargs",
-                                      args->kernel_cmdline);
+                                      ms->kernel_cmdline);
     if (ret < 0)
         fprintf(stderr, "couldn't set /chosen/bootargs\n");
 
@@ -387,7 +387,7 @@ out:
 }
 
 typedef struct DeviceTreeParams {
-    QEMUMachineInitArgs args;
+    MachineState ms;
     PPCE500Params params;
     hwaddr addr;
     hwaddr initrd_base;
@@ -397,18 +397,18 @@ typedef struct DeviceTreeParams {
 static void ppce500_reset_device_tree(void *opaque)
 {
     DeviceTreeParams *p = opaque;
-    ppce500_load_device_tree(&p->args, &p->params, p->addr, p->initrd_base,
+    ppce500_load_device_tree(&p->ms, &p->params, p->addr, p->initrd_base,
                              p->initrd_size, false);
 }
 
-static int ppce500_prep_device_tree(QEMUMachineInitArgs *args,
+static int ppce500_prep_device_tree(MachineState *ms,
                                     PPCE500Params *params,
                                     hwaddr addr,
                                     hwaddr initrd_base,
                                     hwaddr initrd_size)
 {
     DeviceTreeParams *p = g_new(DeviceTreeParams, 1);
-    p->args = *args;
+    p->ms = *ms;
     p->params = *params;
     p->addr = addr;
     p->initrd_base = initrd_base;
@@ -417,7 +417,7 @@ static int ppce500_prep_device_tree(QEMUMachineInitArgs *args,
     qemu_register_reset(ppce500_reset_device_tree, p);
 
     /* Issue the device tree loader once, so that we get the size of the blob */
-    return ppce500_load_device_tree(args, params, addr, initrd_base,
+    return ppce500_load_device_tree(ms, params, addr, initrd_base,
                                     initrd_size, true);
 }
 
@@ -597,7 +597,7 @@ static qemu_irq *ppce500_init_mpic(PPCE500Params *params, MemoryRegion *ccsr,
     return mpic;
 }
 
-void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params)
+void ppce500_init(MachineState *ms, PPCE500Params *params)
 {
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
@@ -622,8 +622,8 @@ void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params)
     PPCE500CCSRState *ccsr;
 
     /* Setup CPUs */
-    if (args->cpu_model == NULL) {
-        args->cpu_model = "e500v2_v30";
+    if (ms->cpu_model == NULL) {
+        ms->cpu_model = "e500v2_v30";
     }
 
     irqs = g_malloc0(smp_cpus * sizeof(qemu_irq *));
@@ -633,7 +633,7 @@ void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params)
         CPUState *cs;
         qemu_irq *input;
 
-        cpu = cpu_ppc_init(args->cpu_model);
+        cpu = cpu_ppc_init(ms->cpu_model);
         if (cpu == NULL) {
             fprintf(stderr, "Unable to initialize CPU!\n");
             exit(1);
@@ -672,7 +672,7 @@ void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params)
 
     /* Fixup Memory size on a alignment boundary */
     ram_size &= ~(RAM_SIZES_ALIGN - 1);
-    args->ram_size = ram_size;
+    ms->ram_size = ram_size;
 
     /* Register Memory */
     memory_region_init_ram(ram, NULL, "mpc8544ds.ram", ram_size);
@@ -739,11 +739,11 @@ void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params)
     sysbus_create_simple("e500-spin", MPC8544_SPIN_BASE, NULL);
 
     /* Load kernel. */
-    if (args->kernel_filename) {
-        kernel_size = load_uimage(args->kernel_filename, &entry,
+    if (ms->kernel_filename) {
+        kernel_size = load_uimage(ms->kernel_filename, &entry,
                                   &loadaddr, NULL);
         if (kernel_size < 0) {
-            kernel_size = load_elf(args->kernel_filename, NULL, NULL,
+            kernel_size = load_elf(ms->kernel_filename, NULL, NULL,
                                    &elf_entry, &elf_lowaddr, NULL, 1,
                                    ELF_MACHINE, 0);
             entry = elf_entry;
@@ -752,7 +752,7 @@ void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params)
         /* XXX try again as binary */
         if (kernel_size < 0) {
             fprintf(stderr, "qemu: could not load kernel '%s'\n",
-                    args->kernel_filename);
+                    ms->kernel_filename);
             exit(1);
         }
 
@@ -764,14 +764,14 @@ void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params)
     }
 
     /* Load initrd. */
-    if (args->initrd_filename) {
+    if (ms->initrd_filename) {
         initrd_base = (cur_base + INITRD_LOAD_PAD) & ~INITRD_PAD_MASK;
-        initrd_size = load_image_targphys(args->initrd_filename, initrd_base,
+        initrd_size = load_image_targphys(ms->initrd_filename, initrd_base,
                                           ram_size - initrd_base);
 
         if (initrd_size < 0) {
             fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
-                    args->initrd_filename);
+                    ms->initrd_filename);
             exit(1);
         }
 
@@ -779,11 +779,11 @@ void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params)
     }
 
     /* If we're loading a kernel directly, we must load the device tree too. */
-    if (args->kernel_filename) {
+    if (ms->kernel_filename) {
         struct boot_info *boot_info;
         int dt_size;
 
-        dt_size = ppce500_prep_device_tree(args, params, dt_base,
+        dt_size = ppce500_prep_device_tree(ms, params, dt_base,
                                            initrd_base, initrd_size);
         if (dt_size < 0) {
             fprintf(stderr, "couldn't load device tree\n");
hw/ppc/e500.h +1 -1
index 52726a2..579f1bf 100644
@@ -13,6 +13,6 @@ typedef struct PPCE500Params {
     int mpic_version;
 } PPCE500Params;
 
-void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params);
+void ppce500_init(MachineState *ms, PPCE500Params *params);
 
 #endif
hw/ppc/e500plat.c +2 -2
index 7d5357e..71e93d3 100644
@@ -28,7 +28,7 @@ static void e500plat_fixup_devtree(PPCE500Params *params, void *fdt)
                      sizeof(compatible));
 }
 
-static void e500plat_init(QEMUMachineInitArgs *args)
+static void e500plat_init(MachineState *ms)
 {
     PPCE500Params params = {
         .pci_first_slot = 0x1,
@@ -43,7 +43,7 @@ static void e500plat_init(QEMUMachineInitArgs *args)
         params.mpic_version = OPENPIC_MODEL_FSL_MPIC_20;
     }
 
-    ppce500_init(args, &params);
+    ppce500_init(ms, &params);
 }
 
 static QEMUMachine e500plat_machine = {
hw/ppc/mac_newworld.c +7 -7
index 5e79575..4e9000d 100644
@@ -140,14 +140,14 @@ static void ppc_core99_reset(void *opaque)
 }
 
 /* PowerPC Mac99 hardware initialisation */
-static void ppc_core99_init(QEMUMachineInitArgs *args)
+static void ppc_core99_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
-    const char *boot_device = args->boot_order;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
+    const char *boot_device = ms->boot_order;
     PowerPCCPU *cpu = NULL;
     CPUPPCState *env = NULL;
     char *filename;
hw/ppc/mac_oldworld.c +7 -7
index 2f27754..465fd37 100644
@@ -71,14 +71,14 @@ static void ppc_heathrow_reset(void *opaque)
     cpu_reset(CPU(cpu));
 }
 
-static void ppc_heathrow_init(QEMUMachineInitArgs *args)
+static void ppc_heathrow_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
-    const char *boot_device = args->boot_order;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
+    const char *boot_device = ms->boot_order;
     MemoryRegion *sysmem = get_system_memory();
     PowerPCCPU *cpu = NULL;
     CPUPPCState *env = NULL;
hw/ppc/mpc8544ds.c +2 -2
index 292c709..2f6b1e3 100644
@@ -26,7 +26,7 @@ static void mpc8544ds_fixup_devtree(PPCE500Params *params, void *fdt)
                      sizeof(compatible));
 }
 
-static void mpc8544ds_init(QEMUMachineInitArgs *args)
+static void mpc8544ds_init(MachineState *ms)
 {
     PPCE500Params params = {
         .pci_first_slot = 0x11,
@@ -35,7 +35,7 @@ static void mpc8544ds_init(QEMUMachineInitArgs *args)
         .mpic_version = OPENPIC_MODEL_FSL_MPIC_20,
     };
 
-    ppce500_init(args, &params);
+    ppce500_init(ms, &params);
 }
 
 
hw/ppc/ppc405_boards.c +9 -9
index f1a8f67..b925343 100644
@@ -172,12 +172,12 @@ static void ref405ep_fpga_init(MemoryRegion *sysmem, uint32_t base)
     qemu_register_reset(&ref405ep_fpga_reset, fpga);
 }
 
-static void ref405ep_init(QEMUMachineInitArgs *args)
+static void ref405ep_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     char *filename;
     ppc4xx_bd_info_t bd;
     CPUPPCState *env;
@@ -499,11 +499,11 @@ static void taihu_cpld_init(MemoryRegion *sysmem, uint32_t base)
     qemu_register_reset(&taihu_cpld_reset, cpld);
 }
 
-static void taihu_405ep_init(QEMUMachineInitArgs *args)
+static void taihu_405ep_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *kernel_filename = args->kernel_filename;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *initrd_filename = ms->initrd_filename;
     char *filename;
     qemu_irq *pic;
     MemoryRegion *sysmem = get_system_memory();
hw/ppc/ppc440_bamboo.c +6 -6
index 2ddc2ed..2b94750 100644
@@ -156,13 +156,13 @@ static void main_cpu_reset(void *opaque)
     mmubooke_create_initial_mapping(env, 0, 0);
 }
 
-static void bamboo_init(QEMUMachineInitArgs *args)
+static void bamboo_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     unsigned int pci_irq_nrs[4] = { 28, 27, 26, 25 };
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *isa = g_new(MemoryRegion, 1);
hw/ppc/prep.c +7 -7
index e243651..f236198 100644
@@ -362,14 +362,14 @@ static const MemoryRegionPortio prep_portio_list[] = {
 };
 
 /* PowerPC PREP hardware initialisation */
-static void ppc_prep_init(QEMUMachineInitArgs *args)
+static void ppc_prep_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
-    const char *boot_device = args->boot_order;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
+    const char *boot_device = ms->boot_order;
     MemoryRegion *sysmem = get_system_memory();
     PowerPCCPU *cpu = NULL;
     CPUPPCState *env = NULL;
hw/ppc/spapr.c +7 -7
index b4ce950..6b2dfd5 100644
@@ -1140,14 +1140,14 @@ static SaveVMHandlers savevm_htab_handlers = {
 };
 
 /* pSeries LPAR / sPAPR hardware init */
-static void ppc_spapr_init(QEMUMachineInitArgs *args)
+static void ppc_spapr_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
-    const char *boot_device = args->boot_order;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
+    const char *boot_device = ms->boot_order;
     PowerPCCPU *cpu;
     CPUPPCState *env;
     PCIHostState *phb;
hw/ppc/virtex_ml507.c +8 -8
index 3e3569d..b816b3c 100644
@@ -194,12 +194,12 @@ static int xilinx_load_device_tree(hwaddr addr,
     return fdt_size;
 }
 
-static void virtex_init(QEMUMachineInitArgs *args)
+static void virtex_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
     hwaddr initrd_base = 0;
     int initrd_size = 0;
     MemoryRegion *address_space_mem = get_system_memory();
@@ -275,14 +275,14 @@ static void virtex_init(QEMUMachineInitArgs *args)
         boot_info.ima_size = kernel_size;
 
         /* Load initrd. */
-        if (args->initrd_filename) {
+        if (ms->initrd_filename) {
             initrd_base = high = ROUND_UP(high, 4);
-            initrd_size = load_image_targphys(args->initrd_filename,
+            initrd_size = load_image_targphys(ms->initrd_filename,
                                               high, ram_size - high);
 
             if (initrd_size < 0) {
                 error_report("couldn't load ram disk '%s'",
-                             args->initrd_filename);
+                             ms->initrd_filename);
                 exit(1);
             }
             high = ROUND_UP(high + initrd_size, 4);
hw/s390x/s390-virtio-ccw.c +5 -5
index 0d4f6ae..3d28045 100644
@@ -79,9 +79,9 @@ static void virtio_ccw_register_hcalls(void)
                                    virtio_ccw_hcall_early_printk);
 }
 
-static void ccw_init(QEMUMachineInitArgs *args)
+static void ccw_init(MachineState *ms)
 {
-    ram_addr_t my_ram_size = args->ram_size;
+    ram_addr_t my_ram_size = ms->ram_size;
     MemoryRegion *sysmem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
     int shift = 0;
@@ -102,8 +102,8 @@ static void ccw_init(QEMUMachineInitArgs *args)
     /* get a BUS */
     css_bus = virtual_css_bus_init();
     s390_sclp_init();
-    s390_init_ipl_dev(args->kernel_filename, args->kernel_cmdline,
-                      args->initrd_filename, "s390-ccw.img");
+    s390_init_ipl_dev(ms->kernel_filename, ms->kernel_cmdline,
+                      ms->initrd_filename, "s390-ccw.img");
     s390_flic_init();
 
     /* register hypercalls */
@@ -118,7 +118,7 @@ static void ccw_init(QEMUMachineInitArgs *args)
     storage_keys = g_malloc0(my_ram_size / TARGET_PAGE_SIZE);
 
     /* init CPUs */
-    s390_init_cpus(args->cpu_model, storage_keys);
+    s390_init_cpus(ms->cpu_model, storage_keys);
 
     if (kvm_enabled()) {
         kvm_s390_enable_css_support(s390_cpu_addr2state(0));
hw/s390x/s390-virtio.c +5 -5
index aef2003..19443d2 100644
@@ -224,9 +224,9 @@ void s390_create_virtio_net(BusState *bus, const char *name)
 }
 
 /* PC hardware initialisation */
-static void s390_init(QEMUMachineInitArgs *args)
+static void s390_init(MachineState *ms)
 {
-    ram_addr_t my_ram_size = args->ram_size;
+    ram_addr_t my_ram_size = ms->ram_size;
     MemoryRegion *sysmem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
     int shift = 0;
@@ -248,8 +248,8 @@ static void s390_init(QEMUMachineInitArgs *args)
     /* get a BUS */
     s390_bus = s390_virtio_bus_init(&my_ram_size);
     s390_sclp_init();
-    s390_init_ipl_dev(args->kernel_filename, args->kernel_cmdline,
-                      args->initrd_filename, ZIPL_FILENAME);
+    s390_init_ipl_dev(ms->kernel_filename, ms->kernel_cmdline,
+                      ms->initrd_filename, ZIPL_FILENAME);
     s390_flic_init();
 
     /* register hypercalls */
@@ -273,7 +273,7 @@ static void s390_init(QEMUMachineInitArgs *args)
     storage_keys = g_malloc0(my_ram_size / TARGET_PAGE_SIZE);
 
     /* init CPUs */
-    s390_init_cpus(args->cpu_model, storage_keys);
+    s390_init_cpus(ms->cpu_model, storage_keys);
 
     /* Create VirtIO network adapters */
     s390_create_virtio_net((BusState *)s390_bus, "virtio-net-s390");
hw/sh4/r2d.c +5 -5
index eaeb7ed..298c7a2 100644
@@ -219,12 +219,12 @@ static struct QEMU_PACKED
     char kernel_cmdline[256];
 } boot_params;
 
-static void r2d_init(QEMUMachineInitArgs *args)
+static void r2d_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     SuperHCPU *cpu;
     CPUSH4State *env;
     ResetData *reset_info;
hw/sh4/shix.c +2 -2
index 904a966..1c2c744 100644
@@ -39,9 +39,9 @@
 #define BIOS_FILENAME "shix_bios.bin"
 #define BIOS_ADDRESS 0xA0000000
 
-static void shix_init(QEMUMachineInitArgs *args)
+static void shix_init(MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
+    const char *cpu_model = ms->cpu_model;
     int ret;
     SuperHCPU *cpu;
     struct SH7750State *s;
hw/sparc/leon3.c +4 -4
index c16e9e4..2a283a3 100644
@@ -101,11 +101,11 @@ static void leon3_set_pil_in(void *opaque, uint32_t pil_in)
     }
 }
 
-static void leon3_generic_hw_init(QEMUMachineInitArgs *args)
+static void leon3_generic_hw_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
     SPARCCPU *cpu;
     CPUSPARCState   *env;
     MemoryRegion *address_space_mem = get_system_memory();
hw/sparc/sun4m.c +32 -32
index 75adb68..534e10a 100644
@@ -867,9 +867,9 @@ static void dummy_fdc_tc(void *opaque, int irq, int level)
 }
 
 static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
-                          QEMUMachineInitArgs *args)
+                          MachineState *ms)
 {
-    const char *cpu_model = args->cpu_model;
+    const char *cpu_model = ms->cpu_model;
     unsigned int i;
     void *iommu, *espdma, *ledma, *nvram;
     qemu_irq *cpu_irqs[MAX_CPUS], slavio_irq[32], slavio_cpu_irq[MAX_CPUS],
@@ -895,10 +895,10 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
 
 
     /* set up devices */
-    ram_init(0, args->ram_size, hwdef->max_mem);
+    ram_init(0, ms->ram_size, hwdef->max_mem);
     /* models without ECC don't trap when missing ram is accessed */
     if (!hwdef->ecc_base) {
-        empty_slot_init(args->ram_size, hwdef->max_mem - args->ram_size);
+        empty_slot_init(ms->ram_size, hwdef->max_mem - ms->ram_size);
     }
 
     prom_init(hwdef->slavio_base, bios_name);
@@ -1051,12 +1051,12 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
         empty_slot_init(hwdef->bpp_base, 0x20);
     }
 
-    kernel_size = sun4m_load_kernel(args->kernel_filename,
-                                    args->initrd_filename,
-                                    args->ram_size);
+    kernel_size = sun4m_load_kernel(ms->kernel_filename,
+                                    ms->initrd_filename,
+                                    ms->ram_size);
 
-    nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr, args->kernel_cmdline,
-               args->boot_order, args->ram_size, kernel_size, graphic_width,
+    nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr, ms->kernel_cmdline,
+               ms->boot_order, ms->ram_size, kernel_size, graphic_width,
                graphic_height, graphic_depth, hwdef->nvram_machine_id,
                "Sun4m");
 
@@ -1074,20 +1074,20 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
     fw_cfg_add_i16(fw_cfg, FW_CFG_SUN4M_HEIGHT, graphic_height);
     fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, KERNEL_LOAD_ADDR);
     fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size);
-    if (args->kernel_cmdline) {
+    if (ms->kernel_cmdline) {
         fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, CMDLINE_ADDR);
         pstrcpy_targphys("cmdline", CMDLINE_ADDR, TARGET_PAGE_SIZE,
-                         args->kernel_cmdline);
-        fw_cfg_add_string(fw_cfg, FW_CFG_CMDLINE_DATA, args->kernel_cmdline);
+                         ms->kernel_cmdline);
+        fw_cfg_add_string(fw_cfg, FW_CFG_CMDLINE_DATA, ms->kernel_cmdline);
         fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE,
-                       strlen(args->kernel_cmdline) + 1);
+                       strlen(ms->kernel_cmdline) + 1);
     } else {
         fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0);
         fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE, 0);
     }
     fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, INITRD_LOAD_ADDR);
     fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, 0); // not used
-    fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, args->boot_order[0]);
+    fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ms->boot_order[0]);
     qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
 }
 
@@ -1349,57 +1349,57 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = {
 };
 
 /* SPARCstation 5 hardware initialisation */
-static void ss5_init(QEMUMachineInitArgs *args)
+static void ss5_init(MachineState *ms)
 {
-    sun4m_hw_init(&sun4m_hwdefs[0], args);
+    sun4m_hw_init(&sun4m_hwdefs[0], ms);
 }
 
 /* SPARCstation 10 hardware initialisation */
-static void ss10_init(QEMUMachineInitArgs *args)
+static void ss10_init(MachineState *ms)
 {
-    sun4m_hw_init(&sun4m_hwdefs[1], args);
+    sun4m_hw_init(&sun4m_hwdefs[1], ms);
 }
 
 /* SPARCserver 600MP hardware initialisation */
-static void ss600mp_init(QEMUMachineInitArgs *args)
+static void ss600mp_init(MachineState *ms)
 {
-    sun4m_hw_init(&sun4m_hwdefs[2], args);
+    sun4m_hw_init(&sun4m_hwdefs[2], ms);
 }
 
 /* SPARCstation 20 hardware initialisation */
-static void ss20_init(QEMUMachineInitArgs *args)
+static void ss20_init(MachineState *ms)
 {
-    sun4m_hw_init(&sun4m_hwdefs[3], args);
+    sun4m_hw_init(&sun4m_hwdefs[3], ms);
 }
 
 /* SPARCstation Voyager hardware initialisation */
-static void vger_init(QEMUMachineInitArgs *args)
+static void vger_init(MachineState *ms)
 {
-    sun4m_hw_init(&sun4m_hwdefs[4], args);
+    sun4m_hw_init(&sun4m_hwdefs[4], ms);
 }
 
 /* SPARCstation LX hardware initialisation */
-static void ss_lx_init(QEMUMachineInitArgs *args)
+static void ss_lx_init(MachineState *ms)
 {
-    sun4m_hw_init(&sun4m_hwdefs[5], args);
+    sun4m_hw_init(&sun4m_hwdefs[5], ms);
 }
 
 /* SPARCstation 4 hardware initialisation */
-static void ss4_init(QEMUMachineInitArgs *args)
+static void ss4_init(MachineState *ms)
 {
-    sun4m_hw_init(&sun4m_hwdefs[6], args);
+    sun4m_hw_init(&sun4m_hwdefs[6], ms);
 }
 
 /* SPARCClassic hardware initialisation */
-static void scls_init(QEMUMachineInitArgs *args)
+static void scls_init(MachineState *ms)
 {
-    sun4m_hw_init(&sun4m_hwdefs[7], args);
+    sun4m_hw_init(&sun4m_hwdefs[7], ms);
 }
 
 /* SPARCbook hardware initialisation */
-static void sbook_init(QEMUMachineInitArgs *args)
+static void sbook_init(MachineState *ms)
 {
-    sun4m_hw_init(&sun4m_hwdefs[8], args);
+    sun4m_hw_init(&sun4m_hwdefs[8], ms);
 }
 
 static QEMUMachine ss5_machine = {
hw/sparc64/sun4u.c +18 -18
index 6f271d9..036e8c9 100644
@@ -811,7 +811,7 @@ static SPARCCPU *cpu_devinit(const char *cpu_model, const struct hwdef *hwdef)
 }
 
 static void sun4uv_init(MemoryRegion *address_space_mem,
-                        QEMUMachineInitArgs *args,
+                        MachineState *ms,
                         const struct hwdef *hwdef)
 {
     SPARCCPU *cpu;
@@ -826,10 +826,10 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
     FWCfgState *fw_cfg;
 
     /* init CPUs */
-    cpu = cpu_devinit(args->cpu_model, hwdef);
+    cpu = cpu_devinit(ms->cpu_model, hwdef);
 
     /* set up devices */
-    ram_init(0, args->ram_size);
+    ram_init(0, ms->ram_size);
 
     prom_init(hwdef->prom_addr, bios_name);
 
@@ -875,15 +875,15 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
 
     initrd_size = 0;
     initrd_addr = 0;
-    kernel_size = sun4u_load_kernel(args->kernel_filename,
-                                    args->initrd_filename,
+    kernel_size = sun4u_load_kernel(ms->kernel_filename,
+                                    ms->initrd_filename,
                                     ram_size, &initrd_size, &initrd_addr,
                                     &kernel_addr, &kernel_entry);
 
-    sun4u_NVRAM_set_params(nvram, NVRAM_SIZE, "Sun4u", args->ram_size,
-                           args->boot_order,
+    sun4u_NVRAM_set_params(nvram, NVRAM_SIZE, "Sun4u", ms->ram_size,
+                           ms->boot_order,
                            kernel_addr, kernel_size,
-                           args->kernel_cmdline,
+                           ms->kernel_cmdline,
                            initrd_addr, initrd_size,
                            /* XXX: need an option to load a NVRAM image */
                            0,
@@ -897,16 +897,16 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
     fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, hwdef->machine_id);
     fw_cfg_add_i64(fw_cfg, FW_CFG_KERNEL_ADDR, kernel_entry);
     fw_cfg_add_i64(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size);
-    if (args->kernel_cmdline) {
+    if (ms->kernel_cmdline) {
         fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE,
-                       strlen(args->kernel_cmdline) + 1);
-        fw_cfg_add_string(fw_cfg, FW_CFG_CMDLINE_DATA, args->kernel_cmdline);
+                       strlen(ms->kernel_cmdline) + 1);
+        fw_cfg_add_string(fw_cfg, FW_CFG_CMDLINE_DATA, ms->kernel_cmdline);
     } else {
         fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE, 0);
     }
     fw_cfg_add_i64(fw_cfg, FW_CFG_INITRD_ADDR, initrd_addr);
     fw_cfg_add_i64(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size);
-    fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, args->boot_order[0]);
+    fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ms->boot_order[0]);
 
     fw_cfg_add_i16(fw_cfg, FW_CFG_SPARC64_WIDTH, graphic_width);
     fw_cfg_add_i16(fw_cfg, FW_CFG_SPARC64_HEIGHT, graphic_height);
@@ -946,21 +946,21 @@ static const struct hwdef hwdefs[] = {
 };
 
 /* Sun4u hardware initialisation */
-static void sun4u_init(QEMUMachineInitArgs *args)
+static void sun4u_init(MachineState *ms)
 {
-    sun4uv_init(get_system_memory(), args, &hwdefs[0]);
+    sun4uv_init(get_system_memory(), ms, &hwdefs[0]);
 }
 
 /* Sun4v hardware initialisation */
-static void sun4v_init(QEMUMachineInitArgs *args)
+static void sun4v_init(MachineState *ms)
 {
-    sun4uv_init(get_system_memory(), args, &hwdefs[1]);
+    sun4uv_init(get_system_memory(), ms, &hwdefs[1]);
 }
 
 /* Niagara hardware initialisation */
-static void niagara_init(QEMUMachineInitArgs *args)
+static void niagara_init(MachineState *ms)
 {
-    sun4uv_init(get_system_memory(), args, &hwdefs[2]);
+    sun4uv_init(get_system_memory(), ms, &hwdefs[2]);
 }
 
 static QEMUMachine sun4u_machine = {
hw/unicore32/puv3.c +5 -5
index 42913b6..532f196 100644
@@ -101,12 +101,12 @@ static void puv3_load_kernel(const char *kernel_filename)
     graphic_console_init(NULL, 0, &no_ops, NULL);
 }
 
-static void puv3_init(QEMUMachineInitArgs *args)
+static void puv3_init(MachineState *ms)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *initrd_filename = args->initrd_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *initrd_filename = ms->initrd_filename;
     CPUUniCore32State *env;
 
     if (initrd_filename) {
hw/xtensa/xtensa_lx60.c +13 -13
index 49c58d1..6168a5c 100644
@@ -159,7 +159,7 @@ static void lx60_reset(void *opaque)
     cpu_reset(CPU(cpu));
 }
 
-static void lx_init(const LxBoardDesc *board, QEMUMachineInitArgs *args)
+static void lx_init(const LxBoardDesc *board, MachineState *ms)
 {
 #ifdef TARGET_WORDS_BIGENDIAN
     int be = 1;
@@ -172,9 +172,9 @@ static void lx_init(const LxBoardDesc *board, QEMUMachineInitArgs *args)
     MemoryRegion *ram, *rom, *system_io;
     DriveInfo *dinfo;
     pflash_t *flash = NULL;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
     int n;
 
     if (!cpu_model) {
@@ -198,7 +198,7 @@ static void lx_init(const LxBoardDesc *board, QEMUMachineInitArgs *args)
     }
 
     ram = g_malloc(sizeof(*ram));
-    memory_region_init_ram(ram, NULL, "lx60.dram", args->ram_size);
+    memory_region_init_ram(ram, NULL, "lx60.dram", ms->ram_size);
     vmstate_register_ram_global(ram);
     memory_region_add_subregion(system_memory, 0, ram);
 
@@ -275,7 +275,7 @@ static void lx_init(const LxBoardDesc *board, QEMUMachineInitArgs *args)
     }
 }
 
-static void xtensa_lx60_init(QEMUMachineInitArgs *args)
+static void xtensa_lx60_init(MachineState *ms)
 {
     static const LxBoardDesc lx60_board = {
         .flash_base = 0xf8000000,
@@ -283,10 +283,10 @@ static void xtensa_lx60_init(QEMUMachineInitArgs *args)
         .flash_sector_size = 0x10000,
         .sram_size = 0x20000,
     };
-    lx_init(&lx60_board, args);
+    lx_init(&lx60_board, ms);
 }
 
-static void xtensa_lx200_init(QEMUMachineInitArgs *args)
+static void xtensa_lx200_init(MachineState *ms)
 {
     static const LxBoardDesc lx200_board = {
         .flash_base = 0xf8000000,
@@ -294,10 +294,10 @@ static void xtensa_lx200_init(QEMUMachineInitArgs *args)
         .flash_sector_size = 0x20000,
         .sram_size = 0x2000000,
     };
-    lx_init(&lx200_board, args);
+    lx_init(&lx200_board, ms);
 }
 
-static void xtensa_ml605_init(QEMUMachineInitArgs *args)
+static void xtensa_ml605_init(MachineState *ms)
 {
     static const LxBoardDesc ml605_board = {
         .flash_base = 0xf8000000,
@@ -305,10 +305,10 @@ static void xtensa_ml605_init(QEMUMachineInitArgs *args)
         .flash_sector_size = 0x20000,
         .sram_size = 0x2000000,
     };
-    lx_init(&ml605_board, args);
+    lx_init(&ml605_board, ms);
 }
 
-static void xtensa_kc705_init(QEMUMachineInitArgs *args)
+static void xtensa_kc705_init(MachineState *ms)
 {
     static const LxBoardDesc kc705_board = {
         .flash_base = 0xf0000000,
@@ -316,7 +316,7 @@ static void xtensa_kc705_init(QEMUMachineInitArgs *args)
         .flash_sector_size = 0x20000,
         .sram_size = 0x2000000,
     };
-    lx_init(&kc705_board, args);
+    lx_init(&kc705_board, ms);
 }
 
 static QEMUMachine xtensa_lx60_machine = {
hw/xtensa/xtensa_sim.c +4 -4
index 1192ce7..3470087 100644
@@ -46,14 +46,14 @@ static void sim_reset(void *opaque)
     cpu_reset(CPU(cpu));
 }
 
-static void xtensa_sim_init(QEMUMachineInitArgs *args)
+static void xtensa_sim_init(MachineState *ms)
 {
     XtensaCPU *cpu = NULL;
     CPUXtensaState *env = NULL;
     MemoryRegion *ram, *rom;
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
+    ram_addr_t ram_size = ms->ram_size;
+    const char *cpu_model = ms->cpu_model;
+    const char *kernel_filename = ms->kernel_filename;
     int n;
 
     if (!cpu_model) {
include/hw/boards.h +11 -17
index 28f0047..eba0574 100644
@@ -7,17 +7,10 @@
 #include "hw/qdev.h"
 #include "qom/object.h"
 
-typedef struct QEMUMachineInitArgs {
-    const MachineClass *machine;
-    ram_addr_t ram_size;
-    const char *boot_order;
-    const char *kernel_filename;
-    const char *kernel_cmdline;
-    const char *initrd_filename;
-    const char *cpu_model;
-} QEMUMachineInitArgs;
 
-typedef void QEMUMachineInitFunc(QEMUMachineInitArgs *args);
+typedef struct MachineState MachineState;
+
+typedef void QEMUMachineInitFunc(MachineState *ms);
 
 typedef void QEMUMachineResetFunc(void);
 
@@ -61,8 +54,6 @@ int qemu_register_machine(QEMUMachine *m);
 #define MACHINE_CLASS(klass) \
     OBJECT_CLASS_CHECK(MachineClass, (klass), TYPE_MACHINE)
 
-typedef struct MachineState MachineState;
-
 MachineClass *find_default_machine(void);
 extern MachineState *current_machine;
 
@@ -79,7 +70,7 @@ struct MachineClass {
     const char *alias;
     const char *desc;
 
-    void (*init)(QEMUMachineInitArgs *args);
+    void (*init)(MachineState *state);
     void (*reset)(void);
     void (*hot_add_cpu)(const int64_t id, Error **errp);
     int (*kvm_type)(const char *arg);
@@ -111,9 +102,6 @@ struct MachineState {
     char *accel;
     bool kernel_irqchip;
     int kvm_shadow_mem;
-    char *kernel;
-    char *initrd;
-    char *append;
     char *dtb;
     char *dumpdtb;
     int phandle_start;
@@ -123,7 +111,13 @@ struct MachineState {
     bool usb;
     char *firmware;
 
-    QEMUMachineInitArgs init_args;
+    const MachineClass *machine;
+    ram_addr_t ram_size;
+    const char *boot_order;
+    const char *kernel_filename;
+    const char *kernel_cmdline;
+    const char *initrd_filename;
+    const char *cpu_model;
 };
 
 #endif
vl.c +9 -10
index c4505dc..58673bd 100644
@@ -4422,16 +4422,15 @@ int main(int argc, char **argv, char **envp)
 
     qdev_machine_init();
 
-    current_machine->init_args = (QEMUMachineInitArgs) {
-        .machine = machine_class,
-        .ram_size = ram_size,
-        .boot_order = boot_order,
-        .kernel_filename = kernel_filename,
-        .kernel_cmdline = kernel_cmdline,
-        .initrd_filename = initrd_filename,
-        .cpu_model = cpu_model };
-
-    machine_class->init(&current_machine->init_args);
+    current_machine->machine = machine_class;
+    current_machine->ram_size = ram_size;
+    current_machine->boot_order = boot_order;
+    current_machine->kernel_filename = kernel_filename;
+    current_machine->kernel_cmdline = kernel_cmdline;
+    current_machine->initrd_filename = initrd_filename;
+    current_machine->cpu_model = cpu_model;
+
+    machine_class->init(current_machine);
 
     audio_init();
 
Signature · 1 line
1.8.3.1
#5 lore raw

Re: [Qemu-devel] [PATCH 1/4] machine: conversion of QEMUMachineInitArgs to MachineState

In reply to Marcel Apfelbaum

Am 07.05.2014 16:42, schrieb Marcel Apfelbaum:

Quoted 5 lines

Total removal of QEMUMachineInitArgs struct. QEMUMachineInitArgs's fields are copied into MachineState. Removed duplicated fields from MachineState.

All the other changes are only mechanical refactoring, no semantic changes.

Quoted 8 lines

---
- I am perfectly aware that patches touching a lot of files

     are not desirable, but this one is a very simple replacement
     patch:
       QEMUMachineInitArgs -> MachineState
       args -> ms

- This is the simplest way to get rid of QEMUMachineInitArgs fast.

Agreed. I did stumble over "ms" though - any reason not to name it "machine"?

[...]

Quoted 20 lines
vl.c +2 -10
index c4505dc..58673bd 100644
@@ -4422,16 +4422,15 @@ int main(int argc, char **argv, char **envp)
 
     qdev_machine_init();
 
-    current_machine->init_args = (QEMUMachineInitArgs) {
-        .machine = machine_class,
-        .ram_size = ram_size,
-        .boot_order = boot_order,
-        .kernel_filename = kernel_filename,
-        .kernel_cmdline = kernel_cmdline,
-        .initrd_filename = initrd_filename,
-        .cpu_model = cpu_model };
-
-    machine_class->init(&current_machine->init_args);
+    current_machine->machine = machine_class;
+    current_machine->ram_size = ram_size;

vl.c int main(int argc, char **argv, char **envp) · line 4436

Quoted 10 lines
vl.c +7 -0
+    current_machine->boot_order = boot_order;
+    current_machine->kernel_filename = kernel_filename;
+    current_machine->kernel_cmdline = kernel_cmdline;
+    current_machine->initrd_filename = initrd_filename;
+    current_machine->cpu_model = cpu_model;
+
+    machine_class->init(current_machine);
 
     audio_init();
 

I had already needed to rebase your previous series on that init_args refactoring that came in through trivial; I would propose to simply officially revert that commit before applying this one.

Regards,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#6 lore raw

Re: [Qemu-devel] [PATCH 1/4] machine: conversion of QEMUMachineInitArgs to MachineState

In reply to Marcel Apfelbaum
Quoted 5 lines · Marcel Apfelbaum

Total removal of QEMUMachineInitArgs struct. QEMUMachineInitArgs's fields are copied into MachineState. Removed duplicated fields from MachineState.

All the other changes are only mechanical refactoring, no semantic changes.

Quoted 8 lines

---
- I am perfectly aware that patches touching a lot of files

     are not desirable, but this one is a very simple replacement
     patch:
       QEMUMachineInitArgs -> MachineState
       args -> ms

- This is the simplest way to get rid of QEMUMachineInitArgs fast.

Snipping all patch hunks that only replace QEMUMachineInitArgs *args by MachineState *ms leaves just the hunks quoted below. Did I miss any?

Quoted 87 lines
include/hw/boards.h +11 -17
index 28f0047..eba0574 100644
@@ -7,17 +7,10 @@
 #include "hw/qdev.h"
 #include "qom/object.h"
 
-typedef struct QEMUMachineInitArgs {
-    const MachineClass *machine;
-    ram_addr_t ram_size;
-    const char *boot_order;
-    const char *kernel_filename;
-    const char *kernel_cmdline;
-    const char *initrd_filename;
-    const char *cpu_model;
-} QEMUMachineInitArgs;
 
-typedef void QEMUMachineInitFunc(QEMUMachineInitArgs *args);
+typedef struct MachineState MachineState;
+
+typedef void QEMUMachineInitFunc(MachineState *ms);
 
 typedef void QEMUMachineResetFunc(void);
 
@@ -61,8 +54,6 @@ int qemu_register_machine(QEMUMachine *m);
 #define MACHINE_CLASS(klass) \
     OBJECT_CLASS_CHECK(MachineClass, (klass), TYPE_MACHINE)
 
-typedef struct MachineState MachineState;
-
 MachineClass *find_default_machine(void);
 extern MachineState *current_machine;
 
@@ -79,7 +70,7 @@ struct MachineClass {
     const char *alias;
     const char *desc;
 
-    void (*init)(QEMUMachineInitArgs *args);
+    void (*init)(MachineState *state);
     void (*reset)(void);
     void (*hot_add_cpu)(const int64_t id, Error **errp);
     int (*kvm_type)(const char *arg);
@@ -111,9 +102,6 @@ struct MachineState {
     char *accel;
     bool kernel_irqchip;
     int kvm_shadow_mem;
-    char *kernel;
-    char *initrd;
-    char *append;
     char *dtb;
     char *dumpdtb;
     int phandle_start;
@@ -123,7 +111,13 @@ struct MachineState {
     bool usb;
     char *firmware;
 
-    QEMUMachineInitArgs init_args;
+    const MachineClass *machine;
+    ram_addr_t ram_size;
+    const char *boot_order;
+    const char *kernel_filename;
+    const char *kernel_cmdline;
+    const char *initrd_filename;
+    const char *cpu_model;
 };
 
 #endif
vl.c +1 -10
index c4505dc..58673bd 100644
@@ -4422,16 +4422,15 @@ int main(int argc, char **argv, char **envp)
 
     qdev_machine_init();
 
-    current_machine->init_args = (QEMUMachineInitArgs) {
-        .machine = machine_class,
-        .ram_size = ram_size,
-        .boot_order = boot_order,
-        .kernel_filename = kernel_filename,
-        .kernel_cmdline = kernel_cmdline,
-        .initrd_filename = initrd_filename,
-        .cpu_model = cpu_model };
-
-    machine_class->init(&current_machine->init_args);
+    current_machine->machine = machine_class;

vl.c int main(int argc, char **argv, char **envp) · line 4435

Quoted 10 lines
vl.c +8 -0
+    current_machine->ram_size = ram_size;
+    current_machine->boot_order = boot_order;
+    current_machine->kernel_filename = kernel_filename;
+    current_machine->kernel_cmdline = kernel_cmdline;
+    current_machine->initrd_filename = initrd_filename;
+    current_machine->cpu_model = cpu_model;
+
+    machine_class->init(current_machine);
 
     audio_init();

This can't lose any implicit zero initialization, because current_machine has been created by object_new(), which zeroes the whole struct. Good.

#7 lore raw

Re: [Qemu-devel] [PATCH 1/4] machine: conversion of QEMUMachineInitArgs to MachineState

Quoted 16 lines · Markus Armbruster
Quoted 5 lines · Marcel Apfelbaum

Total removal of QEMUMachineInitArgs struct. QEMUMachineInitArgs's fields are copied into MachineState. Removed duplicated fields from MachineState.

All the other changes are only mechanical refactoring, no semantic changes.

Quoted 8 lines

---
- I am perfectly aware that patches touching a lot of files

     are not desirable, but this one is a very simple replacement
     patch:
       QEMUMachineInitArgs -> MachineState
       args -> ms

- This is the simplest way to get rid of QEMUMachineInitArgs fast.

Quoted 2 lines

Snipping all patch hunks that only replace QEMUMachineInitArgs *args by MachineState *ms leaves just the hunks quoted below. Did I miss any?

Not that I am aware of.
Thanks for going over the patch!
Marcel

Quoted 102 lines
Quoted 88 lines
include/hw/boards.h +11 -17
index 28f0047..eba0574 100644
@@ -7,17 +7,10 @@
 #include "hw/qdev.h"
 #include "qom/object.h"
 
-typedef struct QEMUMachineInitArgs {
-    const MachineClass *machine;
-    ram_addr_t ram_size;
-    const char *boot_order;
-    const char *kernel_filename;
-    const char *kernel_cmdline;
-    const char *initrd_filename;
-    const char *cpu_model;
-} QEMUMachineInitArgs;
 
-typedef void QEMUMachineInitFunc(QEMUMachineInitArgs *args);
+typedef struct MachineState MachineState;
+
+typedef void QEMUMachineInitFunc(MachineState *ms);
 
 typedef void QEMUMachineResetFunc(void);
 
@@ -61,8 +54,6 @@ int qemu_register_machine(QEMUMachine *m);
 #define MACHINE_CLASS(klass) \
     OBJECT_CLASS_CHECK(MachineClass, (klass), TYPE_MACHINE)
 
-typedef struct MachineState MachineState;
-
 MachineClass *find_default_machine(void);
 extern MachineState *current_machine;
 
@@ -79,7 +70,7 @@ struct MachineClass {
     const char *alias;
     const char *desc;
 
-    void (*init)(QEMUMachineInitArgs *args);
+    void (*init)(MachineState *state);
     void (*reset)(void);
     void (*hot_add_cpu)(const int64_t id, Error **errp);
     int (*kvm_type)(const char *arg);
@@ -111,9 +102,6 @@ struct MachineState {
     char *accel;
     bool kernel_irqchip;
     int kvm_shadow_mem;
-    char *kernel;
-    char *initrd;
-    char *append;
     char *dtb;
     char *dumpdtb;
     int phandle_start;
@@ -123,7 +111,13 @@ struct MachineState {
     bool usb;
     char *firmware;
 
-    QEMUMachineInitArgs init_args;
+    const MachineClass *machine;
+    ram_addr_t ram_size;
+    const char *boot_order;
+    const char *kernel_filename;
+    const char *kernel_cmdline;
+    const char *initrd_filename;
+    const char *cpu_model;
 };
 
 #endif
vl.c +1 -10
index c4505dc..58673bd 100644
@@ -4422,16 +4422,15 @@ int main(int argc, char **argv, char **envp)
 
     qdev_machine_init();
 
-    current_machine->init_args = (QEMUMachineInitArgs) {
-        .machine = machine_class,
-        .ram_size = ram_size,
-        .boot_order = boot_order,
-        .kernel_filename = kernel_filename,
-        .kernel_cmdline = kernel_cmdline,
-        .initrd_filename = initrd_filename,
-        .cpu_model = cpu_model };
-
-    machine_class->init(&current_machine->init_args);
+    current_machine->machine = machine_class;

vl.c int main(int argc, char **argv, char **envp) · line 4435

Quoted 10 lines
vl.c +8 -0
+    current_machine->ram_size = ram_size;
+    current_machine->boot_order = boot_order;
+    current_machine->kernel_filename = kernel_filename;
+    current_machine->kernel_cmdline = kernel_cmdline;
+    current_machine->initrd_filename = initrd_filename;
+    current_machine->cpu_model = cpu_model;
+
+    machine_class->init(current_machine);
 
     audio_init();

This can't lose any implicit zero initialization, because current_machine has been created by object_new(), which zeroes the whole struct. Good.

#8 lore raw

Re: [Qemu-devel] [PATCH 1/4] machine: conversion of QEMUMachineInitArgs to MachineState

In reply to Marcel Apfelbaum
Quoted 5 lines · On Wed, 7 May 2014 17:42:57 +0300 Marcel Apfelbaum <[email protected]> wrote:

Total removal of QEMUMachineInitArgs struct. QEMUMachineInitArgs's fields are copied into MachineState. Removed duplicated fields from MachineState.

All the other changes are only mechanical refactoring, no semantic changes.

Quoted 9 lines

---
- I am perfectly aware that patches touching a lot of files

     are not desirable, but this one is a very simple replacement
     patch:
       QEMUMachineInitArgs -> MachineState
       args -> ms

- This is the simplest way to get rid of QEMUMachineInitArgs fast.

Patch doesn't apply cleanly on current master

[...]

hw/i386/xen_machine_pv.c

Quoted 7 lines

#define PC_Q35_MACHINE_OPTIONS \

hw/i386/xen_machine_pv.c +0 -0
index 9adb57f..fb7a817 100644
@@ -28,11 +28,11 @@

^^^ file was moved

Quoted 15 lines
hw/i386/xen_machine_pv.c +4 -4
 #include "xen_domainbuild.h"
 #include "sysemu/blockdev.h"
 
-static void xen_init_pv(QEMUMachineInitArgs *args)
+static void xen_init_pv(MachineState *ms)
 {
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
+    const char *kernel_filename = ms->kernel_filename;
+    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *initrd_filename = ms->initrd_filename;
     DriveInfo *dinfo;
     int i;
 

[...]

Quoted 54 lines
include/hw/boards.h +4 -16
index 28f0047..eba0574 100644
@@ -7,17 +7,10 @@
 #include "hw/qdev.h"
 #include "qom/object.h"
 
-typedef struct QEMUMachineInitArgs {
-    const MachineClass *machine;
-    ram_addr_t ram_size;
-    const char *boot_order;
-    const char *kernel_filename;
-    const char *kernel_cmdline;
-    const char *initrd_filename;
-    const char *cpu_model;
-} QEMUMachineInitArgs;
 
-typedef void QEMUMachineInitFunc(QEMUMachineInitArgs *args);
+typedef struct MachineState MachineState;
+
+typedef void QEMUMachineInitFunc(MachineState *ms);
 
 typedef void QEMUMachineResetFunc(void);
 
@@ -61,8 +54,6 @@ int qemu_register_machine(QEMUMachine *m);
 #define MACHINE_CLASS(klass) \
     OBJECT_CLASS_CHECK(MachineClass, (klass), TYPE_MACHINE)
 
-typedef struct MachineState MachineState;
-
 MachineClass *find_default_machine(void);
 extern MachineState *current_machine;
 
@@ -79,7 +70,7 @@ struct MachineClass {
     const char *alias;
     const char *desc;
 
-    void (*init)(QEMUMachineInitArgs *args);
+    void (*init)(MachineState *state);
     void (*reset)(void);
     void (*hot_add_cpu)(const int64_t id, Error **errp);
     int (*kvm_type)(const char *arg);
@@ -111,9 +102,6 @@ struct MachineState {
     char *accel;
     bool kernel_irqchip;
     int kvm_shadow_mem;
-    char *kernel;
-    char *initrd;
-    char *append;
     char *dtb;
     char *dumpdtb;
     int phandle_start;

include/hw/boards.h struct MachineState { · line 114

Quoted 5 lines
include/hw/boards.h +1 -1
@@ -123,7 +111,13 @@ struct MachineState {
     bool usb;
     char *firmware;
 
-    QEMUMachineInitArgs init_args;
+    const MachineClass *machine;

Why not drop ^^^? User should use MACHINE_GET_CLASS() instead. Like this:

hw/i386/pc_piix.c +2 -1
index 4fbdaaa..1bedb09 100644
@@ -145,9 +145,10 @@ static void pc_init1(MachineState *ms,
     guest_info->isapc_ram_fw = !pci_enabled;
 
     if (smbios_defaults) {
+        MachineClass *mc = MACHINE_GET_CLASS(ms);
         /* These values are guest ABI, do not change */
         smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)",
-                            ms->machine->name, smbios_legacy_mode);
+                            mc->name, smbios_legacy_mode);
     }
 
     /* allocate ram and load rom/bios */
hw/i386/pc_q35.c +2 -1
index 315cfe5..df13a9e 100644
@@ -132,9 +132,10 @@ static void pc_q35_init(MachineState *ms)
     guest_info->has_acpi_build = has_acpi_build;
 
     if (smbios_defaults) {
+        MachineClass *mc = MACHINE_GET_CLASS(ms);
         /* These values are guest ABI, do not change */
         smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)",
-                            ms->machine->name, smbios_legacy_mode);
+                            mc->name, smbios_legacy_mode);
     }
 
     /* allocate ram and load rom/bios */
include/hw/boards.h renamed from include// +0 -1
index 789a0c2..b62de4a 100644
@@ -112,7 +112,6 @@ struct MachineState {
     bool usb;
     char *firmware;
 
-    const MachineClass *machine;
     ram_addr_t ram_size;
     const char *boot_order;
     const char *kernel_filename;
vl.c +0 -1
index 211efec..2de90fb 100644
@@ -4420,7 +4420,6 @@ int main(int argc, char **argv, char **envp)
 
     qdev_machine_init();
 
-    current_machine->machine = machine_class;
     current_machine->ram_size = ram_size;
     current_machine->boot_order = boot_order;
     current_machine->kernel_filename = kernel_filename;

include/hw/boards.h struct MachineState { · line 123

Quoted 9 lines
include/hw/boards.h +6 -0
+    ram_addr_t ram_size;
+    const char *boot_order;
+    const char *kernel_filename;
+    const char *kernel_cmdline;
+    const char *initrd_filename;
+    const char *cpu_model;
 };
 
 #endif

I've reviewed all targets, it looks good.
+1 to afaerber's comment s/ms/machine/

Signature · 2 lines
Regards,
  Igor
#9 lore raw

Re: [Qemu-devel] [PATCH 1/4] machine: conversion of QEMUMachineInitArgs to MachineState

Am 16.05.2014 16:39, schrieb Igor Mammedov:

Quoted 17 lines
Quoted 5 lines · On Wed, 7 May 2014 17:42:57 +0300 Marcel Apfelbaum <[email protected]> wrote:

Total removal of QEMUMachineInitArgs struct. QEMUMachineInitArgs's fields are copied into MachineState. Removed duplicated fields from MachineState.

All the other changes are only mechanical refactoring, no semantic changes.

Quoted 9 lines

---
- I am perfectly aware that patches touching a lot of files

     are not desirable, but this one is a very simple replacement
     patch:
       QEMUMachineInitArgs -> MachineState
       args -> ms

- This is the simplest way to get rid of QEMUMachineInitArgs fast.

Quoted 1 line

Patch doesn't apply cleanly on current master

patch -p1 applied all hunks ...

Quoted 11 lines

[...]

hw/i386/xen_machine_pv.c

Quoted 7 lines

#define PC_Q35_MACHINE_OPTIONS \

hw/i386/xen_machine_pv.c +0 -0
index 9adb57f..fb7a817 100644
@@ -28,11 +28,11 @@

^^^ file was moved

... and prompted for the hw/xenpv/xen_machine_pv.c path.

Quoted 2 lines

I've reviewed all targets, it looks good.
+1 to afaerber's comment s/ms/machine/

4 "args->" were missed in exynos4_boards.c debug output.

for f in hw/*/*.c; do
sed -i 's/*ms\\)/*machine\\)/g' $f
sed -i 's/*ms,/*machine,/g' $f
sed -i 's/ ms->/ machine->/g' $f
sed -i 's/(ms->/(machine->/g' $f
sed -i 's/!ms->/!machine->/g' $f
sed -i 's/(ms)/(machine)/g' $f
sed -i 's/(ms,/(machine,/g' $f
sed -i 's/ ms,/ machine,/g' $f
sed -i 's/, ms)/, machine)/g' $f
done
git checkout -- hw/ppc/ppc4xx_pci.c # false "(ms," positive

highbank.c had a conflicting "machine" argument -> machine_id.

e500.c needed tweaking due to passing ms in a struct. And it was shallow-copying *ms, which must not be done for QOM. Passing the pointer instead.

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
hw/alpha/dp264.c +6 -6
index ab4647a..b178a03 100644
@@ -43,13 +43,13 @@ static int clipper_pci_map_irq(PCIDevice *d, int irq_num)
     return (slot + 1) * 4 + irq_num;
 }
 
-static void clipper_init(MachineState *ms)
+static void clipper_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
     AlphaCPU *cpus[4];
     PCIBus *pci_bus;
     ISABus *isa_bus;
hw/arm/collie.c +5 -5
index 59715e1..ed7851f 100644
@@ -23,12 +23,12 @@ static struct arm_boot_info collie_binfo = {
     .ram_size = 0x20000000,
 };
 
-static void collie_init(MachineState *ms)
+static void collie_init(MachineState *machine)
 {
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
     StrongARMState *s;
     DriveInfo *dinfo;
     MemoryRegion *sysmem = get_system_memory();
hw/arm/cubieboard.c +6 -5
index ea4c2ab..e2260e3 100644
@@ -30,7 +30,7 @@ typedef struct CubieBoardState {
     MemoryRegion sdram;
 } CubieBoardState;
 
-static void cubieboard_init(MachineState *ms)
+static void cubieboard_init(MachineState *machine)
 {
     CubieBoardState *s = g_new(CubieBoardState, 1);
     Error *err = NULL;
@@ -63,14 +63,15 @@ static void cubieboard_init(MachineState *ms)
         exit(1);
     }
 
-    memory_region_init_ram(&s->sdram, NULL, "cubieboard.ram", ms->ram_size);
+    memory_region_init_ram(&s->sdram, NULL, "cubieboard.ram",
+                           machine->ram_size);
     vmstate_register_ram_global(&s->sdram);
     memory_region_add_subregion(get_system_memory(), AW_A10_SDRAM_BASE,
                                 &s->sdram);
 
-    cubieboard_binfo.ram_size = ms->ram_size;
-    cubieboard_binfo.kernel_filename = ms->kernel_filename;
-    cubieboard_binfo.kernel_cmdline = ms->kernel_cmdline;
+    cubieboard_binfo.ram_size = machine->ram_size;
+    cubieboard_binfo.kernel_filename = machine->kernel_filename;
+    cubieboard_binfo.kernel_cmdline = machine->kernel_cmdline;
     arm_load_kernel(&s->a10->cpu, &cubieboard_binfo);
 }
 
hw/arm/digic_boards.c +1 -1
index cb905f9..d1424ee 100644
@@ -143,7 +143,7 @@ static DigicBoard digic4_board_canon_a1100 = {
     .rom1_def_filename = "canon-a1100-rom1.bin",
 };
 
-static void canon_a1100_init(MachineState *ms)
+static void canon_a1100_init(MachineState *machine)
 {
     digic4_board_init(&digic4_board_canon_a1100);
 }
hw/arm/exynos4_boards.c +11 -11
index 688f117..d644db1 100644
@@ -94,7 +94,7 @@ static void lan9215_init(uint32_t base, qemu_irq irq)
     }
 }
 
-static Exynos4210State *exynos4_boards_init_common(MachineState *ms,
+static Exynos4210State *exynos4_boards_init_common(MachineState *machine,
                                                    Exynos4BoardType board_type)
 {
     if (smp_cpus != EXYNOS4210_NCPUS && !qtest_enabled()) {
@@ -108,9 +108,9 @@ static Exynos4210State *exynos4_boards_init_common(MachineState *ms,
     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.kernel_filename = ms->kernel_filename;
-    exynos4_board_binfo.initrd_filename = ms->initrd_filename;
-    exynos4_board_binfo.kernel_cmdline = ms->kernel_cmdline;
+    exynos4_board_binfo.kernel_filename = machine->kernel_filename;
+    exynos4_board_binfo.initrd_filename = machine->initrd_filename;
+    exynos4_board_binfo.kernel_cmdline = machine->kernel_cmdline;
     exynos4_board_binfo.gic_cpu_if_addr =
             EXYNOS4210_SMP_PRIVATE_BASE_ADDR + 0x100;
 
@@ -120,24 +120,24 @@ static Exynos4210State *exynos4_boards_init_common(MachineState *ms,
             " initrd_filename: %s\n",
             exynos4_board_ram_size[board_type] / 1048576,
             exynos4_board_ram_size[board_type],
-            args->kernel_filename,
-            args->kernel_cmdline,
-            args->initrd_filename);
+            machine->kernel_filename,
+            machine->kernel_cmdline,
+            machine->initrd_filename);
 
     return exynos4210_init(get_system_memory(),
             exynos4_board_ram_size[board_type]);
 }
 
-static void nuri_init(MachineState *ms)
+static void nuri_init(MachineState *machine)
 {
-    exynos4_boards_init_common(ms, EXYNOS4_BOARD_NURI);
+    exynos4_boards_init_common(machine, EXYNOS4_BOARD_NURI);
 
     arm_load_kernel(ARM_CPU(first_cpu), &exynos4_board_binfo);
 }
 
-static void smdkc210_init(MachineState *ms)
+static void smdkc210_init(MachineState *machine)
 {
-    Exynos4210State *s = exynos4_boards_init_common(ms,
+    Exynos4210State *s = exynos4_boards_init_common(machine,
                                                     EXYNOS4_BOARD_SMDKC210);
 
     lan9215_init(SMDK_LAN9118_BASE_ADDR,
hw/arm/gumstix.c +3 -3
index 9caf554..3f8465e 100644
@@ -46,7 +46,7 @@
 
 static const int sector_len = 128 * 1024;
 
-static void connex_init(MachineState *ms)
+static void connex_init(MachineState *machine)
 {
     PXA2xxState *cpu;
     DriveInfo *dinfo;
@@ -83,9 +83,9 @@ static void connex_init(MachineState *ms)
                     qdev_get_gpio_in(cpu->gpio, 36));
 }
 
-static void verdex_init(MachineState *ms)
+static void verdex_init(MachineState *machine)
 {
-    const char *cpu_model = ms->cpu_model;
+    const char *cpu_model = machine->cpu_model;
     PXA2xxState *cpu;
     DriveInfo *dinfo;
     int be;
hw/arm/highbank.c +12 -12
index 423496f..8340434 100644
@@ -199,13 +199,13 @@ enum cxmachines {
  * 32-bit host, set the reg value of memory to 0xf7ff00000 in the
  * device tree and pass -m 2047 to QEMU.
  */
-static void calxeda_init(MachineState *ms, enum cxmachines machine)
+static void calxeda_init(MachineState *machine, enum cxmachines machine_id)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
     DeviceState *dev = NULL;
     SysBusDevice *busdev;
     qemu_irq pic[128];
@@ -217,7 +217,7 @@ static void calxeda_init(MachineState *ms, enum cxmachines machine)
     char *sysboot_filename;
 
     if (!cpu_model) {
-        switch (machine) {
+        switch (machine_id) {
         case CALXEDA_HIGHBANK:
             cpu_model = "cortex-a9";
             break;
@@ -274,7 +274,7 @@ static void calxeda_init(MachineState *ms, enum cxmachines machine)
         }
     }
 
-    switch (machine) {
+    switch (machine_id) {
     case CALXEDA_HIGHBANK:
         dev = qdev_create(NULL, "l2x0");
         qdev_init_nofail(dev);
@@ -359,14 +359,14 @@ static void calxeda_init(MachineState *ms, enum cxmachines machine)
     arm_load_kernel(ARM_CPU(first_cpu), &highbank_binfo);
 }
 
-static void highbank_init(MachineState *ms)
+static void highbank_init(MachineState *machine)
 {
-    calxeda_init(ms, CALXEDA_HIGHBANK);
+    calxeda_init(machine, CALXEDA_HIGHBANK);
 }
 
-static void midway_init(MachineState *ms)
+static void midway_init(MachineState *machine)
 {
-    calxeda_init(ms, CALXEDA_MIDWAY);
+    calxeda_init(machine, CALXEDA_MIDWAY);
 }
 
 static QEMUMachine highbank_machine = {
hw/arm/integratorcp.c +6 -6
index 05884e4..0e476c3 100644
@@ -461,13 +461,13 @@ static struct arm_boot_info integrator_binfo = {
     .board_id = 0x113,
 };
 
-static void integratorcp_init(MachineState *ms)
+static void integratorcp_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
     ARMCPU *cpu;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
hw/arm/kzm.c +6 -6
index dca3b74..0555d12 100644
@@ -70,13 +70,13 @@ static struct arm_boot_info kzm_binfo = {
     .board_id = 1722,
 };
 
-static void kzm_init(MachineState *ms)
+static void kzm_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
     ARMCPU *cpu;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
hw/arm/mainstone.c +7 -7
index de1cdcb..44f1873 100644
@@ -105,7 +105,7 @@ static struct arm_boot_info mainstone_binfo = {
 };
 
 static void mainstone_common_init(MemoryRegion *address_space_mem,
-                                  MachineState *ms,
+                                  MachineState *machine,
                                   enum mainstone_model_e model, int arm_id)
 {
     uint32_t sector_len = 256 * 1024;
@@ -116,7 +116,7 @@ static void mainstone_common_init(MemoryRegion *address_space_mem,
     int i;
     int be;
     MemoryRegion *rom = g_new(MemoryRegion, 1);
-    const char *cpu_model = ms->cpu_model;
+    const char *cpu_model = machine->cpu_model;
 
     if (!cpu_model)
         cpu_model = "pxa270-c5";
@@ -175,16 +175,16 @@ static void mainstone_common_init(MemoryRegion *address_space_mem,
     smc91c111_init(&nd_table[0], MST_ETH_PHYS,
                     qdev_get_gpio_in(mst_irq, ETHERNET_IRQ));
 
-    mainstone_binfo.kernel_filename = ms->kernel_filename;
-    mainstone_binfo.kernel_cmdline = ms->kernel_cmdline;
-    mainstone_binfo.initrd_filename = ms->initrd_filename;
+    mainstone_binfo.kernel_filename = machine->kernel_filename;
+    mainstone_binfo.kernel_cmdline = machine->kernel_cmdline;
+    mainstone_binfo.initrd_filename = machine->initrd_filename;
     mainstone_binfo.board_id = arm_id;
     arm_load_kernel(mpu->cpu, &mainstone_binfo);
 }
 
-static void mainstone_init(MachineState *ms)
+static void mainstone_init(MachineState *machine)
 {
-    mainstone_common_init(get_system_memory(), ms, mainstone, 0x196);
+    mainstone_common_init(get_system_memory(), machine, mainstone, 0x196);
 }
 
 static QEMUMachine mainstone2_machine = {
hw/arm/musicpal.c +5 -5
index 0b95ca5..6a134f2 100644
@@ -1569,12 +1569,12 @@ static struct arm_boot_info musicpal_binfo = {
     .board_id = 0x20e,
 };
 
-static void musicpal_init(MachineState *ms)
+static void musicpal_init(MachineState *machine)
 {
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
     ARMCPU *cpu;
     qemu_irq pic[32];
     DeviceState *dev;
hw/arm/nseries.c +11 -11
index ae097d6..82772c6 100644
@@ -1278,14 +1278,14 @@ static int n810_atag_setup(const struct arm_boot_info *info, void *p)
     return n8x0_atag_setup(p, 810);
 }
 
-static void n8x0_init(MachineState *ms,
+static void n8x0_init(MachineState *machine,
                       struct arm_boot_info *binfo, int model)
 {
     MemoryRegion *sysmem = get_system_memory();
     struct n800_s *s = (struct n800_s *) g_malloc0(sizeof(*s));
     int sdram_size = binfo->ram_size;
 
-    s->mpu = omap2420_mpu_init(sysmem, sdram_size, ms->cpu_model);
+    s->mpu = omap2420_mpu_init(sysmem, sdram_size, machine->cpu_model);
 
     /* Setup peripherals
      *
@@ -1329,18 +1329,18 @@ static void n8x0_init(MachineState *ms,
         n8x0_usb_setup(s);
     }
 
-    if (ms->kernel_filename) {
+    if (machine->kernel_filename) {
         /* Or at the linux loader.  */
-        binfo->kernel_filename = ms->kernel_filename;
-        binfo->kernel_cmdline = ms->kernel_cmdline;
-        binfo->initrd_filename = ms->initrd_filename;
+        binfo->kernel_filename = machine->kernel_filename;
+        binfo->kernel_cmdline = machine->kernel_cmdline;
+        binfo->initrd_filename = machine->initrd_filename;
         arm_load_kernel(s->mpu->cpu, binfo);
 
         qemu_register_reset(n8x0_boot_init, s);
     }
 
     if (option_rom[0].name &&
-        (ms->boot_order[0] == 'n' || !ms->kernel_filename)) {
+        (machine->boot_order[0] == 'n' || !machine->kernel_filename)) {
         uint8_t nolo_tags[0x10000];
         /* No, wait, better start at the ROM.  */
         s->mpu->cpu->env.regs[15] = OMAP2_Q2_BASE + 0x400000;
@@ -1382,14 +1382,14 @@ static struct arm_boot_info n810_binfo = {
     .atag_board = n810_atag_setup,
 };
 
-static void n800_init(MachineState *ms)
+static void n800_init(MachineState *machine)
 {
-    return n8x0_init(ms, &n800_binfo, 800);
+    return n8x0_init(machine, &n800_binfo, 800);
 }
 
-static void n810_init(MachineState *ms)
+static void n810_init(MachineState *machine)
 {
-    return n8x0_init(ms, &n810_binfo, 810);
+    return n8x0_init(machine, &n810_binfo, 810);
 }
 
 static QEMUMachine n800_machine = {
hw/arm/omap_sx1.c +11 -10
index 75b414b..b4f6da6 100644
@@ -98,7 +98,7 @@ static struct arm_boot_info sx1_binfo = {
     .board_id = 0x265,
 };
 
-static void sx1_init(MachineState *ms, const int version)
+static void sx1_init(MachineState *machine, const int version)
 {
     struct omap_mpu_state_s *mpu;
     MemoryRegion *address_space = get_system_memory();
@@ -118,7 +118,8 @@ static void sx1_init(MachineState *ms, const int version)
         flash_size = flash2_size;
     }
 
-    mpu = omap310_mpu_init(address_space, sx1_binfo.ram_size, ms->cpu_model);
+    mpu = omap310_mpu_init(address_space, sx1_binfo.ram_size,
+                           machine->cpu_model);
 
     /* External Flash (EMIFS) */
     memory_region_init_ram(flash, NULL, "omap_sx1.flash0-0", flash_size);
@@ -189,29 +190,29 @@ static void sx1_init(MachineState *ms, const int version)
                                 OMAP_CS1_BASE, &cs[1]);
     }
 
-    if (!ms->kernel_filename && !fl_idx && !qtest_enabled()) {
+    if (!machine->kernel_filename && !fl_idx && !qtest_enabled()) {
         fprintf(stderr, "Kernel or Flash image must be specified\n");
         exit(1);
     }
 
     /* Load the kernel.  */
-    sx1_binfo.kernel_filename = ms->kernel_filename;
-    sx1_binfo.kernel_cmdline = ms->kernel_cmdline;
-    sx1_binfo.initrd_filename = ms->initrd_filename;
+    sx1_binfo.kernel_filename = machine->kernel_filename;
+    sx1_binfo.kernel_cmdline = machine->kernel_cmdline;
+    sx1_binfo.initrd_filename = machine->initrd_filename;
     arm_load_kernel(mpu->cpu, &sx1_binfo);
 
     /* TODO: fix next line */
     //~ qemu_console_resize(ds, 640, 480);
 }
 
-static void sx1_init_v1(MachineState *ms)
+static void sx1_init_v1(MachineState *machine)
 {
-    sx1_init(ms, 1);
+    sx1_init(machine, 1);
 }
 
-static void sx1_init_v2(MachineState *ms)
+static void sx1_init_v2(MachineState *machine)
 {
-    sx1_init(ms, 2);
+    sx1_init(machine, 2);
 }
 
 static QEMUMachine sx1_machine_v2 = {
hw/arm/palm.c +5 -5
index 1e1f47d..e61995f 100644
@@ -191,12 +191,12 @@ static struct arm_boot_info palmte_binfo = {
     .board_id = 0x331,
 };
 
-static void palmte_init(MachineState *ms)
+static void palmte_init(MachineState *machine)
 {
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
     MemoryRegion *address_space_mem = get_system_memory();
     struct omap_mpu_state_s *mpu;
     int flash_size = 0x00800000;
hw/arm/realview.c +22 -22

88 lines not on this page · raw message

hw/arm/spitz.c +13 -13
index b116f00..5455dbf 100644
@@ -887,14 +887,14 @@ static struct arm_boot_info spitz_binfo = {
     .ram_size = 0x04000000,
 };
 
-static void spitz_common_init(MachineState *ms,
+static void spitz_common_init(MachineState *machine,
                               enum spitz_model_e model, int arm_id)
 {
     PXA2xxState *mpu;
     DeviceState *scp0, *scp1 = NULL;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *rom = g_new(MemoryRegion, 1);
-    const char *cpu_model = ms->cpu_model;
+    const char *cpu_model = machine->cpu_model;
 
     if (!cpu_model)
         cpu_model = (model == terrier) ? "pxa270-c5" : "pxa270-c0";
@@ -935,32 +935,32 @@ static void spitz_common_init(MachineState *ms,
         /* A 4.0 GB microdrive is permanently sitting in CF slot 0.  */
         spitz_microdrive_attach(mpu, 0);
 
-    spitz_binfo.kernel_filename = ms->kernel_filename;
-    spitz_binfo.kernel_cmdline = ms->kernel_cmdline;
-    spitz_binfo.initrd_filename = ms->initrd_filename;
+    spitz_binfo.kernel_filename = machine->kernel_filename;
+    spitz_binfo.kernel_cmdline = machine->kernel_cmdline;
+    spitz_binfo.initrd_filename = machine->initrd_filename;
     spitz_binfo.board_id = arm_id;
     arm_load_kernel(mpu->cpu, &spitz_binfo);
     sl_bootparam_write(SL_PXA_PARAM_BASE);
 }
 
-static void spitz_init(MachineState *ms)
+static void spitz_init(MachineState *machine)
 {
-    spitz_common_init(ms, spitz, 0x2c9);
+    spitz_common_init(machine, spitz, 0x2c9);
 }
 
-static void borzoi_init(MachineState *ms)
+static void borzoi_init(MachineState *machine)
 {
-    spitz_common_init(ms, borzoi, 0x33f);
+    spitz_common_init(machine, borzoi, 0x33f);
 }
 
-static void akita_init(MachineState *ms)
+static void akita_init(MachineState *machine)
 {
-    spitz_common_init(ms, akita, 0x2e8);
+    spitz_common_init(machine, akita, 0x2e8);
 }
 
-static void terrier_init(MachineState *ms)
+static void terrier_init(MachineState *machine)
 {
-    spitz_common_init(ms, terrier, 0x33f);
+    spitz_common_init(machine, terrier, 0x33f);
 }
 
 static QEMUMachine akitapda_machine = {
hw/arm/stellaris.c +6 -6
index 2350fab..3b7a27a 100644
@@ -1333,17 +1333,17 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model,
 }
 
 /* FIXME: Figure out how to generate these from stellaris_boards.  */
-static void lm3s811evb_init(MachineState *ms)
+static void lm3s811evb_init(MachineState *machine)
 {
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
     stellaris_init(kernel_filename, cpu_model, &stellaris_boards[0]);
 }
 
-static void lm3s6965evb_init(MachineState *ms)
+static void lm3s6965evb_init(MachineState *machine)
 {
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
     stellaris_init(kernel_filename, cpu_model, &stellaris_boards[1]);
 }
 
hw/arm/tosa.c +5 -5
index 2fbeaf5..abc0f2a 100644
@@ -211,12 +211,12 @@ static struct arm_boot_info tosa_binfo = {
     .ram_size = 0x04000000,
 };
 
-static void tosa_init(MachineState *ms)
+static void tosa_init(MachineState *machine)
 {
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *rom = g_new(MemoryRegion, 1);
     PXA2xxState *mpu;
hw/arm/versatilepb.c +13 -13
index acca596..dea5fc7 100644
@@ -173,7 +173,7 @@ static int vpb_sic_init(SysBusDevice *sbd)
 
 static struct arm_boot_info versatile_binfo;
 
-static void versatile_init(MachineState *ms, int board_id)
+static void versatile_init(MachineState *machine, int board_id)
 {
     ARMCPU *cpu;
     MemoryRegion *sysmem = get_system_memory();
@@ -190,15 +190,15 @@ static void versatile_init(MachineState *ms, int board_id)
     int done_smc = 0;
     DriveInfo *dinfo;
 
-    if (!ms->cpu_model) {
-        ms->cpu_model = "arm926";
+    if (!machine->cpu_model) {
+        machine->cpu_model = "arm926";
     }
-    cpu = cpu_arm_init(ms->cpu_model);
+    cpu = cpu_arm_init(machine->cpu_model);
     if (!cpu) {
         fprintf(stderr, "Unable to find CPU definition\n");
         exit(1);
     }
-    memory_region_init_ram(ram, NULL, "versatile.ram", ms->ram_size);
+    memory_region_init_ram(ram, NULL, "versatile.ram", machine->ram_size);
     vmstate_register_ram_global(ram);
     /* ??? RAM should repeat to fill physical memory space.  */
     /* SDRAM at address zero.  */
@@ -344,22 +344,22 @@ static void versatile_init(MachineState *ms, int board_id)
         fprintf(stderr, "qemu: Error registering flash memory.\n");
     }
 
-    versatile_binfo.ram_size = ms->ram_size;
-    versatile_binfo.kernel_filename = ms->kernel_filename;
-    versatile_binfo.kernel_cmdline = ms->kernel_cmdline;
-    versatile_binfo.initrd_filename = ms->initrd_filename;
+    versatile_binfo.ram_size = machine->ram_size;
+    versatile_binfo.kernel_filename = machine->kernel_filename;
+    versatile_binfo.kernel_cmdline = machine->kernel_cmdline;
+    versatile_binfo.initrd_filename = machine->initrd_filename;
     versatile_binfo.board_id = board_id;
     arm_load_kernel(cpu, &versatile_binfo);
 }
 
-static void vpb_init(MachineState *ms)
+static void vpb_init(MachineState *machine)
 {
-    versatile_init(ms, 0x183);
+    versatile_init(machine, 0x183);
 }
 
-static void vab_init(MachineState *ms)
+static void vab_init(MachineState *machine)
 {
-    versatile_init(ms, 0x25e);
+    versatile_init(machine, 0x25e);
 }
 
 static QEMUMachine versatilepb_machine = {
hw/arm/vexpress.c +11 -10
index 1051387..33ff422 100644
@@ -509,7 +509,7 @@ static pflash_t *ve_pflash_cfi01_register(hwaddr base, const char *name,
 }
 
 static void vexpress_common_init(VEDBoardInfo *daughterboard,
-                                 MachineState *ms)
+                                 MachineState *machine)
 {
     DeviceState *dev, *sysctl, *pl041;
     qemu_irq pic[64];
@@ -525,7 +525,8 @@ static void vexpress_common_init(VEDBoardInfo *daughterboard,
     const hwaddr *map = daughterboard->motherboard_map;
     int i;
 
-    daughterboard->init(daughterboard, ms->ram_size, ms->cpu_model, pic);
+    daughterboard->init(daughterboard, machine->ram_size, machine->cpu_model,
+                        pic);
 
     /* Motherboard peripherals: the wiring is the same but the
      * addresses vary between the legacy and A-Series memory maps.
@@ -639,10 +640,10 @@ static void vexpress_common_init(VEDBoardInfo *daughterboard,
                              pic[40 + i]);
     }
 
-    daughterboard->bootinfo.ram_size = ms->ram_size;
-    daughterboard->bootinfo.kernel_filename = ms->kernel_filename;
-    daughterboard->bootinfo.kernel_cmdline = ms->kernel_cmdline;
-    daughterboard->bootinfo.initrd_filename = ms->initrd_filename;
+    daughterboard->bootinfo.ram_size = machine->ram_size;
+    daughterboard->bootinfo.kernel_filename = machine->kernel_filename;
+    daughterboard->bootinfo.kernel_cmdline = machine->kernel_cmdline;
+    daughterboard->bootinfo.initrd_filename = machine->initrd_filename;
     daughterboard->bootinfo.nb_cpus = smp_cpus;
     daughterboard->bootinfo.board_id = VEXPRESS_BOARD_ID;
     daughterboard->bootinfo.loader_start = daughterboard->loader_start;
@@ -653,14 +654,14 @@ static void vexpress_common_init(VEDBoardInfo *daughterboard,
     arm_load_kernel(ARM_CPU(first_cpu), &daughterboard->bootinfo);
 }
 
-static void vexpress_a9_init(MachineState *ms)
+static void vexpress_a9_init(MachineState *machine)
 {
-    vexpress_common_init(&a9_daughterboard, ms);
+    vexpress_common_init(&a9_daughterboard, machine);
 }
 
-static void vexpress_a15_init(MachineState *ms)
+static void vexpress_a15_init(MachineState *machine)
 {
-    vexpress_common_init(&a15_daughterboard, ms);
+    vexpress_common_init(&a15_daughterboard, machine);
 }
 
 static QEMUMachine vexpress_a9_machine = {
hw/arm/virt.c +8 -8
index 8399e81..3b55a4b 100644
@@ -383,13 +383,13 @@ static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size)
     return board->fdt;
 }
 
-static void machvirt_init(MachineState *ms)
+static void machvirt_init(MachineState *machine)
 {
     qemu_irq pic[NUM_IRQS];
     MemoryRegion *sysmem = get_system_memory();
     int n;
     MemoryRegion *ram = g_new(MemoryRegion, 1);
-    const char *cpu_model = ms->cpu_model;
+    const char *cpu_model = machine->cpu_model;
     VirtBoardInfo *vbi;
 
     if (!cpu_model) {
@@ -415,7 +415,7 @@ static void machvirt_init(MachineState *ms)
         exit(1);
     }
 
-    if (ms->ram_size > vbi->memmap[VIRT_MEM].size) {
+    if (machine->ram_size > vbi->memmap[VIRT_MEM].size) {
         error_report("mach-virt: cannot model more than 30GB RAM");
         exit(1);
     }
@@ -447,7 +447,7 @@ static void machvirt_init(MachineState *ms)
     }
     fdt_add_cpu_nodes(vbi);
 
-    memory_region_init_ram(ram, NULL, "mach-virt.ram", ms->ram_size);
+    memory_region_init_ram(ram, NULL, "mach-virt.ram", machine->ram_size);
     vmstate_register_ram_global(ram);
     memory_region_add_subregion(sysmem, vbi->memmap[VIRT_MEM].base, ram);
 
@@ -461,10 +461,10 @@ static void machvirt_init(MachineState *ms)
      */
     create_virtio_devices(vbi, pic);
 
-    vbi->bootinfo.ram_size = ms->ram_size;
-    vbi->bootinfo.kernel_filename = ms->kernel_filename;
-    vbi->bootinfo.kernel_cmdline = ms->kernel_cmdline;
-    vbi->bootinfo.initrd_filename = ms->initrd_filename;
+    vbi->bootinfo.ram_size = machine->ram_size;
+    vbi->bootinfo.kernel_filename = machine->kernel_filename;
+    vbi->bootinfo.kernel_cmdline = machine->kernel_cmdline;
+    vbi->bootinfo.initrd_filename = machine->initrd_filename;
     vbi->bootinfo.nb_cpus = smp_cpus;
     vbi->bootinfo.board_id = -1;
     vbi->bootinfo.loader_start = vbi->memmap[VIRT_MEM].base;
hw/arm/xilinx_zynq.c +6 -6
index bf64968..bae0416 100644
@@ -101,13 +101,13 @@ static inline void zynq_init_spi_flashes(uint32_t base_addr, qemu_irq irq,
 
 }
 
-static void zynq_init(MachineState *ms)
+static void zynq_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
     ObjectClass *cpu_oc;
     ARMCPU *cpu;
     MemoryRegion *address_space_mem = get_system_memory();
hw/arm/z2.c +5 -5
index bdab03a..ab9e4c9 100644
@@ -300,12 +300,12 @@ static const TypeInfo aer915_info = {
     .class_init    = aer915_class_init,
 };
 
-static void z2_init(MachineState *ms)
+static void z2_init(MachineState *machine)
 {
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
     MemoryRegion *address_space_mem = get_system_memory();
     uint32_t sector_len = 0x10000;
     PXA2xxState *mpu;
hw/core/null-machine.c +1 -1
index 6409bea..1ec7c3b 100644
@@ -15,7 +15,7 @@
 #include "hw/hw.h"
 #include "hw/boards.h"
 
-static void machine_none_init(MachineState *ms)
+static void machine_none_init(MachineState *machine)
 {
 }
 
hw/cris/axis_dev88.c +5 -5
index e20161e..1849338 100644
@@ -243,12 +243,12 @@ static const MemoryRegionOps gpio_ops = {
 static struct cris_load_info li;
 
 static
-void axisdev88_init(MachineState *ms)
+void axisdev88_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
     CRISCPU *cpu;
     CPUCRISState *env;
     DeviceState *dev;
hw/i386/pc_piix.c +54 -54

240 lines not on this page · raw message

hw/i386/pc_q35.c +33 -33

149 lines not on this page · raw message

hw/lm32/lm32_boards.c +8 -8
index fb66f67..0e01340 100644
@@ -69,10 +69,10 @@ static void main_cpu_reset(void *opaque)
     env->deba = reset_info->flash_base;
 }
 
-static void lm32_evr_init(MachineState *ms)
+static void lm32_evr_init(MachineState *machine)
 {
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
     LM32CPU *cpu;
     CPULM32State *env;
     DriveInfo *dinfo;
@@ -162,12 +162,12 @@ static void lm32_evr_init(MachineState *ms)
     qemu_register_reset(main_cpu_reset, reset_info);
 }
 
-static void lm32_uclinux_init(MachineState *ms)
+static void lm32_uclinux_init(MachineState *machine)
 {
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
     LM32CPU *cpu;
     CPULM32State *env;
     DriveInfo *dinfo;
hw/lm32/milkymist.c +5 -5
index 7438a79..81c3933 100644
@@ -74,12 +74,12 @@ static void main_cpu_reset(void *opaque)
 }
 
 static void
-milkymist_init(MachineState *ms)
+milkymist_init(MachineState *machine)
 {
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
     LM32CPU *cpu;
     CPULM32State *env;
     int kernel_size;
hw/m68k/an5206.c +4 -4
index 7814dc9..684496a 100644
@@ -20,11 +20,11 @@
 
 /* Board init.  */
 
-static void an5206_init(MachineState *ms)
+static void an5206_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
     M68kCPU *cpu;
     CPUM68KState *env;
     int kernel_size;
hw/m68k/dummy_m68k.c +4 -4
index e87f8b6..6db1b71 100644
@@ -16,11 +16,11 @@
 
 /* Board init.  */
 
-static void dummy_m68k_init(MachineState *ms)
+static void dummy_m68k_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
     CPUM68KState *env;
     MemoryRegion *address_space_mem =  get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
hw/m68k/mcf5208.c +4 -4
index 26c6ee9..2ef617f 100644
@@ -188,11 +188,11 @@ static void mcf5208_sys_init(MemoryRegion *address_space, qemu_irq *pic)
     }
 }
 
-static void mcf5208evb_init(MachineState *ms)
+static void mcf5208evb_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
     M68kCPU *cpu;
     CPUM68KState *env;
     int kernel_size;
hw/microblaze/petalogix_ml605_mmu.c +3 -3
index 1b3d3ed..496330c 100644
@@ -79,9 +79,9 @@ static void machine_cpu_reset(MicroBlazeCPU *cpu)
 }
 
 static void
-petalogix_ml605_init(MachineState *ms)
+petalogix_ml605_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
+    ram_addr_t ram_size = machine->ram_size;
     MemoryRegion *address_space_mem = get_system_memory();
     DeviceState *dev, *dma, *eth0;
     Object *ds, *cs;
@@ -202,7 +202,7 @@ petalogix_ml605_init(MachineState *ms)
     }
 
     microblaze_load_kernel(cpu, ddr_base, ram_size,
-                           ms->initrd_filename,
+                           machine->initrd_filename,
                            BINARY_DEVICE_TREE_FILE,
                            machine_cpu_reset);
 
hw/microblaze/petalogix_s3adsp1800_mmu.c +4 -4
index 683f7b3..49dc6d1 100644
@@ -59,10 +59,10 @@ static void machine_cpu_reset(MicroBlazeCPU *cpu)
 }
 
 static void
-petalogix_s3adsp1800_init(MachineState *ms)
+petalogix_s3adsp1800_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
     DeviceState *dev;
     MicroBlazeCPU *cpu;
     DriveInfo *dinfo;
@@ -128,7 +128,7 @@ petalogix_s3adsp1800_init(MachineState *ms)
     sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq[ETHLITE_IRQ]);
 
     microblaze_load_kernel(cpu, ddr_base, ram_size,
-                           ms->initrd_filename,
+                           machine->initrd_filename,
                            BINARY_DEVICE_TREE_FILE,
                            machine_cpu_reset);
 }
hw/mips/mips_fulong2e.c +6 -6
index b236ae9..5ad7a41 100644
@@ -259,13 +259,13 @@ static void cpu_request_exit(void *opaque, int irq, int level)
     }
 }
 
-static void mips_fulong2e_init(MachineState *ms)
+static void mips_fulong2e_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
     char *filename;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
hw/mips/mips_jazz.c +6 -6
index 53cad58..c113a80 100644
@@ -329,19 +329,19 @@ static void mips_jazz_init(MemoryRegion *address_space,
 }
 
 static
-void mips_magnum_init(MachineState *ms)
+void mips_magnum_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
         mips_jazz_init(get_system_memory(), get_system_io(),
                        ram_size, cpu_model, JAZZ_MAGNUM);
 }
 
 static
-void mips_pica61_init(MachineState *ms)
+void mips_pica61_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
     mips_jazz_init(get_system_memory(), get_system_io(),
                    ram_size, cpu_model, JAZZ_PICA61);
 }
hw/mips/mips_malta.c +6 -6
index a16ee92..9fe775e 100644
@@ -875,13 +875,13 @@ static void cpu_request_exit(void *opaque, int irq, int level)
 }
 
 static
-void mips_malta_init(MachineState *ms)
+void mips_malta_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
     char *filename;
     pflash_t *fl;
     MemoryRegion *system_memory = get_system_memory();
hw/mips/mips_mipssim.c +6 -6
index 7254adf..413e64d 100644
@@ -133,13 +133,13 @@ static void mipsnet_init(int base, qemu_irq irq, NICInfo *nd)
 }
 
 static void
-mips_mipssim_init(MachineState *ms)
+mips_mipssim_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
     char *filename;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *isa = g_new(MemoryRegion, 1);
hw/mips/mips_r4k.c +6 -6
index 7a69514..7120293 100644
@@ -153,13 +153,13 @@ static void main_cpu_reset(void *opaque)
 
 static const int sector_len = 32 * 1024;
 static
-void mips_r4k_init(MachineState *ms)
+void mips_r4k_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
     char *filename;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
hw/moxie/moxiesim.c +6 -6
index 6114478..f4357cf 100644
@@ -107,14 +107,14 @@ moxie_intc_create(hwaddr base, qemu_irq irq, int kind_of_intr)
     return dev;
 }
 
-static void moxiesim_init(MachineState *ms)
+static void moxiesim_init(MachineState *machine)
 {
     MoxieCPU *cpu = NULL;
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
     CPUMoxieState *env;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
hw/openrisc/openrisc_sim.c +4 -4
index 24bd3c3..b2b4f9b 100644
@@ -90,11 +90,11 @@ static void cpu_openrisc_load_kernel(ram_addr_t ram_size,
     }
 }
 
-static void openrisc_sim_init(MachineState *ms)
+static void openrisc_sim_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
     OpenRISCCPU *cpu = NULL;
     MemoryRegion *ram;
     int n;
hw/ppc/e500.c +22 -22

147 lines not on this page · raw message

hw/ppc/e500plat.c +2 -2
index 71e93d3..27df31d 100644
@@ -28,7 +28,7 @@ static void e500plat_fixup_devtree(PPCE500Params *params, void *fdt)
                      sizeof(compatible));
 }
 
-static void e500plat_init(MachineState *ms)
+static void e500plat_init(MachineState *machine)
 {
     PPCE500Params params = {
         .pci_first_slot = 0x1,
@@ -43,7 +43,7 @@ static void e500plat_init(MachineState *ms)
         params.mpic_version = OPENPIC_MODEL_FSL_MPIC_20;
     }
 
-    ppce500_init(ms, &params);
+    ppce500_init(machine, &params);
 }
 
 static QEMUMachine e500plat_machine = {
hw/ppc/mac_newworld.c +7 -7
index 4e9000d..4bdaa8d 100644
@@ -140,14 +140,14 @@ static void ppc_core99_reset(void *opaque)
 }
 
 /* PowerPC Mac99 hardware initialisation */
-static void ppc_core99_init(MachineState *ms)
+static void ppc_core99_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
-    const char *boot_device = ms->boot_order;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
+    const char *boot_device = machine->boot_order;
     PowerPCCPU *cpu = NULL;
     CPUPPCState *env = NULL;
     char *filename;
hw/ppc/mac_oldworld.c +7 -7
index 465fd37..77598e4 100644
@@ -71,14 +71,14 @@ static void ppc_heathrow_reset(void *opaque)
     cpu_reset(CPU(cpu));
 }
 
-static void ppc_heathrow_init(MachineState *ms)
+static void ppc_heathrow_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
-    const char *boot_device = ms->boot_order;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
+    const char *boot_device = machine->boot_order;
     MemoryRegion *sysmem = get_system_memory();
     PowerPCCPU *cpu = NULL;
     CPUPPCState *env = NULL;
hw/ppc/mpc8544ds.c +2 -2
index 2f6b1e3..b99f74a 100644
@@ -26,7 +26,7 @@ static void mpc8544ds_fixup_devtree(PPCE500Params *params, void *fdt)
                      sizeof(compatible));
 }
 
-static void mpc8544ds_init(MachineState *ms)
+static void mpc8544ds_init(MachineState *machine)
 {
     PPCE500Params params = {
         .pci_first_slot = 0x11,
@@ -35,7 +35,7 @@ static void mpc8544ds_init(MachineState *ms)
         .mpic_version = OPENPIC_MODEL_FSL_MPIC_20,
     };
 
-    ppce500_init(ms, &params);
+    ppce500_init(machine, &params);
 }
 
 
hw/ppc/ppc405_boards.c +9 -9
index b925343..98ad2d7 100644
@@ -172,12 +172,12 @@ static void ref405ep_fpga_init(MemoryRegion *sysmem, uint32_t base)
     qemu_register_reset(&ref405ep_fpga_reset, fpga);
 }
 
-static void ref405ep_init(MachineState *ms)
+static void ref405ep_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
     char *filename;
     ppc4xx_bd_info_t bd;
     CPUPPCState *env;
@@ -499,11 +499,11 @@ static void taihu_cpld_init(MemoryRegion *sysmem, uint32_t base)
     qemu_register_reset(&taihu_cpld_reset, cpld);
 }
 
-static void taihu_405ep_init(MachineState *ms)
+static void taihu_405ep_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *initrd_filename = ms->initrd_filename;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *initrd_filename = machine->initrd_filename;
     char *filename;
     qemu_irq *pic;
     MemoryRegion *sysmem = get_system_memory();
hw/ppc/ppc440_bamboo.c +6 -6
index 2b94750..81a06d3 100644
@@ -156,13 +156,13 @@ static void main_cpu_reset(void *opaque)
     mmubooke_create_initial_mapping(env, 0, 0);
 }
 
-static void bamboo_init(MachineState *ms)
+static void bamboo_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
     unsigned int pci_irq_nrs[4] = { 28, 27, 26, 25 };
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *isa = g_new(MemoryRegion, 1);
hw/ppc/prep.c +7 -7
index 62b845f..2383254 100644
@@ -364,14 +364,14 @@ static const MemoryRegionPortio prep_portio_list[] = {
 static PortioList prep_port_list;
 
 /* PowerPC PREP hardware initialisation */
-static void ppc_prep_init(MachineState *ms)
+static void ppc_prep_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
-    const char *boot_device = ms->boot_order;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
+    const char *boot_device = machine->boot_order;
     MemoryRegion *sysmem = get_system_memory();
     PowerPCCPU *cpu = NULL;
     CPUPPCState *env = NULL;
hw/ppc/spapr.c +7 -7
index 6b2dfd5..57e9578 100644
@@ -1140,14 +1140,14 @@ static SaveVMHandlers savevm_htab_handlers = {
 };
 
 /* pSeries LPAR / sPAPR hardware init */
-static void ppc_spapr_init(MachineState *ms)
+static void ppc_spapr_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
-    const char *boot_device = ms->boot_order;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
+    const char *boot_device = machine->boot_order;
     PowerPCCPU *cpu;
     CPUPPCState *env;
     PCIHostState *phb;
hw/ppc/virtex_ml507.c +8 -8
index b816b3c..02b4f82 100644
@@ -194,12 +194,12 @@ static int xilinx_load_device_tree(hwaddr addr,
     return fdt_size;
 }
 
-static void virtex_init(MachineState *ms)
+static void virtex_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
     hwaddr initrd_base = 0;
     int initrd_size = 0;
     MemoryRegion *address_space_mem = get_system_memory();
@@ -275,14 +275,14 @@ static void virtex_init(MachineState *ms)
         boot_info.ima_size = kernel_size;
 
         /* Load initrd. */
-        if (ms->initrd_filename) {
+        if (machine->initrd_filename) {
             initrd_base = high = ROUND_UP(high, 4);
-            initrd_size = load_image_targphys(ms->initrd_filename,
+            initrd_size = load_image_targphys(machine->initrd_filename,
                                               high, ram_size - high);
 
             if (initrd_size < 0) {
                 error_report("couldn't load ram disk '%s'",
-                             ms->initrd_filename);
+                             machine->initrd_filename);
                 exit(1);
             }
             high = ROUND_UP(high + initrd_size, 4);
hw/s390x/s390-virtio-ccw.c +5 -5
index 3d28045..42f5cec 100644
@@ -79,9 +79,9 @@ static void virtio_ccw_register_hcalls(void)
                                    virtio_ccw_hcall_early_printk);
 }
 
-static void ccw_init(MachineState *ms)
+static void ccw_init(MachineState *machine)
 {
-    ram_addr_t my_ram_size = ms->ram_size;
+    ram_addr_t my_ram_size = machine->ram_size;
     MemoryRegion *sysmem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
     int shift = 0;
@@ -102,8 +102,8 @@ static void ccw_init(MachineState *ms)
     /* get a BUS */
     css_bus = virtual_css_bus_init();
     s390_sclp_init();
-    s390_init_ipl_dev(ms->kernel_filename, ms->kernel_cmdline,
-                      ms->initrd_filename, "s390-ccw.img");
+    s390_init_ipl_dev(machine->kernel_filename, machine->kernel_cmdline,
+                      machine->initrd_filename, "s390-ccw.img");
     s390_flic_init();
 
     /* register hypercalls */
@@ -118,7 +118,7 @@ static void ccw_init(MachineState *ms)
     storage_keys = g_malloc0(my_ram_size / TARGET_PAGE_SIZE);
 
     /* init CPUs */
-    s390_init_cpus(ms->cpu_model, storage_keys);
+    s390_init_cpus(machine->cpu_model, storage_keys);
 
     if (kvm_enabled()) {
         kvm_s390_enable_css_support(s390_cpu_addr2state(0));
hw/s390x/s390-virtio.c +5 -5
index 19443d2..93c7ace 100644
@@ -224,9 +224,9 @@ void s390_create_virtio_net(BusState *bus, const char *name)
 }
 
 /* PC hardware initialisation */
-static void s390_init(MachineState *ms)
+static void s390_init(MachineState *machine)
 {
-    ram_addr_t my_ram_size = ms->ram_size;
+    ram_addr_t my_ram_size = machine->ram_size;
     MemoryRegion *sysmem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
     int shift = 0;
@@ -248,8 +248,8 @@ static void s390_init(MachineState *ms)
     /* get a BUS */
     s390_bus = s390_virtio_bus_init(&my_ram_size);
     s390_sclp_init();
-    s390_init_ipl_dev(ms->kernel_filename, ms->kernel_cmdline,
-                      ms->initrd_filename, ZIPL_FILENAME);
+    s390_init_ipl_dev(machine->kernel_filename, machine->kernel_cmdline,
+                      machine->initrd_filename, ZIPL_FILENAME);
     s390_flic_init();
 
     /* register hypercalls */
@@ -273,7 +273,7 @@ static void s390_init(MachineState *ms)
     storage_keys = g_malloc0(my_ram_size / TARGET_PAGE_SIZE);
 
     /* init CPUs */
-    s390_init_cpus(ms->cpu_model, storage_keys);
+    s390_init_cpus(machine->cpu_model, storage_keys);
 
     /* Create VirtIO network adapters */
     s390_create_virtio_net((BusState *)s390_bus, "virtio-net-s390");
hw/sh4/r2d.c +5 -5
index 298c7a2..95c0246 100644
@@ -219,12 +219,12 @@ static struct QEMU_PACKED
     char kernel_cmdline[256];
 } boot_params;
 
-static void r2d_init(MachineState *ms)
+static void r2d_init(MachineState *machine)
 {
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
     SuperHCPU *cpu;
     CPUSH4State *env;
     ResetData *reset_info;
hw/sh4/shix.c +2 -2
index 1c2c744..7c152b4 100644
@@ -39,9 +39,9 @@
 #define BIOS_FILENAME "shix_bios.bin"
 #define BIOS_ADDRESS 0xA0000000
 
-static void shix_init(MachineState *ms)
+static void shix_init(MachineState *machine)
 {
-    const char *cpu_model = ms->cpu_model;
+    const char *cpu_model = machine->cpu_model;
     int ret;
     SuperHCPU *cpu;
     struct SH7750State *s;
hw/sparc/leon3.c +4 -4
index 2a283a3..827383b 100644
@@ -101,11 +101,11 @@ static void leon3_set_pil_in(void *opaque, uint32_t pil_in)
     }
 }
 
-static void leon3_generic_hw_init(MachineState *ms)
+static void leon3_generic_hw_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
     SPARCCPU *cpu;
     CPUSPARCState   *env;
     MemoryRegion *address_space_mem = get_system_memory();
hw/sparc/sun4m.c +34 -34

144 lines not on this page · raw message

hw/sparc64/sun4u.c +18 -18
index 036e8c9..33c311b 100644
@@ -811,7 +811,7 @@ static SPARCCPU *cpu_devinit(const char *cpu_model, const struct hwdef *hwdef)
 }
 
 static void sun4uv_init(MemoryRegion *address_space_mem,
-                        MachineState *ms,
+                        MachineState *machine,
                         const struct hwdef *hwdef)
 {
     SPARCCPU *cpu;
@@ -826,10 +826,10 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
     FWCfgState *fw_cfg;
 
     /* init CPUs */
-    cpu = cpu_devinit(ms->cpu_model, hwdef);
+    cpu = cpu_devinit(machine->cpu_model, hwdef);
 
     /* set up devices */
-    ram_init(0, ms->ram_size);
+    ram_init(0, machine->ram_size);
 
     prom_init(hwdef->prom_addr, bios_name);
 
@@ -875,15 +875,15 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
 
     initrd_size = 0;
     initrd_addr = 0;
-    kernel_size = sun4u_load_kernel(ms->kernel_filename,
-                                    ms->initrd_filename,
+    kernel_size = sun4u_load_kernel(machine->kernel_filename,
+                                    machine->initrd_filename,
                                     ram_size, &initrd_size, &initrd_addr,
                                     &kernel_addr, &kernel_entry);
 
-    sun4u_NVRAM_set_params(nvram, NVRAM_SIZE, "Sun4u", ms->ram_size,
-                           ms->boot_order,
+    sun4u_NVRAM_set_params(nvram, NVRAM_SIZE, "Sun4u", machine->ram_size,
+                           machine->boot_order,
                            kernel_addr, kernel_size,
-                           ms->kernel_cmdline,
+                           machine->kernel_cmdline,
                            initrd_addr, initrd_size,
                            /* XXX: need an option to load a NVRAM image */
                            0,
@@ -897,16 +897,16 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
     fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, hwdef->machine_id);
     fw_cfg_add_i64(fw_cfg, FW_CFG_KERNEL_ADDR, kernel_entry);
     fw_cfg_add_i64(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size);
-    if (ms->kernel_cmdline) {
+    if (machine->kernel_cmdline) {
         fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE,
-                       strlen(ms->kernel_cmdline) + 1);
-        fw_cfg_add_string(fw_cfg, FW_CFG_CMDLINE_DATA, ms->kernel_cmdline);
+                       strlen(machine->kernel_cmdline) + 1);
+        fw_cfg_add_string(fw_cfg, FW_CFG_CMDLINE_DATA, machine->kernel_cmdline);
     } else {
         fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE, 0);
     }
     fw_cfg_add_i64(fw_cfg, FW_CFG_INITRD_ADDR, initrd_addr);
     fw_cfg_add_i64(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size);
-    fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ms->boot_order[0]);
+    fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, machine->boot_order[0]);
 
     fw_cfg_add_i16(fw_cfg, FW_CFG_SPARC64_WIDTH, graphic_width);
     fw_cfg_add_i16(fw_cfg, FW_CFG_SPARC64_HEIGHT, graphic_height);
@@ -946,21 +946,21 @@ static const struct hwdef hwdefs[] = {
 };
 
 /* Sun4u hardware initialisation */
-static void sun4u_init(MachineState *ms)
+static void sun4u_init(MachineState *machine)
 {
-    sun4uv_init(get_system_memory(), ms, &hwdefs[0]);
+    sun4uv_init(get_system_memory(), machine, &hwdefs[0]);
 }
 
 /* Sun4v hardware initialisation */
-static void sun4v_init(MachineState *ms)
+static void sun4v_init(MachineState *machine)
 {
-    sun4uv_init(get_system_memory(), ms, &hwdefs[1]);
+    sun4uv_init(get_system_memory(), machine, &hwdefs[1]);
 }
 
 /* Niagara hardware initialisation */
-static void niagara_init(MachineState *ms)
+static void niagara_init(MachineState *machine)
 {
-    sun4uv_init(get_system_memory(), ms, &hwdefs[2]);
+    sun4uv_init(get_system_memory(), machine, &hwdefs[2]);
 }
 
 static QEMUMachine sun4u_machine = {
hw/unicore32/puv3.c +5 -5
index 532f196..08dd4d0 100644
@@ -101,12 +101,12 @@ static void puv3_load_kernel(const char *kernel_filename)
     graphic_console_init(NULL, 0, &no_ops, NULL);
 }
 
-static void puv3_init(MachineState *ms)
+static void puv3_init(MachineState *machine)
 {
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *initrd_filename = ms->initrd_filename;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *initrd_filename = machine->initrd_filename;
     CPUUniCore32State *env;
 
     if (initrd_filename) {
hw/xenpv/xen_machine_pv.c +4 -4
index fb7a817..3150064 100644
@@ -28,11 +28,11 @@
 #include "xen_domainbuild.h"
 #include "sysemu/blockdev.h"
 
-static void xen_init_pv(MachineState *ms)
+static void xen_init_pv(MachineState *machine)
 {
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
-    const char *initrd_filename = ms->initrd_filename;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *initrd_filename = machine->initrd_filename;
     DriveInfo *dinfo;
     int i;
 
hw/xtensa/xtensa_lx60.c +13 -13
index 6168a5c..507dd88 100644
@@ -159,7 +159,7 @@ static void lx60_reset(void *opaque)
     cpu_reset(CPU(cpu));
 }
 
-static void lx_init(const LxBoardDesc *board, MachineState *ms)
+static void lx_init(const LxBoardDesc *board, MachineState *machine)
 {
 #ifdef TARGET_WORDS_BIGENDIAN
     int be = 1;
@@ -172,9 +172,9 @@ static void lx_init(const LxBoardDesc *board, MachineState *ms)
     MemoryRegion *ram, *rom, *system_io;
     DriveInfo *dinfo;
     pflash_t *flash = NULL;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
-    const char *kernel_cmdline = ms->kernel_cmdline;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
+    const char *kernel_cmdline = machine->kernel_cmdline;
     int n;
 
     if (!cpu_model) {
@@ -198,7 +198,7 @@ static void lx_init(const LxBoardDesc *board, MachineState *ms)
     }
 
     ram = g_malloc(sizeof(*ram));
-    memory_region_init_ram(ram, NULL, "lx60.dram", ms->ram_size);
+    memory_region_init_ram(ram, NULL, "lx60.dram", machine->ram_size);
     vmstate_register_ram_global(ram);
     memory_region_add_subregion(system_memory, 0, ram);
 
@@ -275,7 +275,7 @@ static void lx_init(const LxBoardDesc *board, MachineState *ms)
     }
 }
 
-static void xtensa_lx60_init(MachineState *ms)
+static void xtensa_lx60_init(MachineState *machine)
 {
     static const LxBoardDesc lx60_board = {
         .flash_base = 0xf8000000,
@@ -283,10 +283,10 @@ static void xtensa_lx60_init(MachineState *ms)
         .flash_sector_size = 0x10000,
         .sram_size = 0x20000,
     };
-    lx_init(&lx60_board, ms);
+    lx_init(&lx60_board, machine);
 }
 
-static void xtensa_lx200_init(MachineState *ms)
+static void xtensa_lx200_init(MachineState *machine)
 {
     static const LxBoardDesc lx200_board = {
         .flash_base = 0xf8000000,
@@ -294,10 +294,10 @@ static void xtensa_lx200_init(MachineState *ms)
         .flash_sector_size = 0x20000,
         .sram_size = 0x2000000,
     };
-    lx_init(&lx200_board, ms);
+    lx_init(&lx200_board, machine);
 }
 
-static void xtensa_ml605_init(MachineState *ms)
+static void xtensa_ml605_init(MachineState *machine)
 {
     static const LxBoardDesc ml605_board = {
         .flash_base = 0xf8000000,
@@ -305,10 +305,10 @@ static void xtensa_ml605_init(MachineState *ms)
         .flash_sector_size = 0x20000,
         .sram_size = 0x2000000,
     };
-    lx_init(&ml605_board, ms);
+    lx_init(&ml605_board, machine);
 }
 
-static void xtensa_kc705_init(MachineState *ms)
+static void xtensa_kc705_init(MachineState *machine)
 {
     static const LxBoardDesc kc705_board = {
         .flash_base = 0xf0000000,
@@ -316,7 +316,7 @@ static void xtensa_kc705_init(MachineState *ms)
         .flash_sector_size = 0x20000,
         .sram_size = 0x2000000,
     };
-    lx_init(&kc705_board, ms);
+    lx_init(&kc705_board, machine);
 }
 
 static QEMUMachine xtensa_lx60_machine = {
hw/xtensa/xtensa_sim.c +4 -4
index 3470087..89da43c 100644
@@ -46,14 +46,14 @@ static void sim_reset(void *opaque)
     cpu_reset(CPU(cpu));
 }
 
-static void xtensa_sim_init(MachineState *ms)
+static void xtensa_sim_init(MachineState *machine)
 {
     XtensaCPU *cpu = NULL;
     CPUXtensaState *env = NULL;
     MemoryRegion *ram, *rom;
-    ram_addr_t ram_size = ms->ram_size;
-    const char *cpu_model = ms->cpu_model;
-    const char *kernel_filename = ms->kernel_filename;
+    ram_addr_t ram_size = machine->ram_size;
+    const char *cpu_model = machine->cpu_model;
+    const char *kernel_filename = machine->kernel_filename;
     int n;
 
     if (!cpu_model) {
#10 lore raw

Re: [Qemu-devel] [PATCH 1/4] machine: conversion of QEMUMachineInitArgs to MachineState

Quoted 54 lines · Andreas Färber

Am 16.05.2014 16:39, schrieb Igor Mammedov:

Quoted 17 lines
Quoted 5 lines · On Wed, 7 May 2014 17:42:57 +0300 Marcel Apfelbaum <[email protected]> wrote:

Total removal of QEMUMachineInitArgs struct. QEMUMachineInitArgs's fields are copied into MachineState. Removed duplicated fields from MachineState.

All the other changes are only mechanical refactoring, no semantic changes.

Quoted 9 lines

---
- I am perfectly aware that patches touching a lot of files

     are not desirable, but this one is a very simple replacement
     patch:
       QEMUMachineInitArgs -> MachineState
       args -> ms

- This is the simplest way to get rid of QEMUMachineInitArgs fast.

Quoted 1 line

Patch doesn't apply cleanly on current master

patch -p1 applied all hunks ...

Quoted 11 lines

[...]

hw/i386/xen_machine_pv.c

Quoted 7 lines

#define PC_Q35_MACHINE_OPTIONS \

hw/i386/xen_machine_pv.c +0 -0
index 9adb57f..fb7a817 100644
@@ -28,11 +28,11 @@

^^^ file was moved

... and prompted for the hw/xenpv/xen_machine_pv.c path.

Quoted 2 lines

I've reviewed all targets, it looks good.
+1 to afaerber's comment s/ms/machine/

4 "args->" were missed in exynos4_boards.c debug output.

for f in hw/*/*.c; do
sed -i 's/*ms\\)/*machine\\)/g' $f
sed -i 's/*ms,/*machine,/g' $f
sed -i 's/ ms->/ machine->/g' $f
sed -i 's/(ms->/(machine->/g' $f
sed -i 's/!ms->/!machine->/g' $f
sed -i 's/(ms)/(machine)/g' $f
sed -i 's/(ms,/(machine,/g' $f
sed -i 's/ ms,/ machine,/g' $f
sed -i 's/, ms)/, machine)/g' $f
done
git checkout -- hw/ppc/ppc4xx_pci.c # false "(ms," positive

Quoted 5 lines

highbank.c had a conflicting "machine" argument -> machine_id.

e500.c needed tweaking due to passing ms in a struct. And it was shallow-copying *ms, which must not be done for QOM. Passing the pointer instead.

Thanks for the help, Andreas!
Marcel

Quoted 3 lines

Andreas

#11 lore raw

Re: [Qemu-devel] [PATCH 1/4] machine: conversion of QEMUMachineInitArgs to MachineState

In reply to Marcel Apfelbaum
Quoted 5 lines · On Wed, 7 May 2014 17:42:57 +0300 Marcel Apfelbaum <[email protected]> wrote:

Total removal of QEMUMachineInitArgs struct. QEMUMachineInitArgs's fields are copied into MachineState. Removed duplicated fields from MachineState.

All the other changes are only mechanical refactoring, no semantic changes.

Quoted 9 lines

---
- I am perfectly aware that patches touching a lot of files

     are not desirable, but this one is a very simple replacement
     patch:
       QEMUMachineInitArgs -> MachineState
       args -> ms

- This is the simplest way to get rid of QEMUMachineInitArgs fast.

One more thing:
pc_q35_init() and pc_init1() both use qdev_get_machine() for adding properties. Please replace it with passed in machine.

Signature · 2 lines
Regards,
  Igor
#12 lore raw

Re: [Qemu-devel] [PATCH 1/4] machine: conversion of QEMUMachineInitArgs to MachineState

Am 16.05.2014 18:20, schrieb Igor Mammedov:

Quoted 17 lines
Quoted 5 lines · On Wed, 7 May 2014 17:42:57 +0300 Marcel Apfelbaum <[email protected]> wrote:

Total removal of QEMUMachineInitArgs struct. QEMUMachineInitArgs's fields are copied into MachineState. Removed duplicated fields from MachineState.

All the other changes are only mechanical refactoring, no semantic changes.

Quoted 9 lines

---
- I am perfectly aware that patches touching a lot of files

     are not desirable, but this one is a very simple replacement
     patch:
       QEMUMachineInitArgs -> MachineState
       args -> ms

- This is the simplest way to get rid of QEMUMachineInitArgs fast.

Quoted 3 lines

One more thing:
pc_q35_init() and pc_init1() both use qdev_get_machine() for adding properties. Please replace it with passed in machine.

For the previous series we had clarified that qdev_get_machine() can safely be used. The benefit of passing "machine" would be efficiency of machine init only, so let's just do that as a follow-up cleanup please.

Regards,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#13 lore raw

Re: [Qemu-devel] [PATCH 1/4] machine: conversion of QEMUMachineInitArgs to MachineState

Quoted 18 lines · Andreas Färber

Am 16.05.2014 18:20, schrieb Igor Mammedov:

Quoted 17 lines
Quoted 14 lines · On Wed, 7 May 2014 17:42:57 +0300 Marcel Apfelbaum <[email protected]> wrote:

Total removal of QEMUMachineInitArgs struct. QEMUMachineInitArgs's fields are copied into MachineState. Removed duplicated fields from MachineState.

All the other changes are only mechanical refactoring, no semantic changes.

---
- I am perfectly aware that patches touching a lot of files

     are not desirable, but this one is a very simple replacement
     patch:
       QEMUMachineInitArgs -> MachineState
       args -> ms

- This is the simplest way to get rid of QEMUMachineInitArgs fast.

Quoted 7 lines
Quoted 3 lines

One more thing:
pc_q35_init() and pc_init1() both use qdev_get_machine() for adding properties. Please replace it with passed in machine.

For the previous series we had clarified that qdev_get_machine() can safely be used. The benefit of passing "machine" would be efficiency of machine init only, so let's just do that as a follow-up cleanup please.

Fine by me.
Thanks,
Marcel

Quoted 4 lines

Regards,
Andreas

#14 lore raw

PATCH 2/4 qapi: output visitor crashes qemu if it encounters a NULL value

In reply to Marcel Apfelbaum

A NULL value is not added to visitor's stack, but there is no check for that when the visitor tries to return that value, leading to Qemu crash.

---
 qapi/qmp-output-visitor.c | 5 +++++
 1 file changed, 5 insertions(+)
qapi/qmp-output-visitor.c +5 -0
index 74a5684..0562f49 100644
@@ -66,6 +66,11 @@ static QObject *qmp_output_pop(QmpOutputVisitor *qov)
 static QObject *qmp_output_first(QmpOutputVisitor *qov)
 {
     QStackEntry *e = QTAILQ_LAST(&qov->stack, QStack);
+
+    if (!e) {
+        return NULL;
+    }
+
     return e->value;
 }
 
Signature · 1 line
1.8.3.1
#15 lore raw

Re: [Qemu-devel] [PATCH 2/4] qapi: output visitor crashes qemu if it encounters a NULL value

Am 07.05.2014 16:42, schrieb Marcel Apfelbaum:

Quoted 6 lines

A NULL value is not added to visitor's stack, but there is no check for that when the visitor tries to return that value, leading to Qemu crash.

Where does the Rb come from on this v1? Is it in any tree already?

Regards,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#16 lore raw

Re: [Qemu-devel] [PATCH 2/4] qapi: output visitor crashes qemu if it encounters a NULL value

Quoted 10 lines · Andreas Färber

Am 07.05.2014 16:42, schrieb Marcel Apfelbaum:

Quoted 6 lines

A NULL value is not added to visitor's stack, but there is no check for that when the visitor tries to return that value, leading to Qemu crash.

Where does the Rb come from on this v1? Is it in any tree already?

The (weak) R-b was here:
https://lists.gnu.org/archive/html/qemu-devel/2014-02/msg02861.html

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#17 lore raw

Re: [Qemu-devel] [PATCH 2/4] qapi: output visitor crashes qemu if it encounters a NULL value

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 13.05.2014 21:08, schrieb Eric Blake:

Quoted 9 lines · Andreas Färber
Quoted 8 lines

Am 07.05.2014 16:42, schrieb Marcel Apfelbaum:

Quoted 6 lines

A NULL value is not added to visitor's stack, but there is no check for that when the visitor tries to return that value, leading to Qemu crash.

Marcel Apfelbaum <[email protected]>

Quoted 6 lines
Quoted 3 lines

Where does the Rb come from on this v1? Is it in any tree already?

The (weak) R-b was here:
https://lists.gnu.org/archive/html/qemu-devel/2014-02/msg02861.html

Thanks.

Quoted 1 line

So Luiz was okay with it too, but his last message seems to be indicating this needs to be fixed somewhere else, too:

https://lists.gnu.org/archive/html/qemu-devel/2014-02/msg05228.html
https://lists.gnu.org/archive/html/qemu-devel/2014-03/msg00217.html

Can/should that be addressed as a follow-up? Or is there a test case that breaks?

Regards,
Andreas

- --
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg -----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQIcBAEBAgAGBQJTc6EeAAoJEPou0S0+fgE/EZEP/0Demtm8RD/bDXkgSZYq8H7C 6FuPxjrkx2F/5Cot36VWeyGWB9A4GX3xH8+OJAsWdPyiq2ChOVXub/knlfedvBKP et8Y2uub5FoLV3l8fPOy8CCO97erF4ZpZ28L1Br7jeUO+gR/b0/a0c2fj3V5SeMO vgY6or46nBteVTyYtkAVx4Ne3VddNjiJJrgTASJkIFCFicG1VSQn6+YT89qmEx1i JL8bbh5UNQ/hSFgQzl88mge9Udv3Zjp1zmbochhdazmoG6dHy7g0A7TuDkhIqnLX p4uEzerjJo+24z6rX50CRj4zr6jnZtMdSWJF25+hvRGOz0UsHQ8D5OTZfs7qwBN3 Nkzqx/tMGENcNOnivJ3CGu7GhlBBEK3moK885dlZQ8p7w0+agNQDrR0CSMJlI4ck 8LgxcDNfGgnK948ZZNPTAlqOR7ZJV1dNE1fHulPVNS1xSdk2h48xOn8NNncRAwyq bs+45pxwTjp+L5WLF7XLKsVF1hYy4wi5pBhT0w+xTymYoP5aHKRmIhogvJY1b6Wf 5isZQUHUeGiepZ26smYROrrQhO4Q2ZqHKjp3yUNfhHaP7bdZYh9ykPQQZra+9+K/ lXNmzFIj2L+kdl5R6/pn9h3nZDjrWxGd+IreVASseW0RuLZXDivOtBKZJ6ZBAqQd Dx5lbtVnihJl9KRRxQw2
=+B1b
-----END PGP SIGNATURE-----

#18 lore raw

Re: [Qemu-devel] [PATCH 2/4] qapi: output visitor crashes qemu if it encounters a NULL value

Quoted 19 lines · Andreas Färber

Am 13.05.2014 21:08, schrieb Eric Blake:

Quoted 9 lines · Andreas Färber
Quoted 8 lines

Am 07.05.2014 16:42, schrieb Marcel Apfelbaum:

Quoted 6 lines

A NULL value is not added to visitor's stack, but there is no check for that when the visitor tries to return that value, leading to Qemu crash.

Marcel Apfelbaum <[email protected]>

Quoted 6 lines
Quoted 3 lines

Where does the Rb come from on this v1? Is it in any tree already?

The (weak) R-b was here:
https://lists.gnu.org/archive/html/qemu-devel/2014-02/msg02861.html

Thanks.

Quoted 1 line
Quoted 8 lines

So Luiz was okay with it too, but his last message seems to be indicating this needs to be fixed somewhere else, too:

https://lists.gnu.org/archive/html/qemu-devel/2014-02/msg05228.html
https://lists.gnu.org/archive/html/qemu-devel/2014-03/msg00217.html

Can/should that be addressed as a follow-up? Or is there a test case that breaks?

Simple and "popular" test case: the user does not use the -kernel-cmdline parameter. The patch is needed because otherwise the main function will fail
if no value is passed by the user to string parameters.

Regarding Luiz's concern, it can be a follow-up as I am not aware of any problem with that.

Thanks,
Marcel

Quoted 4 lines

Regards,
Andreas

#19 lore raw

Re: [Qemu-devel] [PATCH 2/4] qapi: output visitor crashes qemu if it encounters a NULL value

Quoted 26 lines · On Wed, 14 May 2014 20:29:37 +0300 Marcel Apfelbaum <[email protected]> wrote:
Quoted 25 lines · Andreas Färber

Am 13.05.2014 21:08, schrieb Eric Blake:

Quoted 9 lines · Andreas Färber
Quoted 8 lines

Am 07.05.2014 16:42, schrieb Marcel Apfelbaum:

Quoted 6 lines

A NULL value is not added to visitor's stack, but there is no check for that when the visitor tries to return that value, leading to Qemu crash.

Marcel Apfelbaum <[email protected]>

Quoted 6 lines
Quoted 3 lines

Where does the Rb come from on this v1? Is it in any tree already?

The (weak) R-b was here:
https://lists.gnu.org/archive/html/qemu-devel/2014-02/msg02861.html

Thanks.

Quoted 1 line

So Luiz was okay with it too, but his last message seems to be indicating this needs to be fixed somewhere else, too:

https://lists.gnu.org/archive/html/qemu-devel/2014-02/msg05228.html
https://lists.gnu.org/archive/html/qemu-devel/2014-03/msg00217.html

Quoted 8 lines
Quoted 2 lines

Can/should that be addressed as a follow-up? Or is there a test case that breaks?

Simple and "popular" test case: the user does not use the -kernel-cmdline parameter. The patch is needed because otherwise the main function will fail
if no value is passed by the user to string parameters.

Regarding Luiz's concern, it can be a follow-up as I am not aware of any problem with that.

My concern was that I wasn't sure if this is the right fix for the issue or if it's papering over the real bug. I quickly checked the code and it seemed to make sense, but I didn't have time to study it deeper.

We could ask Michael Roth or Anthony, but I wouldn't hold this series because of that. Here's my ACK if you need it:

#20 lore raw

Re: [Qemu-devel] [PATCH 2/4] qapi: output visitor crashes qemu if it encounters a NULL value

Quoted 36 lines · Luiz Capitulino
Quoted 33 lines · On Wed, 14 May 2014 20:29:37 +0300 Marcel Apfelbaum <[email protected]> wrote:
Quoted 19 lines · Andreas Färber

Am 13.05.2014 21:08, schrieb Eric Blake:

Quoted 9 lines · Andreas Färber
Quoted 8 lines

Am 07.05.2014 16:42, schrieb Marcel Apfelbaum:

Quoted 6 lines

A NULL value is not added to visitor's stack, but there is no check for that when the visitor tries to return that value, leading to Qemu crash.

Marcel Apfelbaum <[email protected]>

Quoted 6 lines
Quoted 3 lines

Where does the Rb come from on this v1? Is it in any tree already?

The (weak) R-b was here:
https://lists.gnu.org/archive/html/qemu-devel/2014-02/msg02861.html

Thanks.

Quoted 1 line
Quoted 8 lines

So Luiz was okay with it too, but his last message seems to be indicating this needs to be fixed somewhere else, too:

https://lists.gnu.org/archive/html/qemu-devel/2014-02/msg05228.html
https://lists.gnu.org/archive/html/qemu-devel/2014-03/msg00217.html

Can/should that be addressed as a follow-up? Or is there a test case that breaks?

Simple and "popular" test case: the user does not use the -kernel-cmdline parameter.
The patch is needed because otherwise the main function will fail if no value is passed by the user to string parameters.

Quoted 6 lines
Quoted 2 lines

Regarding Luiz's concern, it can be a follow-up as I am not aware of any problem with that.

My concern was that I wasn't sure if this is the right fix for the issue or if it's papering over the real bug. I quickly checked the code and it seemed to make sense, but I didn't have time to study it deeper.

I can have a look tomorrow.

Quoted 4 lines

We could ask Michael Roth or Anthony, but I wouldn't hold this series because of that. Here's my ACK if you need it:

#21 lore raw

Re: [Qemu-devel] [PATCH 2/4] qapi: output visitor crashes qemu if it encounters a NULL value

In reply to Luiz Capitulino

Quoting Luiz Capitulino (2014-05-14 13:25:16)

Quoted 35 lines
Quoted 32 lines · On Wed, 14 May 2014 20:29:37 +0300 Marcel Apfelbaum <[email protected]> wrote:
Quoted 19 lines · Andreas Färber

Am 13.05.2014 21:08, schrieb Eric Blake:

Quoted 9 lines · Andreas Färber
Quoted 8 lines

Am 07.05.2014 16:42, schrieb Marcel Apfelbaum:

Quoted 6 lines

A NULL value is not added to visitor's stack, but there is no check for that when the visitor tries to return that value, leading to Qemu crash.

Marcel Apfelbaum <[email protected]>

Quoted 6 lines
Quoted 3 lines

Where does the Rb come from on this v1? Is it in any tree already?

The (weak) R-b was here:
https://lists.gnu.org/archive/html/qemu-devel/2014-02/msg02861.html

Thanks.

Quoted 1 line
Quoted 8 lines

So Luiz was okay with it too, but his last message seems to be indicating this needs to be fixed somewhere else, too:

https://lists.gnu.org/archive/html/qemu-devel/2014-02/msg05228.html
https://lists.gnu.org/archive/html/qemu-devel/2014-03/msg00217.html

Can/should that be addressed as a follow-up? Or is there a test case that breaks?

Simple and "popular" test case: the user does not use the -kernel-cmdline parameter. The patch is needed because otherwise the main function will fail
if no value is passed by the user to string parameters.

Quoted 6 lines
Quoted 2 lines

Regarding Luiz's concern, it can be a follow-up as I am not aware of any problem with that.

My concern was that I wasn't sure if this is the right fix for the issue or if it's papering over the real bug. I quickly checked the code and it seemed to make sense, but I didn't have time to study it deeper.

Not sure the fix is bad or not, but the cause might be a little more subtle than NULL string values as mentioned in the other thread. QmpOutputVisitor encodes NULL strings as "" via qmp_output_type_str(), so the problem doesn't seem to lie there: it shouldn't generate NULL values on the stack.

I think the real issue is that object_property_get_str() actually calls an accessor via property_get_str to get the string, then explicitly *skips* the call to visit_type_str() if it is NULL (as it would be in the case of, say, kernel_cmdline option being NULL). So I wonder if maybe the real issue we're fixing is a corner case where you call qmp_output_get_qobject() on an "empty" QmpOutputVisitor.

Surprised that's not covered by tests, but didn't see any coverage doing a cursory glance. Actually, might as well just add one..

tests/test-qmp-output-visitor.c +13 -0
index e073d83..f190eaa 100644
@@ -434,6 +434,17 @@ static void test_visitor_out_union(TestOutputVisitorData *data,
     QDECREF(qdict);
 }
 
+static void test_visitor_out_empty(TestOutputVisitorData *data,
+                                   const void *unused)
+{
+    QObject *arg;
+    QDict *qdict;
+
+    arg = qmp_output_get_qobject(data->qov);
+    qdict = qobject_to_qdict(arg);
+    QDECREF(qdict);
+}
+
 static void init_native_list(UserDefNativeListUnion *cvalue)
 {
     int i;
@@ -782,6 +793,8 @@ int main(int argc, char **argv)
                             &out_visitor_data, test_visitor_out_list_qapi_free);
     output_visitor_test_add("/visitor/output/union",
                             &out_visitor_data, test_visitor_out_union);
+    output_visitor_test_add("/visitor/output/empty",
+                            &out_visitor_data, test_visitor_out_empty);
     output_visitor_test_add("/visitor/output/native_list/int",
                             &out_visitor_data, test_visitor_out_native_list_int);
     output_visitor_test_add("/visitor/output/native_list/int8",
mdroth@loki:~/w/qemu-build$ tests/test-qmp-output-visitor 
/visitor/output/int: OK
/visitor/output/bool: OK
/visitor/output/number: OK
/visitor/output/string: OK
/visitor/output/no-string: OK
/visitor/output/enum: OK
/visitor/output/enum-errors: OK
/visitor/output/struct: OK
/visitor/output/struct-nested: OK
/visitor/output/struct-errors: OK
/visitor/output/list: OK
/visitor/output/list-qapi-free: OK
/visitor/output/union: OK
/visitor/output/empty: Segmentation fault (core dumped)

So I guess the question is whether we should support converting an empty QmpOutputVisitor to a QObject. I would say yes, and that a NULL value is probably the most reasonable value.

I would ask that commit/code is a little more explicit about what corner case is being handled though, and that something like the above unit test be included with the series.

Quoted 5 lines

We could ask Michael Roth or Anthony, but I wouldn't hold this series because of that. Here's my ACK if you need it:

#22 lore raw

Re: [Qemu-devel] [PATCH 2/4] qapi: output visitor crashes qemu if it encounters a NULL value

Quoted 106 lines · Michael Roth

Quoting Luiz Capitulino (2014-05-14 13:25:16)

Quoted 35 lines
Quoted 32 lines · On Wed, 14 May 2014 20:29:37 +0300 Marcel Apfelbaum <[email protected]> wrote:
Quoted 19 lines · Andreas Färber

Am 13.05.2014 21:08, schrieb Eric Blake:

Quoted 9 lines · Andreas Färber
Quoted 8 lines

Am 07.05.2014 16:42, schrieb Marcel Apfelbaum:

Quoted 6 lines

A NULL value is not added to visitor's stack, but there is no check for that when the visitor tries to return that value, leading to Qemu crash.

Marcel Apfelbaum <[email protected]>

Quoted 6 lines
Quoted 3 lines

Where does the Rb come from on this v1? Is it in any tree already?

The (weak) R-b was here:
https://lists.gnu.org/archive/html/qemu-devel/2014-02/msg02861.html

Thanks.

Quoted 1 line
Quoted 8 lines

So Luiz was okay with it too, but his last message seems to be indicating this needs to be fixed somewhere else, too:

https://lists.gnu.org/archive/html/qemu-devel/2014-02/msg05228.html
https://lists.gnu.org/archive/html/qemu-devel/2014-03/msg00217.html

Can/should that be addressed as a follow-up? Or is there a test case that breaks?

Simple and "popular" test case: the user does not use the -kernel-cmdline parameter. The patch is needed because otherwise the main function will fail
if no value is passed by the user to string parameters.

Quoted 6 lines
Quoted 2 lines

Regarding Luiz's concern, it can be a follow-up as I am not aware of any problem with that.

My concern was that I wasn't sure if this is the right fix for the issue or if it's papering over the real bug. I quickly checked the code and it seemed to make sense, but I didn't have time to study it deeper.

Not sure the fix is bad or not, but the cause might be a little more subtle than NULL string values as mentioned in the other thread. QmpOutputVisitor encodes NULL strings as "" via qmp_output_type_str(), so the problem doesn't seem to lie there: it shouldn't generate NULL values on the stack.

I think the real issue is that object_property_get_str() actually calls an accessor via property_get_str to get the string, then explicitly *skips* the call to visit_type_str() if it is NULL (as it would be in the case of, say, kernel_cmdline option being NULL). So I wonder if maybe the real issue we're fixing is a corner case where you call qmp_output_get_qobject() on an "empty" QmpOutputVisitor.

Surprised that's not covered by tests, but didn't see any coverage doing a cursory glance. Actually, might as well just add one..

tests/test-qmp-output-visitor.c +13 -0
index e073d83..f190eaa 100644
@@ -434,6 +434,17 @@ static void test_visitor_out_union(TestOutputVisitorData *data,
     QDECREF(qdict);
 }
 
+static void test_visitor_out_empty(TestOutputVisitorData *data,
+                                   const void *unused)
+{
+    QObject *arg;
+    QDict *qdict;
+
+    arg = qmp_output_get_qobject(data->qov);
+    qdict = qobject_to_qdict(arg);
+    QDECREF(qdict);
+}
+
 static void init_native_list(UserDefNativeListUnion *cvalue)
 {
     int i;
@@ -782,6 +793,8 @@ int main(int argc, char **argv)
                             &out_visitor_data, test_visitor_out_list_qapi_free);
     output_visitor_test_add("/visitor/output/union",
                             &out_visitor_data, test_visitor_out_union);
+    output_visitor_test_add("/visitor/output/empty",
+                            &out_visitor_data, test_visitor_out_empty);
     output_visitor_test_add("/visitor/output/native_list/int",
                             &out_visitor_data, test_visitor_out_native_list_int);
     output_visitor_test_add("/visitor/output/native_list/int8",
mdroth@loki:~/w/qemu-build$ tests/test-qmp-output-visitor 
/visitor/output/int: OK
/visitor/output/bool: OK
/visitor/output/number: OK
/visitor/output/string: OK
/visitor/output/no-string: OK
/visitor/output/enum: OK
/visitor/output/enum-errors: OK
/visitor/output/struct: OK
/visitor/output/struct-nested: OK
/visitor/output/struct-errors: OK
/visitor/output/list: OK
/visitor/output/list-qapi-free: OK
/visitor/output/union: OK
/visitor/output/empty: Segmentation fault (core dumped)
Quoted 7 lines

So I guess the question is whether we should support converting an empty QmpOutputVisitor to a QObject. I would say yes, and that a NULL value is probably the most reasonable value.

I would ask that commit/code is a little more explicit about what corner case is being handled though, and that something like the above unit test be included with the series.

Hi Michael,

Thanks for the test, of course I'll add it, may I add your Signed-off-by? Marcel

Quoted 6 lines
Quoted 6 lines

We could ask Michael Roth or Anthony, but I wouldn't hold this series because of that. Here's my ACK if you need it:

#23 lore raw

Re: [Qemu-devel] [PATCH 2/4] qapi: output visitor crashes qemu if it encounters a NULL value

In reply to Marcel Apfelbaum

Am 14.05.2014 19:29, schrieb Marcel Apfelbaum:

Quoted 23 lines · Andreas Färber
Quoted 22 lines

Am 13.05.2014 21:08, schrieb Eric Blake:

Quoted 9 lines · Andreas Färber
Quoted 8 lines

Am 07.05.2014 16:42, schrieb Marcel Apfelbaum:

Quoted 6 lines

A NULL value is not added to visitor's stack, but there is no check for that when the visitor tries to return that value, leading to Qemu crash.

Marcel Apfelbaum <[email protected]>

Quoted 6 lines
Quoted 3 lines

Where does the Rb come from on this v1? Is it in any tree already?

The (weak) R-b was here:
https://lists.gnu.org/archive/html/qemu-devel/2014-02/msg02861.html

Thanks.

Quoted 1 line

So Luiz was okay with it too, but his last message seems to be indicating this needs to be fixed somewhere else, too:

Quoted 6 lines
Quoted 5 lines

https://lists.gnu.org/archive/html/qemu-devel/2014-02/msg05228.html
https://lists.gnu.org/archive/html/qemu-devel/2014-03/msg00217.html

Can/should that be addressed as a follow-up? Or is there a test case that breaks?

Simple and "popular" test case: the user does not use the -kernel-cmdline parameter.

You had already mentioned a NULL -kernel. I was asking what test case Luiz' qmp_output_last() would be about. :)

Cheers,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#24 lore raw

Re: [Qemu-devel] [PATCH 2/4] qapi: output visitor crashes qemu if it encounters a NULL value

In reply to Marcel Apfelbaum
Quoted 15 lines · Marcel Apfelbaum

A NULL value is not added to visitor's stack, but there is no check for that when the visitor tries to return that value, leading to Qemu crash.

---
 qapi/qmp-output-visitor.c | 5 +++++
 1 file changed, 5 insertions(+)
qapi/qmp-output-visitor.c +0 -0
index 74a5684..0562f49 100644

qapi/qmp-output-visitor.c static QObject *qmp_output_pop(QmpOutputVisitor *qov) · line 75

Quoted 10 lines
qapi/qmp-output-visitor.c +5 -0
@@ -66,6 +66,11 @@ static QObject *qmp_output_pop(QmpOutputVisitor *qov)
 static QObject *qmp_output_first(QmpOutputVisitor *qov)
 {
     QStackEntry *e = QTAILQ_LAST(&qov->stack, QStack);
+
+    if (!e) {
+        return NULL;
+    }
+
     return e->value;
 }

Let's see how this thing works.

The visitor's mutable state is a QStack, which is stack of (QObject, bool). We can ignore the bool; it's just for qmp_output_next_list().

Visits start with an empty stack. See qmp_output_visitor_new().

qmp_output_first() returns the object on the bottom of the stack. qmp_output_last() returns the object on the top of the stack.

<rant>
When you implement a stack with a double-ended queue, you're totally free to pick either end of the queue for top of stack. You're also free to name your functions accessing top and the bottom of the stack however you like. "Of course" the author picked queue end and function names for maximum confusion:

    static QObject *qmp_output_first(QmpOutputVisitor *qov)
    {
        QStackEntry *e = QTAILQ_LAST(&qov->stack, QStack);
        return e->value;
    }

    static QObject *qmp_output_last(QmpOutputVisitor *qov)
    {
        QStackEntry *e = QTAILQ_FIRST(&qov->stack);
        return e->value;
    }

I hate you.
</rant>

The result of the visit sits at the bottom of the stack. Empty stack, null result. See qmp_output_get_qobject().

Visiting a scalar type creates the appropriate scalar QObject, and "adds" it. We'll find out what "adding" means shortly. See qmp_output_type_{int,bool,str,number}().

Special case: null strings get converted to empty strings. See qmp_output_type_str().

Starting a struct visit creates a QDict, adds it, and pushes it onto the stack. Ending it pops it from the stack. See qmp_output_{start,end}_struct().

Starting a list visit creates a QList, adds it, and pushes it onto the stack. Ending it pops it from the stack. See qmp_output_{start,end}_list().

Visiting a list member does nothing interesting; see qmp_output_next_list(). Aside: I suspect the GenericList traversal stuff now done in every next_list() method should be done in the visitor core instead.

Now let's figure out what it means to "add" an object. This is qmp_output_add_obj().

If the stack is still empty, the object is the root object, and it gets pushed.

Else, if the object on top of the stack is a QDict, we're visiting a struct. Enter the object into the QDict.

Else, if the object on top of the stack is a QList, we're visiting a list. Append the object to the QList.

Else, the object on top of the stack must be scalar, and I think it must be the root object. We replace it by the object being added. WTF?

This feels more complicated than it could be. Anyway, how could a null object end up at the bottom of the stack, so that qmp_output_first() chokes on it? I can't see that.

If it can get added, then why can it be seen only by qmp_output_first(), but not by qmp_output_last() and qmp_output_pop()?

#25 lore raw

Re: [Qemu-devel] [PATCH 2/4] qapi: output visitor crashes qemu if it encounters a NULL value

Quoting Markus Armbruster (2014-05-15 11:13:09)

Quoted 98 lines
Quoted 15 lines · Marcel Apfelbaum

A NULL value is not added to visitor's stack, but there is no check for that when the visitor tries to return that value, leading to Qemu crash.

---
 qapi/qmp-output-visitor.c | 5 +++++
 1 file changed, 5 insertions(+)
qapi/qmp-output-visitor.c +0 -0
index 74a5684..0562f49 100644

qapi/qmp-output-visitor.c static QObject *qmp_output_pop(QmpOutputVisitor *qov) · line 75

Quoted 10 lines
qapi/qmp-output-visitor.c +5 -0
@@ -66,6 +66,11 @@ static QObject *qmp_output_pop(QmpOutputVisitor *qov)
 static QObject *qmp_output_first(QmpOutputVisitor *qov)
 {
     QStackEntry *e = QTAILQ_LAST(&qov->stack, QStack);
+
+    if (!e) {
+        return NULL;
+    }
+
     return e->value;
 }

Let's see how this thing works.

The visitor's mutable state is a QStack, which is stack of (QObject, bool). We can ignore the bool; it's just for qmp_output_next_list().

Visits start with an empty stack. See qmp_output_visitor_new().

qmp_output_first() returns the object on the bottom of the stack. qmp_output_last() returns the object on the top of the stack.

<rant>
When you implement a stack with a double-ended queue, you're totally free to pick either end of the queue for top of stack. You're also free to name your functions accessing top and the bottom of the stack however you like. "Of course" the author picked queue end and function names for maximum confusion:

    static QObject *qmp_output_first(QmpOutputVisitor *qov)
    {
        QStackEntry *e = QTAILQ_LAST(&qov->stack, QStack);
        return e->value;
    }

    static QObject *qmp_output_last(QmpOutputVisitor *qov)
    {
        QStackEntry *e = QTAILQ_FIRST(&qov->stack);
        return e->value;
    }

I hate you.
</rant>

The result of the visit sits at the bottom of the stack. Empty stack, null result. See qmp_output_get_qobject().

Visiting a scalar type creates the appropriate scalar QObject, and "adds" it. We'll find out what "adding" means shortly. See qmp_output_type_{int,bool,str,number}().

Special case: null strings get converted to empty strings. See qmp_output_type_str().

Starting a struct visit creates a QDict, adds it, and pushes it onto the stack. Ending it pops it from the stack. See qmp_output_{start,end}_struct().

Starting a list visit creates a QList, adds it, and pushes it onto the stack. Ending it pops it from the stack. See qmp_output_{start,end}_list().

Visiting a list member does nothing interesting; see qmp_output_next_list(). Aside: I suspect the GenericList traversal stuff now done in every next_list() method should be done in the visitor core instead.

Now let's figure out what it means to "add" an object. This is qmp_output_add_obj().

If the stack is still empty, the object is the root object, and it gets pushed.

Else, if the object on top of the stack is a QDict, we're visiting a struct. Enter the object into the QDict.

Else, if the object on top of the stack is a QList, we're visiting a list. Append the object to the QList.

Else, the object on top of the stack must be scalar, and I think it must be the root object. We replace it by the object being added. WTF?

Quoted 6 lines

This feels more complicated than it could be. Anyway, how could a null object end up at the bottom of the stack, so that qmp_output_first() chokes on it? I can't see that.

If it can get added, then why can it be seen only by qmp_output_first(), but not by qmp_output_last() and qmp_output_pop()?

See my note above, the corner case we're hitting seems to be when there's nothing in the stack at all: generating a QObject from an empty QmpOutputVisitor.

This occurs with object_property_get_str skips visit_type_str if the property-specific accessor returns NULL, but we still covert the visitor to a QObject to pull the string out later.

#26 lore raw

Re: [Qemu-devel] [PATCH 2/4] qapi: output visitor crashes qemu if it encounters a NULL value

Quoted 103 lines · Michael Roth

Quoting Markus Armbruster (2014-05-15 11:13:09)

Quoted 102 lines
Quoted 15 lines · Marcel Apfelbaum

A NULL value is not added to visitor's stack, but there is no check for that when the visitor tries to return that value, leading to Qemu crash.

---
 qapi/qmp-output-visitor.c | 5 +++++
 1 file changed, 5 insertions(+)
qapi/qmp-output-visitor.c +0 -0
index 74a5684..0562f49 100644

qapi/qmp-output-visitor.c static QObject *qmp_output_pop(QmpOutputVisitor *qov) · line 75

Quoted 10 lines
qapi/qmp-output-visitor.c +5 -0
@@ -66,6 +66,11 @@ static QObject *qmp_output_pop(QmpOutputVisitor *qov)
 static QObject *qmp_output_first(QmpOutputVisitor *qov)
 {
     QStackEntry *e = QTAILQ_LAST(&qov->stack, QStack);
+
+    if (!e) {
+        return NULL;
+    }
+
     return e->value;
 }

Let's see how this thing works.

The visitor's mutable state is a QStack, which is stack of (QObject, bool). We can ignore the bool; it's just for qmp_output_next_list().

Visits start with an empty stack. See qmp_output_visitor_new().

qmp_output_first() returns the object on the bottom of the stack. qmp_output_last() returns the object on the top of the stack.

<rant>
When you implement a stack with a double-ended queue, you're totally free to pick either end of the queue for top of stack. You're also free to name your functions accessing top and the bottom of the stack however you like. "Of course" the author picked queue end and function names for maximum confusion:

    static QObject *qmp_output_first(QmpOutputVisitor *qov)
    {
        QStackEntry *e = QTAILQ_LAST(&qov->stack, QStack);
        return e->value;
    }

    static QObject *qmp_output_last(QmpOutputVisitor *qov)
    {
        QStackEntry *e = QTAILQ_FIRST(&qov->stack);
        return e->value;
    }

I hate you.
</rant>

The result of the visit sits at the bottom of the stack. Empty stack, null result. See qmp_output_get_qobject().

Visiting a scalar type creates the appropriate scalar QObject, and "adds" it. We'll find out what "adding" means shortly. See qmp_output_type_{int,bool,str,number}().

Special case: null strings get converted to empty strings. See qmp_output_type_str().

Starting a struct visit creates a QDict, adds it, and pushes it onto the stack. Ending it pops it from the stack. See qmp_output_{start,end}_struct().

Starting a list visit creates a QList, adds it, and pushes it onto the stack. Ending it pops it from the stack. See qmp_output_{start,end}_list().

Visiting a list member does nothing interesting; see qmp_output_next_list(). Aside: I suspect the GenericList traversal stuff now done in every next_list() method should be done in the visitor core instead.

Now let's figure out what it means to "add" an object. This is qmp_output_add_obj().

If the stack is still empty, the object is the root object, and it gets pushed.

Else, if the object on top of the stack is a QDict, we're visiting a struct. Enter the object into the QDict.

Else, if the object on top of the stack is a QList, we're visiting a list. Append the object to the QList.

Else, the object on top of the stack must be scalar, and I think it must be the root object. We replace it by the object being added. WTF?

This feels more complicated than it could be. Anyway, how could a null object end up at the bottom of the stack, so that qmp_output_first() chokes on it? I can't see that.

Quoted 6 lines
Quoted 2 lines

If it can get added, then why can it be seen only by qmp_output_first(), but not by qmp_output_last() and qmp_output_pop()?

See my note above, the corner case we're hitting seems to be when there's nothing in the stack at all: generating a QObject from an empty QmpOutputVisitor.

The other user of qmp_output_first() calls it like this:

    QObject *root = QTAILQ_EMPTY(&v->stack) ? NULL : qmp_output_first(v);

Patching qmp_output_first() makes this check redundant.

I suspect we should change both callers to test QTAILQ_EMPTY() instead.

Quoted 3 lines

This occurs with object_property_get_str skips visit_type_str if the property-specific accessor returns NULL, but we still covert the visitor to a QObject to pull the string out later.

Can't see visit_type_str() being called from object_property_get_str(). Do you mean property_get_str()?

static void property_get_str(Object *obj, Visitor *v, void *opaque,
const char *name, Error **errp)

{
    StringProperty *prop = opaque;
    char *value;

    value = prop->get(obj, errp);
    if (value) {
        visit_type_str(v, &value, name, errp);
        g_free(value);
    }
}

Why do we skip visit_type_str() when value is null?

#27 lore raw

Re: [Qemu-devel] [PATCH 2/4] qapi: output visitor crashes qemu if it encounters a NULL value

Quoting Markus Armbruster (2014-05-15 12:19:08)

Quoted 112 lines
Quoted 103 lines · Michael Roth

Quoting Markus Armbruster (2014-05-15 11:13:09)

Quoted 102 lines
Quoted 15 lines · Marcel Apfelbaum

A NULL value is not added to visitor's stack, but there is no check for that when the visitor tries to return that value, leading to Qemu crash.

---
 qapi/qmp-output-visitor.c | 5 +++++
 1 file changed, 5 insertions(+)
qapi/qmp-output-visitor.c +0 -0
index 74a5684..0562f49 100644

qapi/qmp-output-visitor.c static QObject *qmp_output_pop(QmpOutputVisitor *qov) · line 75

Quoted 10 lines
qapi/qmp-output-visitor.c +5 -0
@@ -66,6 +66,11 @@ static QObject *qmp_output_pop(QmpOutputVisitor *qov)
 static QObject *qmp_output_first(QmpOutputVisitor *qov)
 {
     QStackEntry *e = QTAILQ_LAST(&qov->stack, QStack);
+
+    if (!e) {
+        return NULL;
+    }
+
     return e->value;
 }

Let's see how this thing works.

The visitor's mutable state is a QStack, which is stack of (QObject, bool). We can ignore the bool; it's just for qmp_output_next_list().

Visits start with an empty stack. See qmp_output_visitor_new().

qmp_output_first() returns the object on the bottom of the stack. qmp_output_last() returns the object on the top of the stack.

<rant>
When you implement a stack with a double-ended queue, you're totally free to pick either end of the queue for top of stack. You're also free to name your functions accessing top and the bottom of the stack however you like. "Of course" the author picked queue end and function names for maximum confusion:

    static QObject *qmp_output_first(QmpOutputVisitor *qov)
    {
        QStackEntry *e = QTAILQ_LAST(&qov->stack, QStack);
        return e->value;
    }

    static QObject *qmp_output_last(QmpOutputVisitor *qov)
    {
        QStackEntry *e = QTAILQ_FIRST(&qov->stack);
        return e->value;
    }

I hate you.
</rant>

The result of the visit sits at the bottom of the stack. Empty stack, null result. See qmp_output_get_qobject().

Visiting a scalar type creates the appropriate scalar QObject, and "adds" it. We'll find out what "adding" means shortly. See qmp_output_type_{int,bool,str,number}().

Special case: null strings get converted to empty strings. See qmp_output_type_str().

Starting a struct visit creates a QDict, adds it, and pushes it onto the stack. Ending it pops it from the stack. See qmp_output_{start,end}_struct().

Starting a list visit creates a QList, adds it, and pushes it onto the stack. Ending it pops it from the stack. See qmp_output_{start,end}_list().

Visiting a list member does nothing interesting; see qmp_output_next_list(). Aside: I suspect the GenericList traversal stuff now done in every next_list() method should be done in the visitor core instead.

Now let's figure out what it means to "add" an object. This is qmp_output_add_obj().

If the stack is still empty, the object is the root object, and it gets pushed.

Else, if the object on top of the stack is a QDict, we're visiting a struct. Enter the object into the QDict.

Else, if the object on top of the stack is a QList, we're visiting a list. Append the object to the QList.

Else, the object on top of the stack must be scalar, and I think it must be the root object. We replace it by the object being added. WTF?

This feels more complicated than it could be. Anyway, how could a null object end up at the bottom of the stack, so that qmp_output_first() chokes on it? I can't see that.

Quoted 6 lines
Quoted 2 lines

If it can get added, then why can it be seen only by qmp_output_first(), but not by qmp_output_last() and qmp_output_pop()?

See my note above, the corner case we're hitting seems to be when there's nothing in the stack at all: generating a QObject from an empty QmpOutputVisitor.

Quoted 7 lines

The other user of qmp_output_first() calls it like this:

    QObject *root = QTAILQ_EMPTY(&v->stack) ? NULL : qmp_output_first(v);

Patching qmp_output_first() makes this check redundant.

I suspect we should change both callers to test QTAILQ_EMPTY() instead.

Or remove the redundant check, don't have a strong preference either way, though personally I think qmp_output_first should handle it internally and just give us the (possibly NULL) QObject, since it exposes less internals to callers.

Quoted 7 lines
Quoted 4 lines

This occurs with object_property_get_str skips visit_type_str if the property-specific accessor returns NULL, but we still covert the visitor to a QObject to pull the string out later.

Can't see visit_type_str() being called from object_property_get_str(). Do you mean property_get_str()?

Yah, I think it's something like:
object_property_get_str->object_property_get->prop.get->property_get_str

Quoted 14 lines

static void property_get_str(Object *obj, Visitor *v, void *opaque,
const char *name, Error **errp)

{
    StringProperty *prop = opaque;
    char *value;

    value = prop->get(obj, errp);
    if (value) {
        visit_type_str(v, &value, name, errp);
        g_free(value);
    }
}
Quoted 1 line

Why do we skip visit_type_str() when value is null?

Not sure..., seems like an explicit fall through to the QERR_INVALID_PARAMETER_TYPE error in object_property_get_str that wasn't reachable prior to Marcel's patch (due to segfault), so I'm not sure this code path was in play until now.

#28 lore raw

PATCH 3/4 vl.c: do not set 'type' property in obj_set_property

In reply to Marcel Apfelbaum

Filter out also 'type' property when setting
object's properties

---
 vl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
vl.c +2 -1
index 58673bd..6ec6c1a 100644
@@ -2889,7 +2889,8 @@ static int object_set_property(const char *name, const char *value, void *opaque
     StringInputVisitor *siv;
     Error *local_err = NULL;
 
-    if (strcmp(name, "qom-type") == 0 || strcmp(name, "id") == 0) {
+    if (strcmp(name, "qom-type") == 0 || strcmp(name, "id") == 0 ||
+        strcmp(name, "type") == 0) {
         return 0;
     }
 
Signature · 1 line
1.8.3.1
#29 lore raw

Re: [Qemu-devel] [PATCH 3/4] vl.c: do not set 'type' property in obj_set_property

Am 07.05.2014 16:42, schrieb Marcel Apfelbaum:

Quoted 14 lines

Filter out also 'type' property when setting
object's properties

---
 vl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
vl.c +0 -0
index 58673bd..6ec6c1a 100644

vl.c static int object_set_property(const char *name, const char *value, void *opaque · line 2896

Quoted 9 lines
vl.c +2 -1
@@ -2889,7 +2889,8 @@ static int object_set_property(const char *name, const char *value, void *opaque
     StringInputVisitor *siv;
     Error *local_err = NULL;
 
-    if (strcmp(name, "qom-type") == 0 || strcmp(name, "id") == 0) {
+    if (strcmp(name, "qom-type") == 0 || strcmp(name, "id") == 0 ||
+        strcmp(name, "type") == 0) {
         return 0;
     }
 

Seems sensible, although qom-type and type looks kind of odd at first.

Given the Rb on this v1 patch, is this applied in any tree already?

Regards,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#30 lore raw

Re: [Qemu-devel] [PATCH 3/4] vl.c: do not set 'type' property in obj_set_property

In reply to Marcel Apfelbaum
Quoted 14 lines · Marcel Apfelbaum

Filter out also 'type' property when setting
object's properties

---
 vl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
vl.c +0 -0
index 58673bd..6ec6c1a 100644

vl.c static int object_set_property(const char *name, const char *value, void *opaque · line 2895

Quoted 8 lines
vl.c +2 -1
@@ -2889,7 +2889,8 @@ static int object_set_property(const char *name, const char *value, void *opaque
     StringInputVisitor *siv;
     Error *local_err = NULL;
 
-    if (strcmp(name, "qom-type") == 0 || strcmp(name, "id") == 0) {
+    if (strcmp(name, "qom-type") == 0 || strcmp(name, "id") == 0 ||
+        strcmp(name, "type") == 0) {
         return 0;
     }

I can see why "id" and "qom-type" need to be filtered out: they're consumed by object_create() before object_set_property() gets called.

I can't see why "type". Explain?

#31 lore raw

Re: [Qemu-devel] [PATCH 3/4] vl.c: do not set 'type' property in obj_set_property

Am 15.05.2014 18:15, schrieb Markus Armbruster:

Quoted 28 lines
Quoted 14 lines · Marcel Apfelbaum

Filter out also 'type' property when setting
object's properties

---
 vl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
vl.c +0 -0
index 58673bd..6ec6c1a 100644

vl.c static int object_set_property(const char *name, const char *value, void *opaque · line 2895

Quoted 8 lines
vl.c +2 -1
@@ -2889,7 +2889,8 @@ static int object_set_property(const char *name, const char *value, void *opaque
     StringInputVisitor *siv;
     Error *local_err = NULL;
 
-    if (strcmp(name, "qom-type") == 0 || strcmp(name, "id") == 0) {
+    if (strcmp(name, "qom-type") == 0 || strcmp(name, "id") == 0 ||
+        strcmp(name, "type") == 0) {
         return 0;
     }

I can see why "id" and "qom-type" need to be filtered out: they're consumed by object_create() before object_set_property() gets called.

Quoted 1 line

I can't see why "type". Explain?

My understanding is,

-machine [type=]name[,...]

coincides with every Object exposing a read-only property "type".

Not only would setting it fail, but the values differ (display name vs. unique type name).

On that matter, our help output does not seem to indicate the name of the corresponding -object parameter, my unverified guess is that that is called "qom-type".

OTOH there's no reason to suppress "qom-type" or "id" for -machine, as implied when I suggested using a separate function.

Regards,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#32 lore raw

Re: [Qemu-devel] [PATCH 3/4] vl.c: do not set 'type' property in obj_set_property

Il 15/05/2014 18:38, Andreas Färber ha scritto:

Quoted 6 lines

On that matter, our help output does not seem to indicate the name of the corresponding -object parameter, my unverified guess is that that is called "qom-type".

OTOH there's no reason to suppress "qom-type" or "id" for -machine, as implied when I suggested using a separate function.

"id" should be suppressed for backwards compatibility for "-machine id=foo".

"qom-type" is not needed indeed. But it is so ugly that I would suggest doing a backwards-incompatible change to the name the default argument of -object, from "qom-type" to "type". Libvirt doesn't use "qom-type", and "type" nicely matches the QOM property name:

  $ qemu-system-x86_64 -qmp unix:/tmp/m1,server,nowait -S \
       -object rng-random,id=foo &
  $ ./qom-get -s /tmp/m1 /objects/foo.type
  rng-random

Paolo

#33 lore raw

PATCH 4/4 hw/machine: qemu machine opts as properties to QemuMachineState

In reply to Marcel Apfelbaum

Make machine's QemuOpts QOM properties of machine. The properties are automatically filled in. This opens the possiblity to create opts per machine rather than global.

---
 hw/core/machine.c   | 256 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/hw/boards.h |   6 +-
 vl.c                |   9 +-
 3 files changed, 265 insertions(+), 6 deletions(-)
hw/core/machine.c +256 -0
index d3ffef7..fff8317 100644
@@ -11,6 +11,260 @@
  */
 
 #include "hw/boards.h"
+#include "qapi/visitor.h"
+
+static char *machine_get_accel(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    return g_strdup(machine_state->accel);
+}
+
+static void machine_set_accel(Object *obj, const char *value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->accel = g_strdup(value);
+}
+
+static bool machine_get_kernel_irqchip(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    return machine_state->kernel_irqchip;
+}
+
+static void machine_set_kernel_irqchip(Object *obj, bool value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->kernel_irqchip = value;
+}
+
+static void machine_get_kvm_shadow_mem(Object *obj, Visitor *v,
+                                       void *opaque, const char *name,
+                                       Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    int64_t value = machine_state->kvm_shadow_mem;
+
+    visit_type_int(v, &value, name, errp);
+}
+
+static void machine_set_kvm_shadow_mem(Object *obj, Visitor *v,
+                                       void *opaque, const char *name,
+                                       Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    Error *error = NULL;
+    int64_t value;
+
+    visit_type_int(v, &value, name, &error);
+    if (error) {
+        error_propagate(errp, error);
+        return;
+    }
+
+    machine_state->kvm_shadow_mem = value;
+}
+
+static char *machine_get_kernel(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    return g_strdup(machine_state->kernel_filename);
+}
+
+static void machine_set_kernel(Object *obj, const char *value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->kernel_filename = g_strdup(value);
+}
+
+static char *machine_get_initrd(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    return g_strdup(machine_state->initrd_filename);
+}
+
+static void machine_set_initrd(Object *obj, const char *value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->initrd_filename = g_strdup(value);
+}
+
+static char *machine_get_append(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    return g_strdup(machine_state->kernel_cmdline);
+}
+
+static void machine_set_append(Object *obj, const char *value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->kernel_cmdline = g_strdup(value);
+}
+
+static char *machine_get_dtb(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    return g_strdup(machine_state->dtb);
+}
+
+static void machine_set_dtb(Object *obj, const char *value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->dtb = g_strdup(value);
+}
+
+static char *machine_get_dumpdtb(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    return g_strdup(machine_state->dumpdtb);
+}
+
+static void machine_set_dumpdtb(Object *obj, const char *value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->dumpdtb = g_strdup(value);
+}
+
+static void machine_get_phandle_start(Object *obj, Visitor *v,
+                                       void *opaque, const char *name,
+                                       Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    int64_t value = machine_state->phandle_start;
+
+    visit_type_int(v, &value, name, errp);
+}
+
+static void machine_set_phandle_start(Object *obj, Visitor *v,
+                                       void *opaque, const char *name,
+                                       Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    Error *error = NULL;
+    int64_t value;
+
+    visit_type_int(v, &value, name, &error);
+    if (error) {
+        error_propagate(errp, error);
+        return;
+    }
+
+    machine_state->phandle_start = value;
+}
+
+static char *machine_get_dt_compatible(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    return g_strdup(machine_state->dt_compatible);
+}
+
+static void machine_set_dt_compatible(Object *obj, const char *value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->dt_compatible = g_strdup(value);
+}
+
+static bool machine_get_dump_guest_core(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    return machine_state->dump_guest_core;
+}
+
+static void machine_set_dump_guest_core(Object *obj, bool value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->dump_guest_core = value;
+}
+
+static bool machine_get_mem_merge(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    return machine_state->mem_merge;
+}
+
+static void machine_set_mem_merge(Object *obj, bool value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->mem_merge = value;
+}
+
+static bool machine_get_usb(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    return machine_state->usb;
+}
+
+static void machine_set_usb(Object *obj, bool value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->usb = value;
+}
+
+static char *machine_get_firmware(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    return g_strdup(machine_state->firmware);
+}
+
+static void machine_set_firmware(Object *obj, const char *value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->firmware = g_strdup(value);
+}
+
+static void machine_initfn(Object *obj)
+{
+    object_property_add_str(obj, "accel",
+                            machine_get_accel, machine_set_accel, NULL);
+    object_property_add_bool(obj, "kernel_irqchip",
+                             machine_get_kernel_irqchip,
+                             machine_set_kernel_irqchip,
+                             NULL);
+    object_property_add(obj, "kvm_shadow_mem", "int",
+                        machine_get_kvm_shadow_mem,
+                        machine_set_kvm_shadow_mem,
+                        NULL, NULL, NULL);
+    object_property_add_str(obj, "kernel",
+                            machine_get_kernel, machine_set_kernel, NULL);
+    object_property_add_str(obj, "initrd",
+                            machine_get_initrd, machine_set_initrd, NULL);
+    object_property_add_str(obj, "append",
+                            machine_get_append, machine_set_append, NULL);
+    object_property_add_str(obj, "dtb",
+                            machine_get_dtb, machine_set_dtb, NULL);
+    object_property_add_str(obj, "dumpdtb",
+                            machine_get_dumpdtb, machine_set_dumpdtb, NULL);
+    object_property_add(obj, "phandle_start", "int",
+                        machine_get_phandle_start,
+                        machine_set_phandle_start,
+                        NULL, NULL, NULL);
+    object_property_add_str(obj, "dt_compatible",
+                            machine_get_dt_compatible,
+                            machine_set_dt_compatible,
+                            NULL);
+    object_property_add_bool(obj, "dump-guest-core",
+                             machine_get_dump_guest_core,
+                             machine_set_dump_guest_core,
+                             NULL);
+    object_property_add_bool(obj, "mem-merge",
+                             machine_get_mem_merge, machine_set_mem_merge, NULL);
+    object_property_add_bool(obj, "usb", machine_get_usb, machine_set_usb, NULL);
+    object_property_add_str(obj, "firmware",
+                            machine_get_firmware, machine_set_firmware, NULL);
+}
+
+static void qemu_machine_finalize(Object *obj)
+{
+    MachineState *machine_state = MACHINE(obj);
+
+    g_free(machine_state->accel);
+    g_free(machine_state->kernel_filename);
+    g_free(machine_state->initrd_filename);
+    g_free(machine_state->kernel_cmdline);
+    g_free(machine_state->dtb);
+    g_free(machine_state->dumpdtb);
+    g_free(machine_state->dt_compatible);
+    g_free(machine_state->firmware);
+}
 
 static const TypeInfo machine_info = {
     .name = TYPE_MACHINE,
@@ -18,6 +272,8 @@ static const TypeInfo machine_info = {
     .abstract = true,
     .class_size = sizeof(MachineClass),
     .instance_size = sizeof(MachineState),
+    .instance_init = machine_initfn,
+    .instance_finalize = qemu_machine_finalize,
 };
 
 static void machine_register_types(void)
include/hw/boards.h +3 -3
index eba0574..69664a5 100644
@@ -114,9 +114,9 @@ struct MachineState {
     const MachineClass *machine;
     ram_addr_t ram_size;
     const char *boot_order;
-    const char *kernel_filename;
-    const char *kernel_cmdline;
-    const char *initrd_filename;
+    char *kernel_filename;
+    char *kernel_cmdline;
+    char *initrd_filename;
     const char *cpu_model;
 };
 
vl.c +6 -3
index 6ec6c1a..e92871c 100644
@@ -4216,6 +4216,12 @@ int main(int argc, char **argv, char **envp)
         exit(0);
     }
 
+    machine_opts = qemu_get_machine_opts();
+    if (qemu_opt_foreach(machine_opts, object_set_property, current_machine, 1) < 0) {
+        object_unref(OBJECT(current_machine));
+        exit(1);
+    }
+
     configure_accelerator(machine_class);
 
     if (qtest_chrdev) {
@@ -4426,9 +4432,6 @@ int main(int argc, char **argv, char **envp)
     current_machine->machine = machine_class;
     current_machine->ram_size = ram_size;
     current_machine->boot_order = boot_order;
-    current_machine->kernel_filename = kernel_filename;
-    current_machine->kernel_cmdline = kernel_cmdline;
-    current_machine->initrd_filename = initrd_filename;
     current_machine->cpu_model = cpu_model;
 
     machine_class->init(current_machine);
Signature · 1 line
1.8.3.1
#34 lore raw

Re: [Qemu-devel] [PATCH 4/4] hw/machine: qemu machine opts as properties to QemuMachineState

Am 07.05.2014 16:43, schrieb Marcel Apfelbaum:

Quoted 16 lines

Make machine's QemuOpts QOM properties of machine. The properties are automatically filled in. This opens the possiblity to create opts per machine rather than global.

---
 hw/core/machine.c   | 256 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/hw/boards.h |   6 +-
 vl.c                |   9 +-
 3 files changed, 265 insertions(+), 6 deletions(-)
hw/core/machine.c +0 -0
index d3ffef7..fff8317 100644

hw/core/machine.c line 18

Quoted 8 lines
hw/core/machine.c +5 -0
@@ -11,6 +11,260 @@
  */
 
 #include "hw/boards.h"
+#include "qapi/visitor.h"
+
+static char *machine_get_accel(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);

Contrary to 1/4, you here use the overly verbose "machine_state".

Quoted 184 lines
hw/core/machine.c +184 -0
+    return g_strdup(machine_state->accel);
+}
+
+static void machine_set_accel(Object *obj, const char *value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->accel = g_strdup(value);
+}
+
+static bool machine_get_kernel_irqchip(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    return machine_state->kernel_irqchip;
+}
+
+static void machine_set_kernel_irqchip(Object *obj, bool value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->kernel_irqchip = value;
+}
+
+static void machine_get_kvm_shadow_mem(Object *obj, Visitor *v,
+                                       void *opaque, const char *name,
+                                       Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    int64_t value = machine_state->kvm_shadow_mem;
+
+    visit_type_int(v, &value, name, errp);
+}
+
+static void machine_set_kvm_shadow_mem(Object *obj, Visitor *v,
+                                       void *opaque, const char *name,
+                                       Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    Error *error = NULL;
+    int64_t value;
+
+    visit_type_int(v, &value, name, &error);
+    if (error) {
+        error_propagate(errp, error);
+        return;
+    }
+
+    machine_state->kvm_shadow_mem = value;
+}
+
+static char *machine_get_kernel(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    return g_strdup(machine_state->kernel_filename);
+}
+
+static void machine_set_kernel(Object *obj, const char *value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->kernel_filename = g_strdup(value);
+}
+
+static char *machine_get_initrd(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    return g_strdup(machine_state->initrd_filename);
+}
+
+static void machine_set_initrd(Object *obj, const char *value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->initrd_filename = g_strdup(value);
+}
+
+static char *machine_get_append(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    return g_strdup(machine_state->kernel_cmdline);
+}
+
+static void machine_set_append(Object *obj, const char *value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->kernel_cmdline = g_strdup(value);
+}
+
+static char *machine_get_dtb(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    return g_strdup(machine_state->dtb);
+}
+
+static void machine_set_dtb(Object *obj, const char *value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->dtb = g_strdup(value);
+}
+
+static char *machine_get_dumpdtb(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    return g_strdup(machine_state->dumpdtb);
+}
+
+static void machine_set_dumpdtb(Object *obj, const char *value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->dumpdtb = g_strdup(value);
+}
+
+static void machine_get_phandle_start(Object *obj, Visitor *v,
+                                       void *opaque, const char *name,
+                                       Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    int64_t value = machine_state->phandle_start;
+
+    visit_type_int(v, &value, name, errp);
+}
+
+static void machine_set_phandle_start(Object *obj, Visitor *v,
+                                       void *opaque, const char *name,
+                                       Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    Error *error = NULL;
+    int64_t value;
+
+    visit_type_int(v, &value, name, &error);
+    if (error) {
+        error_propagate(errp, error);
+        return;
+    }
+
+    machine_state->phandle_start = value;
+}
+
+static char *machine_get_dt_compatible(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    return g_strdup(machine_state->dt_compatible);
+}
+
+static void machine_set_dt_compatible(Object *obj, const char *value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->dt_compatible = g_strdup(value);
+}
+
+static bool machine_get_dump_guest_core(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    return machine_state->dump_guest_core;
+}
+
+static void machine_set_dump_guest_core(Object *obj, bool value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->dump_guest_core = value;
+}
+
+static bool machine_get_mem_merge(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    return machine_state->mem_merge;
+}
+
+static void machine_set_mem_merge(Object *obj, bool value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->mem_merge = value;
+}
+
+static bool machine_get_usb(Object *obj, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    return machine_state->usb;
+}
+
+static void machine_set_usb(Object *obj, bool value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->usb = value;
+}
+
+static char *machine_get_firmware(Object *obj, Error **errp)

hw/core/machine.c line 212

Quoted 10 lines
hw/core/machine.c +10 -0
+{
+    MachineState *machine_state = MACHINE(obj);
+    return g_strdup(machine_state->firmware);
+}
+
+static void machine_set_firmware(Object *obj, const char *value, Error **errp)
+{
+    MachineState *machine_state = MACHINE(obj);
+    machine_state->firmware = g_strdup(value);
+}

Naming aside, this all looks good up to here.

hw/core/machine.c line 218

Quoted 6 lines
hw/core/machine.c +6 -0
+
+static void machine_initfn(Object *obj)
+{
+    object_property_add_str(obj, "accel",
+                            machine_get_accel, machine_set_accel, NULL);
+    object_property_add_bool(obj, "kernel_irqchip",

"kernel-irqchip"

hw/core/machine.c line 222

Quoted 4 lines
hw/core/machine.c +4 -0
+                             machine_get_kernel_irqchip,
+                             machine_set_kernel_irqchip,
+                             NULL);
+    object_property_add(obj, "kvm_shadow_mem", "int",

"kvm-shadow-mem"

Quoted 4 lines
hw/core/machine.c +4 -0
+                        machine_get_kvm_shadow_mem,
+                        machine_set_kvm_shadow_mem,
+                        NULL, NULL, NULL);
+    object_property_add_str(obj, "kernel",

hw/core/machine.c line 236

Quoted 10 lines
hw/core/machine.c +10 -0
+                            machine_get_kernel, machine_set_kernel, NULL);
+    object_property_add_str(obj, "initrd",
+                            machine_get_initrd, machine_set_initrd, NULL);
+    object_property_add_str(obj, "append",
+                            machine_get_append, machine_set_append, NULL);
+    object_property_add_str(obj, "dtb",
+                            machine_get_dtb, machine_set_dtb, NULL);
+    object_property_add_str(obj, "dumpdtb",
+                            machine_get_dumpdtb, machine_set_dumpdtb, NULL);
+    object_property_add(obj, "phandle_start", "int",

"phandle-start"

hw/core/machine.c line 240

Quoted 4 lines
hw/core/machine.c +4 -0
+                        machine_get_phandle_start,
+                        machine_set_phandle_start,
+                        NULL, NULL, NULL);
+    object_property_add_str(obj, "dt_compatible",

"dt-compatible"

QOM conventions require dashes rather than underscores. We faced the same issue with -cpu legacy options, and the safest solution probably is to replace patch 3/4 and its usage below with a machine-specific function that converts from underscore to dash before setting the property.

Quoted 31 lines
hw/core/machine.c +27 -0
+                            machine_get_dt_compatible,
+                            machine_set_dt_compatible,
+                            NULL);
+    object_property_add_bool(obj, "dump-guest-core",
+                             machine_get_dump_guest_core,
+                             machine_set_dump_guest_core,
+                             NULL);
+    object_property_add_bool(obj, "mem-merge",
+                             machine_get_mem_merge, machine_set_mem_merge, NULL);
+    object_property_add_bool(obj, "usb", machine_get_usb, machine_set_usb, NULL);
+    object_property_add_str(obj, "firmware",
+                            machine_get_firmware, machine_set_firmware, NULL);
+}
+
+static void qemu_machine_finalize(Object *obj)
+{
+    MachineState *machine_state = MACHINE(obj);
+
+    g_free(machine_state->accel);
+    g_free(machine_state->kernel_filename);
+    g_free(machine_state->initrd_filename);
+    g_free(machine_state->kernel_cmdline);
+    g_free(machine_state->dtb);
+    g_free(machine_state->dumpdtb);
+    g_free(machine_state->dt_compatible);
+    g_free(machine_state->firmware);
+}
 
 static const TypeInfo machine_info = {
     .name = TYPE_MACHINE,

hw/core/machine.c static const TypeInfo machine_info = { · line 276

Quoted 5 lines
hw/core/machine.c +2 -0
@@ -18,6 +272,8 @@ static const TypeInfo machine_info = {
     .abstract = true,
     .class_size = sizeof(MachineClass),
     .instance_size = sizeof(MachineState),
+    .instance_init = machine_initfn,
+    .instance_finalize = qemu_machine_finalize,

Do we need an .instance_post_init to apply -global property defaults?

Quoted 38 lines
hw/core/machine.c +0 -0
 };
 
 static void machine_register_types(void)
include/hw/boards.h +3 -3
index eba0574..69664a5 100644
@@ -114,9 +114,9 @@ struct MachineState {
     const MachineClass *machine;
     ram_addr_t ram_size;
     const char *boot_order;
-    const char *kernel_filename;
-    const char *kernel_cmdline;
-    const char *initrd_filename;
+    char *kernel_filename;
+    char *kernel_cmdline;
+    char *initrd_filename;
     const char *cpu_model;
 };
 
vl.c +6 -0
index 6ec6c1a..e92871c 100644
@@ -4216,6 +4216,12 @@ int main(int argc, char **argv, char **envp)
         exit(0);
     }
 
+    machine_opts = qemu_get_machine_opts();
+    if (qemu_opt_foreach(machine_opts, object_set_property, current_machine, 1) < 0) {
+        object_unref(OBJECT(current_machine));
+        exit(1);
+    }
+
     configure_accelerator(machine_class);
 
     if (qtest_chrdev) {

vl.c int main(int argc, char **argv, char **envp) · line 4431

Quoted 6 lines
vl.c +0 -3
@@ -4426,9 +4432,6 @@ int main(int argc, char **argv, char **envp)
     current_machine->machine = machine_class;
     current_machine->ram_size = ram_size;
     current_machine->boot_order = boot_order;
-    current_machine->kernel_filename = kernel_filename;
-    current_machine->kernel_cmdline = kernel_cmdline;
-    current_machine->initrd_filename = initrd_filename;

So these three are the only fields set from -machine itself?

vl.c int main(int argc, char **argv, char **envp) · line 4437

Quoted 3 lines
vl.c +0 -0
     current_machine->cpu_model = cpu_model;
 
     machine_class->init(current_machine);

Regards,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#35 lore raw
In reply to Marcel Apfelbaum
Quoted 9 lines · Marcel Apfelbaum

This series continues 'machine as QOM' targeting two related issues:
- Patch 1/4 completly removes QEMUMachineInitArgs from the code with a big mechanical patch. It removes QEMUMachineInitArgs from MachineState and gets rid of duplicated fields.
- I am perfectly aware that patches touching a lot of files

     are not desirable, but this one is a very simple replacement
     patch:
       QEMUMachineInitArgs -> MachineState
       args -> ms
Quoted 7 lines

- This is the simplest way to get rid of QEMUMachineInitArgs fast.
- Patch 4/4 aims to enable QemuOpts per machine by automatically filling in the machine opts into the current machine. Subclassing MachineClass and adding options mapped into properties is a better way than using global options.

Patches 2/4 and 3/4 fix little bugs needed by 4/4.

Ping :)

Any comments would be appreciated.
I know the first patch is big, but it is only a simple re-factoring with no easy way to split.

Thanks,
Marcel

Quoted 76 lines

Marcel Apfelbaum (4):
machine: conversion of QEMUMachineInitArgs to MachineState
qapi: output visitor crashes qemu if it encounters a NULL value vl.c: do not set 'type' property in obj_set_property hw/machine: qemu machine opts as properties to QemuMachineState

 hw/alpha/dp264.c                         |  12 +-
 hw/arm/collie.c                          |  10 +-
 hw/arm/cubieboard.c                      |  10 +-
 hw/arm/digic_boards.c                    |   2 +-
 hw/arm/exynos4_boards.c                  |  16 +-
 hw/arm/gumstix.c                         |   6 +-
 hw/arm/highbank.c                        |  20 +--
 hw/arm/integratorcp.c                    |  12 +-
 hw/arm/kzm.c                             |  12 +-
 hw/arm/mainstone.c                       |  14 +-
 hw/arm/musicpal.c                        |  10 +-
 hw/arm/nseries.c                         |  22 +--
 hw/arm/omap_sx1.c                        |  20 +--
 hw/arm/palm.c                            |  10 +-
 hw/arm/realview.c                        |  44 +++---
 hw/arm/spitz.c                           |  26 ++--
 hw/arm/stellaris.c                       |  12 +-
 hw/arm/tosa.c                            |  10 +-
 hw/arm/versatilepb.c                     |  26 ++--
 hw/arm/vexpress.c                        |  20 +--
 hw/arm/virt.c                            |  16 +-
 hw/arm/xilinx_zynq.c                     |  12 +-
 hw/arm/z2.c                              |  10 +-
 hw/core/machine.c                        | 256 +++++++++++++++++++++++++++++++
 hw/core/null-machine.c                   |   2 +-
 hw/cris/axis_dev88.c                     |  10 +-
 hw/i386/pc_piix.c                        | 108 ++++++-------
 hw/i386/pc_q35.c                         |  66 ++++----
 hw/i386/xen_machine_pv.c                 |   8 +-
 hw/lm32/lm32_boards.c                    |  16 +-
 hw/lm32/milkymist.c                      |  10 +-
 hw/m68k/an5206.c                         |   8 +-
 hw/m68k/dummy_m68k.c                     |   8 +-
 hw/m68k/mcf5208.c                        |   8 +-
 hw/microblaze/petalogix_ml605_mmu.c      |   6 +-
 hw/microblaze/petalogix_s3adsp1800_mmu.c |   8 +-
 hw/mips/mips_fulong2e.c                  |  12 +-
 hw/mips/mips_jazz.c                      |  12 +-
 hw/mips/mips_malta.c                     |  12 +-
 hw/mips/mips_mipssim.c                   |  12 +-
 hw/mips/mips_r4k.c                       |  12 +-
 hw/moxie/moxiesim.c                      |  12 +-
 hw/openrisc/openrisc_sim.c               |   8 +-
 hw/ppc/e500.c                            |  44 +++---
 hw/ppc/e500.h                            |   2 +-
 hw/ppc/e500plat.c                        |   4 +-
 hw/ppc/mac_newworld.c                    |  14 +-
 hw/ppc/mac_oldworld.c                    |  14 +-
 hw/ppc/mpc8544ds.c                       |   4 +-
 hw/ppc/ppc405_boards.c                   |  18 +--
 hw/ppc/ppc440_bamboo.c                   |  12 +-
 hw/ppc/prep.c                            |  14 +-
 hw/ppc/spapr.c                           |  14 +-
 hw/ppc/virtex_ml507.c                    |  16 +-
 hw/s390x/s390-virtio-ccw.c               |  10 +-
 hw/s390x/s390-virtio.c                   |  10 +-
 hw/sh4/r2d.c                             |  10 +-
 hw/sh4/shix.c                            |   4 +-
 hw/sparc/leon3.c                         |   8 +-
 hw/sparc/sun4m.c                         |  64 ++++----
 hw/sparc64/sun4u.c                       |  36 ++---
 hw/unicore32/puv3.c                      |  10 +-
 hw/xtensa/xtensa_lx60.c                  |  26 ++--
 hw/xtensa/xtensa_sim.c                   |   8 +-
 include/hw/boards.h                      |  28 ++--
 qapi/qmp-output-visitor.c                |   5 +
 vl.c                                     |  23 +--
 67 files changed, 801 insertions(+), 543 deletions(-)