[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 01/26] hw/i386: define _AS_LATEST() macros for machine types
From: |
Thomas Huth |
Subject: |
[PULL 01/26] hw/i386: define _AS_LATEST() macros for machine types |
Date: |
Wed, 11 Dec 2024 09:59:45 +0100 |
From: Daniel P. Berrangé <berrange@redhat.com>
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>
Message-ID: <20240910163041.3764176-1-berrange@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Message-ID: <20241126103005.3794748-2-cohuck@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
include/hw/i386/pc.h | 4 +++-
hw/i386/pc_piix.c | 11 +++++------
hw/i386/pc_q35.c | 11 ++++++-----
3 files changed, 14 insertions(+), 12 deletions(-)
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__) = \
{ \
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);
}
--
2.47.1
- [PULL 00/26] First s390x and functional testing patches for v10.0, Thomas Huth, 2024/12/11
- [PULL 01/26] hw/i386: define _AS_LATEST() macros for machine types,
Thomas Huth <=
- [PULL 02/26] hw: add compat machines for 10.0, Thomas Huth, 2024/12/11
- [PULL 03/26] docs: replace 'Edit on GitLab' with 'View page source', Thomas Huth, 2024/12/11
- [PULL 04/26] s390x/cpumodel: add msa10 subfunctions, Thomas Huth, 2024/12/11
- [PULL 05/26] s390x/cpumodel: add msa11 subfunctions, Thomas Huth, 2024/12/11
- [PULL 08/26] s390x/cpumodel: Add ptff Query Time-Stamp Event (QTSE) support, Thomas Huth, 2024/12/11
- [PULL 12/26] s390x/cpumodel: add Miscellaneous-Instruction-Extensions Facility 4, Thomas Huth, 2024/12/11
- [PULL 10/26] s390x/cpumodel: add Concurrent-functions facility support, Thomas Huth, 2024/12/11
- [PULL 13/26] s390x/cpumodel: add Vector-Packed-Decimal-Enhancement facility 3, Thomas Huth, 2024/12/11
- [PULL 16/26] s390x/cpumodel: correct PLO feature wording, Thomas Huth, 2024/12/11
- [PULL 18/26] s390x/cpumodel: gen17 model, Thomas Huth, 2024/12/11