Skip to contentSkip to conversation

hw/armv7m: Fix broken VMStateDescription

PATCH In review Peter Maydell 4 participants 4 messages Jan 20, 2022 – Jan 21, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/armv7m: Fix broken VMStateDescription

In commit d5093d961585f02 we added a VMStateDescription to the TYPE_ARMV7M object, to handle migration of its Clocks. However a cut-and-paste error meant we used the wrong struct name in the VMSTATE_CLOCK() macro arguments. The result was that attempting a 'savevm' might result in an assertion failure.

---
It's a shame there's no way to type-check that the struct name used in the VMSTATE macros is correct...

---
 hw/arm/armv7m.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/armv7m.c +2 -2
index 8d08db80be8..ceb76df3cd4 100644
@@ -520,8 +520,8 @@ static const VMStateDescription vmstate_armv7m = {
     .version_id = 1,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
-        VMSTATE_CLOCK(refclk, SysTickState),
-        VMSTATE_CLOCK(cpuclk, SysTickState),
+        VMSTATE_CLOCK(refclk, ARMv7MState),
+        VMSTATE_CLOCK(cpuclk, ARMv7MState),
         VMSTATE_END_OF_LIST()
     }
 };
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Peter Maydell

In commit d5093d961585f02 we added a VMStateDescription to the TYPE_ARMV7M object, to handle migration of its Clocks. However a cut-and-paste error meant we used the wrong struct name in the VMSTATE_CLOCK() macro arguments. The result was that attempting a 'savevm' might result in an assertion failure.

Quoted 27 lines

---
It's a shame there's no way to type-check that the struct name used in the VMSTATE macros is correct...

---
 hw/arm/armv7m.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/armv7m.c +2 -3
index 8d08db80be8..ceb76df3cd4 100644
@@ -520,8 +520,8 @@ static const VMStateDescription vmstate_armv7m = {
     .version_id = 1,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
-        VMSTATE_CLOCK(refclk, SysTickState),
-        VMSTATE_CLOCK(cpuclk, SysTickState),
+        VMSTATE_CLOCK(refclk, ARMv7MState),
+        VMSTATE_CLOCK(cpuclk, ARMv7MState),
         VMSTATE_END_OF_LIST()
     }
 };
--

2.25.1

Reviewed-by on v1 1/1
#2 lore raw
In reply to Peter Maydell
Quoted 11 lines · Peter Maydell

In commit d5093d961585f02 we added a VMStateDescription to the TYPE_ARMV7M object, to handle migration of its Clocks. However a cut-and-paste error meant we used the wrong struct name in the VMSTATE_CLOCK() macro arguments. The result was that attempting a 'savevm' might result in an assertion failure.

Signature · 1 line
Alex Bennée
Reviewed-by Philippe Mathieu-Daudé on v1 1/1
#3 lore raw
In reply to Peter Maydell
Quoted 11 lines · Peter Maydell

In commit d5093d961585f02 we added a VMStateDescription to the TYPE_ARMV7M object, to handle migration of its Clocks. However a cut-and-paste error meant we used the wrong struct name in the VMSTATE_CLOCK() macro arguments. The result was that attempting a 'savevm' might result in an assertion failure.

Quoted 6 lines

---
It's a shame there's no way to type-check that the struct name used in the VMSTATE macros is correct...

---
  hw/arm/armv7m.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)