Re: [PATCH v2 06/14] hw/i386: convert 'i440fx' machine definitions to use new macros

2024-07-01 Thread Philippe Mathieu-Daudé

On 20/6/24 18:57, Daniel P. Berrangé wrote:

This changes the DEFINE_I440FX_MACHINE macro to use the common
helpers for constructing versioned symbol names and strings,
bringing greater consistency across targets.

The added benefit is that it avoids the need to repeat the
version number thrice in three different formats in the calls
to DEFINE_I440FX_MACHINE.

Signed-off-by: Daniel P. Berrangé 
---
  hw/i386/pc_piix.c| 219 +++
  include/hw/i386/pc.h |  26 +
  2 files changed, 122 insertions(+), 123 deletions(-)


Reviewed-by: Philippe Mathieu-Daudé 




Re: [PATCH v2 06/14] hw/i386: convert 'i440fx' machine definitions to use new macros

2024-07-01 Thread Thomas Huth

On 20/06/2024 18.57, Daniel P. Berrangé wrote:

This changes the DEFINE_I440FX_MACHINE macro to use the common
helpers for constructing versioned symbol names and strings,
bringing greater consistency across targets.

The added benefit is that it avoids the need to repeat the
version number thrice in three different formats in the calls
to DEFINE_I440FX_MACHINE.

Signed-off-by: Daniel P. Berrangé 
---
  hw/i386/pc_piix.c| 219 +++
  include/hw/i386/pc.h |  26 +
  2 files changed, 122 insertions(+), 123 deletions(-)



Reviewed-by: Thomas Huth 




[PATCH v2 06/14] hw/i386: convert 'i440fx' machine definitions to use new macros

2024-06-20 Thread Daniel P . Berrangé
This changes the DEFINE_I440FX_MACHINE macro to use the common
helpers for constructing versioned symbol names and strings,
bringing greater consistency across targets.

The added benefit is that it avoids the need to repeat the
version number thrice in three different formats in the calls
to DEFINE_I440FX_MACHINE.

Signed-off-by: Daniel P. Berrangé 
---
 hw/i386/pc_piix.c| 219 +++
 include/hw/i386/pc.h |  26 +
 2 files changed, 122 insertions(+), 123 deletions(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index e4930b7f48..5705d6e155 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -445,12 +445,13 @@ static void pc_xen_hvm_init(MachineState *machine)
 }
 #endif
 
-#define DEFINE_I440FX_MACHINE(suffix, name, optionfn) \
-static void pc_init_##suffix(MachineState *machine) \
-{ \
-pc_init1(machine, TYPE_I440FX_PCI_DEVICE); \
-} \
-DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn)
+static void pc_i440fx_init(MachineState *machine)
+{
+pc_init1(machine, TYPE_I440FX_PCI_DEVICE);
+}
+
+#define DEFINE_I440FX_MACHINE(major, minor) \
+DEFINE_PC_VER_MACHINE(pc_i440fx, "pc-i440fx", pc_i440fx_init, major, 
minor);
 
 static void pc_i440fx_machine_options(MachineClass *m)
 {
@@ -478,21 +479,20 @@ static void pc_i440fx_machine_options(MachineClass *m)
  "Use a different south bridge than 
PIIX3");
 }
 
-static void pc_i440fx_9_1_machine_options(MachineClass *m)
+static void pc_i440fx_machine_9_1_options(MachineClass *m)
 {
 pc_i440fx_machine_options(m);
 m->alias = "pc";
 m->is_default = true;
 }
 
-DEFINE_I440FX_MACHINE(v9_1, "pc-i440fx-9.1",
-  pc_i440fx_9_1_machine_options);
+DEFINE_I440FX_MACHINE(9, 1);
 
-static void pc_i440fx_9_0_machine_options(MachineClass *m)
+static void pc_i440fx_machine_9_0_options(MachineClass *m)
 {
 PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
 
-pc_i440fx_9_1_machine_options(m);
+pc_i440fx_machine_9_1_options(m);
 m->alias = NULL;
 m->is_default = false;
 
@@ -501,14 +501,13 @@ static void pc_i440fx_9_0_machine_options(MachineClass *m)
 pcmc->isa_bios_alias = false;
 }
 
-DEFINE_I440FX_MACHINE(v9_0, "pc-i440fx-9.0",
-  pc_i440fx_9_0_machine_options);
+DEFINE_I440FX_MACHINE(9, 0);
 
-static void pc_i440fx_8_2_machine_options(MachineClass *m)
+static void pc_i440fx_machine_8_2_options(MachineClass *m)
 {
 PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
 
-pc_i440fx_9_0_machine_options(m);
+pc_i440fx_machine_9_0_options(m);
 
 compat_props_add(m->compat_props, hw_compat_8_2, hw_compat_8_2_len);
 compat_props_add(m->compat_props, pc_compat_8_2, pc_compat_8_2_len);
@@ -516,28 +515,26 @@ static void pc_i440fx_8_2_machine_options(MachineClass *m)
 pcmc->default_smbios_ep_type = SMBIOS_ENTRY_POINT_TYPE_64;
 }
 
-DEFINE_I440FX_MACHINE(v8_2, "pc-i440fx-8.2",
-  pc_i440fx_8_2_machine_options);
+DEFINE_I440FX_MACHINE(8, 2);
 
-static void pc_i440fx_8_1_machine_options(MachineClass *m)
+static void pc_i440fx_machine_8_1_options(MachineClass *m)
 {
 PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
 
-pc_i440fx_8_2_machine_options(m);
+pc_i440fx_machine_8_2_options(m);
 pcmc->broken_32bit_mem_addr_check = true;
 
 compat_props_add(m->compat_props, hw_compat_8_1, hw_compat_8_1_len);
 compat_props_add(m->compat_props, pc_compat_8_1, pc_compat_8_1_len);
 }
 
-DEFINE_I440FX_MACHINE(v8_1, "pc-i440fx-8.1",
-  pc_i440fx_8_1_machine_options);
+DEFINE_I440FX_MACHINE(8, 1);
 
-static void pc_i440fx_8_0_machine_options(MachineClass *m)
+static void pc_i440fx_machine_8_0_options(MachineClass *m)
 {
 PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
 
-pc_i440fx_8_1_machine_options(m);
+pc_i440fx_machine_8_1_options(m);
 compat_props_add(m->compat_props, hw_compat_8_0, hw_compat_8_0_len);
 compat_props_add(m->compat_props, pc_compat_8_0, pc_compat_8_0_len);
 
@@ -545,268 +542,244 @@ static void pc_i440fx_8_0_machine_options(MachineClass 
*m)
 pcmc->default_smbios_ep_type = SMBIOS_ENTRY_POINT_TYPE_32;
 }
 
-DEFINE_I440FX_MACHINE(v8_0, "pc-i440fx-8.0",
-  pc_i440fx_8_0_machine_options);
+DEFINE_I440FX_MACHINE(8, 0);
 
-static void pc_i440fx_7_2_machine_options(MachineClass *m)
+static void pc_i440fx_machine_7_2_options(MachineClass *m)
 {
-pc_i440fx_8_0_machine_options(m);
+pc_i440fx_machine_8_0_options(m);
 compat_props_add(m->compat_props, hw_compat_7_2, hw_compat_7_2_len);
 compat_props_add(m->compat_props, pc_compat_7_2, pc_compat_7_2_len);
 }
 
-DEFINE_I440FX_MACHINE(v7_2, "pc-i440fx-7.2",
-  pc_i440fx_7_2_machine_options);
+DEFINE_I440FX_MACHINE(7, 2)
 
-static void pc_i440fx_7_1_machine_options(MachineClass *m)
+static void pc_i440fx_machine_7_1_options(MachineClass *m)
 {
-pc_i440fx_7_2_machine_options(m);
+