@samitouri / QOSamiQemu / commits / 7d1e9bcfe9

hw/core/boards: Remove MachineClass::smbus_no_migration_support field

The MachineClass::smbus_no_migration_support boolean was only used by the pc-q35-3.1 and pc-i440fx-3.1 machines, which got removed. Remove it, along with pm_smbus_vmstate_needed(). Use the unconditional VMSTATE_BOOL() and VMSTATE_STRUCT() macros. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Acked-by: Corey Minyard <corey@minyard.net> Message-Id: <20260307152635.83893-5-philmd@linaro.org>

Philippe Mathieu-Daudé committed Apr 29, 2025 at 16:53 UTC 7d1e9bcfe9f178a0cff3b38a05118accc3087f15
6 files changed +4 -33
hw/acpi/piix4.c
+1 -7
@@ -205,11 +205,6 @@ static const VMStateDescription vmstate_cpuhp_state = {
205 }
206 };
207
208 -static bool piix4_vmstate_need_smbus(void *opaque, int version_id)
209 -{
210 - return pm_smbus_vmstate_needed();
211 -}
212 -
208 /*
209 * This is a fudge to turn off the acpi_index field,
210 * whose test was always broken on piix4 with 6.2 and older machine types.
@@ -238,8 +233,7 @@ static const VMStateDescription vmstate_acpi = {
233 VMSTATE_UINT16(ar.pm1.evt.en, PIIX4PMState),
234 VMSTATE_UINT16(ar.pm1.cnt.cnt, PIIX4PMState),
235 VMSTATE_STRUCT(apm, PIIX4PMState, 0, vmstate_apm, APMState),
241 - VMSTATE_STRUCT_TEST(smb, PIIX4PMState, piix4_vmstate_need_smbus, 3,
242 - pmsmb_vmstate, PMSMBus),
236 + VMSTATE_STRUCT(smb, PIIX4PMState, 3, pmsmb_vmstate, PMSMBus),
237 VMSTATE_TIMER_PTR(ar.tmr.timer, PIIX4PMState),
238 VMSTATE_INT64(ar.tmr.overflow_time, PIIX4PMState),
239 VMSTATE_STRUCT(ar.gpe, PIIX4PMState, 2, vmstate_gpe, ACPIGPE),
hw/i2c/pm_smbus.c
-7
@@ -443,13 +443,6 @@ static const MemoryRegionOps pm_smbus_ops = {
443 .endianness = DEVICE_LITTLE_ENDIAN,
444 };
445
446 -bool pm_smbus_vmstate_needed(void)
447 -{
448 - MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
449 -
450 - return !mc->smbus_no_migration_support;
451 -}
452 -
446 const VMStateDescription pmsmb_vmstate = {
447 .name = "pmsmb",
448 .version_id = 1,
hw/i2c/smbus_eeprom.c
+1 -3
@@ -88,11 +88,9 @@ static int eeprom_write_data(SMBusDevice *dev, uint8_t *buf, uint8_t len)
88
89 static bool smbus_eeprom_vmstate_needed(void *opaque)
90 {
91 - MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
91 SMBusEEPROMDevice *eeprom = opaque;
92
94 - return (eeprom->accessed || smbus_vmstate_needed(&eeprom->smbusdev)) &&
95 - !mc->smbus_no_migration_support;
93 + return eeprom->accessed || smbus_vmstate_needed(&eeprom->smbusdev);
94 }
95
96 static const VMStateDescription vmstate_smbus_eeprom = {
hw/i2c/smbus_ich9.c
+2 -8
@@ -41,20 +41,14 @@ struct ICH9SMBState {
41 PMSMBus smb;
42 };
43
44 -static bool ich9_vmstate_need_smbus(void *opaque, int version_id)
45 -{
46 - return pm_smbus_vmstate_needed();
47 -}
48 -
44 static const VMStateDescription vmstate_ich9_smbus = {
45 .name = "ich9_smb",
46 .version_id = 1,
47 .minimum_version_id = 1,
48 .fields = (const VMStateField[]) {
49 VMSTATE_PCI_DEVICE(dev, ICH9SMBState),
55 - VMSTATE_BOOL_TEST(irq_enabled, ICH9SMBState, ich9_vmstate_need_smbus),
56 - VMSTATE_STRUCT_TEST(smb, ICH9SMBState, ich9_vmstate_need_smbus, 1,
57 - pmsmb_vmstate, PMSMBus),
50 + VMSTATE_BOOL(irq_enabled, ICH9SMBState),
51 + VMSTATE_STRUCT(smb, ICH9SMBState, 1, pmsmb_vmstate, PMSMBus),
52 VMSTATE_END_OF_LIST()
53 }
54 };
include/hw/core/boards.h
-1
@@ -314,7 +314,6 @@ struct MachineClass {
314 bool auto_enable_numa_with_memhp;
315 bool auto_enable_numa_with_memdev;
316 bool ignore_boot_device_suffixes;
317 - bool smbus_no_migration_support;
317 bool nvdimm_supported;
318 bool numa_mem_supported;
319 bool auto_enable_numa;
include/hw/i2c/pm_smbus.h
-7
@@ -44,13 +44,6 @@ typedef struct PMSMBus {
44
45 void pm_smbus_init(DeviceState *parent, PMSMBus *smb, bool force_aux_blk);
46
47 -/*
48 - * For backwards compatibility on migration, older versions don't have
49 - * working migration for pm_smbus, this lets us ignore the migrations
50 - * for older machine versions.
51 - */
52 -bool pm_smbus_vmstate_needed(void);
53 -
47 extern const VMStateDescription pmsmb_vmstate;
48
49 #endif /* PM_SMBUS_H */