qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] hw/i386: define _AS_LATEST() macros for machine types
@ 2024-09-10 16:30 Daniel P. Berrangé
  2024-10-21 18:03 ` Daniel P. Berrangé
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel P. Berrangé @ 2024-09-10 16:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Cornelia Huck, Marcel Apfelbaum, Paolo Bonzini, Eduardo Habkost,
	Richard Henderson, Michael S. Tsirkin, Daniel P. Berrangé,
	Philippe Mathieu-Daudé

Follow the other architecture targets by adding extra macros for
defining a versioned machine type as the latest. This reduces the
size of the changes when introducing new machine types at the start
of each release cycle.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---

In v2:

 - Rebased on top of new 9.2 machine types

 hw/i386/pc_piix.c    | 11 +++++------
 hw/i386/pc_q35.c     | 11 ++++++-----
 include/hw/i386/pc.h |  4 +++-
 3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 2bf6865d40..4953676170 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -446,7 +446,10 @@ static void pc_i440fx_init(MachineState *machine)
 }
 
 #define DEFINE_I440FX_MACHINE(major, minor) \
-    DEFINE_PC_VER_MACHINE(pc_i440fx, "pc-i440fx", pc_i440fx_init, major, minor);
+    DEFINE_PC_VER_MACHINE(pc_i440fx, "pc-i440fx", pc_i440fx_init, false, NULL, major, minor);
+
+#define DEFINE_I440FX_MACHINE_AS_LATEST(major, minor) \
+    DEFINE_PC_VER_MACHINE(pc_i440fx, "pc-i440fx", pc_i440fx_init, true, "pc", major, minor);
 
 static void pc_i440fx_machine_options(MachineClass *m)
 {
@@ -477,17 +480,13 @@ static void pc_i440fx_machine_options(MachineClass *m)
 static void pc_i440fx_machine_9_2_options(MachineClass *m)
 {
     pc_i440fx_machine_options(m);
-    m->alias = "pc";
-    m->is_default = true;
 }
 
-DEFINE_I440FX_MACHINE(9, 2);
+DEFINE_I440FX_MACHINE_AS_LATEST(9, 2);
 
 static void pc_i440fx_machine_9_1_options(MachineClass *m)
 {
     pc_i440fx_machine_9_2_options(m);
-    m->alias = NULL;
-    m->is_default = false;
     compat_props_add(m->compat_props, hw_compat_9_1, hw_compat_9_1_len);
     compat_props_add(m->compat_props, pc_compat_9_1, pc_compat_9_1_len);
 }
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 8319b6d45e..42bdedbaa4 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -327,10 +327,13 @@ static void pc_q35_init(MachineState *machine)
 }
 
 #define DEFINE_Q35_MACHINE(major, minor) \
-    DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, major, minor);
+    DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, false, NULL, major, minor);
+
+#define DEFINE_Q35_MACHINE_AS_LATEST(major, minor) \
+    DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, false, "q35", major, minor);
 
 #define DEFINE_Q35_MACHINE_BUGFIX(major, minor, micro) \
-    DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, major, minor, micro);
+    DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, false, NULL, major, minor, micro);
 
 static void pc_q35_machine_options(MachineClass *m)
 {
@@ -359,15 +362,13 @@ static void pc_q35_machine_options(MachineClass *m)
 static void pc_q35_machine_9_2_options(MachineClass *m)
 {
     pc_q35_machine_options(m);
-    m->alias = "q35";
 }
 
-DEFINE_Q35_MACHINE(9, 2);
+DEFINE_Q35_MACHINE_AS_LATEST(9, 2);
 
 static void pc_q35_machine_9_1_options(MachineClass *m)
 {
     pc_q35_machine_9_2_options(m);
-    m->alias = NULL;
     compat_props_add(m->compat_props, hw_compat_9_1, hw_compat_9_1_len);
     compat_props_add(m->compat_props, pc_compat_9_1, pc_compat_9_1_len);
 }
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 14ee06287d..890427c56e 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -320,7 +320,7 @@ extern const size_t pc_compat_2_3_len;
     } \
     type_init(pc_machine_init_##suffix)
 
-#define DEFINE_PC_VER_MACHINE(namesym, namestr, initfn, ...) \
+#define DEFINE_PC_VER_MACHINE(namesym, namestr, initfn, isdefault, malias, ...) \
     static void MACHINE_VER_SYM(init, namesym, __VA_ARGS__)( \
         MachineState *machine) \
     { \
@@ -334,6 +334,8 @@ extern const size_t pc_compat_2_3_len;
         MACHINE_VER_SYM(options, namesym, __VA_ARGS__)(mc); \
         mc->init = MACHINE_VER_SYM(init, namesym, __VA_ARGS__); \
         MACHINE_VER_DEPRECATION(__VA_ARGS__); \
+        mc->is_default = isdefault; \
+        mc->alias = malias; \
     } \
     static const TypeInfo MACHINE_VER_SYM(info, namesym, __VA_ARGS__) = \
     { \
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] hw/i386: define _AS_LATEST() macros for machine types
  2024-09-10 16:30 [PATCH v2] hw/i386: define _AS_LATEST() macros for machine types Daniel P. Berrangé
@ 2024-10-21 18:03 ` Daniel P. Berrangé
  2024-11-25 10:18   ` Cornelia Huck
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel P. Berrangé @ 2024-10-21 18:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: Cornelia Huck, Marcel Apfelbaum, Paolo Bonzini, Eduardo Habkost,
	Richard Henderson, Michael S. Tsirkin,
	Philippe Mathieu-Daudé

Ping: for the x86 maintainers.

On Tue, Sep 10, 2024 at 05:30:41PM +0100, Daniel P. Berrangé wrote:
> Follow the other architecture targets by adding extra macros for
> defining a versioned machine type as the latest. This reduces the
> size of the changes when introducing new machine types at the start
> of each release cycle.
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> 
> In v2:
> 
>  - Rebased on top of new 9.2 machine types
> 
>  hw/i386/pc_piix.c    | 11 +++++------
>  hw/i386/pc_q35.c     | 11 ++++++-----
>  include/hw/i386/pc.h |  4 +++-
>  3 files changed, 14 insertions(+), 12 deletions(-)
> 
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 2bf6865d40..4953676170 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -446,7 +446,10 @@ static void pc_i440fx_init(MachineState *machine)
>  }
>  
>  #define DEFINE_I440FX_MACHINE(major, minor) \
> -    DEFINE_PC_VER_MACHINE(pc_i440fx, "pc-i440fx", pc_i440fx_init, major, minor);
> +    DEFINE_PC_VER_MACHINE(pc_i440fx, "pc-i440fx", pc_i440fx_init, false, NULL, major, minor);
> +
> +#define DEFINE_I440FX_MACHINE_AS_LATEST(major, minor) \
> +    DEFINE_PC_VER_MACHINE(pc_i440fx, "pc-i440fx", pc_i440fx_init, true, "pc", major, minor);
>  
>  static void pc_i440fx_machine_options(MachineClass *m)
>  {
> @@ -477,17 +480,13 @@ static void pc_i440fx_machine_options(MachineClass *m)
>  static void pc_i440fx_machine_9_2_options(MachineClass *m)
>  {
>      pc_i440fx_machine_options(m);
> -    m->alias = "pc";
> -    m->is_default = true;
>  }
>  
> -DEFINE_I440FX_MACHINE(9, 2);
> +DEFINE_I440FX_MACHINE_AS_LATEST(9, 2);
>  
>  static void pc_i440fx_machine_9_1_options(MachineClass *m)
>  {
>      pc_i440fx_machine_9_2_options(m);
> -    m->alias = NULL;
> -    m->is_default = false;
>      compat_props_add(m->compat_props, hw_compat_9_1, hw_compat_9_1_len);
>      compat_props_add(m->compat_props, pc_compat_9_1, pc_compat_9_1_len);
>  }
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index 8319b6d45e..42bdedbaa4 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -327,10 +327,13 @@ static void pc_q35_init(MachineState *machine)
>  }
>  
>  #define DEFINE_Q35_MACHINE(major, minor) \
> -    DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, major, minor);
> +    DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, false, NULL, major, minor);
> +
> +#define DEFINE_Q35_MACHINE_AS_LATEST(major, minor) \
> +    DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, false, "q35", major, minor);
>  
>  #define DEFINE_Q35_MACHINE_BUGFIX(major, minor, micro) \
> -    DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, major, minor, micro);
> +    DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, false, NULL, major, minor, micro);
>  
>  static void pc_q35_machine_options(MachineClass *m)
>  {
> @@ -359,15 +362,13 @@ static void pc_q35_machine_options(MachineClass *m)
>  static void pc_q35_machine_9_2_options(MachineClass *m)
>  {
>      pc_q35_machine_options(m);
> -    m->alias = "q35";
>  }
>  
> -DEFINE_Q35_MACHINE(9, 2);
> +DEFINE_Q35_MACHINE_AS_LATEST(9, 2);
>  
>  static void pc_q35_machine_9_1_options(MachineClass *m)
>  {
>      pc_q35_machine_9_2_options(m);
> -    m->alias = NULL;
>      compat_props_add(m->compat_props, hw_compat_9_1, hw_compat_9_1_len);
>      compat_props_add(m->compat_props, pc_compat_9_1, pc_compat_9_1_len);
>  }
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 14ee06287d..890427c56e 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -320,7 +320,7 @@ extern const size_t pc_compat_2_3_len;
>      } \
>      type_init(pc_machine_init_##suffix)
>  
> -#define DEFINE_PC_VER_MACHINE(namesym, namestr, initfn, ...) \
> +#define DEFINE_PC_VER_MACHINE(namesym, namestr, initfn, isdefault, malias, ...) \
>      static void MACHINE_VER_SYM(init, namesym, __VA_ARGS__)( \
>          MachineState *machine) \
>      { \
> @@ -334,6 +334,8 @@ extern const size_t pc_compat_2_3_len;
>          MACHINE_VER_SYM(options, namesym, __VA_ARGS__)(mc); \
>          mc->init = MACHINE_VER_SYM(init, namesym, __VA_ARGS__); \
>          MACHINE_VER_DEPRECATION(__VA_ARGS__); \
> +        mc->is_default = isdefault; \
> +        mc->alias = malias; \
>      } \
>      static const TypeInfo MACHINE_VER_SYM(info, namesym, __VA_ARGS__) = \
>      { \
> -- 
> 2.43.0
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] hw/i386: define _AS_LATEST() macros for machine types
  2024-10-21 18:03 ` Daniel P. Berrangé
@ 2024-11-25 10:18   ` Cornelia Huck
  2024-11-25 10:27     ` Daniel P. Berrangé
  0 siblings, 1 reply; 5+ messages in thread
From: Cornelia Huck @ 2024-11-25 10:18 UTC (permalink / raw)
  To: Daniel P. Berrangé, qemu-devel
  Cc: Marcel Apfelbaum, Paolo Bonzini, Eduardo Habkost,
	Richard Henderson, Michael S. Tsirkin,
	Philippe Mathieu-Daudé

On Mon, Oct 21 2024, Daniel P. Berrangé <berrange@redhat.com> wrote:

> Ping: for the x86 maintainers.

...has anything ever happened with this patch? It's machine type
creation time again, and it would probably make sense for me to do the
10.0 machine types on top of this.

>
> On Tue, Sep 10, 2024 at 05:30:41PM +0100, Daniel P. Berrangé wrote:
>> Follow the other architecture targets by adding extra macros for
>> defining a versioned machine type as the latest. This reduces the
>> size of the changes when introducing new machine types at the start
>> of each release cycle.
>> 
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
>> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
>> ---
>> 
>> In v2:
>> 
>>  - Rebased on top of new 9.2 machine types
>> 
>>  hw/i386/pc_piix.c    | 11 +++++------
>>  hw/i386/pc_q35.c     | 11 ++++++-----
>>  include/hw/i386/pc.h |  4 +++-
>>  3 files changed, 14 insertions(+), 12 deletions(-)
>> 
>> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
>> index 2bf6865d40..4953676170 100644
>> --- a/hw/i386/pc_piix.c
>> +++ b/hw/i386/pc_piix.c
>> @@ -446,7 +446,10 @@ static void pc_i440fx_init(MachineState *machine)
>>  }
>>  
>>  #define DEFINE_I440FX_MACHINE(major, minor) \
>> -    DEFINE_PC_VER_MACHINE(pc_i440fx, "pc-i440fx", pc_i440fx_init, major, minor);
>> +    DEFINE_PC_VER_MACHINE(pc_i440fx, "pc-i440fx", pc_i440fx_init, false, NULL, major, minor);
>> +
>> +#define DEFINE_I440FX_MACHINE_AS_LATEST(major, minor) \
>> +    DEFINE_PC_VER_MACHINE(pc_i440fx, "pc-i440fx", pc_i440fx_init, true, "pc", major, minor);
>>  
>>  static void pc_i440fx_machine_options(MachineClass *m)
>>  {
>> @@ -477,17 +480,13 @@ static void pc_i440fx_machine_options(MachineClass *m)
>>  static void pc_i440fx_machine_9_2_options(MachineClass *m)
>>  {
>>      pc_i440fx_machine_options(m);
>> -    m->alias = "pc";
>> -    m->is_default = true;
>>  }
>>  
>> -DEFINE_I440FX_MACHINE(9, 2);
>> +DEFINE_I440FX_MACHINE_AS_LATEST(9, 2);
>>  
>>  static void pc_i440fx_machine_9_1_options(MachineClass *m)
>>  {
>>      pc_i440fx_machine_9_2_options(m);
>> -    m->alias = NULL;
>> -    m->is_default = false;
>>      compat_props_add(m->compat_props, hw_compat_9_1, hw_compat_9_1_len);
>>      compat_props_add(m->compat_props, pc_compat_9_1, pc_compat_9_1_len);
>>  }
>> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
>> index 8319b6d45e..42bdedbaa4 100644
>> --- a/hw/i386/pc_q35.c
>> +++ b/hw/i386/pc_q35.c
>> @@ -327,10 +327,13 @@ static void pc_q35_init(MachineState *machine)
>>  }
>>  
>>  #define DEFINE_Q35_MACHINE(major, minor) \
>> -    DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, major, minor);
>> +    DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, false, NULL, major, minor);
>> +
>> +#define DEFINE_Q35_MACHINE_AS_LATEST(major, minor) \
>> +    DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, false, "q35", major, minor);
>>  
>>  #define DEFINE_Q35_MACHINE_BUGFIX(major, minor, micro) \
>> -    DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, major, minor, micro);
>> +    DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, false, NULL, major, minor, micro);
>>  
>>  static void pc_q35_machine_options(MachineClass *m)
>>  {
>> @@ -359,15 +362,13 @@ static void pc_q35_machine_options(MachineClass *m)
>>  static void pc_q35_machine_9_2_options(MachineClass *m)
>>  {
>>      pc_q35_machine_options(m);
>> -    m->alias = "q35";
>>  }
>>  
>> -DEFINE_Q35_MACHINE(9, 2);
>> +DEFINE_Q35_MACHINE_AS_LATEST(9, 2);
>>  
>>  static void pc_q35_machine_9_1_options(MachineClass *m)
>>  {
>>      pc_q35_machine_9_2_options(m);
>> -    m->alias = NULL;
>>      compat_props_add(m->compat_props, hw_compat_9_1, hw_compat_9_1_len);
>>      compat_props_add(m->compat_props, pc_compat_9_1, pc_compat_9_1_len);
>>  }
>> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
>> index 14ee06287d..890427c56e 100644
>> --- a/include/hw/i386/pc.h
>> +++ b/include/hw/i386/pc.h
>> @@ -320,7 +320,7 @@ extern const size_t pc_compat_2_3_len;
>>      } \
>>      type_init(pc_machine_init_##suffix)
>>  
>> -#define DEFINE_PC_VER_MACHINE(namesym, namestr, initfn, ...) \
>> +#define DEFINE_PC_VER_MACHINE(namesym, namestr, initfn, isdefault, malias, ...) \
>>      static void MACHINE_VER_SYM(init, namesym, __VA_ARGS__)( \
>>          MachineState *machine) \
>>      { \
>> @@ -334,6 +334,8 @@ extern const size_t pc_compat_2_3_len;
>>          MACHINE_VER_SYM(options, namesym, __VA_ARGS__)(mc); \
>>          mc->init = MACHINE_VER_SYM(init, namesym, __VA_ARGS__); \
>>          MACHINE_VER_DEPRECATION(__VA_ARGS__); \
>> +        mc->is_default = isdefault; \
>> +        mc->alias = malias; \
>>      } \
>>      static const TypeInfo MACHINE_VER_SYM(info, namesym, __VA_ARGS__) = \
>>      { \
>> -- 
>> 2.43.0
>> 
>
> With regards,
> Daniel
> -- 
> |: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org         -o-            https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] hw/i386: define _AS_LATEST() macros for machine types
  2024-11-25 10:18   ` Cornelia Huck
@ 2024-11-25 10:27     ` Daniel P. Berrangé
  2024-11-25 10:29       ` Cornelia Huck
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel P. Berrangé @ 2024-11-25 10:27 UTC (permalink / raw)
  To: Cornelia Huck
  Cc: qemu-devel, Marcel Apfelbaum, Paolo Bonzini, Eduardo Habkost,
	Richard Henderson, Michael S. Tsirkin,
	Philippe Mathieu-Daudé

On Mon, Nov 25, 2024 at 11:18:26AM +0100, Cornelia Huck wrote:
> On Mon, Oct 21 2024, Daniel P. Berrangé <berrange@redhat.com> wrote:
> 
> > Ping: for the x86 maintainers.
> 
> ...has anything ever happened with this patch? It's machine type
> creation time again, and it would probably make sense for me to do the
> 10.0 machine types on top of this.

Still not picked up by the x86 maintainers :-(

I'd suggest you just put it at the start of your 10.0 series.

> 
> >
> > On Tue, Sep 10, 2024 at 05:30:41PM +0100, Daniel P. Berrangé wrote:
> >> Follow the other architecture targets by adding extra macros for
> >> defining a versioned machine type as the latest. This reduces the
> >> size of the changes when introducing new machine types at the start
> >> of each release cycle.
> >> 
> >> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> >> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
> >> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> >> ---
> >> 
> >> In v2:
> >> 
> >>  - Rebased on top of new 9.2 machine types
> >> 
> >>  hw/i386/pc_piix.c    | 11 +++++------
> >>  hw/i386/pc_q35.c     | 11 ++++++-----
> >>  include/hw/i386/pc.h |  4 +++-
> >>  3 files changed, 14 insertions(+), 12 deletions(-)
> >> 
> >> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> >> index 2bf6865d40..4953676170 100644
> >> --- a/hw/i386/pc_piix.c
> >> +++ b/hw/i386/pc_piix.c
> >> @@ -446,7 +446,10 @@ static void pc_i440fx_init(MachineState *machine)
> >>  }
> >>  
> >>  #define DEFINE_I440FX_MACHINE(major, minor) \
> >> -    DEFINE_PC_VER_MACHINE(pc_i440fx, "pc-i440fx", pc_i440fx_init, major, minor);
> >> +    DEFINE_PC_VER_MACHINE(pc_i440fx, "pc-i440fx", pc_i440fx_init, false, NULL, major, minor);
> >> +
> >> +#define DEFINE_I440FX_MACHINE_AS_LATEST(major, minor) \
> >> +    DEFINE_PC_VER_MACHINE(pc_i440fx, "pc-i440fx", pc_i440fx_init, true, "pc", major, minor);
> >>  
> >>  static void pc_i440fx_machine_options(MachineClass *m)
> >>  {
> >> @@ -477,17 +480,13 @@ static void pc_i440fx_machine_options(MachineClass *m)
> >>  static void pc_i440fx_machine_9_2_options(MachineClass *m)
> >>  {
> >>      pc_i440fx_machine_options(m);
> >> -    m->alias = "pc";
> >> -    m->is_default = true;
> >>  }
> >>  
> >> -DEFINE_I440FX_MACHINE(9, 2);
> >> +DEFINE_I440FX_MACHINE_AS_LATEST(9, 2);
> >>  
> >>  static void pc_i440fx_machine_9_1_options(MachineClass *m)
> >>  {
> >>      pc_i440fx_machine_9_2_options(m);
> >> -    m->alias = NULL;
> >> -    m->is_default = false;
> >>      compat_props_add(m->compat_props, hw_compat_9_1, hw_compat_9_1_len);
> >>      compat_props_add(m->compat_props, pc_compat_9_1, pc_compat_9_1_len);
> >>  }
> >> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> >> index 8319b6d45e..42bdedbaa4 100644
> >> --- a/hw/i386/pc_q35.c
> >> +++ b/hw/i386/pc_q35.c
> >> @@ -327,10 +327,13 @@ static void pc_q35_init(MachineState *machine)
> >>  }
> >>  
> >>  #define DEFINE_Q35_MACHINE(major, minor) \
> >> -    DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, major, minor);
> >> +    DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, false, NULL, major, minor);
> >> +
> >> +#define DEFINE_Q35_MACHINE_AS_LATEST(major, minor) \
> >> +    DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, false, "q35", major, minor);
> >>  
> >>  #define DEFINE_Q35_MACHINE_BUGFIX(major, minor, micro) \
> >> -    DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, major, minor, micro);
> >> +    DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, false, NULL, major, minor, micro);
> >>  
> >>  static void pc_q35_machine_options(MachineClass *m)
> >>  {
> >> @@ -359,15 +362,13 @@ static void pc_q35_machine_options(MachineClass *m)
> >>  static void pc_q35_machine_9_2_options(MachineClass *m)
> >>  {
> >>      pc_q35_machine_options(m);
> >> -    m->alias = "q35";
> >>  }
> >>  
> >> -DEFINE_Q35_MACHINE(9, 2);
> >> +DEFINE_Q35_MACHINE_AS_LATEST(9, 2);
> >>  
> >>  static void pc_q35_machine_9_1_options(MachineClass *m)
> >>  {
> >>      pc_q35_machine_9_2_options(m);
> >> -    m->alias = NULL;
> >>      compat_props_add(m->compat_props, hw_compat_9_1, hw_compat_9_1_len);
> >>      compat_props_add(m->compat_props, pc_compat_9_1, pc_compat_9_1_len);
> >>  }
> >> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> >> index 14ee06287d..890427c56e 100644
> >> --- a/include/hw/i386/pc.h
> >> +++ b/include/hw/i386/pc.h
> >> @@ -320,7 +320,7 @@ extern const size_t pc_compat_2_3_len;
> >>      } \
> >>      type_init(pc_machine_init_##suffix)
> >>  
> >> -#define DEFINE_PC_VER_MACHINE(namesym, namestr, initfn, ...) \
> >> +#define DEFINE_PC_VER_MACHINE(namesym, namestr, initfn, isdefault, malias, ...) \
> >>      static void MACHINE_VER_SYM(init, namesym, __VA_ARGS__)( \
> >>          MachineState *machine) \
> >>      { \
> >> @@ -334,6 +334,8 @@ extern const size_t pc_compat_2_3_len;
> >>          MACHINE_VER_SYM(options, namesym, __VA_ARGS__)(mc); \
> >>          mc->init = MACHINE_VER_SYM(init, namesym, __VA_ARGS__); \
> >>          MACHINE_VER_DEPRECATION(__VA_ARGS__); \
> >> +        mc->is_default = isdefault; \
> >> +        mc->alias = malias; \
> >>      } \
> >>      static const TypeInfo MACHINE_VER_SYM(info, namesym, __VA_ARGS__) = \
> >>      { \
> >> -- 
> >> 2.43.0
> >> 
> >
> > With regards,
> > Daniel
> > -- 
> > |: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
> > |: https://libvirt.org         -o-            https://fstop138.berrange.com :|
> > |: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] hw/i386: define _AS_LATEST() macros for machine types
  2024-11-25 10:27     ` Daniel P. Berrangé
@ 2024-11-25 10:29       ` Cornelia Huck
  0 siblings, 0 replies; 5+ messages in thread
From: Cornelia Huck @ 2024-11-25 10:29 UTC (permalink / raw)
  To: Daniel P. Berrangé
  Cc: qemu-devel, Marcel Apfelbaum, Paolo Bonzini, Eduardo Habkost,
	Richard Henderson, Michael S. Tsirkin,
	Philippe Mathieu-Daudé

On Mon, Nov 25 2024, Daniel P. Berrangé <berrange@redhat.com> wrote:

> On Mon, Nov 25, 2024 at 11:18:26AM +0100, Cornelia Huck wrote:
>> On Mon, Oct 21 2024, Daniel P. Berrangé <berrange@redhat.com> wrote:
>> 
>> > Ping: for the x86 maintainers.
>> 
>> ...has anything ever happened with this patch? It's machine type
>> creation time again, and it would probably make sense for me to do the
>> 10.0 machine types on top of this.
>
> Still not picked up by the x86 maintainers :-(
>
> I'd suggest you just put it at the start of your 10.0 series.

Yep, that's what I'll be doing.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-11-25 10:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-10 16:30 [PATCH v2] hw/i386: define _AS_LATEST() macros for machine types Daniel P. Berrangé
2024-10-21 18:03 ` Daniel P. Berrangé
2024-11-25 10:18   ` Cornelia Huck
2024-11-25 10:27     ` Daniel P. Berrangé
2024-11-25 10:29       ` Cornelia Huck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).