* [PATCH v4 2/3] hw: Make MachineClass::is_default a boolean type
@ 2020-02-07 16:19 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 42+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-07 16:19 UTC (permalink / raw)
To: qemu-devel
Cc: Aleksandar Rikalo, Guan Xuetao, qemu-ppc, Sagar Karandikar,
David Gibson, Christian Borntraeger, Paolo Bonzini,
Bastian Koppelmann, Eduardo Habkost, Laurent Vivier,
Anthony Green, Richard Henderson, Artyom Tarasenko, qemu-trivial,
Cornelia Huck, Aurelien Jarno, Edgar E. Iglesias,
Mark Cave-Ayland, qemu-riscv, Michael S. Tsirkin,
Aleksandar Markovic, Marek Vasut, Palmer Dabbelt, Michael Walle,
Halil Pasic, Marcel Apfelbaum, qemu-s390x,
Philippe Mathieu-Daudé,
Richard Henderson, Thomas Huth, Magnus Damm, David Hildenbrand,
Chris Wulff, Stafford Horne, Helge Deller, Alistair Francis,
Jia Liu
There's no good reason for it to be type int, change it to bool.
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
v4:
- fixed incorrect changes to max_cpus (Laurent)
- describe field
---
include/hw/boards.h | 4 +++-
hw/alpha/dp264.c | 2 +-
hw/cris/axis_dev88.c | 2 +-
hw/hppa/machine.c | 2 +-
hw/i386/pc_piix.c | 10 +++++-----
hw/lm32/lm32_boards.c | 2 +-
hw/m68k/mcf5208.c | 2 +-
hw/microblaze/petalogix_s3adsp1800_mmu.c | 2 +-
hw/mips/mips_malta.c | 2 +-
hw/moxie/moxiesim.c | 2 +-
hw/nios2/10m50_devboard.c | 2 +-
hw/openrisc/openrisc_sim.c | 2 +-
hw/ppc/mac_oldworld.c | 2 +-
hw/ppc/spapr.c | 2 +-
hw/riscv/spike.c | 2 +-
hw/s390x/s390-virtio-ccw.c | 2 +-
hw/sh4/shix.c | 2 +-
hw/sparc/sun4m.c | 2 +-
hw/sparc64/sun4u.c | 2 +-
hw/unicore32/puv3.c | 2 +-
20 files changed, 26 insertions(+), 24 deletions(-)
diff --git a/include/hw/boards.h b/include/hw/boards.h
index fb1b43d5b9..c3523a70e8 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -107,6 +107,8 @@ typedef struct {
* @max_cpus: maximum number of CPUs supported. Default: 1
* @min_cpus: minimum number of CPUs supported. Default: 1
* @default_cpus: number of CPUs instantiated if none are specified. Default: 1
+ * @is_default:
+ * If true QEMU will use this machine by default if no '-M' option is given.
* @get_hotplug_handler: this function is called during bus-less
* device hotplug. If defined it returns pointer to an instance
* of HotplugHandler object, which handles hotplug operation
@@ -200,7 +202,7 @@ struct MachineClass {
no_sdcard:1,
pci_allow_0_address:1,
legacy_fw_cfg_order:1;
- int is_default;
+ bool is_default;
const char *default_machine_opts;
const char *default_boot_order;
const char *default_display;
diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
index a8f9a89cc4..083a198a64 100644
--- a/hw/alpha/dp264.c
+++ b/hw/alpha/dp264.c
@@ -181,7 +181,7 @@ static void clipper_machine_init(MachineClass *mc)
mc->init = clipper_init;
mc->block_default_type = IF_IDE;
mc->max_cpus = 4;
- mc->is_default = 1;
+ mc->is_default = true;
mc->default_cpu_type = ALPHA_CPU_TYPE_NAME("ev67");
}
diff --git a/hw/cris/axis_dev88.c b/hw/cris/axis_dev88.c
index be7760476a..de7b49188b 100644
--- a/hw/cris/axis_dev88.c
+++ b/hw/cris/axis_dev88.c
@@ -349,7 +349,7 @@ static void axisdev88_machine_init(MachineClass *mc)
{
mc->desc = "AXIS devboard 88";
mc->init = axisdev88_init;
- mc->is_default = 1;
+ mc->is_default = true;
mc->default_cpu_type = CRIS_CPU_TYPE_NAME("crisv32");
}
diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index d8755ec422..83ae87f565 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -295,7 +295,7 @@ static void machine_hppa_machine_init(MachineClass *mc)
mc->block_default_type = IF_SCSI;
mc->max_cpus = HPPA_MAX_CPUS;
mc->default_cpus = 1;
- mc->is_default = 1;
+ mc->is_default = true;
mc->default_ram_size = 512 * MiB;
mc->default_boot_order = "cd";
}
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index fa12203079..9088db8fb6 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -423,7 +423,7 @@ static void pc_i440fx_5_0_machine_options(MachineClass *m)
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
pc_i440fx_machine_options(m);
m->alias = "pc";
- m->is_default = 1;
+ m->is_default = true;
pcmc->default_cpu_version = 1;
}
@@ -434,7 +434,7 @@ static void pc_i440fx_4_2_machine_options(MachineClass *m)
{
pc_i440fx_5_0_machine_options(m);
m->alias = NULL;
- m->is_default = 0;
+ m->is_default = false;
compat_props_add(m->compat_props, hw_compat_4_2, hw_compat_4_2_len);
compat_props_add(m->compat_props, pc_compat_4_2, pc_compat_4_2_len);
}
@@ -446,7 +446,7 @@ static void pc_i440fx_4_1_machine_options(MachineClass *m)
{
pc_i440fx_4_2_machine_options(m);
m->alias = NULL;
- m->is_default = 0;
+ m->is_default = false;
compat_props_add(m->compat_props, hw_compat_4_1, hw_compat_4_1_len);
compat_props_add(m->compat_props, pc_compat_4_1, pc_compat_4_1_len);
}
@@ -459,7 +459,7 @@ static void pc_i440fx_4_0_machine_options(MachineClass *m)
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
pc_i440fx_4_1_machine_options(m);
m->alias = NULL;
- m->is_default = 0;
+ m->is_default = false;
pcmc->default_cpu_version = CPU_VERSION_LEGACY;
compat_props_add(m->compat_props, hw_compat_4_0, hw_compat_4_0_len);
compat_props_add(m->compat_props, pc_compat_4_0, pc_compat_4_0_len);
@@ -473,7 +473,7 @@ static void pc_i440fx_3_1_machine_options(MachineClass *m)
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
pc_i440fx_4_0_machine_options(m);
- m->is_default = 0;
+ m->is_default = false;
pcmc->do_not_add_smb_acpi = true;
m->smbus_no_migration_support = true;
m->alias = NULL;
diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c
index 156b050abc..352f69532e 100644
--- a/hw/lm32/lm32_boards.c
+++ b/hw/lm32/lm32_boards.c
@@ -286,7 +286,7 @@ static void lm32_evr_class_init(ObjectClass *oc, void *data)
mc->desc = "LatticeMico32 EVR32 eval system";
mc->init = lm32_evr_init;
- mc->is_default = 1;
+ mc->is_default = true;
mc->default_cpu_type = LM32_CPU_TYPE_NAME("lm32-full");
}
diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
index a999c21982..5f8f6e4475 100644
--- a/hw/m68k/mcf5208.c
+++ b/hw/m68k/mcf5208.c
@@ -352,7 +352,7 @@ static void mcf5208evb_machine_init(MachineClass *mc)
{
mc->desc = "MCF5208EVB";
mc->init = mcf5208evb_init;
- mc->is_default = 1;
+ mc->is_default = true;
mc->default_cpu_type = M68K_CPU_TYPE_NAME("m5208");
}
diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c
index 849bafc186..0bb6cdea8d 100644
--- a/hw/microblaze/petalogix_s3adsp1800_mmu.c
+++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c
@@ -132,7 +132,7 @@ static void petalogix_s3adsp1800_machine_init(MachineClass *mc)
{
mc->desc = "PetaLogix linux refdesign for xilinx Spartan 3ADSP1800";
mc->init = petalogix_s3adsp1800_init;
- mc->is_default = 1;
+ mc->is_default = true;
}
DEFINE_MACHINE("petalogix-s3adsp1800", petalogix_s3adsp1800_machine_init)
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 34b76bb6a1..499eac8d33 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -1442,7 +1442,7 @@ static void mips_malta_machine_init(MachineClass *mc)
mc->init = mips_malta_init;
mc->block_default_type = IF_IDE;
mc->max_cpus = 16;
- mc->is_default = 1;
+ mc->is_default = true;
#ifdef TARGET_MIPS64
mc->default_cpu_type = MIPS_CPU_TYPE_NAME("20Kc");
#else
diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c
index 1d06e39fcb..51a98287b5 100644
--- a/hw/moxie/moxiesim.c
+++ b/hw/moxie/moxiesim.c
@@ -150,7 +150,7 @@ static void moxiesim_machine_init(MachineClass *mc)
{
mc->desc = "Moxie simulator platform";
mc->init = moxiesim_init;
- mc->is_default = 1;
+ mc->is_default = true;
mc->default_cpu_type = MOXIE_CPU_TYPE_NAME("MoxieLite");
}
diff --git a/hw/nios2/10m50_devboard.c b/hw/nios2/10m50_devboard.c
index ad8b2fc670..33dc2bf511 100644
--- a/hw/nios2/10m50_devboard.c
+++ b/hw/nios2/10m50_devboard.c
@@ -120,7 +120,7 @@ static void nios2_10m50_ghrd_machine_init(struct MachineClass *mc)
{
mc->desc = "Altera 10M50 GHRD Nios II design";
mc->init = nios2_10m50_ghrd_init;
- mc->is_default = 1;
+ mc->is_default = true;
}
DEFINE_MACHINE("10m50-ghrd", nios2_10m50_ghrd_machine_init);
diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
index ad5371250f..d08ce61811 100644
--- a/hw/openrisc/openrisc_sim.c
+++ b/hw/openrisc/openrisc_sim.c
@@ -176,7 +176,7 @@ static void openrisc_sim_machine_init(MachineClass *mc)
mc->desc = "or1k simulation";
mc->init = openrisc_sim_init;
mc->max_cpus = 2;
- mc->is_default = 1;
+ mc->is_default = true;
mc->default_cpu_type = OPENRISC_CPU_TYPE_NAME("or1200");
}
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index 7318d7e9b4..1630663bc2 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -438,7 +438,7 @@ static void heathrow_class_init(ObjectClass *oc, void *data)
mc->block_default_type = IF_IDE;
mc->max_cpus = MAX_CPUS;
#ifndef TARGET_PPC64
- mc->is_default = 1;
+ mc->is_default = true;
#endif
/* TOFIX "cad" when Mac floppy is implemented */
mc->default_boot_order = "cd";
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index c9b2e0a5e0..e3e3208cd8 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -4493,7 +4493,7 @@ static const TypeInfo spapr_machine_info = {
spapr_machine_##suffix##_class_options(mc); \
if (latest) { \
mc->alias = "pseries"; \
- mc->is_default = 1; \
+ mc->is_default = true; \
} \
} \
static const TypeInfo spapr_machine_##suffix##_info = { \
diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
index 8823681783..6f03857660 100644
--- a/hw/riscv/spike.c
+++ b/hw/riscv/spike.c
@@ -448,7 +448,7 @@ static void spike_machine_init(MachineClass *mc)
mc->desc = "RISC-V Spike Board";
mc->init = spike_board_init;
mc->max_cpus = 1;
- mc->is_default = 1;
+ mc->is_default = true;
mc->default_cpu_type = SPIKE_V1_10_0_CPU;
}
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index e759eb5f83..c4b291e434 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -631,7 +631,7 @@ bool css_migration_enabled(void)
mc->desc = "VirtIO-ccw based S390 machine v" verstr; \
if (latest) { \
mc->alias = "s390-ccw-virtio"; \
- mc->is_default = 1; \
+ mc->is_default = true; \
} \
} \
static void ccw_machine_##suffix##_instance_init(Object *obj) \
diff --git a/hw/sh4/shix.c b/hw/sh4/shix.c
index 2fc2915428..68b14ee5e7 100644
--- a/hw/sh4/shix.c
+++ b/hw/sh4/shix.c
@@ -82,7 +82,7 @@ static void shix_machine_init(MachineClass *mc)
{
mc->desc = "shix card";
mc->init = shix_init;
- mc->is_default = 1;
+ mc->is_default = true;
mc->default_cpu_type = TYPE_SH7750R_CPU;
}
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index 25e96db5ca..d6c9772f95 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -1411,7 +1411,7 @@ static void ss5_class_init(ObjectClass *oc, void *data)
mc->desc = "Sun4m platform, SPARCstation 5";
mc->init = ss5_init;
mc->block_default_type = IF_SCSI;
- mc->is_default = 1;
+ mc->is_default = true;
mc->default_boot_order = "c";
mc->default_cpu_type = SPARC_CPU_TYPE_NAME("Fujitsu-MB86904");
mc->default_display = "tcx";
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index b7ac42f7a5..d33e84f831 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -816,7 +816,7 @@ static void sun4u_class_init(ObjectClass *oc, void *data)
mc->init = sun4u_init;
mc->block_default_type = IF_IDE;
mc->max_cpus = 1; /* XXX for now */
- mc->is_default = 1;
+ mc->is_default = true;
mc->default_boot_order = "c";
mc->default_cpu_type = SPARC_CPU_TYPE_NAME("TI-UltraSparc-IIi");
mc->ignore_boot_device_suffixes = true;
diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c
index 7e933de228..7f9c0238fe 100644
--- a/hw/unicore32/puv3.c
+++ b/hw/unicore32/puv3.c
@@ -140,7 +140,7 @@ static void puv3_machine_init(MachineClass *mc)
{
mc->desc = "PKUnity Version-3 based on UniCore32";
mc->init = puv3_init;
- mc->is_default = 1;
+ mc->is_default = true;
mc->default_cpu_type = UNICORE32_CPU_TYPE_NAME("UniCore-II");
}
--
2.21.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* Re: [PATCH v4 2/3] hw: Make MachineClass::is_default a boolean type
2020-02-07 16:19 ` Philippe Mathieu-Daudé
@ 2020-02-07 16:32 ` Marc-André Lureau
-1 siblings, 0 replies; 42+ messages in thread
From: Marc-André Lureau @ 2020-02-07 16:32 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Cornelia Huck, Sagar Karandikar, Michael S. Tsirkin,
Anthony Green, Mark Cave-Ayland, QEMU, Alistair Francis,
Edgar E. Iglesias, Guan Xuetao, Marek Vasut, Jia Liu,
qemu trival, Helge Deller, David Hildenbrand, Magnus Damm,
Halil Pasic, Christian Borntraeger, open list:sPAPR pseries,
Aleksandar Rikalo, David Gibson, Artyom Tarasenko,
Eduardo Habkost, Richard Henderson, Qemu-s390x list,
Stafford Horne, Richard Henderson, qemu-riscv, Thomas Huth,
Bastian Koppelmann, Chris Wulff, Laurent Vivier, Michael Walle,
Palmer Dabbelt, Aleksandar Markovic, Paolo Bonzini,
Aurelien Jarno
On Fri, Feb 7, 2020 at 5:21 PM Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> There's no good reason for it to be type int, change it to bool.
>
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> v4:
> - fixed incorrect changes to max_cpus (Laurent)
> - describe field
> ---
> include/hw/boards.h | 4 +++-
> hw/alpha/dp264.c | 2 +-
> hw/cris/axis_dev88.c | 2 +-
> hw/hppa/machine.c | 2 +-
> hw/i386/pc_piix.c | 10 +++++-----
> hw/lm32/lm32_boards.c | 2 +-
> hw/m68k/mcf5208.c | 2 +-
> hw/microblaze/petalogix_s3adsp1800_mmu.c | 2 +-
> hw/mips/mips_malta.c | 2 +-
> hw/moxie/moxiesim.c | 2 +-
> hw/nios2/10m50_devboard.c | 2 +-
> hw/openrisc/openrisc_sim.c | 2 +-
> hw/ppc/mac_oldworld.c | 2 +-
> hw/ppc/spapr.c | 2 +-
> hw/riscv/spike.c | 2 +-
> hw/s390x/s390-virtio-ccw.c | 2 +-
> hw/sh4/shix.c | 2 +-
> hw/sparc/sun4m.c | 2 +-
> hw/sparc64/sun4u.c | 2 +-
> hw/unicore32/puv3.c | 2 +-
> 20 files changed, 26 insertions(+), 24 deletions(-)
>
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index fb1b43d5b9..c3523a70e8 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -107,6 +107,8 @@ typedef struct {
> * @max_cpus: maximum number of CPUs supported. Default: 1
> * @min_cpus: minimum number of CPUs supported. Default: 1
> * @default_cpus: number of CPUs instantiated if none are specified. Default: 1
> + * @is_default:
> + * If true QEMU will use this machine by default if no '-M' option is given.
> * @get_hotplug_handler: this function is called during bus-less
> * device hotplug. If defined it returns pointer to an instance
> * of HotplugHandler object, which handles hotplug operation
> @@ -200,7 +202,7 @@ struct MachineClass {
> no_sdcard:1,
> pci_allow_0_address:1,
> legacy_fw_cfg_order:1;
> - int is_default;
> + bool is_default;
> const char *default_machine_opts;
> const char *default_boot_order;
> const char *default_display;
> diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
> index a8f9a89cc4..083a198a64 100644
> --- a/hw/alpha/dp264.c
> +++ b/hw/alpha/dp264.c
> @@ -181,7 +181,7 @@ static void clipper_machine_init(MachineClass *mc)
> mc->init = clipper_init;
> mc->block_default_type = IF_IDE;
> mc->max_cpus = 4;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = ALPHA_CPU_TYPE_NAME("ev67");
> }
>
> diff --git a/hw/cris/axis_dev88.c b/hw/cris/axis_dev88.c
> index be7760476a..de7b49188b 100644
> --- a/hw/cris/axis_dev88.c
> +++ b/hw/cris/axis_dev88.c
> @@ -349,7 +349,7 @@ static void axisdev88_machine_init(MachineClass *mc)
> {
> mc->desc = "AXIS devboard 88";
> mc->init = axisdev88_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = CRIS_CPU_TYPE_NAME("crisv32");
> }
>
> diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
> index d8755ec422..83ae87f565 100644
> --- a/hw/hppa/machine.c
> +++ b/hw/hppa/machine.c
> @@ -295,7 +295,7 @@ static void machine_hppa_machine_init(MachineClass *mc)
> mc->block_default_type = IF_SCSI;
> mc->max_cpus = HPPA_MAX_CPUS;
> mc->default_cpus = 1;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_ram_size = 512 * MiB;
> mc->default_boot_order = "cd";
> }
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index fa12203079..9088db8fb6 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -423,7 +423,7 @@ static void pc_i440fx_5_0_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
> pc_i440fx_machine_options(m);
> m->alias = "pc";
> - m->is_default = 1;
> + m->is_default = true;
> pcmc->default_cpu_version = 1;
> }
>
> @@ -434,7 +434,7 @@ static void pc_i440fx_4_2_machine_options(MachineClass *m)
> {
> pc_i440fx_5_0_machine_options(m);
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
> compat_props_add(m->compat_props, hw_compat_4_2, hw_compat_4_2_len);
> compat_props_add(m->compat_props, pc_compat_4_2, pc_compat_4_2_len);
> }
> @@ -446,7 +446,7 @@ static void pc_i440fx_4_1_machine_options(MachineClass *m)
> {
> pc_i440fx_4_2_machine_options(m);
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
> compat_props_add(m->compat_props, hw_compat_4_1, hw_compat_4_1_len);
> compat_props_add(m->compat_props, pc_compat_4_1, pc_compat_4_1_len);
> }
> @@ -459,7 +459,7 @@ static void pc_i440fx_4_0_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
> pc_i440fx_4_1_machine_options(m);
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
> pcmc->default_cpu_version = CPU_VERSION_LEGACY;
> compat_props_add(m->compat_props, hw_compat_4_0, hw_compat_4_0_len);
> compat_props_add(m->compat_props, pc_compat_4_0, pc_compat_4_0_len);
> @@ -473,7 +473,7 @@ static void pc_i440fx_3_1_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
>
> pc_i440fx_4_0_machine_options(m);
> - m->is_default = 0;
> + m->is_default = false;
> pcmc->do_not_add_smb_acpi = true;
> m->smbus_no_migration_support = true;
> m->alias = NULL;
> diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c
> index 156b050abc..352f69532e 100644
> --- a/hw/lm32/lm32_boards.c
> +++ b/hw/lm32/lm32_boards.c
> @@ -286,7 +286,7 @@ static void lm32_evr_class_init(ObjectClass *oc, void *data)
>
> mc->desc = "LatticeMico32 EVR32 eval system";
> mc->init = lm32_evr_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = LM32_CPU_TYPE_NAME("lm32-full");
> }
>
> diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
> index a999c21982..5f8f6e4475 100644
> --- a/hw/m68k/mcf5208.c
> +++ b/hw/m68k/mcf5208.c
> @@ -352,7 +352,7 @@ static void mcf5208evb_machine_init(MachineClass *mc)
> {
> mc->desc = "MCF5208EVB";
> mc->init = mcf5208evb_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = M68K_CPU_TYPE_NAME("m5208");
> }
>
> diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c
> index 849bafc186..0bb6cdea8d 100644
> --- a/hw/microblaze/petalogix_s3adsp1800_mmu.c
> +++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c
> @@ -132,7 +132,7 @@ static void petalogix_s3adsp1800_machine_init(MachineClass *mc)
> {
> mc->desc = "PetaLogix linux refdesign for xilinx Spartan 3ADSP1800";
> mc->init = petalogix_s3adsp1800_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> }
>
> DEFINE_MACHINE("petalogix-s3adsp1800", petalogix_s3adsp1800_machine_init)
> diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
> index 34b76bb6a1..499eac8d33 100644
> --- a/hw/mips/mips_malta.c
> +++ b/hw/mips/mips_malta.c
> @@ -1442,7 +1442,7 @@ static void mips_malta_machine_init(MachineClass *mc)
> mc->init = mips_malta_init;
> mc->block_default_type = IF_IDE;
> mc->max_cpus = 16;
> - mc->is_default = 1;
> + mc->is_default = true;
> #ifdef TARGET_MIPS64
> mc->default_cpu_type = MIPS_CPU_TYPE_NAME("20Kc");
> #else
> diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c
> index 1d06e39fcb..51a98287b5 100644
> --- a/hw/moxie/moxiesim.c
> +++ b/hw/moxie/moxiesim.c
> @@ -150,7 +150,7 @@ static void moxiesim_machine_init(MachineClass *mc)
> {
> mc->desc = "Moxie simulator platform";
> mc->init = moxiesim_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = MOXIE_CPU_TYPE_NAME("MoxieLite");
> }
>
> diff --git a/hw/nios2/10m50_devboard.c b/hw/nios2/10m50_devboard.c
> index ad8b2fc670..33dc2bf511 100644
> --- a/hw/nios2/10m50_devboard.c
> +++ b/hw/nios2/10m50_devboard.c
> @@ -120,7 +120,7 @@ static void nios2_10m50_ghrd_machine_init(struct MachineClass *mc)
> {
> mc->desc = "Altera 10M50 GHRD Nios II design";
> mc->init = nios2_10m50_ghrd_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> }
>
> DEFINE_MACHINE("10m50-ghrd", nios2_10m50_ghrd_machine_init);
> diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
> index ad5371250f..d08ce61811 100644
> --- a/hw/openrisc/openrisc_sim.c
> +++ b/hw/openrisc/openrisc_sim.c
> @@ -176,7 +176,7 @@ static void openrisc_sim_machine_init(MachineClass *mc)
> mc->desc = "or1k simulation";
> mc->init = openrisc_sim_init;
> mc->max_cpus = 2;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = OPENRISC_CPU_TYPE_NAME("or1200");
> }
>
> diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
> index 7318d7e9b4..1630663bc2 100644
> --- a/hw/ppc/mac_oldworld.c
> +++ b/hw/ppc/mac_oldworld.c
> @@ -438,7 +438,7 @@ static void heathrow_class_init(ObjectClass *oc, void *data)
> mc->block_default_type = IF_IDE;
> mc->max_cpus = MAX_CPUS;
> #ifndef TARGET_PPC64
> - mc->is_default = 1;
> + mc->is_default = true;
> #endif
> /* TOFIX "cad" when Mac floppy is implemented */
> mc->default_boot_order = "cd";
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index c9b2e0a5e0..e3e3208cd8 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -4493,7 +4493,7 @@ static const TypeInfo spapr_machine_info = {
> spapr_machine_##suffix##_class_options(mc); \
> if (latest) { \
> mc->alias = "pseries"; \
> - mc->is_default = 1; \
> + mc->is_default = true; \
> } \
> } \
> static const TypeInfo spapr_machine_##suffix##_info = { \
> diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
> index 8823681783..6f03857660 100644
> --- a/hw/riscv/spike.c
> +++ b/hw/riscv/spike.c
> @@ -448,7 +448,7 @@ static void spike_machine_init(MachineClass *mc)
> mc->desc = "RISC-V Spike Board";
> mc->init = spike_board_init;
> mc->max_cpus = 1;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = SPIKE_V1_10_0_CPU;
> }
>
> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
> index e759eb5f83..c4b291e434 100644
> --- a/hw/s390x/s390-virtio-ccw.c
> +++ b/hw/s390x/s390-virtio-ccw.c
> @@ -631,7 +631,7 @@ bool css_migration_enabled(void)
> mc->desc = "VirtIO-ccw based S390 machine v" verstr; \
> if (latest) { \
> mc->alias = "s390-ccw-virtio"; \
> - mc->is_default = 1; \
> + mc->is_default = true; \
> } \
> } \
> static void ccw_machine_##suffix##_instance_init(Object *obj) \
> diff --git a/hw/sh4/shix.c b/hw/sh4/shix.c
> index 2fc2915428..68b14ee5e7 100644
> --- a/hw/sh4/shix.c
> +++ b/hw/sh4/shix.c
> @@ -82,7 +82,7 @@ static void shix_machine_init(MachineClass *mc)
> {
> mc->desc = "shix card";
> mc->init = shix_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = TYPE_SH7750R_CPU;
> }
>
> diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
> index 25e96db5ca..d6c9772f95 100644
> --- a/hw/sparc/sun4m.c
> +++ b/hw/sparc/sun4m.c
> @@ -1411,7 +1411,7 @@ static void ss5_class_init(ObjectClass *oc, void *data)
> mc->desc = "Sun4m platform, SPARCstation 5";
> mc->init = ss5_init;
> mc->block_default_type = IF_SCSI;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_boot_order = "c";
> mc->default_cpu_type = SPARC_CPU_TYPE_NAME("Fujitsu-MB86904");
> mc->default_display = "tcx";
> diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
> index b7ac42f7a5..d33e84f831 100644
> --- a/hw/sparc64/sun4u.c
> +++ b/hw/sparc64/sun4u.c
> @@ -816,7 +816,7 @@ static void sun4u_class_init(ObjectClass *oc, void *data)
> mc->init = sun4u_init;
> mc->block_default_type = IF_IDE;
> mc->max_cpus = 1; /* XXX for now */
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_boot_order = "c";
> mc->default_cpu_type = SPARC_CPU_TYPE_NAME("TI-UltraSparc-IIi");
> mc->ignore_boot_device_suffixes = true;
> diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c
> index 7e933de228..7f9c0238fe 100644
> --- a/hw/unicore32/puv3.c
> +++ b/hw/unicore32/puv3.c
> @@ -140,7 +140,7 @@ static void puv3_machine_init(MachineClass *mc)
> {
> mc->desc = "PKUnity Version-3 based on UniCore32";
> mc->init = puv3_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = UNICORE32_CPU_TYPE_NAME("UniCore-II");
> }
>
> --
> 2.21.1
>
>
--
Marc-André Lureau
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v4 2/3] hw: Make MachineClass::is_default a boolean type
@ 2020-02-07 16:32 ` Marc-André Lureau
0 siblings, 0 replies; 42+ messages in thread
From: Marc-André Lureau @ 2020-02-07 16:32 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: QEMU, Chris Wulff, Sagar Karandikar, Michael S. Tsirkin,
Anthony Green, Mark Cave-Ayland, Alistair Francis,
Edgar E. Iglesias, Guan Xuetao, Marek Vasut, Jia Liu,
qemu trival, Helge Deller, David Hildenbrand, Magnus Damm,
Halil Pasic, Christian Borntraeger, Palmer Dabbelt,
Aleksandar Rikalo, Richard Henderson, Artyom Tarasenko,
Eduardo Habkost, Richard Henderson, Qemu-s390x list,
Stafford Horne, David Gibson, qemu-riscv, Thomas Huth,
Bastian Koppelmann, Cornelia Huck, Laurent Vivier, Michael Walle,
open list:sPAPR pseries, Aleksandar Markovic, Paolo Bonzini,
Aurelien Jarno
On Fri, Feb 7, 2020 at 5:21 PM Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> There's no good reason for it to be type int, change it to bool.
>
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> v4:
> - fixed incorrect changes to max_cpus (Laurent)
> - describe field
> ---
> include/hw/boards.h | 4 +++-
> hw/alpha/dp264.c | 2 +-
> hw/cris/axis_dev88.c | 2 +-
> hw/hppa/machine.c | 2 +-
> hw/i386/pc_piix.c | 10 +++++-----
> hw/lm32/lm32_boards.c | 2 +-
> hw/m68k/mcf5208.c | 2 +-
> hw/microblaze/petalogix_s3adsp1800_mmu.c | 2 +-
> hw/mips/mips_malta.c | 2 +-
> hw/moxie/moxiesim.c | 2 +-
> hw/nios2/10m50_devboard.c | 2 +-
> hw/openrisc/openrisc_sim.c | 2 +-
> hw/ppc/mac_oldworld.c | 2 +-
> hw/ppc/spapr.c | 2 +-
> hw/riscv/spike.c | 2 +-
> hw/s390x/s390-virtio-ccw.c | 2 +-
> hw/sh4/shix.c | 2 +-
> hw/sparc/sun4m.c | 2 +-
> hw/sparc64/sun4u.c | 2 +-
> hw/unicore32/puv3.c | 2 +-
> 20 files changed, 26 insertions(+), 24 deletions(-)
>
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index fb1b43d5b9..c3523a70e8 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -107,6 +107,8 @@ typedef struct {
> * @max_cpus: maximum number of CPUs supported. Default: 1
> * @min_cpus: minimum number of CPUs supported. Default: 1
> * @default_cpus: number of CPUs instantiated if none are specified. Default: 1
> + * @is_default:
> + * If true QEMU will use this machine by default if no '-M' option is given.
> * @get_hotplug_handler: this function is called during bus-less
> * device hotplug. If defined it returns pointer to an instance
> * of HotplugHandler object, which handles hotplug operation
> @@ -200,7 +202,7 @@ struct MachineClass {
> no_sdcard:1,
> pci_allow_0_address:1,
> legacy_fw_cfg_order:1;
> - int is_default;
> + bool is_default;
> const char *default_machine_opts;
> const char *default_boot_order;
> const char *default_display;
> diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
> index a8f9a89cc4..083a198a64 100644
> --- a/hw/alpha/dp264.c
> +++ b/hw/alpha/dp264.c
> @@ -181,7 +181,7 @@ static void clipper_machine_init(MachineClass *mc)
> mc->init = clipper_init;
> mc->block_default_type = IF_IDE;
> mc->max_cpus = 4;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = ALPHA_CPU_TYPE_NAME("ev67");
> }
>
> diff --git a/hw/cris/axis_dev88.c b/hw/cris/axis_dev88.c
> index be7760476a..de7b49188b 100644
> --- a/hw/cris/axis_dev88.c
> +++ b/hw/cris/axis_dev88.c
> @@ -349,7 +349,7 @@ static void axisdev88_machine_init(MachineClass *mc)
> {
> mc->desc = "AXIS devboard 88";
> mc->init = axisdev88_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = CRIS_CPU_TYPE_NAME("crisv32");
> }
>
> diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
> index d8755ec422..83ae87f565 100644
> --- a/hw/hppa/machine.c
> +++ b/hw/hppa/machine.c
> @@ -295,7 +295,7 @@ static void machine_hppa_machine_init(MachineClass *mc)
> mc->block_default_type = IF_SCSI;
> mc->max_cpus = HPPA_MAX_CPUS;
> mc->default_cpus = 1;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_ram_size = 512 * MiB;
> mc->default_boot_order = "cd";
> }
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index fa12203079..9088db8fb6 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -423,7 +423,7 @@ static void pc_i440fx_5_0_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
> pc_i440fx_machine_options(m);
> m->alias = "pc";
> - m->is_default = 1;
> + m->is_default = true;
> pcmc->default_cpu_version = 1;
> }
>
> @@ -434,7 +434,7 @@ static void pc_i440fx_4_2_machine_options(MachineClass *m)
> {
> pc_i440fx_5_0_machine_options(m);
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
> compat_props_add(m->compat_props, hw_compat_4_2, hw_compat_4_2_len);
> compat_props_add(m->compat_props, pc_compat_4_2, pc_compat_4_2_len);
> }
> @@ -446,7 +446,7 @@ static void pc_i440fx_4_1_machine_options(MachineClass *m)
> {
> pc_i440fx_4_2_machine_options(m);
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
> compat_props_add(m->compat_props, hw_compat_4_1, hw_compat_4_1_len);
> compat_props_add(m->compat_props, pc_compat_4_1, pc_compat_4_1_len);
> }
> @@ -459,7 +459,7 @@ static void pc_i440fx_4_0_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
> pc_i440fx_4_1_machine_options(m);
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
> pcmc->default_cpu_version = CPU_VERSION_LEGACY;
> compat_props_add(m->compat_props, hw_compat_4_0, hw_compat_4_0_len);
> compat_props_add(m->compat_props, pc_compat_4_0, pc_compat_4_0_len);
> @@ -473,7 +473,7 @@ static void pc_i440fx_3_1_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
>
> pc_i440fx_4_0_machine_options(m);
> - m->is_default = 0;
> + m->is_default = false;
> pcmc->do_not_add_smb_acpi = true;
> m->smbus_no_migration_support = true;
> m->alias = NULL;
> diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c
> index 156b050abc..352f69532e 100644
> --- a/hw/lm32/lm32_boards.c
> +++ b/hw/lm32/lm32_boards.c
> @@ -286,7 +286,7 @@ static void lm32_evr_class_init(ObjectClass *oc, void *data)
>
> mc->desc = "LatticeMico32 EVR32 eval system";
> mc->init = lm32_evr_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = LM32_CPU_TYPE_NAME("lm32-full");
> }
>
> diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
> index a999c21982..5f8f6e4475 100644
> --- a/hw/m68k/mcf5208.c
> +++ b/hw/m68k/mcf5208.c
> @@ -352,7 +352,7 @@ static void mcf5208evb_machine_init(MachineClass *mc)
> {
> mc->desc = "MCF5208EVB";
> mc->init = mcf5208evb_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = M68K_CPU_TYPE_NAME("m5208");
> }
>
> diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c
> index 849bafc186..0bb6cdea8d 100644
> --- a/hw/microblaze/petalogix_s3adsp1800_mmu.c
> +++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c
> @@ -132,7 +132,7 @@ static void petalogix_s3adsp1800_machine_init(MachineClass *mc)
> {
> mc->desc = "PetaLogix linux refdesign for xilinx Spartan 3ADSP1800";
> mc->init = petalogix_s3adsp1800_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> }
>
> DEFINE_MACHINE("petalogix-s3adsp1800", petalogix_s3adsp1800_machine_init)
> diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
> index 34b76bb6a1..499eac8d33 100644
> --- a/hw/mips/mips_malta.c
> +++ b/hw/mips/mips_malta.c
> @@ -1442,7 +1442,7 @@ static void mips_malta_machine_init(MachineClass *mc)
> mc->init = mips_malta_init;
> mc->block_default_type = IF_IDE;
> mc->max_cpus = 16;
> - mc->is_default = 1;
> + mc->is_default = true;
> #ifdef TARGET_MIPS64
> mc->default_cpu_type = MIPS_CPU_TYPE_NAME("20Kc");
> #else
> diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c
> index 1d06e39fcb..51a98287b5 100644
> --- a/hw/moxie/moxiesim.c
> +++ b/hw/moxie/moxiesim.c
> @@ -150,7 +150,7 @@ static void moxiesim_machine_init(MachineClass *mc)
> {
> mc->desc = "Moxie simulator platform";
> mc->init = moxiesim_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = MOXIE_CPU_TYPE_NAME("MoxieLite");
> }
>
> diff --git a/hw/nios2/10m50_devboard.c b/hw/nios2/10m50_devboard.c
> index ad8b2fc670..33dc2bf511 100644
> --- a/hw/nios2/10m50_devboard.c
> +++ b/hw/nios2/10m50_devboard.c
> @@ -120,7 +120,7 @@ static void nios2_10m50_ghrd_machine_init(struct MachineClass *mc)
> {
> mc->desc = "Altera 10M50 GHRD Nios II design";
> mc->init = nios2_10m50_ghrd_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> }
>
> DEFINE_MACHINE("10m50-ghrd", nios2_10m50_ghrd_machine_init);
> diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
> index ad5371250f..d08ce61811 100644
> --- a/hw/openrisc/openrisc_sim.c
> +++ b/hw/openrisc/openrisc_sim.c
> @@ -176,7 +176,7 @@ static void openrisc_sim_machine_init(MachineClass *mc)
> mc->desc = "or1k simulation";
> mc->init = openrisc_sim_init;
> mc->max_cpus = 2;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = OPENRISC_CPU_TYPE_NAME("or1200");
> }
>
> diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
> index 7318d7e9b4..1630663bc2 100644
> --- a/hw/ppc/mac_oldworld.c
> +++ b/hw/ppc/mac_oldworld.c
> @@ -438,7 +438,7 @@ static void heathrow_class_init(ObjectClass *oc, void *data)
> mc->block_default_type = IF_IDE;
> mc->max_cpus = MAX_CPUS;
> #ifndef TARGET_PPC64
> - mc->is_default = 1;
> + mc->is_default = true;
> #endif
> /* TOFIX "cad" when Mac floppy is implemented */
> mc->default_boot_order = "cd";
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index c9b2e0a5e0..e3e3208cd8 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -4493,7 +4493,7 @@ static const TypeInfo spapr_machine_info = {
> spapr_machine_##suffix##_class_options(mc); \
> if (latest) { \
> mc->alias = "pseries"; \
> - mc->is_default = 1; \
> + mc->is_default = true; \
> } \
> } \
> static const TypeInfo spapr_machine_##suffix##_info = { \
> diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
> index 8823681783..6f03857660 100644
> --- a/hw/riscv/spike.c
> +++ b/hw/riscv/spike.c
> @@ -448,7 +448,7 @@ static void spike_machine_init(MachineClass *mc)
> mc->desc = "RISC-V Spike Board";
> mc->init = spike_board_init;
> mc->max_cpus = 1;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = SPIKE_V1_10_0_CPU;
> }
>
> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
> index e759eb5f83..c4b291e434 100644
> --- a/hw/s390x/s390-virtio-ccw.c
> +++ b/hw/s390x/s390-virtio-ccw.c
> @@ -631,7 +631,7 @@ bool css_migration_enabled(void)
> mc->desc = "VirtIO-ccw based S390 machine v" verstr; \
> if (latest) { \
> mc->alias = "s390-ccw-virtio"; \
> - mc->is_default = 1; \
> + mc->is_default = true; \
> } \
> } \
> static void ccw_machine_##suffix##_instance_init(Object *obj) \
> diff --git a/hw/sh4/shix.c b/hw/sh4/shix.c
> index 2fc2915428..68b14ee5e7 100644
> --- a/hw/sh4/shix.c
> +++ b/hw/sh4/shix.c
> @@ -82,7 +82,7 @@ static void shix_machine_init(MachineClass *mc)
> {
> mc->desc = "shix card";
> mc->init = shix_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = TYPE_SH7750R_CPU;
> }
>
> diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
> index 25e96db5ca..d6c9772f95 100644
> --- a/hw/sparc/sun4m.c
> +++ b/hw/sparc/sun4m.c
> @@ -1411,7 +1411,7 @@ static void ss5_class_init(ObjectClass *oc, void *data)
> mc->desc = "Sun4m platform, SPARCstation 5";
> mc->init = ss5_init;
> mc->block_default_type = IF_SCSI;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_boot_order = "c";
> mc->default_cpu_type = SPARC_CPU_TYPE_NAME("Fujitsu-MB86904");
> mc->default_display = "tcx";
> diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
> index b7ac42f7a5..d33e84f831 100644
> --- a/hw/sparc64/sun4u.c
> +++ b/hw/sparc64/sun4u.c
> @@ -816,7 +816,7 @@ static void sun4u_class_init(ObjectClass *oc, void *data)
> mc->init = sun4u_init;
> mc->block_default_type = IF_IDE;
> mc->max_cpus = 1; /* XXX for now */
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_boot_order = "c";
> mc->default_cpu_type = SPARC_CPU_TYPE_NAME("TI-UltraSparc-IIi");
> mc->ignore_boot_device_suffixes = true;
> diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c
> index 7e933de228..7f9c0238fe 100644
> --- a/hw/unicore32/puv3.c
> +++ b/hw/unicore32/puv3.c
> @@ -140,7 +140,7 @@ static void puv3_machine_init(MachineClass *mc)
> {
> mc->desc = "PKUnity Version-3 based on UniCore32";
> mc->init = puv3_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = UNICORE32_CPU_TYPE_NAME("UniCore-II");
> }
>
> --
> 2.21.1
>
>
--
Marc-André Lureau
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v4 2/3] hw: Make MachineClass::is_default a boolean type
2020-02-07 16:19 ` Philippe Mathieu-Daudé
@ 2020-02-07 17:48 ` Laurent Vivier
-1 siblings, 0 replies; 42+ messages in thread
From: Laurent Vivier @ 2020-02-07 17:48 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Chris Wulff, Sagar Karandikar, Michael S. Tsirkin, Anthony Green,
Mark Cave-Ayland, Alistair Francis, Edgar E. Iglesias,
Guan Xuetao, Marek Vasut, Jia Liu, qemu-trivial, Helge Deller,
David Hildenbrand, Magnus Damm, Halil Pasic,
Christian Borntraeger, Palmer Dabbelt, Aleksandar Rikalo,
Richard Henderson, Artyom Tarasenko, Eduardo Habkost,
Richard Henderson, qemu-s390x, Stafford Horne, David Gibson,
qemu-riscv, Thomas Huth, Bastian Koppelmann, Cornelia Huck,
Michael Walle, qemu-ppc, Aleksandar Markovic, Paolo Bonzini,
Aurelien Jarno
Le 07/02/2020 à 17:19, Philippe Mathieu-Daudé a écrit :
> There's no good reason for it to be type int, change it to bool.
>
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> v4:
> - fixed incorrect changes to max_cpus (Laurent)
> - describe field
> ---
> include/hw/boards.h | 4 +++-
> hw/alpha/dp264.c | 2 +-
> hw/cris/axis_dev88.c | 2 +-
> hw/hppa/machine.c | 2 +-
> hw/i386/pc_piix.c | 10 +++++-----
> hw/lm32/lm32_boards.c | 2 +-
> hw/m68k/mcf5208.c | 2 +-
> hw/microblaze/petalogix_s3adsp1800_mmu.c | 2 +-
> hw/mips/mips_malta.c | 2 +-
> hw/moxie/moxiesim.c | 2 +-
> hw/nios2/10m50_devboard.c | 2 +-
> hw/openrisc/openrisc_sim.c | 2 +-
> hw/ppc/mac_oldworld.c | 2 +-
> hw/ppc/spapr.c | 2 +-
> hw/riscv/spike.c | 2 +-
> hw/s390x/s390-virtio-ccw.c | 2 +-
> hw/sh4/shix.c | 2 +-
> hw/sparc/sun4m.c | 2 +-
> hw/sparc64/sun4u.c | 2 +-
> hw/unicore32/puv3.c | 2 +-
> 20 files changed, 26 insertions(+), 24 deletions(-)
>
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index fb1b43d5b9..c3523a70e8 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -107,6 +107,8 @@ typedef struct {
> * @max_cpus: maximum number of CPUs supported. Default: 1
> * @min_cpus: minimum number of CPUs supported. Default: 1
> * @default_cpus: number of CPUs instantiated if none are specified. Default: 1
> + * @is_default:
> + * If true QEMU will use this machine by default if no '-M' option is given.
> * @get_hotplug_handler: this function is called during bus-less
> * device hotplug. If defined it returns pointer to an instance
> * of HotplugHandler object, which handles hotplug operation
> @@ -200,7 +202,7 @@ struct MachineClass {
> no_sdcard:1,
> pci_allow_0_address:1,
> legacy_fw_cfg_order:1;
> - int is_default;
> + bool is_default;
> const char *default_machine_opts;
> const char *default_boot_order;
> const char *default_display;
> diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
> index a8f9a89cc4..083a198a64 100644
> --- a/hw/alpha/dp264.c
> +++ b/hw/alpha/dp264.c
> @@ -181,7 +181,7 @@ static void clipper_machine_init(MachineClass *mc)
> mc->init = clipper_init;
> mc->block_default_type = IF_IDE;
> mc->max_cpus = 4;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = ALPHA_CPU_TYPE_NAME("ev67");
> }
>
> diff --git a/hw/cris/axis_dev88.c b/hw/cris/axis_dev88.c
> index be7760476a..de7b49188b 100644
> --- a/hw/cris/axis_dev88.c
> +++ b/hw/cris/axis_dev88.c
> @@ -349,7 +349,7 @@ static void axisdev88_machine_init(MachineClass *mc)
> {
> mc->desc = "AXIS devboard 88";
> mc->init = axisdev88_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = CRIS_CPU_TYPE_NAME("crisv32");
> }
>
> diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
> index d8755ec422..83ae87f565 100644
> --- a/hw/hppa/machine.c
> +++ b/hw/hppa/machine.c
> @@ -295,7 +295,7 @@ static void machine_hppa_machine_init(MachineClass *mc)
> mc->block_default_type = IF_SCSI;
> mc->max_cpus = HPPA_MAX_CPUS;
> mc->default_cpus = 1;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_ram_size = 512 * MiB;
> mc->default_boot_order = "cd";
> }
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index fa12203079..9088db8fb6 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -423,7 +423,7 @@ static void pc_i440fx_5_0_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
> pc_i440fx_machine_options(m);
> m->alias = "pc";
> - m->is_default = 1;
> + m->is_default = true;
> pcmc->default_cpu_version = 1;
> }
>
> @@ -434,7 +434,7 @@ static void pc_i440fx_4_2_machine_options(MachineClass *m)
> {
> pc_i440fx_5_0_machine_options(m);
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
> compat_props_add(m->compat_props, hw_compat_4_2, hw_compat_4_2_len);
> compat_props_add(m->compat_props, pc_compat_4_2, pc_compat_4_2_len);
> }
> @@ -446,7 +446,7 @@ static void pc_i440fx_4_1_machine_options(MachineClass *m)
> {
> pc_i440fx_4_2_machine_options(m);
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
> compat_props_add(m->compat_props, hw_compat_4_1, hw_compat_4_1_len);
> compat_props_add(m->compat_props, pc_compat_4_1, pc_compat_4_1_len);
> }
> @@ -459,7 +459,7 @@ static void pc_i440fx_4_0_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
> pc_i440fx_4_1_machine_options(m);
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
> pcmc->default_cpu_version = CPU_VERSION_LEGACY;
> compat_props_add(m->compat_props, hw_compat_4_0, hw_compat_4_0_len);
> compat_props_add(m->compat_props, pc_compat_4_0, pc_compat_4_0_len);
> @@ -473,7 +473,7 @@ static void pc_i440fx_3_1_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
>
> pc_i440fx_4_0_machine_options(m);
> - m->is_default = 0;
> + m->is_default = false;
> pcmc->do_not_add_smb_acpi = true;
> m->smbus_no_migration_support = true;
> m->alias = NULL;
> diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c
> index 156b050abc..352f69532e 100644
> --- a/hw/lm32/lm32_boards.c
> +++ b/hw/lm32/lm32_boards.c
> @@ -286,7 +286,7 @@ static void lm32_evr_class_init(ObjectClass *oc, void *data)
>
> mc->desc = "LatticeMico32 EVR32 eval system";
> mc->init = lm32_evr_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = LM32_CPU_TYPE_NAME("lm32-full");
> }
>
> diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
> index a999c21982..5f8f6e4475 100644
> --- a/hw/m68k/mcf5208.c
> +++ b/hw/m68k/mcf5208.c
> @@ -352,7 +352,7 @@ static void mcf5208evb_machine_init(MachineClass *mc)
> {
> mc->desc = "MCF5208EVB";
> mc->init = mcf5208evb_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = M68K_CPU_TYPE_NAME("m5208");
> }
>
> diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c
> index 849bafc186..0bb6cdea8d 100644
> --- a/hw/microblaze/petalogix_s3adsp1800_mmu.c
> +++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c
> @@ -132,7 +132,7 @@ static void petalogix_s3adsp1800_machine_init(MachineClass *mc)
> {
> mc->desc = "PetaLogix linux refdesign for xilinx Spartan 3ADSP1800";
> mc->init = petalogix_s3adsp1800_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> }
>
> DEFINE_MACHINE("petalogix-s3adsp1800", petalogix_s3adsp1800_machine_init)
> diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
> index 34b76bb6a1..499eac8d33 100644
> --- a/hw/mips/mips_malta.c
> +++ b/hw/mips/mips_malta.c
> @@ -1442,7 +1442,7 @@ static void mips_malta_machine_init(MachineClass *mc)
> mc->init = mips_malta_init;
> mc->block_default_type = IF_IDE;
> mc->max_cpus = 16;
> - mc->is_default = 1;
> + mc->is_default = true;
> #ifdef TARGET_MIPS64
> mc->default_cpu_type = MIPS_CPU_TYPE_NAME("20Kc");
> #else
> diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c
> index 1d06e39fcb..51a98287b5 100644
> --- a/hw/moxie/moxiesim.c
> +++ b/hw/moxie/moxiesim.c
> @@ -150,7 +150,7 @@ static void moxiesim_machine_init(MachineClass *mc)
> {
> mc->desc = "Moxie simulator platform";
> mc->init = moxiesim_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = MOXIE_CPU_TYPE_NAME("MoxieLite");
> }
>
> diff --git a/hw/nios2/10m50_devboard.c b/hw/nios2/10m50_devboard.c
> index ad8b2fc670..33dc2bf511 100644
> --- a/hw/nios2/10m50_devboard.c
> +++ b/hw/nios2/10m50_devboard.c
> @@ -120,7 +120,7 @@ static void nios2_10m50_ghrd_machine_init(struct MachineClass *mc)
> {
> mc->desc = "Altera 10M50 GHRD Nios II design";
> mc->init = nios2_10m50_ghrd_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> }
>
> DEFINE_MACHINE("10m50-ghrd", nios2_10m50_ghrd_machine_init);
> diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
> index ad5371250f..d08ce61811 100644
> --- a/hw/openrisc/openrisc_sim.c
> +++ b/hw/openrisc/openrisc_sim.c
> @@ -176,7 +176,7 @@ static void openrisc_sim_machine_init(MachineClass *mc)
> mc->desc = "or1k simulation";
> mc->init = openrisc_sim_init;
> mc->max_cpus = 2;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = OPENRISC_CPU_TYPE_NAME("or1200");
> }
>
> diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
> index 7318d7e9b4..1630663bc2 100644
> --- a/hw/ppc/mac_oldworld.c
> +++ b/hw/ppc/mac_oldworld.c
> @@ -438,7 +438,7 @@ static void heathrow_class_init(ObjectClass *oc, void *data)
> mc->block_default_type = IF_IDE;
> mc->max_cpus = MAX_CPUS;
> #ifndef TARGET_PPC64
> - mc->is_default = 1;
> + mc->is_default = true;
> #endif
> /* TOFIX "cad" when Mac floppy is implemented */
> mc->default_boot_order = "cd";
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index c9b2e0a5e0..e3e3208cd8 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -4493,7 +4493,7 @@ static const TypeInfo spapr_machine_info = {
> spapr_machine_##suffix##_class_options(mc); \
> if (latest) { \
> mc->alias = "pseries"; \
> - mc->is_default = 1; \
> + mc->is_default = true; \
> } \
> } \
> static const TypeInfo spapr_machine_##suffix##_info = { \
> diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
> index 8823681783..6f03857660 100644
> --- a/hw/riscv/spike.c
> +++ b/hw/riscv/spike.c
> @@ -448,7 +448,7 @@ static void spike_machine_init(MachineClass *mc)
> mc->desc = "RISC-V Spike Board";
> mc->init = spike_board_init;
> mc->max_cpus = 1;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = SPIKE_V1_10_0_CPU;
> }
>
> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
> index e759eb5f83..c4b291e434 100644
> --- a/hw/s390x/s390-virtio-ccw.c
> +++ b/hw/s390x/s390-virtio-ccw.c
> @@ -631,7 +631,7 @@ bool css_migration_enabled(void)
> mc->desc = "VirtIO-ccw based S390 machine v" verstr; \
> if (latest) { \
> mc->alias = "s390-ccw-virtio"; \
> - mc->is_default = 1; \
> + mc->is_default = true; \
> } \
> } \
> static void ccw_machine_##suffix##_instance_init(Object *obj) \
> diff --git a/hw/sh4/shix.c b/hw/sh4/shix.c
> index 2fc2915428..68b14ee5e7 100644
> --- a/hw/sh4/shix.c
> +++ b/hw/sh4/shix.c
> @@ -82,7 +82,7 @@ static void shix_machine_init(MachineClass *mc)
> {
> mc->desc = "shix card";
> mc->init = shix_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = TYPE_SH7750R_CPU;
> }
>
> diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
> index 25e96db5ca..d6c9772f95 100644
> --- a/hw/sparc/sun4m.c
> +++ b/hw/sparc/sun4m.c
> @@ -1411,7 +1411,7 @@ static void ss5_class_init(ObjectClass *oc, void *data)
> mc->desc = "Sun4m platform, SPARCstation 5";
> mc->init = ss5_init;
> mc->block_default_type = IF_SCSI;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_boot_order = "c";
> mc->default_cpu_type = SPARC_CPU_TYPE_NAME("Fujitsu-MB86904");
> mc->default_display = "tcx";
> diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
> index b7ac42f7a5..d33e84f831 100644
> --- a/hw/sparc64/sun4u.c
> +++ b/hw/sparc64/sun4u.c
> @@ -816,7 +816,7 @@ static void sun4u_class_init(ObjectClass *oc, void *data)
> mc->init = sun4u_init;
> mc->block_default_type = IF_IDE;
> mc->max_cpus = 1; /* XXX for now */
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_boot_order = "c";
> mc->default_cpu_type = SPARC_CPU_TYPE_NAME("TI-UltraSparc-IIi");
> mc->ignore_boot_device_suffixes = true;
> diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c
> index 7e933de228..7f9c0238fe 100644
> --- a/hw/unicore32/puv3.c
> +++ b/hw/unicore32/puv3.c
> @@ -140,7 +140,7 @@ static void puv3_machine_init(MachineClass *mc)
> {
> mc->desc = "PKUnity Version-3 based on UniCore32";
> mc->init = puv3_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = UNICORE32_CPU_TYPE_NAME("UniCore-II");
> }
>
>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v4 2/3] hw: Make MachineClass::is_default a boolean type
@ 2020-02-07 17:48 ` Laurent Vivier
0 siblings, 0 replies; 42+ messages in thread
From: Laurent Vivier @ 2020-02-07 17:48 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Aleksandar Rikalo, Guan Xuetao, qemu-ppc, Sagar Karandikar,
David Gibson, Christian Borntraeger, Paolo Bonzini,
Bastian Koppelmann, Eduardo Habkost, Anthony Green,
Richard Henderson, Artyom Tarasenko, qemu-trivial, Cornelia Huck,
Aurelien Jarno, Edgar E. Iglesias, Mark Cave-Ayland, qemu-riscv,
Michael S. Tsirkin, Aleksandar Markovic, Marek Vasut,
Palmer Dabbelt, Michael Walle, Halil Pasic, Marcel Apfelbaum,
qemu-s390x, Richard Henderson, Thomas Huth, Magnus Damm,
David Hildenbrand, Chris Wulff, Stafford Horne, Helge Deller,
Alistair Francis, Jia Liu
Le 07/02/2020 à 17:19, Philippe Mathieu-Daudé a écrit :
> There's no good reason for it to be type int, change it to bool.
>
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> v4:
> - fixed incorrect changes to max_cpus (Laurent)
> - describe field
> ---
> include/hw/boards.h | 4 +++-
> hw/alpha/dp264.c | 2 +-
> hw/cris/axis_dev88.c | 2 +-
> hw/hppa/machine.c | 2 +-
> hw/i386/pc_piix.c | 10 +++++-----
> hw/lm32/lm32_boards.c | 2 +-
> hw/m68k/mcf5208.c | 2 +-
> hw/microblaze/petalogix_s3adsp1800_mmu.c | 2 +-
> hw/mips/mips_malta.c | 2 +-
> hw/moxie/moxiesim.c | 2 +-
> hw/nios2/10m50_devboard.c | 2 +-
> hw/openrisc/openrisc_sim.c | 2 +-
> hw/ppc/mac_oldworld.c | 2 +-
> hw/ppc/spapr.c | 2 +-
> hw/riscv/spike.c | 2 +-
> hw/s390x/s390-virtio-ccw.c | 2 +-
> hw/sh4/shix.c | 2 +-
> hw/sparc/sun4m.c | 2 +-
> hw/sparc64/sun4u.c | 2 +-
> hw/unicore32/puv3.c | 2 +-
> 20 files changed, 26 insertions(+), 24 deletions(-)
>
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index fb1b43d5b9..c3523a70e8 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -107,6 +107,8 @@ typedef struct {
> * @max_cpus: maximum number of CPUs supported. Default: 1
> * @min_cpus: minimum number of CPUs supported. Default: 1
> * @default_cpus: number of CPUs instantiated if none are specified. Default: 1
> + * @is_default:
> + * If true QEMU will use this machine by default if no '-M' option is given.
> * @get_hotplug_handler: this function is called during bus-less
> * device hotplug. If defined it returns pointer to an instance
> * of HotplugHandler object, which handles hotplug operation
> @@ -200,7 +202,7 @@ struct MachineClass {
> no_sdcard:1,
> pci_allow_0_address:1,
> legacy_fw_cfg_order:1;
> - int is_default;
> + bool is_default;
> const char *default_machine_opts;
> const char *default_boot_order;
> const char *default_display;
> diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
> index a8f9a89cc4..083a198a64 100644
> --- a/hw/alpha/dp264.c
> +++ b/hw/alpha/dp264.c
> @@ -181,7 +181,7 @@ static void clipper_machine_init(MachineClass *mc)
> mc->init = clipper_init;
> mc->block_default_type = IF_IDE;
> mc->max_cpus = 4;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = ALPHA_CPU_TYPE_NAME("ev67");
> }
>
> diff --git a/hw/cris/axis_dev88.c b/hw/cris/axis_dev88.c
> index be7760476a..de7b49188b 100644
> --- a/hw/cris/axis_dev88.c
> +++ b/hw/cris/axis_dev88.c
> @@ -349,7 +349,7 @@ static void axisdev88_machine_init(MachineClass *mc)
> {
> mc->desc = "AXIS devboard 88";
> mc->init = axisdev88_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = CRIS_CPU_TYPE_NAME("crisv32");
> }
>
> diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
> index d8755ec422..83ae87f565 100644
> --- a/hw/hppa/machine.c
> +++ b/hw/hppa/machine.c
> @@ -295,7 +295,7 @@ static void machine_hppa_machine_init(MachineClass *mc)
> mc->block_default_type = IF_SCSI;
> mc->max_cpus = HPPA_MAX_CPUS;
> mc->default_cpus = 1;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_ram_size = 512 * MiB;
> mc->default_boot_order = "cd";
> }
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index fa12203079..9088db8fb6 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -423,7 +423,7 @@ static void pc_i440fx_5_0_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
> pc_i440fx_machine_options(m);
> m->alias = "pc";
> - m->is_default = 1;
> + m->is_default = true;
> pcmc->default_cpu_version = 1;
> }
>
> @@ -434,7 +434,7 @@ static void pc_i440fx_4_2_machine_options(MachineClass *m)
> {
> pc_i440fx_5_0_machine_options(m);
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
> compat_props_add(m->compat_props, hw_compat_4_2, hw_compat_4_2_len);
> compat_props_add(m->compat_props, pc_compat_4_2, pc_compat_4_2_len);
> }
> @@ -446,7 +446,7 @@ static void pc_i440fx_4_1_machine_options(MachineClass *m)
> {
> pc_i440fx_4_2_machine_options(m);
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
> compat_props_add(m->compat_props, hw_compat_4_1, hw_compat_4_1_len);
> compat_props_add(m->compat_props, pc_compat_4_1, pc_compat_4_1_len);
> }
> @@ -459,7 +459,7 @@ static void pc_i440fx_4_0_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
> pc_i440fx_4_1_machine_options(m);
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
> pcmc->default_cpu_version = CPU_VERSION_LEGACY;
> compat_props_add(m->compat_props, hw_compat_4_0, hw_compat_4_0_len);
> compat_props_add(m->compat_props, pc_compat_4_0, pc_compat_4_0_len);
> @@ -473,7 +473,7 @@ static void pc_i440fx_3_1_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
>
> pc_i440fx_4_0_machine_options(m);
> - m->is_default = 0;
> + m->is_default = false;
> pcmc->do_not_add_smb_acpi = true;
> m->smbus_no_migration_support = true;
> m->alias = NULL;
> diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c
> index 156b050abc..352f69532e 100644
> --- a/hw/lm32/lm32_boards.c
> +++ b/hw/lm32/lm32_boards.c
> @@ -286,7 +286,7 @@ static void lm32_evr_class_init(ObjectClass *oc, void *data)
>
> mc->desc = "LatticeMico32 EVR32 eval system";
> mc->init = lm32_evr_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = LM32_CPU_TYPE_NAME("lm32-full");
> }
>
> diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
> index a999c21982..5f8f6e4475 100644
> --- a/hw/m68k/mcf5208.c
> +++ b/hw/m68k/mcf5208.c
> @@ -352,7 +352,7 @@ static void mcf5208evb_machine_init(MachineClass *mc)
> {
> mc->desc = "MCF5208EVB";
> mc->init = mcf5208evb_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = M68K_CPU_TYPE_NAME("m5208");
> }
>
> diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c
> index 849bafc186..0bb6cdea8d 100644
> --- a/hw/microblaze/petalogix_s3adsp1800_mmu.c
> +++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c
> @@ -132,7 +132,7 @@ static void petalogix_s3adsp1800_machine_init(MachineClass *mc)
> {
> mc->desc = "PetaLogix linux refdesign for xilinx Spartan 3ADSP1800";
> mc->init = petalogix_s3adsp1800_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> }
>
> DEFINE_MACHINE("petalogix-s3adsp1800", petalogix_s3adsp1800_machine_init)
> diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
> index 34b76bb6a1..499eac8d33 100644
> --- a/hw/mips/mips_malta.c
> +++ b/hw/mips/mips_malta.c
> @@ -1442,7 +1442,7 @@ static void mips_malta_machine_init(MachineClass *mc)
> mc->init = mips_malta_init;
> mc->block_default_type = IF_IDE;
> mc->max_cpus = 16;
> - mc->is_default = 1;
> + mc->is_default = true;
> #ifdef TARGET_MIPS64
> mc->default_cpu_type = MIPS_CPU_TYPE_NAME("20Kc");
> #else
> diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c
> index 1d06e39fcb..51a98287b5 100644
> --- a/hw/moxie/moxiesim.c
> +++ b/hw/moxie/moxiesim.c
> @@ -150,7 +150,7 @@ static void moxiesim_machine_init(MachineClass *mc)
> {
> mc->desc = "Moxie simulator platform";
> mc->init = moxiesim_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = MOXIE_CPU_TYPE_NAME("MoxieLite");
> }
>
> diff --git a/hw/nios2/10m50_devboard.c b/hw/nios2/10m50_devboard.c
> index ad8b2fc670..33dc2bf511 100644
> --- a/hw/nios2/10m50_devboard.c
> +++ b/hw/nios2/10m50_devboard.c
> @@ -120,7 +120,7 @@ static void nios2_10m50_ghrd_machine_init(struct MachineClass *mc)
> {
> mc->desc = "Altera 10M50 GHRD Nios II design";
> mc->init = nios2_10m50_ghrd_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> }
>
> DEFINE_MACHINE("10m50-ghrd", nios2_10m50_ghrd_machine_init);
> diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
> index ad5371250f..d08ce61811 100644
> --- a/hw/openrisc/openrisc_sim.c
> +++ b/hw/openrisc/openrisc_sim.c
> @@ -176,7 +176,7 @@ static void openrisc_sim_machine_init(MachineClass *mc)
> mc->desc = "or1k simulation";
> mc->init = openrisc_sim_init;
> mc->max_cpus = 2;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = OPENRISC_CPU_TYPE_NAME("or1200");
> }
>
> diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
> index 7318d7e9b4..1630663bc2 100644
> --- a/hw/ppc/mac_oldworld.c
> +++ b/hw/ppc/mac_oldworld.c
> @@ -438,7 +438,7 @@ static void heathrow_class_init(ObjectClass *oc, void *data)
> mc->block_default_type = IF_IDE;
> mc->max_cpus = MAX_CPUS;
> #ifndef TARGET_PPC64
> - mc->is_default = 1;
> + mc->is_default = true;
> #endif
> /* TOFIX "cad" when Mac floppy is implemented */
> mc->default_boot_order = "cd";
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index c9b2e0a5e0..e3e3208cd8 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -4493,7 +4493,7 @@ static const TypeInfo spapr_machine_info = {
> spapr_machine_##suffix##_class_options(mc); \
> if (latest) { \
> mc->alias = "pseries"; \
> - mc->is_default = 1; \
> + mc->is_default = true; \
> } \
> } \
> static const TypeInfo spapr_machine_##suffix##_info = { \
> diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
> index 8823681783..6f03857660 100644
> --- a/hw/riscv/spike.c
> +++ b/hw/riscv/spike.c
> @@ -448,7 +448,7 @@ static void spike_machine_init(MachineClass *mc)
> mc->desc = "RISC-V Spike Board";
> mc->init = spike_board_init;
> mc->max_cpus = 1;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = SPIKE_V1_10_0_CPU;
> }
>
> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
> index e759eb5f83..c4b291e434 100644
> --- a/hw/s390x/s390-virtio-ccw.c
> +++ b/hw/s390x/s390-virtio-ccw.c
> @@ -631,7 +631,7 @@ bool css_migration_enabled(void)
> mc->desc = "VirtIO-ccw based S390 machine v" verstr; \
> if (latest) { \
> mc->alias = "s390-ccw-virtio"; \
> - mc->is_default = 1; \
> + mc->is_default = true; \
> } \
> } \
> static void ccw_machine_##suffix##_instance_init(Object *obj) \
> diff --git a/hw/sh4/shix.c b/hw/sh4/shix.c
> index 2fc2915428..68b14ee5e7 100644
> --- a/hw/sh4/shix.c
> +++ b/hw/sh4/shix.c
> @@ -82,7 +82,7 @@ static void shix_machine_init(MachineClass *mc)
> {
> mc->desc = "shix card";
> mc->init = shix_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = TYPE_SH7750R_CPU;
> }
>
> diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
> index 25e96db5ca..d6c9772f95 100644
> --- a/hw/sparc/sun4m.c
> +++ b/hw/sparc/sun4m.c
> @@ -1411,7 +1411,7 @@ static void ss5_class_init(ObjectClass *oc, void *data)
> mc->desc = "Sun4m platform, SPARCstation 5";
> mc->init = ss5_init;
> mc->block_default_type = IF_SCSI;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_boot_order = "c";
> mc->default_cpu_type = SPARC_CPU_TYPE_NAME("Fujitsu-MB86904");
> mc->default_display = "tcx";
> diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
> index b7ac42f7a5..d33e84f831 100644
> --- a/hw/sparc64/sun4u.c
> +++ b/hw/sparc64/sun4u.c
> @@ -816,7 +816,7 @@ static void sun4u_class_init(ObjectClass *oc, void *data)
> mc->init = sun4u_init;
> mc->block_default_type = IF_IDE;
> mc->max_cpus = 1; /* XXX for now */
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_boot_order = "c";
> mc->default_cpu_type = SPARC_CPU_TYPE_NAME("TI-UltraSparc-IIi");
> mc->ignore_boot_device_suffixes = true;
> diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c
> index 7e933de228..7f9c0238fe 100644
> --- a/hw/unicore32/puv3.c
> +++ b/hw/unicore32/puv3.c
> @@ -140,7 +140,7 @@ static void puv3_machine_init(MachineClass *mc)
> {
> mc->desc = "PKUnity Version-3 based on UniCore32";
> mc->init = puv3_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = UNICORE32_CPU_TYPE_NAME("UniCore-II");
> }
>
>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v4 2/3] hw: Make MachineClass::is_default a boolean type
2020-02-07 16:19 ` Philippe Mathieu-Daudé
@ 2020-02-08 9:24 ` David Gibson
-1 siblings, 0 replies; 42+ messages in thread
From: David Gibson @ 2020-02-08 9:24 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Chris Wulff, Sagar Karandikar, Michael S. Tsirkin, Anthony Green,
Mark Cave-Ayland, qemu-devel, Alistair Francis,
Edgar E. Iglesias, Guan Xuetao, Marek Vasut, Jia Liu,
qemu-trivial, Helge Deller, David Hildenbrand, Magnus Damm,
Halil Pasic, Christian Borntraeger, Palmer Dabbelt,
Aleksandar Rikalo, Artyom Tarasenko, Eduardo Habkost,
Richard Henderson, qemu-s390x, Stafford Horne, Richard Henderson,
qemu-riscv, Thomas Huth, Bastian Koppelmann, Cornelia Huck,
Laurent Vivier, Michael Walle, qemu-ppc, Aleksandar Markovic,
Paolo Bonzini, Aurelien Jarno
[-- Attachment #1: Type: text/plain, Size: 14388 bytes --]
On Fri, Feb 07, 2020 at 05:19:47PM +0100, Philippe Mathieu-Daudé wrote:
> There's no good reason for it to be type int, change it to bool.
>
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
and ppc parts
Acked-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> v4:
> - fixed incorrect changes to max_cpus (Laurent)
> - describe field
> ---
> include/hw/boards.h | 4 +++-
> hw/alpha/dp264.c | 2 +-
> hw/cris/axis_dev88.c | 2 +-
> hw/hppa/machine.c | 2 +-
> hw/i386/pc_piix.c | 10 +++++-----
> hw/lm32/lm32_boards.c | 2 +-
> hw/m68k/mcf5208.c | 2 +-
> hw/microblaze/petalogix_s3adsp1800_mmu.c | 2 +-
> hw/mips/mips_malta.c | 2 +-
> hw/moxie/moxiesim.c | 2 +-
> hw/nios2/10m50_devboard.c | 2 +-
> hw/openrisc/openrisc_sim.c | 2 +-
> hw/ppc/mac_oldworld.c | 2 +-
> hw/ppc/spapr.c | 2 +-
> hw/riscv/spike.c | 2 +-
> hw/s390x/s390-virtio-ccw.c | 2 +-
> hw/sh4/shix.c | 2 +-
> hw/sparc/sun4m.c | 2 +-
> hw/sparc64/sun4u.c | 2 +-
> hw/unicore32/puv3.c | 2 +-
> 20 files changed, 26 insertions(+), 24 deletions(-)
>
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index fb1b43d5b9..c3523a70e8 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -107,6 +107,8 @@ typedef struct {
> * @max_cpus: maximum number of CPUs supported. Default: 1
> * @min_cpus: minimum number of CPUs supported. Default: 1
> * @default_cpus: number of CPUs instantiated if none are specified. Default: 1
> + * @is_default:
> + * If true QEMU will use this machine by default if no '-M' option is given.
> * @get_hotplug_handler: this function is called during bus-less
> * device hotplug. If defined it returns pointer to an instance
> * of HotplugHandler object, which handles hotplug operation
> @@ -200,7 +202,7 @@ struct MachineClass {
> no_sdcard:1,
> pci_allow_0_address:1,
> legacy_fw_cfg_order:1;
> - int is_default;
> + bool is_default;
> const char *default_machine_opts;
> const char *default_boot_order;
> const char *default_display;
> diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
> index a8f9a89cc4..083a198a64 100644
> --- a/hw/alpha/dp264.c
> +++ b/hw/alpha/dp264.c
> @@ -181,7 +181,7 @@ static void clipper_machine_init(MachineClass *mc)
> mc->init = clipper_init;
> mc->block_default_type = IF_IDE;
> mc->max_cpus = 4;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = ALPHA_CPU_TYPE_NAME("ev67");
> }
>
> diff --git a/hw/cris/axis_dev88.c b/hw/cris/axis_dev88.c
> index be7760476a..de7b49188b 100644
> --- a/hw/cris/axis_dev88.c
> +++ b/hw/cris/axis_dev88.c
> @@ -349,7 +349,7 @@ static void axisdev88_machine_init(MachineClass *mc)
> {
> mc->desc = "AXIS devboard 88";
> mc->init = axisdev88_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = CRIS_CPU_TYPE_NAME("crisv32");
> }
>
> diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
> index d8755ec422..83ae87f565 100644
> --- a/hw/hppa/machine.c
> +++ b/hw/hppa/machine.c
> @@ -295,7 +295,7 @@ static void machine_hppa_machine_init(MachineClass *mc)
> mc->block_default_type = IF_SCSI;
> mc->max_cpus = HPPA_MAX_CPUS;
> mc->default_cpus = 1;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_ram_size = 512 * MiB;
> mc->default_boot_order = "cd";
> }
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index fa12203079..9088db8fb6 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -423,7 +423,7 @@ static void pc_i440fx_5_0_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
> pc_i440fx_machine_options(m);
> m->alias = "pc";
> - m->is_default = 1;
> + m->is_default = true;
> pcmc->default_cpu_version = 1;
> }
>
> @@ -434,7 +434,7 @@ static void pc_i440fx_4_2_machine_options(MachineClass *m)
> {
> pc_i440fx_5_0_machine_options(m);
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
> compat_props_add(m->compat_props, hw_compat_4_2, hw_compat_4_2_len);
> compat_props_add(m->compat_props, pc_compat_4_2, pc_compat_4_2_len);
> }
> @@ -446,7 +446,7 @@ static void pc_i440fx_4_1_machine_options(MachineClass *m)
> {
> pc_i440fx_4_2_machine_options(m);
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
> compat_props_add(m->compat_props, hw_compat_4_1, hw_compat_4_1_len);
> compat_props_add(m->compat_props, pc_compat_4_1, pc_compat_4_1_len);
> }
> @@ -459,7 +459,7 @@ static void pc_i440fx_4_0_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
> pc_i440fx_4_1_machine_options(m);
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
> pcmc->default_cpu_version = CPU_VERSION_LEGACY;
> compat_props_add(m->compat_props, hw_compat_4_0, hw_compat_4_0_len);
> compat_props_add(m->compat_props, pc_compat_4_0, pc_compat_4_0_len);
> @@ -473,7 +473,7 @@ static void pc_i440fx_3_1_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
>
> pc_i440fx_4_0_machine_options(m);
> - m->is_default = 0;
> + m->is_default = false;
> pcmc->do_not_add_smb_acpi = true;
> m->smbus_no_migration_support = true;
> m->alias = NULL;
> diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c
> index 156b050abc..352f69532e 100644
> --- a/hw/lm32/lm32_boards.c
> +++ b/hw/lm32/lm32_boards.c
> @@ -286,7 +286,7 @@ static void lm32_evr_class_init(ObjectClass *oc, void *data)
>
> mc->desc = "LatticeMico32 EVR32 eval system";
> mc->init = lm32_evr_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = LM32_CPU_TYPE_NAME("lm32-full");
> }
>
> diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
> index a999c21982..5f8f6e4475 100644
> --- a/hw/m68k/mcf5208.c
> +++ b/hw/m68k/mcf5208.c
> @@ -352,7 +352,7 @@ static void mcf5208evb_machine_init(MachineClass *mc)
> {
> mc->desc = "MCF5208EVB";
> mc->init = mcf5208evb_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = M68K_CPU_TYPE_NAME("m5208");
> }
>
> diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c
> index 849bafc186..0bb6cdea8d 100644
> --- a/hw/microblaze/petalogix_s3adsp1800_mmu.c
> +++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c
> @@ -132,7 +132,7 @@ static void petalogix_s3adsp1800_machine_init(MachineClass *mc)
> {
> mc->desc = "PetaLogix linux refdesign for xilinx Spartan 3ADSP1800";
> mc->init = petalogix_s3adsp1800_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> }
>
> DEFINE_MACHINE("petalogix-s3adsp1800", petalogix_s3adsp1800_machine_init)
> diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
> index 34b76bb6a1..499eac8d33 100644
> --- a/hw/mips/mips_malta.c
> +++ b/hw/mips/mips_malta.c
> @@ -1442,7 +1442,7 @@ static void mips_malta_machine_init(MachineClass *mc)
> mc->init = mips_malta_init;
> mc->block_default_type = IF_IDE;
> mc->max_cpus = 16;
> - mc->is_default = 1;
> + mc->is_default = true;
> #ifdef TARGET_MIPS64
> mc->default_cpu_type = MIPS_CPU_TYPE_NAME("20Kc");
> #else
> diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c
> index 1d06e39fcb..51a98287b5 100644
> --- a/hw/moxie/moxiesim.c
> +++ b/hw/moxie/moxiesim.c
> @@ -150,7 +150,7 @@ static void moxiesim_machine_init(MachineClass *mc)
> {
> mc->desc = "Moxie simulator platform";
> mc->init = moxiesim_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = MOXIE_CPU_TYPE_NAME("MoxieLite");
> }
>
> diff --git a/hw/nios2/10m50_devboard.c b/hw/nios2/10m50_devboard.c
> index ad8b2fc670..33dc2bf511 100644
> --- a/hw/nios2/10m50_devboard.c
> +++ b/hw/nios2/10m50_devboard.c
> @@ -120,7 +120,7 @@ static void nios2_10m50_ghrd_machine_init(struct MachineClass *mc)
> {
> mc->desc = "Altera 10M50 GHRD Nios II design";
> mc->init = nios2_10m50_ghrd_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> }
>
> DEFINE_MACHINE("10m50-ghrd", nios2_10m50_ghrd_machine_init);
> diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
> index ad5371250f..d08ce61811 100644
> --- a/hw/openrisc/openrisc_sim.c
> +++ b/hw/openrisc/openrisc_sim.c
> @@ -176,7 +176,7 @@ static void openrisc_sim_machine_init(MachineClass *mc)
> mc->desc = "or1k simulation";
> mc->init = openrisc_sim_init;
> mc->max_cpus = 2;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = OPENRISC_CPU_TYPE_NAME("or1200");
> }
>
> diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
> index 7318d7e9b4..1630663bc2 100644
> --- a/hw/ppc/mac_oldworld.c
> +++ b/hw/ppc/mac_oldworld.c
> @@ -438,7 +438,7 @@ static void heathrow_class_init(ObjectClass *oc, void *data)
> mc->block_default_type = IF_IDE;
> mc->max_cpus = MAX_CPUS;
> #ifndef TARGET_PPC64
> - mc->is_default = 1;
> + mc->is_default = true;
> #endif
> /* TOFIX "cad" when Mac floppy is implemented */
> mc->default_boot_order = "cd";
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index c9b2e0a5e0..e3e3208cd8 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -4493,7 +4493,7 @@ static const TypeInfo spapr_machine_info = {
> spapr_machine_##suffix##_class_options(mc); \
> if (latest) { \
> mc->alias = "pseries"; \
> - mc->is_default = 1; \
> + mc->is_default = true; \
> } \
> } \
> static const TypeInfo spapr_machine_##suffix##_info = { \
> diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
> index 8823681783..6f03857660 100644
> --- a/hw/riscv/spike.c
> +++ b/hw/riscv/spike.c
> @@ -448,7 +448,7 @@ static void spike_machine_init(MachineClass *mc)
> mc->desc = "RISC-V Spike Board";
> mc->init = spike_board_init;
> mc->max_cpus = 1;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = SPIKE_V1_10_0_CPU;
> }
>
> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
> index e759eb5f83..c4b291e434 100644
> --- a/hw/s390x/s390-virtio-ccw.c
> +++ b/hw/s390x/s390-virtio-ccw.c
> @@ -631,7 +631,7 @@ bool css_migration_enabled(void)
> mc->desc = "VirtIO-ccw based S390 machine v" verstr; \
> if (latest) { \
> mc->alias = "s390-ccw-virtio"; \
> - mc->is_default = 1; \
> + mc->is_default = true; \
> } \
> } \
> static void ccw_machine_##suffix##_instance_init(Object *obj) \
> diff --git a/hw/sh4/shix.c b/hw/sh4/shix.c
> index 2fc2915428..68b14ee5e7 100644
> --- a/hw/sh4/shix.c
> +++ b/hw/sh4/shix.c
> @@ -82,7 +82,7 @@ static void shix_machine_init(MachineClass *mc)
> {
> mc->desc = "shix card";
> mc->init = shix_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = TYPE_SH7750R_CPU;
> }
>
> diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
> index 25e96db5ca..d6c9772f95 100644
> --- a/hw/sparc/sun4m.c
> +++ b/hw/sparc/sun4m.c
> @@ -1411,7 +1411,7 @@ static void ss5_class_init(ObjectClass *oc, void *data)
> mc->desc = "Sun4m platform, SPARCstation 5";
> mc->init = ss5_init;
> mc->block_default_type = IF_SCSI;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_boot_order = "c";
> mc->default_cpu_type = SPARC_CPU_TYPE_NAME("Fujitsu-MB86904");
> mc->default_display = "tcx";
> diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
> index b7ac42f7a5..d33e84f831 100644
> --- a/hw/sparc64/sun4u.c
> +++ b/hw/sparc64/sun4u.c
> @@ -816,7 +816,7 @@ static void sun4u_class_init(ObjectClass *oc, void *data)
> mc->init = sun4u_init;
> mc->block_default_type = IF_IDE;
> mc->max_cpus = 1; /* XXX for now */
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_boot_order = "c";
> mc->default_cpu_type = SPARC_CPU_TYPE_NAME("TI-UltraSparc-IIi");
> mc->ignore_boot_device_suffixes = true;
> diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c
> index 7e933de228..7f9c0238fe 100644
> --- a/hw/unicore32/puv3.c
> +++ b/hw/unicore32/puv3.c
> @@ -140,7 +140,7 @@ static void puv3_machine_init(MachineClass *mc)
> {
> mc->desc = "PKUnity Version-3 based on UniCore32";
> mc->init = puv3_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = UNICORE32_CPU_TYPE_NAME("UniCore-II");
> }
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v4 2/3] hw: Make MachineClass::is_default a boolean type
@ 2020-02-08 9:24 ` David Gibson
0 siblings, 0 replies; 42+ messages in thread
From: David Gibson @ 2020-02-08 9:24 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Aleksandar Rikalo, Guan Xuetao, qemu-ppc,
Sagar Karandikar, Christian Borntraeger, Paolo Bonzini,
Bastian Koppelmann, Eduardo Habkost, Laurent Vivier,
Anthony Green, Richard Henderson, Artyom Tarasenko, qemu-trivial,
Cornelia Huck, Aurelien Jarno, Edgar E. Iglesias,
Mark Cave-Ayland, qemu-riscv, Michael S. Tsirkin,
Aleksandar Markovic, Marek Vasut, Palmer Dabbelt, Michael Walle,
Halil Pasic, Marcel Apfelbaum, qemu-s390x, Richard Henderson,
Thomas Huth, Magnus Damm, David Hildenbrand, Chris Wulff,
Stafford Horne, Helge Deller, Alistair Francis, Jia Liu
[-- Attachment #1: Type: text/plain, Size: 14388 bytes --]
On Fri, Feb 07, 2020 at 05:19:47PM +0100, Philippe Mathieu-Daudé wrote:
> There's no good reason for it to be type int, change it to bool.
>
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
and ppc parts
Acked-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> v4:
> - fixed incorrect changes to max_cpus (Laurent)
> - describe field
> ---
> include/hw/boards.h | 4 +++-
> hw/alpha/dp264.c | 2 +-
> hw/cris/axis_dev88.c | 2 +-
> hw/hppa/machine.c | 2 +-
> hw/i386/pc_piix.c | 10 +++++-----
> hw/lm32/lm32_boards.c | 2 +-
> hw/m68k/mcf5208.c | 2 +-
> hw/microblaze/petalogix_s3adsp1800_mmu.c | 2 +-
> hw/mips/mips_malta.c | 2 +-
> hw/moxie/moxiesim.c | 2 +-
> hw/nios2/10m50_devboard.c | 2 +-
> hw/openrisc/openrisc_sim.c | 2 +-
> hw/ppc/mac_oldworld.c | 2 +-
> hw/ppc/spapr.c | 2 +-
> hw/riscv/spike.c | 2 +-
> hw/s390x/s390-virtio-ccw.c | 2 +-
> hw/sh4/shix.c | 2 +-
> hw/sparc/sun4m.c | 2 +-
> hw/sparc64/sun4u.c | 2 +-
> hw/unicore32/puv3.c | 2 +-
> 20 files changed, 26 insertions(+), 24 deletions(-)
>
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index fb1b43d5b9..c3523a70e8 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -107,6 +107,8 @@ typedef struct {
> * @max_cpus: maximum number of CPUs supported. Default: 1
> * @min_cpus: minimum number of CPUs supported. Default: 1
> * @default_cpus: number of CPUs instantiated if none are specified. Default: 1
> + * @is_default:
> + * If true QEMU will use this machine by default if no '-M' option is given.
> * @get_hotplug_handler: this function is called during bus-less
> * device hotplug. If defined it returns pointer to an instance
> * of HotplugHandler object, which handles hotplug operation
> @@ -200,7 +202,7 @@ struct MachineClass {
> no_sdcard:1,
> pci_allow_0_address:1,
> legacy_fw_cfg_order:1;
> - int is_default;
> + bool is_default;
> const char *default_machine_opts;
> const char *default_boot_order;
> const char *default_display;
> diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
> index a8f9a89cc4..083a198a64 100644
> --- a/hw/alpha/dp264.c
> +++ b/hw/alpha/dp264.c
> @@ -181,7 +181,7 @@ static void clipper_machine_init(MachineClass *mc)
> mc->init = clipper_init;
> mc->block_default_type = IF_IDE;
> mc->max_cpus = 4;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = ALPHA_CPU_TYPE_NAME("ev67");
> }
>
> diff --git a/hw/cris/axis_dev88.c b/hw/cris/axis_dev88.c
> index be7760476a..de7b49188b 100644
> --- a/hw/cris/axis_dev88.c
> +++ b/hw/cris/axis_dev88.c
> @@ -349,7 +349,7 @@ static void axisdev88_machine_init(MachineClass *mc)
> {
> mc->desc = "AXIS devboard 88";
> mc->init = axisdev88_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = CRIS_CPU_TYPE_NAME("crisv32");
> }
>
> diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
> index d8755ec422..83ae87f565 100644
> --- a/hw/hppa/machine.c
> +++ b/hw/hppa/machine.c
> @@ -295,7 +295,7 @@ static void machine_hppa_machine_init(MachineClass *mc)
> mc->block_default_type = IF_SCSI;
> mc->max_cpus = HPPA_MAX_CPUS;
> mc->default_cpus = 1;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_ram_size = 512 * MiB;
> mc->default_boot_order = "cd";
> }
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index fa12203079..9088db8fb6 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -423,7 +423,7 @@ static void pc_i440fx_5_0_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
> pc_i440fx_machine_options(m);
> m->alias = "pc";
> - m->is_default = 1;
> + m->is_default = true;
> pcmc->default_cpu_version = 1;
> }
>
> @@ -434,7 +434,7 @@ static void pc_i440fx_4_2_machine_options(MachineClass *m)
> {
> pc_i440fx_5_0_machine_options(m);
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
> compat_props_add(m->compat_props, hw_compat_4_2, hw_compat_4_2_len);
> compat_props_add(m->compat_props, pc_compat_4_2, pc_compat_4_2_len);
> }
> @@ -446,7 +446,7 @@ static void pc_i440fx_4_1_machine_options(MachineClass *m)
> {
> pc_i440fx_4_2_machine_options(m);
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
> compat_props_add(m->compat_props, hw_compat_4_1, hw_compat_4_1_len);
> compat_props_add(m->compat_props, pc_compat_4_1, pc_compat_4_1_len);
> }
> @@ -459,7 +459,7 @@ static void pc_i440fx_4_0_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
> pc_i440fx_4_1_machine_options(m);
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
> pcmc->default_cpu_version = CPU_VERSION_LEGACY;
> compat_props_add(m->compat_props, hw_compat_4_0, hw_compat_4_0_len);
> compat_props_add(m->compat_props, pc_compat_4_0, pc_compat_4_0_len);
> @@ -473,7 +473,7 @@ static void pc_i440fx_3_1_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
>
> pc_i440fx_4_0_machine_options(m);
> - m->is_default = 0;
> + m->is_default = false;
> pcmc->do_not_add_smb_acpi = true;
> m->smbus_no_migration_support = true;
> m->alias = NULL;
> diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c
> index 156b050abc..352f69532e 100644
> --- a/hw/lm32/lm32_boards.c
> +++ b/hw/lm32/lm32_boards.c
> @@ -286,7 +286,7 @@ static void lm32_evr_class_init(ObjectClass *oc, void *data)
>
> mc->desc = "LatticeMico32 EVR32 eval system";
> mc->init = lm32_evr_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = LM32_CPU_TYPE_NAME("lm32-full");
> }
>
> diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
> index a999c21982..5f8f6e4475 100644
> --- a/hw/m68k/mcf5208.c
> +++ b/hw/m68k/mcf5208.c
> @@ -352,7 +352,7 @@ static void mcf5208evb_machine_init(MachineClass *mc)
> {
> mc->desc = "MCF5208EVB";
> mc->init = mcf5208evb_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = M68K_CPU_TYPE_NAME("m5208");
> }
>
> diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c
> index 849bafc186..0bb6cdea8d 100644
> --- a/hw/microblaze/petalogix_s3adsp1800_mmu.c
> +++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c
> @@ -132,7 +132,7 @@ static void petalogix_s3adsp1800_machine_init(MachineClass *mc)
> {
> mc->desc = "PetaLogix linux refdesign for xilinx Spartan 3ADSP1800";
> mc->init = petalogix_s3adsp1800_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> }
>
> DEFINE_MACHINE("petalogix-s3adsp1800", petalogix_s3adsp1800_machine_init)
> diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
> index 34b76bb6a1..499eac8d33 100644
> --- a/hw/mips/mips_malta.c
> +++ b/hw/mips/mips_malta.c
> @@ -1442,7 +1442,7 @@ static void mips_malta_machine_init(MachineClass *mc)
> mc->init = mips_malta_init;
> mc->block_default_type = IF_IDE;
> mc->max_cpus = 16;
> - mc->is_default = 1;
> + mc->is_default = true;
> #ifdef TARGET_MIPS64
> mc->default_cpu_type = MIPS_CPU_TYPE_NAME("20Kc");
> #else
> diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c
> index 1d06e39fcb..51a98287b5 100644
> --- a/hw/moxie/moxiesim.c
> +++ b/hw/moxie/moxiesim.c
> @@ -150,7 +150,7 @@ static void moxiesim_machine_init(MachineClass *mc)
> {
> mc->desc = "Moxie simulator platform";
> mc->init = moxiesim_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = MOXIE_CPU_TYPE_NAME("MoxieLite");
> }
>
> diff --git a/hw/nios2/10m50_devboard.c b/hw/nios2/10m50_devboard.c
> index ad8b2fc670..33dc2bf511 100644
> --- a/hw/nios2/10m50_devboard.c
> +++ b/hw/nios2/10m50_devboard.c
> @@ -120,7 +120,7 @@ static void nios2_10m50_ghrd_machine_init(struct MachineClass *mc)
> {
> mc->desc = "Altera 10M50 GHRD Nios II design";
> mc->init = nios2_10m50_ghrd_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> }
>
> DEFINE_MACHINE("10m50-ghrd", nios2_10m50_ghrd_machine_init);
> diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
> index ad5371250f..d08ce61811 100644
> --- a/hw/openrisc/openrisc_sim.c
> +++ b/hw/openrisc/openrisc_sim.c
> @@ -176,7 +176,7 @@ static void openrisc_sim_machine_init(MachineClass *mc)
> mc->desc = "or1k simulation";
> mc->init = openrisc_sim_init;
> mc->max_cpus = 2;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = OPENRISC_CPU_TYPE_NAME("or1200");
> }
>
> diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
> index 7318d7e9b4..1630663bc2 100644
> --- a/hw/ppc/mac_oldworld.c
> +++ b/hw/ppc/mac_oldworld.c
> @@ -438,7 +438,7 @@ static void heathrow_class_init(ObjectClass *oc, void *data)
> mc->block_default_type = IF_IDE;
> mc->max_cpus = MAX_CPUS;
> #ifndef TARGET_PPC64
> - mc->is_default = 1;
> + mc->is_default = true;
> #endif
> /* TOFIX "cad" when Mac floppy is implemented */
> mc->default_boot_order = "cd";
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index c9b2e0a5e0..e3e3208cd8 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -4493,7 +4493,7 @@ static const TypeInfo spapr_machine_info = {
> spapr_machine_##suffix##_class_options(mc); \
> if (latest) { \
> mc->alias = "pseries"; \
> - mc->is_default = 1; \
> + mc->is_default = true; \
> } \
> } \
> static const TypeInfo spapr_machine_##suffix##_info = { \
> diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
> index 8823681783..6f03857660 100644
> --- a/hw/riscv/spike.c
> +++ b/hw/riscv/spike.c
> @@ -448,7 +448,7 @@ static void spike_machine_init(MachineClass *mc)
> mc->desc = "RISC-V Spike Board";
> mc->init = spike_board_init;
> mc->max_cpus = 1;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = SPIKE_V1_10_0_CPU;
> }
>
> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
> index e759eb5f83..c4b291e434 100644
> --- a/hw/s390x/s390-virtio-ccw.c
> +++ b/hw/s390x/s390-virtio-ccw.c
> @@ -631,7 +631,7 @@ bool css_migration_enabled(void)
> mc->desc = "VirtIO-ccw based S390 machine v" verstr; \
> if (latest) { \
> mc->alias = "s390-ccw-virtio"; \
> - mc->is_default = 1; \
> + mc->is_default = true; \
> } \
> } \
> static void ccw_machine_##suffix##_instance_init(Object *obj) \
> diff --git a/hw/sh4/shix.c b/hw/sh4/shix.c
> index 2fc2915428..68b14ee5e7 100644
> --- a/hw/sh4/shix.c
> +++ b/hw/sh4/shix.c
> @@ -82,7 +82,7 @@ static void shix_machine_init(MachineClass *mc)
> {
> mc->desc = "shix card";
> mc->init = shix_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = TYPE_SH7750R_CPU;
> }
>
> diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
> index 25e96db5ca..d6c9772f95 100644
> --- a/hw/sparc/sun4m.c
> +++ b/hw/sparc/sun4m.c
> @@ -1411,7 +1411,7 @@ static void ss5_class_init(ObjectClass *oc, void *data)
> mc->desc = "Sun4m platform, SPARCstation 5";
> mc->init = ss5_init;
> mc->block_default_type = IF_SCSI;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_boot_order = "c";
> mc->default_cpu_type = SPARC_CPU_TYPE_NAME("Fujitsu-MB86904");
> mc->default_display = "tcx";
> diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
> index b7ac42f7a5..d33e84f831 100644
> --- a/hw/sparc64/sun4u.c
> +++ b/hw/sparc64/sun4u.c
> @@ -816,7 +816,7 @@ static void sun4u_class_init(ObjectClass *oc, void *data)
> mc->init = sun4u_init;
> mc->block_default_type = IF_IDE;
> mc->max_cpus = 1; /* XXX for now */
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_boot_order = "c";
> mc->default_cpu_type = SPARC_CPU_TYPE_NAME("TI-UltraSparc-IIi");
> mc->ignore_boot_device_suffixes = true;
> diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c
> index 7e933de228..7f9c0238fe 100644
> --- a/hw/unicore32/puv3.c
> +++ b/hw/unicore32/puv3.c
> @@ -140,7 +140,7 @@ static void puv3_machine_init(MachineClass *mc)
> {
> mc->desc = "PKUnity Version-3 based on UniCore32";
> mc->init = puv3_init;
> - mc->is_default = 1;
> + mc->is_default = true;
> mc->default_cpu_type = UNICORE32_CPU_TYPE_NAME("UniCore-II");
> }
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v4 2/3] hw: Make MachineClass::is_default a boolean type
2020-02-07 16:19 ` Philippe Mathieu-Daudé
@ 2020-02-10 8:51 ` Cornelia Huck
-1 siblings, 0 replies; 42+ messages in thread
From: Cornelia Huck @ 2020-02-10 8:51 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Sagar Karandikar, Michael S. Tsirkin, Anthony Green,
Mark Cave-Ayland, qemu-devel, Alistair Francis,
Edgar E. Iglesias, Guan Xuetao, Marek Vasut, Jia Liu,
qemu-trivial, Helge Deller, David Hildenbrand, Magnus Damm,
Halil Pasic, Christian Borntraeger, Palmer Dabbelt,
Aleksandar Rikalo, Richard Henderson, Artyom Tarasenko,
Eduardo Habkost, Richard Henderson, qemu-s390x, Stafford Horne,
David Gibson, qemu-riscv, Thomas Huth, Bastian Koppelmann,
Chris Wulff, Laurent Vivier, Michael Walle, qemu-ppc,
Aleksandar Markovic, Paolo Bonzini, Aurelien Jarno
On Fri, 7 Feb 2020 17:19:47 +0100
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> There's no good reason for it to be type int, change it to bool.
>
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> v4:
> - fixed incorrect changes to max_cpus (Laurent)
> - describe field
> ---
> include/hw/boards.h | 4 +++-
> hw/alpha/dp264.c | 2 +-
> hw/cris/axis_dev88.c | 2 +-
> hw/hppa/machine.c | 2 +-
> hw/i386/pc_piix.c | 10 +++++-----
> hw/lm32/lm32_boards.c | 2 +-
> hw/m68k/mcf5208.c | 2 +-
> hw/microblaze/petalogix_s3adsp1800_mmu.c | 2 +-
> hw/mips/mips_malta.c | 2 +-
> hw/moxie/moxiesim.c | 2 +-
> hw/nios2/10m50_devboard.c | 2 +-
> hw/openrisc/openrisc_sim.c | 2 +-
> hw/ppc/mac_oldworld.c | 2 +-
> hw/ppc/spapr.c | 2 +-
> hw/riscv/spike.c | 2 +-
> hw/s390x/s390-virtio-ccw.c | 2 +-
> hw/sh4/shix.c | 2 +-
> hw/sparc/sun4m.c | 2 +-
> hw/sparc64/sun4u.c | 2 +-
> hw/unicore32/puv3.c | 2 +-
> 20 files changed, 26 insertions(+), 24 deletions(-)
s390 part:
Acked-by: Cornelia Huck <cohuck@redhat.com>
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v4 2/3] hw: Make MachineClass::is_default a boolean type
@ 2020-02-10 8:51 ` Cornelia Huck
0 siblings, 0 replies; 42+ messages in thread
From: Cornelia Huck @ 2020-02-10 8:51 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Aleksandar Rikalo, Guan Xuetao, qemu-ppc,
Sagar Karandikar, David Gibson, Christian Borntraeger,
Paolo Bonzini, Bastian Koppelmann, Eduardo Habkost,
Laurent Vivier, Anthony Green, Richard Henderson,
Artyom Tarasenko, qemu-trivial, Aurelien Jarno,
Edgar E. Iglesias, Mark Cave-Ayland, qemu-riscv,
Michael S. Tsirkin, Aleksandar Markovic, Marek Vasut,
Palmer Dabbelt, Michael Walle, Halil Pasic, Marcel Apfelbaum,
qemu-s390x, Richard Henderson, Thomas Huth, Magnus Damm,
David Hildenbrand, Chris Wulff, Stafford Horne, Helge Deller,
Alistair Francis, Jia Liu
On Fri, 7 Feb 2020 17:19:47 +0100
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> There's no good reason for it to be type int, change it to bool.
>
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> v4:
> - fixed incorrect changes to max_cpus (Laurent)
> - describe field
> ---
> include/hw/boards.h | 4 +++-
> hw/alpha/dp264.c | 2 +-
> hw/cris/axis_dev88.c | 2 +-
> hw/hppa/machine.c | 2 +-
> hw/i386/pc_piix.c | 10 +++++-----
> hw/lm32/lm32_boards.c | 2 +-
> hw/m68k/mcf5208.c | 2 +-
> hw/microblaze/petalogix_s3adsp1800_mmu.c | 2 +-
> hw/mips/mips_malta.c | 2 +-
> hw/moxie/moxiesim.c | 2 +-
> hw/nios2/10m50_devboard.c | 2 +-
> hw/openrisc/openrisc_sim.c | 2 +-
> hw/ppc/mac_oldworld.c | 2 +-
> hw/ppc/spapr.c | 2 +-
> hw/riscv/spike.c | 2 +-
> hw/s390x/s390-virtio-ccw.c | 2 +-
> hw/sh4/shix.c | 2 +-
> hw/sparc/sun4m.c | 2 +-
> hw/sparc64/sun4u.c | 2 +-
> hw/unicore32/puv3.c | 2 +-
> 20 files changed, 26 insertions(+), 24 deletions(-)
s390 part:
Acked-by: Cornelia Huck <cohuck@redhat.com>
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v4 2/3] hw: Make MachineClass::is_default a boolean type
2020-02-07 16:19 ` Philippe Mathieu-Daudé
@ 2020-02-10 9:22 ` Thomas Huth
-1 siblings, 0 replies; 42+ messages in thread
From: Thomas Huth @ 2020-02-10 9:22 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Cornelia Huck, Sagar Karandikar, Michael S. Tsirkin,
Anthony Green, Mark Cave-Ayland, Alistair Francis,
Edgar E. Iglesias, Guan Xuetao, Marek Vasut, Jia Liu,
qemu-trivial, Helge Deller, David Hildenbrand, Magnus Damm,
Halil Pasic, Christian Borntraeger, qemu-ppc, Aleksandar Rikalo,
David Gibson, Artyom Tarasenko, Eduardo Habkost,
Richard Henderson, qemu-s390x, Stafford Horne, Richard Henderson,
qemu-riscv, Thomas Huth, Bastian Koppelmann, Chris Wulff,
Laurent Vivier, Michael Walle, Palmer Dabbelt,
Aleksandar Markovic, Paolo Bonzini, Aurelien Jarno
On 07/02/2020 17.19, Philippe Mathieu-Daudé wrote:
> There's no good reason for it to be type int, change it to bool.
>
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> v4:
> - fixed incorrect changes to max_cpus (Laurent)
> - describe field
> ---
[...]
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index fa12203079..9088db8fb6 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -423,7 +423,7 @@ static void pc_i440fx_5_0_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
> pc_i440fx_machine_options(m);
> m->alias = "pc";
> - m->is_default = 1;
> + m->is_default = true;
> pcmc->default_cpu_version = 1;
> }
>
> @@ -434,7 +434,7 @@ static void pc_i440fx_4_2_machine_options(MachineClass *m)
> {
> pc_i440fx_5_0_machine_options(m);
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
> compat_props_add(m->compat_props, hw_compat_4_2, hw_compat_4_2_len);
> compat_props_add(m->compat_props, pc_compat_4_2, pc_compat_4_2_len);
> }
> @@ -446,7 +446,7 @@ static void pc_i440fx_4_1_machine_options(MachineClass *m)
> {
> pc_i440fx_4_2_machine_options(m);
Since we're calling pc_i440fx_4_2_machine_options() here...
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
... you could even remove this line now...
> compat_props_add(m->compat_props, hw_compat_4_1, hw_compat_4_1_len);
> compat_props_add(m->compat_props, pc_compat_4_1, pc_compat_4_1_len);
> }
> @@ -459,7 +459,7 @@ static void pc_i440fx_4_0_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
> pc_i440fx_4_1_machine_options(m);
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
... and this one, too.
> pcmc->default_cpu_version = CPU_VERSION_LEGACY;
> compat_props_add(m->compat_props, hw_compat_4_0, hw_compat_4_0_len);
> compat_props_add(m->compat_props, pc_compat_4_0, pc_compat_4_0_len);
> @@ -473,7 +473,7 @@ static void pc_i440fx_3_1_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
>
> pc_i440fx_4_0_machine_options(m);
> - m->is_default = 0;
> + m->is_default = false;
dito.
But that could also be done in a later patch, so:
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v4 2/3] hw: Make MachineClass::is_default a boolean type
@ 2020-02-10 9:22 ` Thomas Huth
0 siblings, 0 replies; 42+ messages in thread
From: Thomas Huth @ 2020-02-10 9:22 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Chris Wulff, Sagar Karandikar, Michael S. Tsirkin, Anthony Green,
Mark Cave-Ayland, Alistair Francis, Edgar E. Iglesias,
Guan Xuetao, Marek Vasut, Jia Liu, qemu-trivial, Helge Deller,
David Hildenbrand, Magnus Damm, Halil Pasic,
Christian Borntraeger, Marcel Apfelbaum, Palmer Dabbelt,
Aleksandar Rikalo, Richard Henderson, Artyom Tarasenko,
Eduardo Habkost, Richard Henderson, qemu-s390x, Stafford Horne,
David Gibson, qemu-riscv, Thomas Huth, Bastian Koppelmann,
Cornelia Huck, Laurent Vivier, Michael Walle, qemu-ppc,
Aleksandar Markovic, Paolo Bonzini, Aurelien Jarno
On 07/02/2020 17.19, Philippe Mathieu-Daudé wrote:
> There's no good reason for it to be type int, change it to bool.
>
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> v4:
> - fixed incorrect changes to max_cpus (Laurent)
> - describe field
> ---
[...]
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index fa12203079..9088db8fb6 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -423,7 +423,7 @@ static void pc_i440fx_5_0_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
> pc_i440fx_machine_options(m);
> m->alias = "pc";
> - m->is_default = 1;
> + m->is_default = true;
> pcmc->default_cpu_version = 1;
> }
>
> @@ -434,7 +434,7 @@ static void pc_i440fx_4_2_machine_options(MachineClass *m)
> {
> pc_i440fx_5_0_machine_options(m);
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
> compat_props_add(m->compat_props, hw_compat_4_2, hw_compat_4_2_len);
> compat_props_add(m->compat_props, pc_compat_4_2, pc_compat_4_2_len);
> }
> @@ -446,7 +446,7 @@ static void pc_i440fx_4_1_machine_options(MachineClass *m)
> {
> pc_i440fx_4_2_machine_options(m);
Since we're calling pc_i440fx_4_2_machine_options() here...
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
... you could even remove this line now...
> compat_props_add(m->compat_props, hw_compat_4_1, hw_compat_4_1_len);
> compat_props_add(m->compat_props, pc_compat_4_1, pc_compat_4_1_len);
> }
> @@ -459,7 +459,7 @@ static void pc_i440fx_4_0_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
> pc_i440fx_4_1_machine_options(m);
> m->alias = NULL;
> - m->is_default = 0;
> + m->is_default = false;
... and this one, too.
> pcmc->default_cpu_version = CPU_VERSION_LEGACY;
> compat_props_add(m->compat_props, hw_compat_4_0, hw_compat_4_0_len);
> compat_props_add(m->compat_props, pc_compat_4_0, pc_compat_4_0_len);
> @@ -473,7 +473,7 @@ static void pc_i440fx_3_1_machine_options(MachineClass *m)
> PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
>
> pc_i440fx_4_0_machine_options(m);
> - m->is_default = 0;
> + m->is_default = false;
dito.
But that could also be done in a later patch, so:
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 42+ messages in thread