Misc HW patches for 2024-07-02
Subsystems (2)
The following changes since commit b6d32a06fc0984e537091cba08f2e1ed9f775d74:
Merge tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu into staging (2024-06-30 16:12:24 -0700)
are available in the Git repository at:
https://github.com/philmd/qemu.git tags/hw-misc-20240702
for you to fetch changes up to f0936cbc1d42410ccd58c042bc26fa33a23a77d6:
Remove inclusion of hw/hw.h from files that don't need it (2024-07-02 06:58:48 +0200)
Ignored checkpatch warnings:
WARNING: line over 80 characters
#45: FILE: include/hw/boards.h:431:
+ * mc->desc = "QEMU " MACHINE_VER_STR(__VA_ARGS__) " Virtual Machine"; \
#205: FILE: include/hw/boards.h:591:
+ prefix ## _machine_ ## major ## _ ## minor ## _ ## micro ## _ ## tag ## _ ## sym
#40: FILE: hw/arm/virt.c:112:
+ mc->desc = "QEMU " MACHINE_VER_STR(__VA_ARGS__) " ARM Virtual Machine"; \
#55: FILE: hw/s390x/s390-virtio-ccw.c:828:
+ mc->desc = "Virtual s390x machine (version " MACHINE_VER_STR(__VA_ARGS__) ")"; \
#43: FILE: hw/m68k/virt.c:345:
+ mc->desc = "QEMU " MACHINE_VER_STR(__VA_ARGS__) " M68K Virtual Machine"; \
----------------------------------------------------------------
Misc HW patches queue
- Prevent NULL deref in sPAPR network model (Oleg)
- Automatic deprecation of versioned machine types (Daniel)
- Correct 'dump-guest-core' property name in hint (Akihiko)
- Prevent IRQ leak in MacIO IDE model (Mark)
- Remove dead #ifdef'ry related to unsupported macOS 12.0 (Akihiko)
- Remove "hw/hw.h" where unnecessary (Thomas)
----------------------------------------------------------------
Akihiko Odaki (5):
system/physmem: Fix reference to dump-guest-core
hvf: Drop ifdef for macOS versions older than 12.0
audio: Drop ifdef for macOS versions older than 12.0 block/file-posix: Drop ifdef for macOS versions older than 12.0 net/vmnet: Drop ifdef for macOS versions older than 12.0
Daniel P. Berrangé (14):
include/hw: add helpers for defining versioned machine types hw/arm: convert 'virt' machine definitions to use new macros hw/s390x: convert 'ccw' machine definitions to use new macros hw/ppc: convert 'spapr' machine definitions to use new macros hw/m68k: convert 'virt' machine definitions to use new macros hw/i386: convert 'i440fx' machine definitions to use new macros hw/i386: convert 'q35' machine definitions to use new macros include/hw: add macros for deprecation & removal of versioned machines include/hw: temporarily disable deletion of versioned machine types
hw: set deprecation info for all versioned machine types
hw: skip registration of outdated versioned machine types hw/ppc: remove obsolete manual deprecation reason string of spapr
machines
hw/i386: remove obsolete manual deprecation reason string of i440fx
machines
docs: document special exception for machine type deprecation &
removal
Mark Cave-Ayland (1):
hw/ide/macio: switch from using qemu_allocate_irq() to qdev input
GPIOs
Oleg Sviridov (1):
hw/net/spapr: prevent potential NULL dereference
Thomas Huth (1):
Remove inclusion of hw/hw.h from files that don't need it
docs/about/deprecated.rst | 13 ++ include/hw/boards.h | 298 ++++++++++++++++++++++++++++++++++ include/hw/i386/pc.h | 28 ++++ include/hw/misc/macio/macio.h | 7 +- include/hw/misc/xlnx-cfi-if.h | 1 - accel/hvf/hvf-all.c | 3 - block/file-posix.c | 5 - hw/arm/virt.c | 34 ++-- hw/i386/pc_piix.c | 220 +++++++++++-------------- hw/i386/pc_q35.c | 215 ++++++++++-------------- hw/ide/macio.c | 10 +- hw/m68k/virt.c | 57 ++++--- hw/misc/edu.c | 1 - hw/net/spapr_llan.c | 6 + hw/ppc/spapr.c | 100 +++++++----- hw/s390x/s390-virtio-ccw.c | 102 +++++++----- hw/vfio/container.c | 1 - net/vmnet-host.c | 24 +-- net/vmnet-shared.c | 13 -- system/physmem.c | 2 +- target/i386/hvf/hvf.c | 23 +-- audio/coreaudio.m | 5 - net/vmnet-bridged.m | 13 +- net/vmnet-common.m | 3 - 24 files changed, 710 insertions(+), 474 deletions(-)
Signature · 1 line
2.41.0
[PULL 01/22] hw/net/spapr: prevent potential NULL dereference
From: Oleg Sviridov <[email protected]>
Pointer, returned from function 'spapr_vio_find_by_reg', may be NULL and is dereferenced immediately after.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Message-ID: <[email protected]>
--- hw/net/spapr_llan.c | 6 ++++++ 1 file changed, 6 insertions(+)
hw/net/spapr_llan.c +6 -0
@@ -770,6 +770,12 @@ static target_ulong h_change_logical_lan_mac(PowerPCCPU *cpu,SpaprVioVlan *dev =VIO_SPAPR_VLAN_DEVICE (sdev);int i; +if (!dev) { +hcall_dprintf ("H_CHANGE_LOGICAL_LAN_MAC called when " +"no NIC is present\n" ); +return H_PARAMETER ; + } +for (i =0 ; i <ETH_ALEN ; i++) { dev->nicconf.macaddr.a[ETH_ALEN - i -1 ] = macaddr &0xff ; macaddr >>=8 ;
Signature · 1 line
2.41.0
[PULL 06/22] hw/m68k: convert 'virt' machine definitions to use new macros
In reply to Philippe Mathieu-DaudéFrom: Daniel P. Berrangé <[email protected]>
This changes the DEFINE_VIRT_MACHINE macro to use the common helpers for constructing versioned symbol names and strings, bringing greater consistency across targets.
A DEFINE_VIRT_MACHINE_AS_LATEST helper is added so that it is not required to pass 'false' for every single historical machine type.
Message-ID: <[email protected]>
--- hw/m68k/virt.c | 55 ++++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 24 deletions(-)
hw/m68k/virt.c +31 -24
@@ -335,99 +335,106 @@ static void virt_machine_register_types(void) type_init(virt_machine_register_types) -#define DEFINE_VIRT_MACHINE (major, minor, latest) \ - static void virt_##major##_##minor##_class_init(ObjectClass *oc, \ - void *data) \ +#define DEFINE_VIRT_MACHINE_IMPL (latest, ...) \ + static void MACHINE_VER_SYM(class_init, virt, __VA_ARGS__)( \ + ObjectClass *oc, \ + void *data) \ { \ MachineClass *mc = MACHINE_CLASS(oc); \ - virt_machine_##major##_##minor##_options(mc); \ - mc->desc = "QEMU " # major "." # minor " M68K Virtual Machine"; \ + MACHINE_VER_SYM(options, virt, __VA_ARGS__)(mc); \ + mc->desc = "QEMU " MACHINE_VER_STR(__VA_ARGS__) " M68K Virtual Machine"; \ if (latest) { \ mc->alias = "virt"; \ } \ } \ - static const TypeInfo machvirt_##major##_##minor##_info = { \ - .name = MACHINE_TYPE_NAME("virt-" # major "." # minor), \ - .parent = MACHINE_TYPE_NAME("virt"), \ - .class_init = virt_##major##_##minor##_class_init, \ - }; \ - static void machvirt_machine_##major##_##minor##_init(void) \ + static const TypeInfo MACHINE_VER_SYM(info, virt, __VA_ARGS__) = \ { \ - type_register_static(&machvirt_##major##_##minor##_info); \ + .name = MACHINE_VER_TYPE_NAME("virt", __VA_ARGS__), \ + .parent = MACHINE_TYPE_NAME("virt"), \ + .class_init = MACHINE_VER_SYM(class_init, virt, __VA_ARGS__), \ + }; \ + static void MACHINE_VER_SYM(register, virt, __VA_ARGS__)(void) \ + { \ + type_register_static(&MACHINE_VER_SYM(info, virt, __VA_ARGS__)); \ } \ - type_init(machvirt_machine_##major##_##minor##_init); + type_init(MACHINE_VER_SYM(register, virt, __VA_ARGS__)); + +#define DEFINE_VIRT_MACHINE_AS_LATEST (major, minor) \ + DEFINE_VIRT_MACHINE_IMPL(true, major, minor) +#define DEFINE_VIRT_MACHINE (major, minor) \ + DEFINE_VIRT_MACHINE_IMPL(false, major, minor)static void virt_machine_9_1_options (MachineClass *mc) { } -DEFINE_VIRT_MACHINE(9, 1, true) +DEFINE_VIRT_MACHINE_AS_LATEST(9, 1)static void virt_machine_9_0_options (MachineClass *mc) {virt_machine_9_1_options (mc);compat_props_add (mc->compat_props, hw_compat_9_0, hw_compat_9_0_len); } -DEFINE_VIRT_MACHINE(9, 0, false) +DEFINE_VIRT_MACHINE(9, 0)static void virt_machine_8_2_options (MachineClass *mc) {virt_machine_9_0_options (mc);compat_props_add (mc->compat_props, hw_compat_8_2, hw_compat_8_2_len); } -DEFINE_VIRT_MACHINE(8, 2, false) +DEFINE_VIRT_MACHINE(8, 2)static void virt_machine_8_1_options (MachineClass *mc) {virt_machine_8_2_options (mc);compat_props_add (mc->compat_props, hw_compat_8_1, hw_compat_8_1_len); } -DEFINE_VIRT_MACHINE(8, 1, false) +DEFINE_VIRT_MACHINE(8, 1)static void virt_machine_8_0_options (MachineClass *mc) {virt_machine_8_1_options (mc);compat_props_add (mc->compat_props, hw_compat_8_0, hw_compat_8_0_len); } -DEFINE_VIRT_MACHINE(8, 0, false) +DEFINE_VIRT_MACHINE(8, 0)static void virt_machine_7_2_options (MachineClass *mc) {virt_machine_8_0_options (mc);compat_props_add (mc->compat_props, hw_compat_7_2, hw_compat_7_2_len); } -DEFINE_VIRT_MACHINE(7, 2, false) +DEFINE_VIRT_MACHINE(7, 2)static void virt_machine_7_1_options (MachineClass *mc) {virt_machine_7_2_options (mc);compat_props_add (mc->compat_props, hw_compat_7_1, hw_compat_7_1_len); } -DEFINE_VIRT_MACHINE(7, 1, false) +DEFINE_VIRT_MACHINE(7, 1)static void virt_machine_7_0_options (MachineClass *mc) {virt_machine_7_1_options (mc);compat_props_add (mc->compat_props, hw_compat_7_0, hw_compat_7_0_len); } -DEFINE_VIRT_MACHINE(7, 0, false) +DEFINE_VIRT_MACHINE(7, 0)static void virt_machine_6_2_options (MachineClass *mc) {virt_machine_7_0_options (mc);compat_props_add (mc->compat_props, hw_compat_6_2, hw_compat_6_2_len); } -DEFINE_VIRT_MACHINE(6, 2, false) +DEFINE_VIRT_MACHINE(6, 2)static void virt_machine_6_1_options (MachineClass *mc) {virt_machine_6_2_options (mc);compat_props_add (mc->compat_props, hw_compat_6_1, hw_compat_6_1_len); } -DEFINE_VIRT_MACHINE(6, 1, false) +DEFINE_VIRT_MACHINE(6, 1)static void virt_machine_6_0_options (MachineClass *mc) {virt_machine_6_1_options (mc);compat_props_add (mc->compat_props, hw_compat_6_0, hw_compat_6_0_len); } -DEFINE_VIRT_MACHINE (6 ,0 , false) +DEFINE_VIRT_MACHINE (6 ,0 )
Signature · 1 line
2.41.0
[PULL 04/22] hw/s390x: convert 'ccw' machine definitions to use new macros
In reply to Philippe Mathieu-DaudéFrom: Daniel P. Berrangé <[email protected]>
This changes the DEFINE_CCW_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 twice in two different formats in the calls to DEFINE_CCW_MACHINE.
A DEFINE_CCW_MACHINE_AS_LATEST helper is added so that it is not required to pass 'false' for every single historical machine type.
Message-ID: <[email protected]>
--- hw/s390x/s390-virtio-ccw.c | 100 ++++++++++++++++++++----------------- 1 file changed, 55 insertions(+), 45 deletions(-)
hw/s390x/s390-virtio-ccw.c +55 -45
@@ -15,6 +15,7 @@#include "qapi/error.h" #include "exec/ram_addr.h" #include "exec/confidential-guest-support.h" +#include "hw/boards.h" #include "hw/s390x/s390-virtio-hcall.h" #include "hw/s390x/sclp.h" #include "hw/s390x/s390_flic.h"
@@ -817,35 +818,44 @@ static const TypeInfo ccw_machine_info = { }, }; -#define DEFINE_CCW_MACHINE (suffix, verstr, latest) \ - static void ccw_machine_##suffix##_class_init(ObjectClass *oc, \ - void *data) \ +#define DEFINE_CCW_MACHINE_IMPL (latest, ...) \ + static void MACHINE_VER_SYM(class_init, ccw, __VA_ARGS__)( \ + ObjectClass *oc, \ + void *data) \ { \ MachineClass *mc = MACHINE_CLASS(oc); \ - ccw_machine_##suffix##_class_options(mc); \ - mc->desc = "Virtual s390x machine (version " verstr ")"; \ + MACHINE_VER_SYM(class_options, ccw, __VA_ARGS__)(mc); \ + mc->desc = "Virtual s390x machine (version " MACHINE_VER_STR(__VA_ARGS__) ")"; \ if (latest) { \ mc->alias = "s390-ccw-virtio"; \ mc->is_default = true; \ } \ } \ - static void ccw_machine_##suffix##_instance_init(Object *obj) \ + static void MACHINE_VER_SYM(instance_init, ccw, __VA_ARGS__)(Object *obj) \ { \ MachineState *machine = MACHINE(obj); \ - current_mc = S390_CCW_MACHINE_CLASS(MACHINE_GET_CLASS(machine)); \ - ccw_machine_##suffix##_instance_options(machine); \ + current_mc = S390_CCW_MACHINE_CLASS(MACHINE_GET_CLASS(machine)); \ + MACHINE_VER_SYM(instance_options, ccw, __VA_ARGS__)(machine); \ } \ - static const TypeInfo ccw_machine_##suffix##_info = { \ - .name = MACHINE_TYPE_NAME("s390-ccw-virtio-" verstr), \ - .parent = TYPE_S390_CCW_MACHINE, \ - .class_init = ccw_machine_##suffix##_class_init, \ - .instance_init = ccw_machine_##suffix##_instance_init, \ - }; \ - static void ccw_machine_register_##suffix(void) \ + static const TypeInfo MACHINE_VER_SYM(info, ccw, __VA_ARGS__) = \ { \ - type_register_static(&ccw_machine_##suffix##_info); \ + .name = MACHINE_VER_TYPE_NAME("s390-ccw-virtio", __VA_ARGS__), \ + .parent = TYPE_S390_CCW_MACHINE, \ + .class_init = MACHINE_VER_SYM(class_init, ccw, __VA_ARGS__), \ + .instance_init = MACHINE_VER_SYM(instance_init, ccw, __VA_ARGS__), \ + }; \ + static void MACHINE_VER_SYM(register, ccw, __VA_ARGS__)(void) \ + { \ + type_register_static(&MACHINE_VER_SYM(info, ccw, __VA_ARGS__)); \ } \ - type_init(ccw_machine_register_##suffix) + type_init(MACHINE_VER_SYM(register, ccw, __VA_ARGS__)) + +#define DEFINE_CCW_MACHINE_AS_LATEST (major, minor) \ + DEFINE_CCW_MACHINE_IMPL(true, major, minor) + +#define DEFINE_CCW_MACHINE (major, minor) \ + DEFINE_CCW_MACHINE_IMPL(false, major, minor) +static void ccw_machine_9_1_instance_options (MachineState *machine) {
@@ -854,7 +864,7 @@ static void ccw_machine_9_1_instance_options(MachineState *machine)static void ccw_machine_9_1_class_options (MachineClass *mc) { } -DEFINE_CCW_MACHINE(9_1, "9.1", true); +DEFINE_CCW_MACHINE_AS_LATEST (9 ,1 );static void ccw_machine_9_0_instance_options (MachineState *machine) {
@@ -866,7 +876,7 @@ static void ccw_machine_9_0_class_options(MachineClass *mc)ccw_machine_9_1_class_options (mc);compat_props_add (mc->compat_props, hw_compat_9_0, hw_compat_9_0_len); } -DEFINE_CCW_MACHINE(9_0, "9.0", false); +DEFINE_CCW_MACHINE (9 ,0 );static void ccw_machine_8_2_instance_options (MachineState *machine) {
@@ -878,7 +888,7 @@ static void ccw_machine_8_2_class_options(MachineClass *mc)ccw_machine_9_0_class_options (mc);compat_props_add (mc->compat_props, hw_compat_8_2, hw_compat_8_2_len); } -DEFINE_CCW_MACHINE(8_2, "8.2", false); +DEFINE_CCW_MACHINE (8 ,2 );static void ccw_machine_8_1_instance_options (MachineState *machine) {
@@ -892,7 +902,7 @@ static void ccw_machine_8_1_class_options(MachineClass *mc) mc->smp_props.drawers_supported = false; mc->smp_props.books_supported = false; } -DEFINE_CCW_MACHINE(8_1, "8.1", false); +DEFINE_CCW_MACHINE (8 ,1 );static void ccw_machine_8_0_instance_options (MachineState *machine) {
@@ -904,7 +914,7 @@ static void ccw_machine_8_0_class_options(MachineClass *mc)ccw_machine_8_1_class_options (mc);compat_props_add (mc->compat_props, hw_compat_8_0, hw_compat_8_0_len); } -DEFINE_CCW_MACHINE(8_0, "8.0", false); +DEFINE_CCW_MACHINE (8 ,0 );static void ccw_machine_7_2_instance_options (MachineState *machine) {
@@ -916,7 +926,7 @@ static void ccw_machine_7_2_class_options(MachineClass *mc)ccw_machine_8_0_class_options (mc);compat_props_add (mc->compat_props, hw_compat_7_2, hw_compat_7_2_len); } -DEFINE_CCW_MACHINE(7_2, "7.2", false); +DEFINE_CCW_MACHINE (7 ,2 );static void ccw_machine_7_1_instance_options (MachineState *machine) {
@@ -940,7 +950,7 @@ static void ccw_machine_7_1_class_options(MachineClass *mc)compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); s390mc->max_threads =S390_MAX_CPUS ; } -DEFINE_CCW_MACHINE(7_1, "7.1", false); +DEFINE_CCW_MACHINE (7 ,1 );static void ccw_machine_7_0_instance_options (MachineState *machine) {
@@ -955,7 +965,7 @@ static void ccw_machine_7_0_class_options(MachineClass *mc)ccw_machine_7_1_class_options (mc);compat_props_add (mc->compat_props, hw_compat_7_0, hw_compat_7_0_len); } -DEFINE_CCW_MACHINE(7_0, "7.0", false); +DEFINE_CCW_MACHINE (7 ,0 );static void ccw_machine_6_2_instance_options (MachineState *machine) {
@@ -970,7 +980,7 @@ static void ccw_machine_6_2_class_options(MachineClass *mc)ccw_machine_7_0_class_options (mc);compat_props_add (mc->compat_props, hw_compat_6_2, hw_compat_6_2_len); } -DEFINE_CCW_MACHINE(6_2, "6.2", false); +DEFINE_CCW_MACHINE (6 ,2 );static void ccw_machine_6_1_instance_options (MachineState *machine) {
@@ -988,7 +998,7 @@ static void ccw_machine_6_1_class_options(MachineClass *mc)compat_props_add (mc->compat_props, hw_compat_6_1, hw_compat_6_1_len); mc->smp_props.prefer_sockets = true; } -DEFINE_CCW_MACHINE(6_1, "6.1", false); +DEFINE_CCW_MACHINE (6 ,1 );static void ccw_machine_6_0_instance_options (MachineState *machine) {
@@ -1003,7 +1013,7 @@ static void ccw_machine_6_0_class_options(MachineClass *mc)ccw_machine_6_1_class_options (mc);compat_props_add (mc->compat_props, hw_compat_6_0, hw_compat_6_0_len); } -DEFINE_CCW_MACHINE(6_0, "6.0", false); +DEFINE_CCW_MACHINE (6 ,0 );static void ccw_machine_5_2_instance_options (MachineState *machine) {
@@ -1015,7 +1025,7 @@ static void ccw_machine_5_2_class_options(MachineClass *mc)ccw_machine_6_0_class_options (mc);compat_props_add (mc->compat_props, hw_compat_5_2, hw_compat_5_2_len); } -DEFINE_CCW_MACHINE(5_2, "5.2", false); +DEFINE_CCW_MACHINE (5 ,2 );static void ccw_machine_5_1_instance_options (MachineState *machine) {
@@ -1027,7 +1037,7 @@ static void ccw_machine_5_1_class_options(MachineClass *mc)ccw_machine_5_2_class_options (mc);compat_props_add (mc->compat_props, hw_compat_5_1, hw_compat_5_1_len); } -DEFINE_CCW_MACHINE(5_1, "5.1", false); +DEFINE_CCW_MACHINE (5 ,1 );static void ccw_machine_5_0_instance_options (MachineState *machine) {
@@ -1039,7 +1049,7 @@ static void ccw_machine_5_0_class_options(MachineClass *mc)ccw_machine_5_1_class_options (mc);compat_props_add (mc->compat_props, hw_compat_5_0, hw_compat_5_0_len); } -DEFINE_CCW_MACHINE(5_0, "5.0", false); +DEFINE_CCW_MACHINE (5 ,0 );static void ccw_machine_4_2_instance_options (MachineState *machine) {
@@ -1052,7 +1062,7 @@ static void ccw_machine_4_2_class_options(MachineClass *mc) mc->fixup_ram_size = s390_fixup_ram_size;compat_props_add (mc->compat_props, hw_compat_4_2, hw_compat_4_2_len); } -DEFINE_CCW_MACHINE(4_2, "4.2", false); +DEFINE_CCW_MACHINE (4 ,2 );static void ccw_machine_4_1_instance_options (MachineState *machine) {
@@ -1066,7 +1076,7 @@ static void ccw_machine_4_1_class_options(MachineClass *mc)ccw_machine_4_2_class_options (mc);compat_props_add (mc->compat_props, hw_compat_4_1, hw_compat_4_1_len); } -DEFINE_CCW_MACHINE(4_1, "4.1", false); +DEFINE_CCW_MACHINE (4 ,1 );static void ccw_machine_4_0_instance_options (MachineState *machine) {
@@ -1080,7 +1090,7 @@ static void ccw_machine_4_0_class_options(MachineClass *mc)ccw_machine_4_1_class_options (mc);compat_props_add (mc->compat_props, hw_compat_4_0, hw_compat_4_0_len); } -DEFINE_CCW_MACHINE(4_0, "4.0", false); +DEFINE_CCW_MACHINE (4 ,0 );static void ccw_machine_3_1_instance_options (MachineState *machine) {
@@ -1096,7 +1106,7 @@ static void ccw_machine_3_1_class_options(MachineClass *mc)ccw_machine_4_0_class_options (mc);compat_props_add (mc->compat_props, hw_compat_3_1, hw_compat_3_1_len); } -DEFINE_CCW_MACHINE(3_1, "3.1", false); +DEFINE_CCW_MACHINE (3 ,1 );static void ccw_machine_3_0_instance_options (MachineState *machine) {
@@ -1111,7 +1121,7 @@ static void ccw_machine_3_0_class_options(MachineClass *mc)ccw_machine_3_1_class_options (mc);compat_props_add (mc->compat_props, hw_compat_3_0, hw_compat_3_0_len); } -DEFINE_CCW_MACHINE(3_0, "3.0", false); +DEFINE_CCW_MACHINE (3 ,0 );static void ccw_machine_2_12_instance_options (MachineState *machine) {
@@ -1125,7 +1135,7 @@ static void ccw_machine_2_12_class_options(MachineClass *mc)ccw_machine_3_0_class_options (mc);compat_props_add (mc->compat_props, hw_compat_2_12, hw_compat_2_12_len); } -DEFINE_CCW_MACHINE(2_12, "2.12", false); +DEFINE_CCW_MACHINE (2 ,12 );#ifdef CONFIG_S390X_LEGACY_CPUS
@@ -1148,7 +1158,7 @@ static void ccw_machine_2_11_class_options(MachineClass *mc)compat_props_add (mc->compat_props, hw_compat_2_11, hw_compat_2_11_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); } -DEFINE_CCW_MACHINE(2_11, "2.11", false); +DEFINE_CCW_MACHINE (2 ,11 );static void ccw_machine_2_10_instance_options (MachineState *machine) {
@@ -1160,7 +1170,7 @@ static void ccw_machine_2_10_class_options(MachineClass *mc)ccw_machine_2_11_class_options (mc);compat_props_add (mc->compat_props, hw_compat_2_10, hw_compat_2_10_len); } -DEFINE_CCW_MACHINE(2_10, "2.10", false); +DEFINE_CCW_MACHINE (2 ,10 );static void ccw_machine_2_9_instance_options (MachineState *machine) {
@@ -1184,7 +1194,7 @@ static void ccw_machine_2_9_class_options(MachineClass *mc)compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); css_migration_enabled = false; } -DEFINE_CCW_MACHINE(2_9, "2.9", false); +DEFINE_CCW_MACHINE (2 ,9 );static void ccw_machine_2_8_instance_options (MachineState *machine) {
@@ -1201,7 +1211,7 @@ static void ccw_machine_2_8_class_options(MachineClass *mc)compat_props_add (mc->compat_props, hw_compat_2_8, hw_compat_2_8_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); } -DEFINE_CCW_MACHINE(2_8, "2.8", false); +DEFINE_CCW_MACHINE (2 ,8 );static void ccw_machine_2_7_instance_options (MachineState *machine) {
@@ -1216,7 +1226,7 @@ static void ccw_machine_2_7_class_options(MachineClass *mc)ccw_machine_2_8_class_options (mc);compat_props_add (mc->compat_props, hw_compat_2_7, hw_compat_2_7_len); } -DEFINE_CCW_MACHINE(2_7, "2.7", false); +DEFINE_CCW_MACHINE (2 ,7 );static void ccw_machine_2_6_instance_options (MachineState *machine) {
@@ -1236,7 +1246,7 @@ static void ccw_machine_2_6_class_options(MachineClass *mc)compat_props_add (mc->compat_props, hw_compat_2_6, hw_compat_2_6_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); } -DEFINE_CCW_MACHINE(2_6, "2.6", false); +DEFINE_CCW_MACHINE (2 ,6 );static void ccw_machine_2_5_instance_options (MachineState *machine) {
@@ -1248,7 +1258,7 @@ static void ccw_machine_2_5_class_options(MachineClass *mc)ccw_machine_2_6_class_options (mc);compat_props_add (mc->compat_props, hw_compat_2_5, hw_compat_2_5_len); } -DEFINE_CCW_MACHINE(2_5, "2.5", false); +DEFINE_CCW_MACHINE (2 ,5 );static void ccw_machine_2_4_instance_options (MachineState *machine) {
@@ -1273,7 +1283,7 @@ static void ccw_machine_2_4_class_options(MachineClass *mc)compat_props_add (mc->compat_props, hw_compat_2_4, hw_compat_2_4_len); compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); } -DEFINE_CCW_MACHINE(2_4, "2.4", false); +DEFINE_CCW_MACHINE (2 ,4 );#endif
Signature · 1 line
2.41.0
[PULL 03/22] hw/arm: convert 'virt' machine definitions to use new macros
In reply to Philippe Mathieu-DaudéFrom: Daniel P. Berrangé <[email protected]>
This changes the DEFINE_VIRT_MACHINE macro to use the common helpers for constructing versioned symbol names and strings, bringing greater consistency across targets.
Message-ID: <[email protected]>
--- hw/arm/virt.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-)
hw/arm/virt.c +17 -15
@@ -101,33 +101,35 @@ static void arm_virt_compat_set(MachineClass *mc) arm_virt_compat_len); } -#define DEFINE_VIRT_MACHINE_LATEST (major, minor, latest) \ - static void virt_##major##_##minor##_class_init(ObjectClass *oc, \ - void *data) \ +#define DEFINE_VIRT_MACHINE_IMPL (latest, ...) \ + static void MACHINE_VER_SYM(class_init, virt, __VA_ARGS__)( \ + ObjectClass *oc, \ + void *data) \ { \ MachineClass *mc = MACHINE_CLASS(oc); \ arm_virt_compat_set(mc); \ - virt_machine_##major##_##minor##_options(mc); \ - mc->desc = "QEMU " # major "." # minor " ARM Virtual Machine"; \ + MACHINE_VER_SYM(options, virt, __VA_ARGS__)(mc); \ + mc->desc = "QEMU " MACHINE_VER_STR(__VA_ARGS__) " ARM Virtual Machine"; \ if (latest) { \ mc->alias = "virt"; \ } \ } \ - static const TypeInfo machvirt_##major##_##minor##_info = { \ - .name = MACHINE_TYPE_NAME("virt-" # major "." # minor), \ - .parent = TYPE_VIRT_MACHINE, \ - .class_init = virt_##major##_##minor##_class_init, \ - }; \ - static void machvirt_machine_##major##_##minor##_init(void) \ + static const TypeInfo MACHINE_VER_SYM(info, virt, __VA_ARGS__) = \ { \ - type_register_static(&machvirt_##major##_##minor##_info); \ + .name = MACHINE_VER_TYPE_NAME("virt", __VA_ARGS__), \ + .parent = TYPE_VIRT_MACHINE, \ + .class_init = MACHINE_VER_SYM(class_init, virt, __VA_ARGS__), \ + }; \ + static void MACHINE_VER_SYM(register, virt, __VA_ARGS__)(void) \ + { \ + type_register_static(&MACHINE_VER_SYM(info, virt, __VA_ARGS__)); \ } \ - type_init(machvirt_machine_##major##_##minor##_init); + type_init(MACHINE_VER_SYM(register, virt, __VA_ARGS__));#define DEFINE_VIRT_MACHINE_AS_LATEST (major, minor) \ - DEFINE_VIRT_MACHINE_LATEST(major, minor, true) + DEFINE_VIRT_MACHINE_IMPL(true, major, minor)#define DEFINE_VIRT_MACHINE (major, minor) \ - DEFINE_VIRT_MACHINE_LATEST(major, minor, false) + DEFINE_VIRT_MACHINE_IMPL(false, major, minor)/* Number of external interrupt lines to configure the GIC with */
Signature · 1 line
2.41.0
[PULL 10/22] include/hw: temporarily disable deletion of versioned machine types
In reply to Philippe Mathieu-DaudéFrom: Daniel P. Berrangé <[email protected]>
The new deprecation and deletion policy for versioned machine types is being introduced in QEMU 9.1.0.
Under the new policy a number of old machine types (any prior to 2.12) would be liable for immediate deletion which would be a violation of our historical deprecation and removal policy
Thus automatic deletions (by skipping QOM registration) are temporarily gated on existance of the env variable "QEMU_DELETE_MACHINES" / QEMU version number >= 10.1.0. This allows opt-in testing of the automatic deletion logic, while activating it fully in QEMU >= 10.1.0.
This whole commit should be reverted in the 10.1.0 dev cycle or shortly thereafter.
Message-ID: <[email protected]>
--- include/hw/boards.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
include/hw/boards.h +18 -1
@@ -686,11 +686,28 @@ struct MachineState {* suitable period of time has passed, it will cause * execution of the method to return, avoiding registration * of the machine +* +* The new deprecation and deletion policy for versioned +* machine types was introduced in QEMU 9.1.0. +* +* Under the new policy a number of old machine types (any +* prior to 2.12) would be liable for immediate deletion +* which would be a violation of our historical deprecation +* and removal policy +* +* Thus deletions are temporarily gated on existance of +* the env variable "QEMU_DELETE_MACHINES" / QEMU version +* number >= 10.1.0. This gate can be deleted in the 10.1.0 +* dev cycle */ #define MACHINE_VER_DELETION (...) \ do { \ if (MACHINE_VER_SHOULD_DELETE(__VA_ARGS__)) { \ - return; \ + if (getenv("QEMU_DELETE_MACHINES") || \ + QEMU_VERSION_MAJOR > 10 || (QEMU_VERSION_MAJOR == 10 && \ + QEMU_VERSION_MINOR >= 1)) { \ + return; \ + } \ } \ } while (0)
Signature · 1 line
2.41.0
[PULL 09/22] include/hw: add macros for deprecation & removal of versioned machines
In reply to Philippe Mathieu-DaudéFrom: Daniel P. Berrangé <[email protected]>
Versioned machines live for a long time to provide back compat for incoming migration and restore of saved images. To guide users away from usage of old machines, however, we want to deprecate any older than 3 years (equiv of 9 releases), and delete any older than 6 years (equiva of 18 releases).
To get a standardized deprecation message and avoid having to remember to manually add it after three years, this introduces two macros to be used by targets when defining versioned machines.
* MACHINE_VER_DEPRECATION(major, minor)
Automates the task of setting the 'deprecation_reason' field on the machine, if-and-only-if the major/minor version is older than 3 years.
* MACHINE_VER_DELETION(major, minor)
Simulates the deletion of by skipping registration of the QOM type for a versioned machine, if-and-only-if the major/minor version is older than 6 years.
By using these two macros there is no longer any manual work required per-release to deprecate old machines. By preventing the use of machines that have reached their deletion date, it is also not necessary to manually delete machines per-release. Deletion can be batched up once a year or whenever makes most sense.
Message-ID: <[email protected]>
--- include/hw/boards.h | 96 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+)
include/hw/boards.h +96 -0
@@ -429,6 +429,7 @@ struct MachineState {* MachineClass *mc = MACHINE_CLASS(oc); \ * MACHINE_VER_SYM(options, virt, __VA_ARGS__)(mc); \ * mc->desc = "QEMU " MACHINE_VER_STR(__VA_ARGS__) " Virtual Machine"; \ +* MACHINE_VER_DEPRECATION(__VA_ARGS__); \ * if (latest) { \ * mc->alias = "virt"; \ * } \
@@ -440,6 +441,7 @@ struct MachineState {* }; \ * static void MACHINE_VER_SYM(register, virt, __VA_ARGS__)(void) \ * { \ +* MACHINE_VER_DELETION(__VA_ARGS__); \ * type_register_static(&MACHINE_VER_SYM(info, virt, __VA_ARGS__)); \ * } \ * type_init(MACHINE_VER_SYM(register, virt, __VA_ARGS__));
@@ -598,6 +600,100 @@ struct MachineState { _MACHINE_VER_SYM2) (sym, prefix, __VA_ARGS__) +/* +* How many years/major releases for each phase +* of the life cycle. Assumes use of versioning +* scheme where major is bumped each year + */ +#define MACHINE_VER_DELETION_MAJOR 6 +#define MACHINE_VER_DEPRECATION_MAJOR 3 + +/* +* Expands to a static string containing a deprecation +* message for a versioned machine type +*/ +#define MACHINE_VER_DEPRECATION_MSG \ + "machines more than " stringify(MACHINE_VER_DEPRECATION_MAJOR) \ + " years old are subject to deletion after " \ + stringify(MACHINE_VER_DELETION_MAJOR) " years" + +#define _MACHINE_VER_IS_EXPIRED_IMPL (cutoff, major, minor) \ + (((QEMU_VERSION_MAJOR - major) > cutoff) || \ + (((QEMU_VERSION_MAJOR - major) == cutoff) && \ + (QEMU_VERSION_MINOR - minor) >= 0)) + +#define _MACHINE_VER_IS_EXPIRED2 (cutoff, major, minor) \ + _MACHINE_VER_IS_EXPIRED_IMPL(cutoff, major, minor) +#define _MACHINE_VER_IS_EXPIRED3 (cutoff, major, minor, micro) \ + _MACHINE_VER_IS_EXPIRED_IMPL(cutoff, major, minor) +#define _MACHINE_VER_IS_EXPIRED4 (cutoff, major, minor, _unused, tag) \ + _MACHINE_VER_IS_EXPIRED_IMPL(cutoff, major, minor) +#define _MACHINE_VER_IS_EXPIRED5 (cutoff, major, minor, micro, _unused, tag) \ + _MACHINE_VER_IS_EXPIRED_IMPL(cutoff, major, minor) + +#define _MACHINE_IS_EXPIRED (cutoff, ...) \ + _MACHINE_VER_PICK(__VA_ARGS__, \ + _MACHINE_VER_IS_EXPIRED5, \ + _MACHINE_VER_IS_EXPIRED4, \ + _MACHINE_VER_IS_EXPIRED3, \ + _MACHINE_VER_IS_EXPIRED2) (cutoff, __VA_ARGS__) + +/* +* Evaluates true when a machine type with (major, minor) +* or (major, minor, micro) version should be considered +* deprecated based on the current versioned machine type +* lifecycle rules +*/ +#define MACHINE_VER_IS_DEPRECATED (...) \ + _MACHINE_IS_EXPIRED(MACHINE_VER_DEPRECATION_MAJOR, __VA_ARGS__) + +/* +* Evaluates true when a machine type with (major, minor) +* or (major, minor, micro) version should be considered +* for deletion based on the current versioned machine type +* lifecycle rules +*/ +#define MACHINE_VER_SHOULD_DELETE (...) \ + _MACHINE_IS_EXPIRED(MACHINE_VER_DELETION_MAJOR, __VA_ARGS__) + +/* +* Sets the deprecation reason for a versioned machine based +* on its age +* +* This must be unconditionally used in the _class_init +* function for all machine types which support versioning. +* +* Initially it will effectively be a no-op, but after a +* suitable period of time has passed, it will set the +* 'deprecation_reason' field on the machine, to warn users +* about forthcoming removal. +*/ +#define MACHINE_VER_DEPRECATION (...) \ + do { \ + if (MACHINE_VER_IS_DEPRECATED(__VA_ARGS__)) { \ + mc->deprecation_reason = MACHINE_VER_DEPRECATION_MSG; \ + } \ + } while (0) + +/* +* Prevents registration of a versioned machined based on +* its age +* +* This must be unconditionally used in the register +* method for all machine types which support versioning. +* +* Inijtially it will effectively be a no-op, but after a +* suitable period of time has passed, it will cause +* execution of the method to return, avoiding registration +* of the machine +*/ +#define MACHINE_VER_DELETION (...) \ + do { \ + if (MACHINE_VER_SHOULD_DELETE(__VA_ARGS__)) { \ + return; \ + } \ + } while (0) +#define DEFINE_MACHINE (namestr, machine_initfn) \ static void machine_initfn##_class_init(ObjectClass *oc, void *data) \ { \
Signature · 1 line
2.41.0
[PULL 08/22] hw/i386: convert 'q35' machine definitions to use new macros
In reply to Philippe Mathieu-DaudéFrom: Daniel P. Berrangé <[email protected]>
This changes the DEFINE_Q35_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_Q35_MACHINE.
Due to the odd-ball '4.0.1' machine type version, this commit introduces a DEFINE_Q35_BUGFIX helper, to allow defining of "bugfix" machine types which have a three digit version.
Message-ID: <[email protected]>
--- hw/i386/pc_q35.c | 215 ++++++++++++++++++++--------------------------- 1 file changed, 90 insertions(+), 125 deletions(-)
hw/i386/pc_q35.c +90 -125
@@ -331,17 +331,11 @@ static void pc_q35_init(MachineState *machine) } } -#define DEFINE_Q35_MACHINE (suffix, name, compatfn, optionfn) \ - static void pc_init_##suffix(MachineState *machine) \ - { \ - void (*compat)(MachineState *m) = (compatfn); \ - if (compat) { \ - compat(machine); \ - } \ - pc_q35_init(machine); \ - } \ - DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn) +#define DEFINE_Q35_MACHINE (major, minor) \ + DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, major, minor); +#define DEFINE_Q35_MACHINE_BUGFIX (major, minor, micro) \ + DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, major, minor, micro);static void pc_q35_machine_options (MachineClass *m) {
@@ -367,32 +361,30 @@ static void pc_q35_machine_options(MachineClass *m) pc_q35_compat_defaults, pc_q35_compat_defaults_len); } -static void pc_q35_9_1_machine_options (MachineClass *m) +static void pc_q35_machine_9_1_options (MachineClass *m) {pc_q35_machine_options (m); m->alias ="q35" ; } -DEFINE_Q35_MACHINE (v9_1,"pc-q35-9.1" ,NULL , - pc_q35_9_1_machine_options); +DEFINE_Q35_MACHINE (9 ,1 ); -static void pc_q35_9_0_machine_options (MachineClass *m) +static void pc_q35_machine_9_0_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -pc_q35_9_1_machine_options (m); +pc_q35_machine_9_1_options (m); m->alias =NULL ;compat_props_add (m->compat_props, hw_compat_9_0, hw_compat_9_0_len);compat_props_add (m->compat_props, pc_compat_9_0, pc_compat_9_0_len); pcmc->isa_bios_alias = false; } -DEFINE_Q35_MACHINE (v9_0,"pc-q35-9.0" ,NULL , - pc_q35_9_0_machine_options); +DEFINE_Q35_MACHINE (9 ,0 ); -static void pc_q35_8_2_machine_options (MachineClass *m) +static void pc_q35_machine_8_2_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -pc_q35_9_0_machine_options (m); +pc_q35_machine_9_0_options (m); m->max_cpus =1024 ;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);
@@ -400,26 +392,24 @@ static void pc_q35_8_2_machine_options(MachineClass *m) pcmc->default_smbios_ep_type =SMBIOS_ENTRY_POINT_TYPE_64 ; } -DEFINE_Q35_MACHINE (v8_2,"pc-q35-8.2" ,NULL , - pc_q35_8_2_machine_options); +DEFINE_Q35_MACHINE (8 ,2 ); -static void pc_q35_8_1_machine_options (MachineClass *m) +static void pc_q35_machine_8_1_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -pc_q35_8_2_machine_options (m); +pc_q35_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_Q35_MACHINE (v8_1,"pc-q35-8.1" ,NULL , - pc_q35_8_1_machine_options); +DEFINE_Q35_MACHINE (8 ,1 ); -static void pc_q35_8_0_machine_options (MachineClass *m) +static void pc_q35_machine_8_0_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -pc_q35_8_1_machine_options (m); +pc_q35_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);
@@ -428,132 +418,120 @@ static void pc_q35_8_0_machine_options(MachineClass *m) m->max_cpus =288 ; } -DEFINE_Q35_MACHINE (v8_0,"pc-q35-8.0" ,NULL , - pc_q35_8_0_machine_options); +DEFINE_Q35_MACHINE (8 ,0 ); -static void pc_q35_7_2_machine_options (MachineClass *m) +static void pc_q35_machine_7_2_options (MachineClass *m) { -pc_q35_8_0_machine_options (m); +pc_q35_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_Q35_MACHINE (v7_2,"pc-q35-7.2" ,NULL , - pc_q35_7_2_machine_options); +DEFINE_Q35_MACHINE (7 ,2 ); -static void pc_q35_7_1_machine_options (MachineClass *m) +static void pc_q35_machine_7_1_options (MachineClass *m) { -pc_q35_7_2_machine_options (m); +pc_q35_machine_7_2_options (m);compat_props_add (m->compat_props, hw_compat_7_1, hw_compat_7_1_len);compat_props_add (m->compat_props, pc_compat_7_1, pc_compat_7_1_len); } -DEFINE_Q35_MACHINE (v7_1,"pc-q35-7.1" ,NULL , - pc_q35_7_1_machine_options); +DEFINE_Q35_MACHINE (7 ,1 ); -static void pc_q35_7_0_machine_options (MachineClass *m) +static void pc_q35_machine_7_0_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -pc_q35_7_1_machine_options (m); +pc_q35_machine_7_1_options (m); pcmc->enforce_amd_1tb_hole = false;compat_props_add (m->compat_props, hw_compat_7_0, hw_compat_7_0_len);compat_props_add (m->compat_props, pc_compat_7_0, pc_compat_7_0_len); } -DEFINE_Q35_MACHINE (v7_0,"pc-q35-7.0" ,NULL , - pc_q35_7_0_machine_options); +DEFINE_Q35_MACHINE (7 ,0 ); -static void pc_q35_6_2_machine_options (MachineClass *m) +static void pc_q35_machine_6_2_options (MachineClass *m) { -pc_q35_7_0_machine_options (m); +pc_q35_machine_7_0_options (m);compat_props_add (m->compat_props, hw_compat_6_2, hw_compat_6_2_len);compat_props_add (m->compat_props, pc_compat_6_2, pc_compat_6_2_len); } -DEFINE_Q35_MACHINE (v6_2,"pc-q35-6.2" ,NULL , - pc_q35_6_2_machine_options); +DEFINE_Q35_MACHINE (6 ,2 ); -static void pc_q35_6_1_machine_options (MachineClass *m) +static void pc_q35_machine_6_1_options (MachineClass *m) { -pc_q35_6_2_machine_options (m); +pc_q35_machine_6_2_options (m);compat_props_add (m->compat_props, hw_compat_6_1, hw_compat_6_1_len);compat_props_add (m->compat_props, pc_compat_6_1, pc_compat_6_1_len); m->smp_props.prefer_sockets = true; } -DEFINE_Q35_MACHINE (v6_1,"pc-q35-6.1" ,NULL , - pc_q35_6_1_machine_options); +DEFINE_Q35_MACHINE (6 ,1 ); -static void pc_q35_6_0_machine_options (MachineClass *m) +static void pc_q35_machine_6_0_options (MachineClass *m) { -pc_q35_6_1_machine_options (m); +pc_q35_machine_6_1_options (m);compat_props_add (m->compat_props, hw_compat_6_0, hw_compat_6_0_len);compat_props_add (m->compat_props, pc_compat_6_0, pc_compat_6_0_len); } -DEFINE_Q35_MACHINE (v6_0,"pc-q35-6.0" ,NULL , - pc_q35_6_0_machine_options); +DEFINE_Q35_MACHINE (6 ,0 ); -static void pc_q35_5_2_machine_options (MachineClass *m) +static void pc_q35_machine_5_2_options (MachineClass *m) { -pc_q35_6_0_machine_options (m); +pc_q35_machine_6_0_options (m);compat_props_add (m->compat_props, hw_compat_5_2, hw_compat_5_2_len);compat_props_add (m->compat_props, pc_compat_5_2, pc_compat_5_2_len); } -DEFINE_Q35_MACHINE (v5_2,"pc-q35-5.2" ,NULL , - pc_q35_5_2_machine_options); +DEFINE_Q35_MACHINE (5 ,2 ); -static void pc_q35_5_1_machine_options (MachineClass *m) +static void pc_q35_machine_5_1_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -pc_q35_5_2_machine_options (m); +pc_q35_machine_5_2_options (m);compat_props_add (m->compat_props, hw_compat_5_1, hw_compat_5_1_len);compat_props_add (m->compat_props, pc_compat_5_1, pc_compat_5_1_len); pcmc->kvmclock_create_always = false; pcmc->pci_root_uid =1 ; } -DEFINE_Q35_MACHINE (v5_1,"pc-q35-5.1" ,NULL , - pc_q35_5_1_machine_options); +DEFINE_Q35_MACHINE (5 ,1 ); -static void pc_q35_5_0_machine_options (MachineClass *m) +static void pc_q35_machine_5_0_options (MachineClass *m) { -pc_q35_5_1_machine_options (m); +pc_q35_machine_5_1_options (m); m->numa_mem_supported = true;compat_props_add (m->compat_props, hw_compat_5_0, hw_compat_5_0_len);compat_props_add (m->compat_props, pc_compat_5_0, pc_compat_5_0_len); m->auto_enable_numa_with_memdev = false; } -DEFINE_Q35_MACHINE (v5_0,"pc-q35-5.0" ,NULL , - pc_q35_5_0_machine_options); +DEFINE_Q35_MACHINE (5 ,0 ); -static void pc_q35_4_2_machine_options (MachineClass *m) +static void pc_q35_machine_4_2_options (MachineClass *m) { -pc_q35_5_0_machine_options (m); +pc_q35_machine_5_0_options (m);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); } -DEFINE_Q35_MACHINE (v4_2,"pc-q35-4.2" ,NULL , - pc_q35_4_2_machine_options); +DEFINE_Q35_MACHINE (4 ,2 ); -static void pc_q35_4_1_machine_options (MachineClass *m) +static void pc_q35_machine_4_1_options (MachineClass *m) { -pc_q35_4_2_machine_options (m); +pc_q35_machine_4_2_options (m);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); } -DEFINE_Q35_MACHINE (v4_1,"pc-q35-4.1" ,NULL , - pc_q35_4_1_machine_options); +DEFINE_Q35_MACHINE (4 ,1 ); -static void pc_q35_4_0_1_machine_options (MachineClass *m) +static void pc_q35_machine_4_0_1_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -pc_q35_4_1_machine_options (m); +pc_q35_machine_4_1_options (m); pcmc->default_cpu_version =CPU_VERSION_LEGACY ;/* * This is the default machine for the 4.0-stable branch. It is basically
@@ -564,24 +542,22 @@ static void pc_q35_4_0_1_machine_options(MachineClass *m)compat_props_add (m->compat_props, pc_compat_4_0, pc_compat_4_0_len); } -DEFINE_Q35_MACHINE (v4_0_1,"pc-q35-4.0.1" ,NULL , - pc_q35_4_0_1_machine_options); +DEFINE_Q35_MACHINE_BUGFIX (4 ,0 ,1 ); -static void pc_q35_4_0_machine_options (MachineClass *m) +static void pc_q35_machine_4_0_options (MachineClass *m) { -pc_q35_4_0_1_machine_options (m); +pc_q35_machine_4_0_1_options (m); m->default_kernel_irqchip_split = true;/* Compat props are applied by the 4.0.1 machine */ } -DEFINE_Q35_MACHINE (v4_0,"pc-q35-4.0" ,NULL , - pc_q35_4_0_machine_options); +DEFINE_Q35_MACHINE (4 ,0 ); -static void pc_q35_3_1_machine_options (MachineClass *m) +static void pc_q35_machine_3_1_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -pc_q35_4_0_machine_options (m); +pc_q35_machine_4_0_options (m); m->default_kernel_irqchip_split = false; m->smbus_no_migration_support = true; pcmc->pvh_enabled = false;
@@ -589,121 +565,110 @@ static void pc_q35_3_1_machine_options(MachineClass *m)compat_props_add (m->compat_props, pc_compat_3_1, pc_compat_3_1_len); } -DEFINE_Q35_MACHINE (v3_1,"pc-q35-3.1" ,NULL , - pc_q35_3_1_machine_options); +DEFINE_Q35_MACHINE (3 ,1 ); -static void pc_q35_3_0_machine_options (MachineClass *m) +static void pc_q35_machine_3_0_options (MachineClass *m) { -pc_q35_3_1_machine_options (m); +pc_q35_machine_3_1_options (m);compat_props_add (m->compat_props, hw_compat_3_0, hw_compat_3_0_len);compat_props_add (m->compat_props, pc_compat_3_0, pc_compat_3_0_len); } -DEFINE_Q35_MACHINE (v3_0,"pc-q35-3.0" ,NULL , - pc_q35_3_0_machine_options); +DEFINE_Q35_MACHINE (3 ,0 ); -static void pc_q35_2_12_machine_options (MachineClass *m) +static void pc_q35_machine_2_12_options (MachineClass *m) { -pc_q35_3_0_machine_options (m); +pc_q35_machine_3_0_options (m);compat_props_add (m->compat_props, hw_compat_2_12, hw_compat_2_12_len);compat_props_add (m->compat_props, pc_compat_2_12, pc_compat_2_12_len); } -DEFINE_Q35_MACHINE (v2_12,"pc-q35-2.12" ,NULL , - pc_q35_2_12_machine_options); +DEFINE_Q35_MACHINE (2 ,12 ); -static void pc_q35_2_11_machine_options (MachineClass *m) +static void pc_q35_machine_2_11_options (MachineClass *m) { -pc_q35_2_12_machine_options (m); +pc_q35_machine_2_12_options (m); m->default_nic ="e1000" ;compat_props_add (m->compat_props, hw_compat_2_11, hw_compat_2_11_len);compat_props_add (m->compat_props, pc_compat_2_11, pc_compat_2_11_len); } -DEFINE_Q35_MACHINE (v2_11,"pc-q35-2.11" ,NULL , - pc_q35_2_11_machine_options); +DEFINE_Q35_MACHINE (2 ,11 ); -static void pc_q35_2_10_machine_options (MachineClass *m) +static void pc_q35_machine_2_10_options (MachineClass *m) { -pc_q35_2_11_machine_options (m); +pc_q35_machine_2_11_options (m);compat_props_add (m->compat_props, hw_compat_2_10, hw_compat_2_10_len);compat_props_add (m->compat_props, pc_compat_2_10, pc_compat_2_10_len); m->auto_enable_numa_with_memhp = false; } -DEFINE_Q35_MACHINE (v2_10,"pc-q35-2.10" ,NULL , - pc_q35_2_10_machine_options); +DEFINE_Q35_MACHINE (2 ,10 ); -static void pc_q35_2_9_machine_options (MachineClass *m) +static void pc_q35_machine_2_9_options (MachineClass *m) { -pc_q35_2_10_machine_options (m); +pc_q35_machine_2_10_options (m);compat_props_add (m->compat_props, hw_compat_2_9, hw_compat_2_9_len);compat_props_add (m->compat_props, pc_compat_2_9, pc_compat_2_9_len); } -DEFINE_Q35_MACHINE (v2_9,"pc-q35-2.9" ,NULL , - pc_q35_2_9_machine_options); +DEFINE_Q35_MACHINE (2 ,9 ); -static void pc_q35_2_8_machine_options (MachineClass *m) +static void pc_q35_machine_2_8_options (MachineClass *m) { -pc_q35_2_9_machine_options (m); +pc_q35_machine_2_9_options (m);compat_props_add (m->compat_props, hw_compat_2_8, hw_compat_2_8_len);compat_props_add (m->compat_props, pc_compat_2_8, pc_compat_2_8_len); } -DEFINE_Q35_MACHINE (v2_8,"pc-q35-2.8" ,NULL , - pc_q35_2_8_machine_options); +DEFINE_Q35_MACHINE (2 ,8 ); -static void pc_q35_2_7_machine_options (MachineClass *m) +static void pc_q35_machine_2_7_options (MachineClass *m) { -pc_q35_2_8_machine_options (m); +pc_q35_machine_2_8_options (m); m->max_cpus =255 ;compat_props_add (m->compat_props, hw_compat_2_7, hw_compat_2_7_len);compat_props_add (m->compat_props, pc_compat_2_7, pc_compat_2_7_len); } -DEFINE_Q35_MACHINE (v2_7,"pc-q35-2.7" ,NULL , - pc_q35_2_7_machine_options); +DEFINE_Q35_MACHINE (2 ,7 ); -static void pc_q35_2_6_machine_options (MachineClass *m) +static void pc_q35_machine_2_6_options (MachineClass *m) {X86MachineClass *x86mc =X86_MACHINE_CLASS (m);PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -pc_q35_2_7_machine_options (m); +pc_q35_machine_2_7_options (m); pcmc->legacy_cpu_hotplug = true; x86mc->fwcfg_dma_enabled = false;compat_props_add (m->compat_props, hw_compat_2_6, hw_compat_2_6_len);compat_props_add (m->compat_props, pc_compat_2_6, pc_compat_2_6_len); } -DEFINE_Q35_MACHINE (v2_6,"pc-q35-2.6" ,NULL , - pc_q35_2_6_machine_options); +DEFINE_Q35_MACHINE (2 ,6 ); -static void pc_q35_2_5_machine_options (MachineClass *m) +static void pc_q35_machine_2_5_options (MachineClass *m) {X86MachineClass *x86mc =X86_MACHINE_CLASS (m); -pc_q35_2_6_machine_options (m); +pc_q35_machine_2_6_options (m); x86mc->save_tsc_khz = false; m->legacy_fw_cfg_order =1 ;compat_props_add (m->compat_props, hw_compat_2_5, hw_compat_2_5_len);compat_props_add (m->compat_props, pc_compat_2_5, pc_compat_2_5_len); } -DEFINE_Q35_MACHINE (v2_5,"pc-q35-2.5" ,NULL , - pc_q35_2_5_machine_options); +DEFINE_Q35_MACHINE (2 ,5 ); -static void pc_q35_2_4_machine_options (MachineClass *m) +static void pc_q35_machine_2_4_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m); -pc_q35_2_5_machine_options (m); +pc_q35_machine_2_5_options (m); m->hw_version ="2.4.0" ; pcmc->broken_reserved_end = true;compat_props_add (m->compat_props, hw_compat_2_4, hw_compat_2_4_len);compat_props_add (m->compat_props, pc_compat_2_4, pc_compat_2_4_len); } -DEFINE_Q35_MACHINE (v2_4,"pc-q35-2.4" ,NULL , - pc_q35_2_4_machine_options); +DEFINE_Q35_MACHINE (2 ,4 );
Signature · 1 line
2.41.0
[PULL 11/22] hw: set deprecation info for all versioned machine types
In reply to Philippe Mathieu-DaudéFrom: Daniel P. Berrangé <[email protected]>
This calls the MACHINE_VER_DEPRECATION() macro in the definition of all machine type classes which support versioning. This ensures that they will automatically get deprecation info set when they reach the appropriate point in their lifecycle.
Message-ID: <[email protected]>
--- include/hw/i386/pc.h | 1 + hw/arm/virt.c | 1 + hw/m68k/virt.c | 1 + hw/ppc/spapr.c | 1 + hw/s390x/s390-virtio-ccw.c | 1 + 5 files changed, 5 insertions(+)
include/hw/i386/pc.h +1 -0
@@ -330,6 +330,7 @@ extern const size_t pc_compat_2_3_len;MachineClass *mc =MACHINE_CLASS (oc); \MACHINE_VER_SYM (options, namesym, __VA_ARGS__)(mc); \ mc->init =MACHINE_VER_SYM (init, namesym, __VA_ARGS__); \ +MACHINE_VER_DEPRECATION (__VA_ARGS__); \ } \static const TypeInfo MACHINE_VER_SYM (info ,namesym ,__VA_ARGS__ ) = \ { \
hw/arm/virt.c +1 -0
@@ -110,6 +110,7 @@ static void arm_virt_compat_set(MachineClass *mc)arm_virt_compat_set (mc); \MACHINE_VER_SYM (options, virt, __VA_ARGS__)(mc); \ mc->desc = "QEMU " MACHINE_VER_STR(__VA_ARGS__) " ARM Virtual Machine"; \ +MACHINE_VER_DEPRECATION (__VA_ARGS__); \if (latest) { \ mc->alias ="virt" ; \ } \
hw/m68k/virt.c +1 -0
@@ -343,6 +343,7 @@ type_init(virt_machine_register_types)MachineClass *mc =MACHINE_CLASS (oc); \MACHINE_VER_SYM (options, virt, __VA_ARGS__)(mc); \ mc->desc = "QEMU " MACHINE_VER_STR(__VA_ARGS__) " M68K Virtual Machine"; \ +MACHINE_VER_DEPRECATION (__VA_ARGS__); \if (latest) { \ mc->alias ="virt" ; \ } \
hw/ppc/spapr.c +1 -0
@@ -4811,6 +4811,7 @@ static void spapr_machine_latest_class_options(MachineClass *mc) { \MachineClass *mc =MACHINE_CLASS (oc); \MACHINE_VER_SYM (class_options, spapr, __VA_ARGS__)(mc); \ +MACHINE_VER_DEPRECATION (__VA_ARGS__); \if (latest) { \spapr_machine_latest_class_options (mc); \ } \
hw/s390x/s390-virtio-ccw.c +1 -0
@@ -826,6 +826,7 @@ static const TypeInfo ccw_machine_info = {MachineClass *mc =MACHINE_CLASS (oc); \MACHINE_VER_SYM (class_options, ccw, __VA_ARGS__)(mc); \ mc->desc = "Virtual s390x machine (version " MACHINE_VER_STR(__VA_ARGS__) ")"; \ +MACHINE_VER_DEPRECATION (__VA_ARGS__); \if (latest) { \ mc->alias ="s390-ccw-virtio" ; \ mc->is_default = true; \
Signature · 1 line
2.41.0
[PULL 07/22] hw/i386: convert 'i440fx' machine definitions to use new macros
In reply to Philippe Mathieu-DaudéFrom: Daniel P. Berrangé <[email protected]>
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.
Message-ID: <[email protected]>
--- include/hw/i386/pc.h | 26 +++++ hw/i386/pc_piix.c | 219 +++++++++++++++++++------------------------ 2 files changed, 122 insertions(+), 123 deletions(-)
include/hw/i386/pc.h +26 -0
@@ -317,4 +317,30 @@ extern const size_t pc_compat_2_3_len; } \ type_init(pc_machine_init_##suffix) +#define DEFINE_PC_VER_MACHINE (namesym, namestr, initfn, ...) \ + static void MACHINE_VER_SYM(init, namesym, __VA_ARGS__)( \ + MachineState *machine) \ + { \ + initfn(machine); \ + } \ + static void MACHINE_VER_SYM(class_init, namesym, __VA_ARGS__)( \ + ObjectClass *oc, \ + void *data) \ + { \ + MachineClass *mc = MACHINE_CLASS(oc); \ + MACHINE_VER_SYM(options, namesym, __VA_ARGS__)(mc); \ + mc->init = MACHINE_VER_SYM(init, namesym, __VA_ARGS__); \ + } \ + static const TypeInfo MACHINE_VER_SYM(info, namesym, __VA_ARGS__) = \ + { \ + .name = MACHINE_VER_TYPE_NAME(namestr, __VA_ARGS__), \ + .parent = TYPE_PC_MACHINE, \ + .class_init = MACHINE_VER_SYM(class_init, namesym, __VA_ARGS__), \ + }; \ + static void MACHINE_VER_SYM(register, namesym, __VA_ARGS__)(void) \ + { \ + type_register(&MACHINE_VER_SYM(info, namesym, __VA_ARGS__)); \ + } \ + type_init(MACHINE_VER_SYM(register, namesym, __VA_ARGS__)); +#endif
hw/i386/pc_piix.c +96 -123
464 lines not on this page · raw message
Signature · 1 line
2.41.0
[PULL 13/22] hw/ppc: remove obsolete manual deprecation reason string of spapr machines
In reply to Philippe Mathieu-DaudéFrom: Daniel P. Berrangé <[email protected]>
The automatic deprecation mechanism introduced in the preceeding patches will mark every spapr machine upto and including 2.12 as deprecated. As such we can revert the manually added deprecation which was a subset:
commit 1392617d35765d5d912625fbb5cab1ffbed8e140
Author: Cédric Le Goater <[email protected]>
Date: Tue Jan 23 16:37:02 2024 +1000
spapr: Tag pseries-2.1 - 2.11 machines as deprecated
Message-ID: <[email protected]>
--- hw/ppc/spapr.c | 1 - 1 file changed, 1 deletion(-)
hw/ppc/spapr.c +0 -1
@@ -5156,7 +5156,6 @@ static void spapr_machine_2_11_class_options(MachineClass *mc)spapr_machine_2_12_class_options (mc); smc->default_caps.caps[SPAPR_CAP_HTM ] =SPAPR_CAP_ON ;compat_props_add (mc->compat_props, hw_compat_2_11, hw_compat_2_11_len); - mc->deprecation_reason ="old and not maintained - use a 2.12+ version" ; }DEFINE_SPAPR_MACHINE (2 ,11 );
Signature · 1 line
2.41.0
[PULL 14/22] hw/i386: remove obsolete manual deprecation reason string of i440fx machines
In reply to Philippe Mathieu-DaudéFrom: Daniel P. Berrangé <[email protected]>
The automatic deprecation mechanism introduced in the preceeding patches will mark every i440fx machine upto and including 2.12 as deprecated. As such we can revert the manually added deprecation introduced in:
commit 792b4fdd4eb8197bd6eb9e80a1dfaf0cb3b54aeb
Author: Philippe Mathieu-Daudé <[email protected]>
Date: Wed Feb 28 10:34:35 2024 +0100
hw/i386/pc: Deprecate 2.4 to 2.12 pc-i440fx machines
Message-ID: <[email protected]>
--- hw/i386/pc_piix.c | 1 - 1 file changed, 1 deletion(-)
hw/i386/pc_piix.c +0 -1
@@ -688,7 +688,6 @@ DEFINE_I440FX_MACHINE(3, 0);static void pc_i440fx_machine_2_12_options (MachineClass *m) {pc_i440fx_machine_3_0_options (m); - m->deprecation_reason ="old and unattended - use a newer version instead" ;compat_props_add (m->compat_props, hw_compat_2_12, hw_compat_2_12_len);compat_props_add (m->compat_props, pc_compat_2_12, pc_compat_2_12_len); }
Signature · 1 line
2.41.0
[PULL 02/22] include/hw: add helpers for defining versioned machine types
In reply to Philippe Mathieu-DaudéFrom: Daniel P. Berrangé <[email protected]>
The various targets which define versioned machine types have a bunch of obfuscated macro code for defining unique function and variable names using string concatenation.
This adds a couple of helpers to improve the clarity of such code macro.
Message-ID: <[email protected]>
--- include/hw/boards.h | 185 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 185 insertions(+)
include/hw/boards.h +185 -0
@@ -413,6 +413,191 @@ struct MachineState {struct NumaState *numa_state; }; +/* +* The macros which follow are intended to facilitate the +* definition of versioned machine types, using a somewhat +* similar pattern across targets. +* +* For example, a macro that can be used to define versioned +* 'virt' machine types would look like: +* +* #define DEFINE_VIRT_MACHINE_IMPL(latest, ...) \ +* static void MACHINE_VER_SYM(class_init, virt, __VA_ARGS__)( \ +* ObjectClass *oc, \ +* void *data) \ +* { \ +* MachineClass *mc = MACHINE_CLASS(oc); \ +* MACHINE_VER_SYM(options, virt, __VA_ARGS__)(mc); \ +* mc->desc = "QEMU " MACHINE_VER_STR(__VA_ARGS__) " Virtual Machine"; \ +* if (latest) { \ +* mc->alias = "virt"; \ +* } \ +* } \ +* static const TypeInfo MACHINE_VER_SYM(info, virt, __VA_ARGS__) = { \ +* .name = MACHINE_VER_TYPE_NAME("virt", __VA_ARGS__), \ +* .parent = TYPE_VIRT_MACHINE, \ +* .class_init = MACHINE_VER_SYM(class_init, virt, __VA_ARGS__), \ +* }; \ +* static void MACHINE_VER_SYM(register, virt, __VA_ARGS__)(void) \ +* { \ +* type_register_static(&MACHINE_VER_SYM(info, virt, __VA_ARGS__)); \ +* } \ +* type_init(MACHINE_VER_SYM(register, virt, __VA_ARGS__)); +* +* Following this, one (or more) helpers can be added for +* whichever scenarios need to be catered for with a machine: +* +* // Normal 2 digit, marked as latest e.g. 'virt-9.0' +* #define DEFINE_VIRT_MACHINE_LATEST(major, minor) \ +* DEFINE_VIRT_MACHINE_IMPL(true, major, minor) +* +* // Normal 2 digit e.g. 'virt-9.0' +* #define DEFINE_VIRT_MACHINE(major, minor) \ +* DEFINE_VIRT_MACHINE_IMPL(false, major, minor) +* +* // Bugfix 3 digit e.g. 'virt-9.0.1' +* #define DEFINE_VIRT_MACHINE_BUGFIX(major, minor, micro) \ +* DEFINE_VIRT_MACHINE_IMPL(false, major, minor, micro) +* +* // Tagged 2 digit e.g. 'virt-9.0-extra' +* #define DEFINE_VIRT_MACHINE_TAGGED(major, minor, tag) \ +* DEFINE_VIRT_MACHINE_IMPL(false, major, minor, _, tag) +* +* // Tagged bugfix 2 digit e.g. 'virt-9.0.1-extra' +* #define DEFINE_VIRT_MACHINE_TAGGED(major, minor, micro, tag) \ +* DEFINE_VIRT_MACHINE_IMPL(false, major, minor, micro, _, tag) +*/ + +/* +* Helper for dispatching different macros based on how +* many __VA_ARGS__ are passed. Supports 1 to 5 variadic +* arguments, with the called target able to be prefixed +* with 0 or more fixed arguments too. To be called thus: +* +* _MACHINE_VER_PICK(__VA_ARGS, +* MACRO_MATCHING_5_ARGS, +* MACRO_MATCHING_4_ARGS, +* MACRO_MATCHING_3_ARGS, +* MACRO_MATCHING_2_ARGS, +* MACRO_MATCHING_1_ARG) (FIXED-ARG-1, +* ..., +* FIXED-ARG-N, +* __VA_ARGS__) +*/ +#define _MACHINE_VER_PICK (x1, x2, x3, x4, x5, x6, ...) x6 + +/* +* Construct a human targeted machine version string. +* +* Can be invoked with various signatures +* +* MACHINE_VER_STR(sym, prefix, major, minor) +* MACHINE_VER_STR(sym, prefix, major, minor, micro) +* MACHINE_VER_STR(sym, prefix, major, minor, _, tag) +* MACHINE_VER_STR(sym, prefix, major, minor, micro, _, tag) +* +* Respectively emitting symbols with the format +* +* "{major}.{minor}" +* "{major}.{minor}-{tag}" +* "{major}.{minor}.{micro}" +* "{major}.{minor}.{micro}-{tag}" +*/ +#define _MACHINE_VER_STR2 (major, minor) \ + #major "." #minor + +#define _MACHINE_VER_STR3 (major, minor, micro) \ + #major "." #minor "." #micro + +#define _MACHINE_VER_STR4 (major, minor, _unused_, tag) \ + #major "." #minor "-" #tag + +#define _MACHINE_VER_STR5 (major, minor, micro, _unused_, tag) \ + #major "." #minor "." #micro "-" #tag + +#define MACHINE_VER_STR (...) \ + _MACHINE_VER_PICK(__VA_ARGS__, \ + _MACHINE_VER_STR5, \ + _MACHINE_VER_STR4, \ + _MACHINE_VER_STR3, \ + _MACHINE_VER_STR2) (__VA_ARGS__) + + +/* +* Construct a QAPI type name for a versioned machine +* type +* +* Can be invoked with various signatures +* +* MACHINE_VER_TYPE_NAME(prefix, major, minor) +* MACHINE_VER_TYPE_NAME(prefix, major, minor, micro) +* MACHINE_VER_TYPE_NAME(prefix, major, minor, _, tag) +* MACHINE_VER_TYPE_NAME(prefix, major, minor, micro, _, tag) +* +* Respectively emitting symbols with the format +* +* "{prefix}-{major}.{minor}" +* "{prefix}-{major}.{minor}.{micro}" +* "{prefix}-{major}.{minor}-{tag}" +* "{prefix}-{major}.{minor}.{micro}-{tag}" +*/ +#define _MACHINE_VER_TYPE_NAME2 (prefix, major, minor) \ + prefix "-" #major "." #minor TYPE_MACHINE_SUFFIX + +#define _MACHINE_VER_TYPE_NAME3 (prefix, major, minor, micro) \ + prefix "-" #major "." #minor "." #micro TYPE_MACHINE_SUFFIX + +#define _MACHINE_VER_TYPE_NAME4 (prefix, major, minor, _unused_, tag) \ + prefix "-" #major "." #minor "-" #tag TYPE_MACHINE_SUFFIX + +#define _MACHINE_VER_TYPE_NAME5 (prefix, major, minor, micro, _unused_, tag) \ + prefix "-" #major "." #minor "." #micro "-" #tag TYPE_MACHINE_SUFFIX + +#define MACHINE_VER_TYPE_NAME (prefix, ...) \ + _MACHINE_VER_PICK(__VA_ARGS__, \ + _MACHINE_VER_TYPE_NAME5, \ + _MACHINE_VER_TYPE_NAME4, \ + _MACHINE_VER_TYPE_NAME3, \ + _MACHINE_VER_TYPE_NAME2) (prefix, __VA_ARGS__) + +/* +* Construct a name for a versioned machine type that is +* suitable for use as a C symbol (function/variable/etc). +* +* Can be invoked with various signatures +* +* MACHINE_VER_SYM(sym, prefix, major, minor) +* MACHINE_VER_SYM(sym, prefix, major, minor, micro) +* MACHINE_VER_SYM(sym, prefix, major, minor, _, tag) +* MACHINE_VER_SYM(sym, prefix, major, minor, micro, _, tag) +* +* Respectively emitting symbols with the format +* +* {prefix}_machine_{major}_{minor}_{sym} +* {prefix}_machine_{major}_{minor}_{micro}_{sym} +* {prefix}_machine_{major}_{minor}_{tag}_{sym} +* {prefix}_machine_{major}_{minor}_{micro}_{tag}_{sym} +*/ +#define _MACHINE_VER_SYM2 (sym, prefix, major, minor) \ + prefix ## _machine_ ## major ## _ ## minor ## _ ## sym + +#define _MACHINE_VER_SYM3 (sym, prefix, major, minor, micro) \ + prefix ## _machine_ ## major ## _ ## minor ## _ ## micro ## _ ## sym + +#define _MACHINE_VER_SYM4 (sym, prefix, major, minor, _unused_, tag) \ + prefix ## _machine_ ## major ## _ ## minor ## _ ## tag ## _ ## sym + +#define _MACHINE_VER_SYM5 (sym, prefix, major, minor, micro, _unused_, tag) \ + prefix ## _machine_ ## major ## _ ## minor ## _ ## micro ## _ ## tag ## _ ## sym + +#define MACHINE_VER_SYM (sym, prefix, ...) \ + _MACHINE_VER_PICK(__VA_ARGS__, \ + _MACHINE_VER_SYM5, \ + _MACHINE_VER_SYM4, \ + _MACHINE_VER_SYM3, \ + _MACHINE_VER_SYM2) (sym, prefix, __VA_ARGS__) + +#define DEFINE_MACHINE (namestr, machine_initfn) \ static void machine_initfn##_class_init(ObjectClass *oc, void *data) \ { \
Signature · 1 line
2.41.0
[PULL 12/22] hw: skip registration of outdated versioned machine types
In reply to Philippe Mathieu-DaudéFrom: Daniel P. Berrangé <[email protected]>
This calls the MACHINE_VER_DELETION() macro in the machine type registration method, so that when a versioned machine type reaches the end of its life, it is no longer registered with QOM and thus cannot be used.
The actual definition of the machine type should be deleted at this point, but experience shows that can easily be forgotten. By skipping registration the manual code deletion task can be done at any later date.
Message-ID: <[email protected]>
--- include/hw/i386/pc.h | 1 + hw/arm/virt.c | 1 + hw/m68k/virt.c | 1 + hw/ppc/spapr.c | 1 + hw/s390x/s390-virtio-ccw.c | 1 + 5 files changed, 5 insertions(+)
include/hw/i386/pc.h +1 -0
@@ -340,6 +340,7 @@ extern const size_t pc_compat_2_3_len; }; \ static void MACHINE_VER_SYM(register, namesym, __VA_ARGS__)(void) \ { \ +MACHINE_VER_DELETION (__VA_ARGS__); \type_register (&MACHINE_VER_SYM (info, namesym, __VA_ARGS__)); \ } \type_init (MACHINE_VER_SYM (register, namesym, __VA_ARGS__));
hw/arm/virt.c +1 -0
@@ -123,6 +123,7 @@ static void arm_virt_compat_set(MachineClass *mc) }; \ static void MACHINE_VER_SYM(register, virt, __VA_ARGS__)(void) \ { \ +MACHINE_VER_DELETION (__VA_ARGS__); \type_register_static (&MACHINE_VER_SYM (info, virt, __VA_ARGS__)); \ } \type_init (MACHINE_VER_SYM (register, virt, __VA_ARGS__));
hw/m68k/virt.c +1 -0
@@ -356,6 +356,7 @@ type_init(virt_machine_register_types) }; \ static void MACHINE_VER_SYM(register, virt, __VA_ARGS__)(void) \ { \ +MACHINE_VER_DELETION (__VA_ARGS__); \type_register_static (&MACHINE_VER_SYM (info, virt, __VA_ARGS__)); \ } \type_init (MACHINE_VER_SYM (register, virt, __VA_ARGS__));
hw/ppc/spapr.c +1 -0
@@ -4824,6 +4824,7 @@ static void spapr_machine_latest_class_options(MachineClass *mc) }; \ static void MACHINE_VER_SYM(register, spapr, __VA_ARGS__)(void) \ { \ +MACHINE_VER_DELETION (__VA_ARGS__); \type_register (&MACHINE_VER_SYM (info, spapr, __VA_ARGS__)); \ } \type_init (MACHINE_VER_SYM (register, spapr, __VA_ARGS__))
hw/s390x/s390-virtio-ccw.c +1 -0
@@ -847,6 +847,7 @@ static const TypeInfo ccw_machine_info = { }; \ static void MACHINE_VER_SYM(register, ccw, __VA_ARGS__)(void) \ { \ +MACHINE_VER_DELETION (__VA_ARGS__); \type_register_static (&MACHINE_VER_SYM (info, ccw, __VA_ARGS__)); \ } \type_init (MACHINE_VER_SYM (register, ccw, __VA_ARGS__))
Signature · 1 line
2.41.0
[PULL 17/22] hw/ide/macio: switch from using qemu_allocate_irq() to qdev input GPIOs
In reply to Philippe Mathieu-DaudéFrom: Mark Cave-Ayland <[email protected]>
This prevents the IRQs from being leaked when the macio IDE device is used.
Message-ID: <[email protected]>
--- include/hw/misc/macio/macio.h | 7 +++++-- hw/ide/macio.c | 10 ++++++---- 2 files changed, 11 insertions(+), 6 deletions(-)
include/hw/misc/macio/macio.h +5 -2
@@ -80,8 +80,6 @@ struct MACIOIDEState {uint32_t channel;qemu_irq real_ide_irq;qemu_irq real_dma_irq; -qemu_irq ide_irq; -qemu_irq dma_irq;MemoryRegion mem;IDEBus bus;
@@ -92,6 +90,11 @@ struct MACIOIDEState {uint32_t irq_reg; }; +#define MACIO_IDE_PMAC_NIRQS 2 + +#define MACIO_IDE_PMAC_DMA_IRQ 0 +#define MACIO_IDE_PMAC_IDE_IRQ 1 +void macio_ide_init_drives (MACIOIDEState *ide,DriveInfo **hd_table);void macio_ide_register_dma (MACIOIDEState *ide);
hw/ide/macio.c +6 -4
@@ -420,7 +420,8 @@ static void macio_ide_realizefn(DeviceState *dev, Error **errp) {MACIOIDEState *s =MACIO_IDE (dev); -ide_bus_init_output_irq (&s->bus, s->ide_irq); +ide_bus_init_output_irq (&s->bus, +qdev_get_gpio_in (dev,MACIO_IDE_PMAC_IDE_IRQ ));/* Register DMA callbacks */ s->dma.ops = &dbdma_ops;
@@ -456,8 +457,8 @@ static void macio_ide_initfn(Object *obj)sysbus_init_mmio (d, &s->mem);sysbus_init_irq (d, &s->real_ide_irq);sysbus_init_irq (d, &s->real_dma_irq); - s->dma_irq =qemu_allocate_irq (pmac_ide_irq, s,0 ); - s->ide_irq =qemu_allocate_irq (pmac_ide_irq, s,1 ); + +qdev_init_gpio_in (DEVICE (obj), pmac_ide_irq,MACIO_IDE_PMAC_NIRQS ); object_property_add_link(obj, "dbdma", TYPE_MAC_DBDMA, (Object **) &s->dbdma,
@@ -508,7 +509,8 @@ void macio_ide_init_drives(MACIOIDEState *s, DriveInfo **hd_table)void macio_ide_register_dma (MACIOIDEState *s) { -DBDMA_register_channel (s->dbdma, s->channel, s->dma_irq, +DBDMA_register_channel (s->dbdma, s->channel, +qdev_get_gpio_in (DEVICE (s),MACIO_IDE_PMAC_DMA_IRQ ), pmac_ide_transfer, pmac_ide_flush, s); }
Signature · 1 line
2.41.0
[PULL 05/22] hw/ppc: convert 'spapr' machine definitions to use new macros
In reply to Philippe Mathieu-DaudéFrom: Daniel P. Berrangé <[email protected]>
This changes the DEFINE_SPAPR_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 twice in two different formats in the calls to DEFINE_SPAPR_MACHINE.
A DEFINE_SPAPR_MACHINE_AS_LATEST helper is added so that it is not required to pass 'false' for every single historical machine type.
Due to the odd-ball '2.12-sxxm' machine type version, this commit introduces a DEFINE_SPAPR_MACHINE_TAGGED helper to allow defining of "tagged" machine types which have a string suffix.
Message-ID: <[email protected]>
--- hw/ppc/spapr.c | 97 +++++++++++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 44 deletions(-)
hw/ppc/spapr.c +53 -44
@@ -4804,26 +4804,35 @@ static void spapr_machine_latest_class_options(MachineClass *mc) mc->is_default = true; } -#define DEFINE_SPAPR_MACHINE (suffix, verstr, latest) \ - static void spapr_machine_##suffix##_class_init(ObjectClass *oc, \ - void *data) \ +#define DEFINE_SPAPR_MACHINE_IMPL (latest, ...) \ + static void MACHINE_VER_SYM(class_init, spapr, __VA_ARGS__)( \ + ObjectClass *oc, \ + void *data) \ { \ MachineClass *mc = MACHINE_CLASS(oc); \ - spapr_machine_##suffix##_class_options(mc); \ + MACHINE_VER_SYM(class_options, spapr, __VA_ARGS__)(mc); \ if (latest) { \ spapr_machine_latest_class_options(mc); \ } \ } \ - static const TypeInfo spapr_machine_##suffix##_info = { \ - .name = MACHINE_TYPE_NAME("pseries-" verstr), \ - .parent = TYPE_SPAPR_MACHINE, \ - .class_init = spapr_machine_##suffix##_class_init, \ - }; \ - static void spapr_machine_register_##suffix(void) \ + static const TypeInfo MACHINE_VER_SYM(info, spapr, __VA_ARGS__) = \ { \ - type_register(&spapr_machine_##suffix##_info); \ + .name = MACHINE_VER_TYPE_NAME("pseries", __VA_ARGS__), \ + .parent = TYPE_SPAPR_MACHINE, \ + .class_init = MACHINE_VER_SYM(class_init, spapr, __VA_ARGS__), \ + }; \ + static void MACHINE_VER_SYM(register, spapr, __VA_ARGS__)(void) \ + { \ + type_register(&MACHINE_VER_SYM(info, spapr, __VA_ARGS__)); \ } \ - type_init(spapr_machine_register_##suffix) + type_init(MACHINE_VER_SYM(register, spapr, __VA_ARGS__)) + +#define DEFINE_SPAPR_MACHINE_AS_LATEST (major, minor) \ + DEFINE_SPAPR_MACHINE_IMPL(true, major, minor) +#define DEFINE_SPAPR_MACHINE (major, minor) \ + DEFINE_SPAPR_MACHINE_IMPL(false, major, minor) +#define DEFINE_SPAPR_MACHINE_TAGGED (major, minor, tag) \ + DEFINE_SPAPR_MACHINE_IMPL(false, major, minor, _, tag)/* * pseries-9.1
@@ -4833,7 +4842,7 @@ static void spapr_machine_9_1_class_options(MachineClass *mc)/* Defaults for the latest behaviour inherited from the base class */ } -DEFINE_SPAPR_MACHINE(9_1, "9.1", true); +DEFINE_SPAPR_MACHINE_AS_LATEST (9 ,1 );/* * pseries-9.0
@@ -4844,7 +4853,7 @@ static void spapr_machine_9_0_class_options(MachineClass *mc)compat_props_add (mc->compat_props, hw_compat_9_0, hw_compat_9_0_len); } -DEFINE_SPAPR_MACHINE(9_0, "9.0", false); +DEFINE_SPAPR_MACHINE (9 ,0 );/* * pseries-8.2
@@ -4855,7 +4864,7 @@ static void spapr_machine_8_2_class_options(MachineClass *mc)compat_props_add (mc->compat_props, hw_compat_8_2, hw_compat_8_2_len); } -DEFINE_SPAPR_MACHINE(8_2, "8.2", false); +DEFINE_SPAPR_MACHINE (8 ,2 );/* * pseries-8.1
@@ -4866,7 +4875,7 @@ static void spapr_machine_8_1_class_options(MachineClass *mc)compat_props_add (mc->compat_props, hw_compat_8_1, hw_compat_8_1_len); } -DEFINE_SPAPR_MACHINE(8_1, "8.1", false); +DEFINE_SPAPR_MACHINE (8 ,1 );/* * pseries-8.0
@@ -4877,7 +4886,7 @@ static void spapr_machine_8_0_class_options(MachineClass *mc)compat_props_add (mc->compat_props, hw_compat_8_0, hw_compat_8_0_len); } -DEFINE_SPAPR_MACHINE(8_0, "8.0", false); +DEFINE_SPAPR_MACHINE (8 ,0 );/* * pseries-7.2
@@ -4888,7 +4897,7 @@ static void spapr_machine_7_2_class_options(MachineClass *mc)compat_props_add (mc->compat_props, hw_compat_7_2, hw_compat_7_2_len); } -DEFINE_SPAPR_MACHINE(7_2, "7.2", false); +DEFINE_SPAPR_MACHINE (7 ,2 );/* * pseries-7.1
@@ -4899,7 +4908,7 @@ static void spapr_machine_7_1_class_options(MachineClass *mc)compat_props_add (mc->compat_props, hw_compat_7_1, hw_compat_7_1_len); } -DEFINE_SPAPR_MACHINE(7_1, "7.1", false); +DEFINE_SPAPR_MACHINE (7 ,1 );/* * pseries-7.0
@@ -4910,7 +4919,7 @@ static void spapr_machine_7_0_class_options(MachineClass *mc)compat_props_add (mc->compat_props, hw_compat_7_0, hw_compat_7_0_len); } -DEFINE_SPAPR_MACHINE(7_0, "7.0", false); +DEFINE_SPAPR_MACHINE (7 ,0 );/* * pseries-6.2
@@ -4921,7 +4930,7 @@ static void spapr_machine_6_2_class_options(MachineClass *mc)compat_props_add (mc->compat_props, hw_compat_6_2, hw_compat_6_2_len); } -DEFINE_SPAPR_MACHINE(6_2, "6.2", false); +DEFINE_SPAPR_MACHINE (6 ,2 );/* * pseries-6.1
@@ -4936,7 +4945,7 @@ static void spapr_machine_6_1_class_options(MachineClass *mc) mc->smp_props.prefer_sockets = true; } -DEFINE_SPAPR_MACHINE(6_1, "6.1", false); +DEFINE_SPAPR_MACHINE (6 ,1 );/* * pseries-6.0
@@ -4947,7 +4956,7 @@ static void spapr_machine_6_0_class_options(MachineClass *mc)compat_props_add (mc->compat_props, hw_compat_6_0, hw_compat_6_0_len); } -DEFINE_SPAPR_MACHINE(6_0, "6.0", false); +DEFINE_SPAPR_MACHINE (6 ,0 );/* * pseries-5.2
@@ -4958,7 +4967,7 @@ static void spapr_machine_5_2_class_options(MachineClass *mc)compat_props_add (mc->compat_props, hw_compat_5_2, hw_compat_5_2_len); } -DEFINE_SPAPR_MACHINE(5_2, "5.2", false); +DEFINE_SPAPR_MACHINE (5 ,2 );/* * pseries-5.1
@@ -4972,7 +4981,7 @@ static void spapr_machine_5_1_class_options(MachineClass *mc) smc->pre_5_2_numa_associativity = true; } -DEFINE_SPAPR_MACHINE(5_1, "5.1", false); +DEFINE_SPAPR_MACHINE (5 ,1 );/* * pseries-5.0
@@ -4991,7 +5000,7 @@ static void spapr_machine_5_0_class_options(MachineClass *mc) smc->pre_5_1_assoc_refpoints = true; } -DEFINE_SPAPR_MACHINE(5_0, "5.0", false); +DEFINE_SPAPR_MACHINE (5 ,0 );/* * pseries-4.2
@@ -5008,7 +5017,7 @@ static void spapr_machine_4_2_class_options(MachineClass *mc) mc->nvdimm_supported = false; } -DEFINE_SPAPR_MACHINE(4_2, "4.2", false); +DEFINE_SPAPR_MACHINE (4 ,2 );/* * pseries-4.1
@@ -5028,7 +5037,7 @@ static void spapr_machine_4_1_class_options(MachineClass *mc)compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); } -DEFINE_SPAPR_MACHINE(4_1, "4.1", false); +DEFINE_SPAPR_MACHINE (4 ,1 );/* * pseries-4.0
@@ -5055,7 +5064,7 @@ static void spapr_machine_4_0_class_options(MachineClass *mc) smc->pre_4_1_migration = true; } -DEFINE_SPAPR_MACHINE(4_0, "4.0", false); +DEFINE_SPAPR_MACHINE (4 ,0 );/* * pseries-3.1
@@ -5077,7 +5086,7 @@ static void spapr_machine_3_1_class_options(MachineClass *mc) smc->default_caps.caps[SPAPR_CAP_LARGE_DECREMENTER ] =SPAPR_CAP_OFF ; } -DEFINE_SPAPR_MACHINE(3_1, "3.1", false); +DEFINE_SPAPR_MACHINE (3 ,1 );/* * pseries-3.0
@@ -5095,7 +5104,7 @@ static void spapr_machine_3_0_class_options(MachineClass *mc) smc->irq = &spapr_irq_xics_legacy; } -DEFINE_SPAPR_MACHINE(3_0, "3.0", false); +DEFINE_SPAPR_MACHINE (3 ,0 );/* * pseries-2.12
@@ -5120,7 +5129,7 @@ static void spapr_machine_2_12_class_options(MachineClass *mc) smc->default_caps.caps[SPAPR_CAP_HPT_MAXPAGESIZE ] =0 ; } -DEFINE_SPAPR_MACHINE(2_12, "2.12", false); +DEFINE_SPAPR_MACHINE (2 ,12 );static void spapr_machine_2_12_sxxm_class_options (MachineClass *mc) {
@@ -5132,7 +5141,7 @@ static void spapr_machine_2_12_sxxm_class_options(MachineClass *mc) smc->default_caps.caps[SPAPR_CAP_IBS ] =SPAPR_CAP_FIXED_CCD ; } -DEFINE_SPAPR_MACHINE(2_12_sxxm, "2.12-sxxm", false); +DEFINE_SPAPR_MACHINE_TAGGED (2 ,12 , sxxm);/* * pseries-2.11
@@ -5148,7 +5157,7 @@ static void spapr_machine_2_11_class_options(MachineClass *mc) mc->deprecation_reason ="old and not maintained - use a 2.12+ version" ; } -DEFINE_SPAPR_MACHINE(2_11, "2.11", false); +DEFINE_SPAPR_MACHINE (2 ,11 );/* * pseries-2.10
@@ -5160,7 +5169,7 @@ static void spapr_machine_2_10_class_options(MachineClass *mc)compat_props_add (mc->compat_props, hw_compat_2_10, hw_compat_2_10_len); } -DEFINE_SPAPR_MACHINE(2_10, "2.10", false); +DEFINE_SPAPR_MACHINE (2 ,10 );/* * pseries-2.9
@@ -5180,7 +5189,7 @@ static void spapr_machine_2_9_class_options(MachineClass *mc) smc->resize_hpt_default =SPAPR_RESIZE_HPT_DISABLED ; } -DEFINE_SPAPR_MACHINE(2_9, "2.9", false); +DEFINE_SPAPR_MACHINE (2 ,9 );/* * pseries-2.8
@@ -5198,7 +5207,7 @@ static void spapr_machine_2_8_class_options(MachineClass *mc) mc->numa_mem_align_shift =23 ; } -DEFINE_SPAPR_MACHINE(2_8, "2.8", false); +DEFINE_SPAPR_MACHINE (2 ,8 );/* * pseries-2.7
@@ -5273,7 +5282,7 @@ static void spapr_machine_2_7_class_options(MachineClass *mc) smc->phb_placement = phb_placement_2_7; } -DEFINE_SPAPR_MACHINE(2_7, "2.7", false); +DEFINE_SPAPR_MACHINE (2 ,7 );/* * pseries-2.6
@@ -5291,7 +5300,7 @@ static void spapr_machine_2_6_class_options(MachineClass *mc)compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); } -DEFINE_SPAPR_MACHINE(2_6, "2.6", false); +DEFINE_SPAPR_MACHINE (2 ,6 );/* * pseries-2.5
@@ -5310,7 +5319,7 @@ static void spapr_machine_2_5_class_options(MachineClass *mc)compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); } -DEFINE_SPAPR_MACHINE(2_5, "2.5", false); +DEFINE_SPAPR_MACHINE (2 ,5 );/* * pseries-2.4
@@ -5325,7 +5334,7 @@ static void spapr_machine_2_4_class_options(MachineClass *mc)compat_props_add (mc->compat_props, hw_compat_2_4, hw_compat_2_4_len); } -DEFINE_SPAPR_MACHINE(2_4, "2.4", false); +DEFINE_SPAPR_MACHINE (2 ,4 );/* * pseries-2.3
@@ -5340,7 +5349,7 @@ static void spapr_machine_2_3_class_options(MachineClass *mc)compat_props_add (mc->compat_props, hw_compat_2_3, hw_compat_2_3_len);compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); } -DEFINE_SPAPR_MACHINE(2_3, "2.3", false); +DEFINE_SPAPR_MACHINE (2 ,3 );/* * pseries-2.2
@@ -5357,7 +5366,7 @@ static void spapr_machine_2_2_class_options(MachineClass *mc)compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); mc->default_machine_opts ="modern-hotplug-events=off,suppress-vmdesc=on" ; } -DEFINE_SPAPR_MACHINE(2_2, "2.2", false); +DEFINE_SPAPR_MACHINE (2 ,2 );/* * pseries-2.1
@@ -5368,7 +5377,7 @@ static void spapr_machine_2_1_class_options(MachineClass *mc)spapr_machine_2_2_class_options (mc);compat_props_add (mc->compat_props, hw_compat_2_1, hw_compat_2_1_len); } -DEFINE_SPAPR_MACHINE(2_1, "2.1", false); +DEFINE_SPAPR_MACHINE (2 ,1 );static void spapr_machine_register_types (void ) {
Signature · 1 line
2.41.0
[PULL 16/22] system/physmem: Fix reference to dump-guest-core
In reply to Philippe Mathieu-DaudéFrom: Akihiko Odaki <[email protected]>
dump_guest_core is exposed as dump-guest-core with QOM.
Message-ID: <[email protected]>
--- system/physmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
system/physmem.c +1 -1
@@ -1521,7 +1521,7 @@ static void qemu_ram_setup_dump(void *addr, ram_addr_t size)if (ret) {perror ("qemu_madvise" );fprintf (stderr,"madvise doesn't support MADV_DONTDUMP, " -"but dump_guest_core=off specified\n" ); +"but dump-guest-core=off specified\n" ); } } }
Signature · 1 line
2.41.0
[PULL 21/22] net/vmnet: Drop ifdef for macOS versions older than 12.0
In reply to Philippe Mathieu-DaudéFrom: Akihiko Odaki <[email protected]>
macOS versions older than 12.0 are no longer supported.
docs/about/build-platforms.rst says:
Quoted 3 lines
Support for the previous major version will be dropped 2 years after the new major version is released or when the vendor itself drops support, whichever comes first.
macOS 12.0 was released 2021:
https://www.apple.com/newsroom/2021/10/macos-monterey-is-now-available/
Message-ID: <[email protected]>
--- net/vmnet-host.c | 24 +----------------------- net/vmnet-shared.c | 13 ------------- net/vmnet-bridged.m | 13 +------------ net/vmnet-common.m | 3 --- 4 files changed, 2 insertions(+), 51 deletions(-)
net/vmnet-host.c +1 -23
@@ -21,31 +21,13 @@static bool validate_options (const Netdev *netdev,Error **errp) {const NetdevVmnetHostOptions *options = &(netdev->u.vmnet_host); - -#if defined(MAC_OS_VERSION_11_0 ) && \ -MAC_OS_X_VERSION_MIN_REQUIRED >=MAC_OS_VERSION_11_0 -QemuUUID net_uuid; +if (options->net_uuid &&qemu_uuid_parse (options->net_uuid, &net_uuid) <0 ) {error_setg (errp,"Invalid UUID provided in 'net-uuid'" );return false; } -#else -if (options->has_isolated) { -error_setg (errp, -"vmnet-host.isolated feature is " -"unavailable: outdated vmnet.framework API" ); -return false; - } - -if (options->net_uuid) { -error_setg (errp, -"vmnet-host.net-uuid feature is " -"unavailable: outdated vmnet.framework API" ); -return false; - } -#endif if ((options->start_address || options->end_address ||
@@ -71,9 +53,6 @@ static xpc_object_t build_if_desc(const Netdev *netdev) vmnet_operation_mode_key, VMNET_HOST_MODE); -#if defined(MAC_OS_VERSION_11_0 ) && \ -MAC_OS_X_VERSION_MIN_REQUIRED >=MAC_OS_VERSION_11_0 -xpc_dictionary_set_bool (if_desc, vmnet_enable_isolation_key, options->isolated);
@@ -85,7 +64,6 @@ static xpc_object_t build_if_desc(const Netdev *netdev) vmnet_network_identifier_key, net_uuid.data); } -#endif if (options->start_address) { xpc_dictionary_set_string(if_desc,
net/vmnet-shared.c +0 -13
@@ -21,16 +21,6 @@ static bool validate_options(const Netdev *netdev, Error **errp) {const NetdevVmnetSharedOptions *options = &(netdev->u.vmnet_shared); -#if !defined(MAC_OS_VERSION_11_0 ) || \ -MAC_OS_X_VERSION_MIN_REQUIRED <MAC_OS_VERSION_11_0 -if (options->has_isolated) { -error_setg (errp, -"vmnet-shared.isolated feature is " -"unavailable: outdated vmnet.framework API" ); -return false; - } -#endif - if ((options->start_address || options->end_address || options->subnet_mask) &&
@@ -76,14 +66,11 @@ static xpc_object_t build_if_desc(const Netdev *netdev) options->subnet_mask); } -#if defined(MAC_OS_VERSION_11_0 ) && \ -MAC_OS_X_VERSION_MIN_REQUIRED >=MAC_OS_VERSION_11_0 xpc_dictionary_set_bool ( if_desc, vmnet_enable_isolation_key, options->isolated ); -#endif return if_desc; }
net/vmnet-bridged.m +1 -12
@@ -88,15 +88,6 @@ static bool validate_options(const Netdev *netdev, Error **errp) return false; } -#if !defined(MAC_OS_VERSION_11_0) || \ - MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_VERSION_11_0 - if (options->has_isolated) { - error_setg(errp, - "vmnet-bridged.isolated feature is " - "unavailable: outdated vmnet.framework API"); - return false; - } -#endif return true; }
@@ -115,12 +106,10 @@ static xpc_object_t build_if_desc(const Netdev *netdev) vmnet_shared_interface_name_key, options->ifname); -#if defined(MAC_OS_VERSION_11_0) && \ - MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_VERSION_11_0 xpc_dictionary_set_bool(if_desc, vmnet_enable_isolation_key, options->isolated); -#endif + return if_desc; }
net/vmnet-common.m +0 -3
@@ -47,11 +47,8 @@ return "buffers exhausted in kernel"; case VMNET_TOO_MANY_PACKETS: return "packet count exceeds limit"; -#if defined(MAC_OS_VERSION_11_0) && \ - MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_VERSION_11_0 case VMNET_SHARING_SERVICE_BUSY: return "conflict, sharing service is in use"; -#endif default: return "unknown vmnet error"; }
Signature · 1 line
2.41.0
[PULL 18/22] hvf: Drop ifdef for macOS versions older than 12.0
In reply to Philippe Mathieu-DaudéFrom: Akihiko Odaki <[email protected]>
macOS versions older than 12.0 are no longer supported.
docs/about/build-platforms.rst says:
Quoted 3 lines
Support for the previous major version will be dropped 2 years after the new major version is released or when the vendor itself drops support, whichever comes first.
macOS 12.0 was released 2021:
https://www.apple.com/newsroom/2021/10/macos-monterey-is-now-available/
Message-ID: <[email protected]>
--- accel/hvf/hvf-all.c | 3 --- target/i386/hvf/hvf.c | 23 +---------------------- 2 files changed, 1 insertion(+), 25 deletions(-)
accel/hvf/hvf-all.c +0 -3
@@ -23,10 +23,7 @@ const char *hvf_return_string(hv_return_t ret)case HV_NO_RESOURCES :return "HV_NO_RESOURCES" ;case HV_NO_DEVICE :return "HV_NO_DEVICE" ;case HV_UNSUPPORTED :return "HV_UNSUPPORTED" ; -#if defined(MAC_OS_VERSION_11_0 ) && \ -MAC_OS_X_VERSION_MIN_REQUIRED >=MAC_OS_VERSION_11_0 case HV_DENIED :return "HV_DENIED" ; -#endif default :return "[unknown hv_return value]" ; } }
target/i386/hvf/hvf.c +1 -22
@@ -427,27 +427,6 @@ static void hvf_cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, } } -static hv_return_t hvf_vcpu_run (hv_vcpuid_t vcpu_id) -{ -/* -* hv_vcpu_run_until is available and recommended from macOS 10.15+, -* HV_DEADLINE_FOREVER from 11.0. Test for availability at runtime and fall -* back to hv_vcpu_run() only where necessary. -*/ -#ifndef MAC_OS_VERSION_11_0 -return hv_vcpu_run (vcpu_id); -#elif MAC_OS_X_VERSION_MIN_REQUIRED >=MAC_OS_VERSION_11_0 -return hv_vcpu_run_until (vcpu_id,HV_DEADLINE_FOREVER ); -#else /* MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_VERSION_11_0 */ -/* 11.0 SDK or newer, but could be < 11 at runtime */ - if (__builtin_available(macOS 11.0, *)) { -return hv_vcpu_run_until (vcpu_id,HV_DEADLINE_FOREVER ); - }else { -return hv_vcpu_run (vcpu_id); - } -#endif -} -int hvf_vcpu_exec (CPUState *cpu) {X86CPU *x86_cpu =X86_CPU (cpu);
@@ -476,7 +455,7 @@ int hvf_vcpu_exec(CPUState *cpu)return EXCP_HLT ; } -hv_return_t r =hvf_vcpu_run (cpu->accel->fd); +hv_return_t r =hv_vcpu_run_until (cpu->accel->fd,HV_DEADLINE_FOREVER );assert_hvf_ok (r);/* handle VMEXIT */
Signature · 1 line
2.41.0
[PULL 22/22] Remove inclusion of hw/hw.h from files that don't need it
In reply to Philippe Mathieu-DaudéFrom: Thomas Huth <[email protected]>
hw/hw.h only contains the prototype of hw_error() nowadays, so files that don't use this function don't need to include this header.
Message-ID: <[email protected]>
--- include/hw/misc/xlnx-cfi-if.h | 1 - hw/misc/edu.c | 1 - hw/vfio/container.c | 1 - 3 files changed, 3 deletions(-)
include/hw/misc/xlnx-cfi-if.h +0 -1
@@ -11,7 +11,6 @@#define XLNX_CFI_IF_H 1#include "qemu/help-texts.h" -#include "hw/hw.h" #include "qom/object.h" #define TYPE_XLNX_CFI_IF "xlnx-cfi-if"
hw/misc/edu.c +0 -1
@@ -26,7 +26,6 @@#include "qemu/log.h" #include "qemu/units.h" #include "hw/pci/pci.h" -#include "hw/hw.h" #include "hw/pci/msi.h" #include "qemu/timer.h" #include "qom/object.h"
hw/vfio/container.c +0 -1
@@ -26,7 +26,6 @@#include "exec/address-spaces.h" #include "exec/memory.h" #include "exec/ram_addr.h" -#include "hw/hw.h" #include "qemu/error-report.h" #include "qemu/range.h" #include "sysemu/reset.h"
Signature · 1 line
2.41.0
[PULL 19/22] audio: Drop ifdef for macOS versions older than 12.0
In reply to Philippe Mathieu-DaudéFrom: Akihiko Odaki <[email protected]>
macOS versions older than 12.0 are no longer supported.
docs/about/build-platforms.rst says:
Quoted 3 lines
Support for the previous major version will be dropped 2 years after the new major version is released or when the vendor itself drops support, whichever comes first.
macOS 12.0 was released 2021:
https://www.apple.com/newsroom/2021/10/macos-monterey-is-now-available/
Message-ID: <[email protected]>
--- audio/coreaudio.m | 5 ----- 1 file changed, 5 deletions(-)
audio/coreaudio.m +0 -5
@@ -44,11 +44,6 @@ bool enabled; } coreaudioVoiceOut; -#if !defined(MAC_OS_VERSION_12_0) \ - || (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_VERSION_12_0) -#define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster -#endif - static const AudioObjectPropertyAddress voice_addr = { kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyScopeGlobal,
Signature · 1 line
2.41.0
[PULL 20/22] block/file-posix: Drop ifdef for macOS versions older than 12.0
In reply to Philippe Mathieu-DaudéFrom: Akihiko Odaki <[email protected]>
macOS versions older than 12.0 are no longer supported.
docs/about/build-platforms.rst says:
Quoted 3 lines
Support for the previous major version will be dropped 2 years after the new major version is released or when the vendor itself drops support, whichever comes first.
macOS 12.0 was released 2021:
https://www.apple.com/newsroom/2021/10/macos-monterey-is-now-available/
Message-ID: <[email protected]>
--- block/file-posix.c | 5 ----- 1 file changed, 5 deletions(-)
block/file-posix.c +0 -5
@@ -3929,11 +3929,6 @@ BlockDriver bdrv_file = {static kern_return_t GetBSDPath (io_iterator_t mediaIterator,char *bsdPath,CFIndex maxPathSize,int flags); -#if !defined(MAC_OS_VERSION_12_0 ) \ - || (MAC_OS_X_VERSION_MIN_REQUIRED <MAC_OS_VERSION_12_0 ) -#define IOMainPort IOMasterPort -#endif -static char *FindEjectableOpticalMedia (io_iterator_t *mediaIterator) {kern_return_t kernResult =KERN_FAILURE ;
Signature · 1 line
2.41.0
[PULL 15/22] docs: document special exception for machine type deprecation & removal
In reply to Philippe Mathieu-DaudéFrom: Daniel P. Berrangé <[email protected]>
This extends the deprecation policy to indicate that versioned machine types will be marked deprecated after 3 years, and then subject to removal after a further 3 years has passed.
Message-ID: <[email protected]>
--- docs/about/deprecated.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+)
docs/about/deprecated.rst +13 -0
@@ -11,6 +11,19 @@ releases, the feature is liable to be removed. Deprecated features may also generate warnings on the console when QEMU starts up, or if activated via a monitor command, however, this is not a mandatory requirement. +As a special exception to this general timeframe, rather than have an +indefinite lifetime, versioned machine types are only intended to be +supported for a period of 6 years, equivalent to 18 QEMU releases. All +versioned machine types will be automatically marked deprecated after an +initial 3 years (9 QEMU releases) has passed, and will then be deleted after +a further 3 year period has passed. It is recommended that a deprecated +machine type is only used for incoming migrations and restore of saved state, +for pre-existing VM deployments. They should be scheduled for updating to a +newer machine type during an appropriate service window. Newly deployed VMs +should exclusively use a non-deprecated machine type, with use of the most +recent version highly recommended. Non-versioned machine types follow the +general feature deprecation policy. + Prior to the 2.10.0 release there was no official policy on how long features would be deprecated prior to their removal, nor any documented list of which features were deprecated. Thus
Signature · 1 line
2.41.0
Richard Henderson
AppliedQuoted 29 lines · Philippe Mathieu-Daudé
The following changes since commit
b6d32a06fc0984e537091cba08f2e1ed9f775d74:Merge tag 'pull-trivial-patches' ofhttps://gitlab.com/mjt0k/qemu into staging (2024-06-30 16:12:24 -0700)are available in the Git repository at:
https://github.com/philmd/qemu.git tags/hw-misc-20240702for you to fetch changes up to
f0936cbc1d42410ccd58c042bc26fa33a23a77d6:Remove inclusion of
hw/hw.hfrom files that don't need it (2024-07-02 06:58:48 +0200)Ignored checkpatch warnings:
WARNING: line over 80 characters
#45: FILE:include/hw/boards.h:431:
+ *mc->desc= "QEMU "MACHINE_VER_STR(__VA_ARGS__)" Virtual Machine"; \
#205: FILE:include/hw/boards.h:591:
+ prefix ##_machine_ ## major ## _ ## minor ## _ ## micro ## _ ## tag ## _ ## sym
#40: FILE:hw/arm/virt.c:112:
+mc->desc= "QEMU "MACHINE_VER_STR(__VA_ARGS__)" ARM Virtual Machine"; \
#55: FILE:hw/s390x/s390-virtio-ccw.c:828:
+mc->desc= "Virtual s390x machine (version "MACHINE_VER_STR(__VA_ARGS__)")"; \
#43: FILE:hw/m68k/virt.c:345:
+mc->desc= "QEMU "MACHINE_VER_STR(__VA_ARGS__)" M68K Virtual Machine"; \----------------------------------------------------------------
Misc HW patches queue
Quoted 6 lines
- Prevent NULL deref in sPAPR network model (Oleg)
- Automatic deprecation of versioned machine types (Daniel)
- Correct 'dump-guest-core' property name in hint (Akihiko)
- Prevent IRQ leak in MacIO IDE model (Mark)
- Remove dead #ifdef'ry related to unsupported macOS 12.0 (Akihiko)
- Remove "hw/hw.h" where unnecessary (Thomas)
Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/9.1 as appropriate.
r~