aboutsummaryrefslogtreecommitdiff
path: root/hw/timer
diff options
context:
space:
mode:
authorPavel Dovgalyuk <pavel.dovgalyuk@ispras.ru>2022-02-07 11:44:19 +0300
committerPeter Maydell <peter.maydell@linaro.org>2022-02-21 13:30:21 +0000
commit432732b5e455ef0b28304004a3ca2b96ae33e39d (patch)
tree1f7913f1598408975efca340a506e171847468bb /hw/timer
parentaf643498d2541113e64602624b788a2d7deab084 (diff)
downloadqemu-432732b5e455ef0b28304004a3ca2b96ae33e39d.zip
qemu-432732b5e455ef0b28304004a3ca2b96ae33e39d.tar.gz
qemu-432732b5e455ef0b28304004a3ca2b96ae33e39d.tar.bz2
hw/timer: fix a9gtimer vmstate
A9 gtimer includes global control field and number of per-cpu fields. But only per-cpu ones are migrated. This patch adds a subsection for global control field migration. Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru> Message-id: 164422345976.2186660.1104517592452494510.stgit@pasha-ThinkPad-X280 Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/timer')
-rw-r--r--hw/timer/a9gtimer.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/hw/timer/a9gtimer.c b/hw/timer/a9gtimer.c
index 7233068..5e959b6 100644
--- a/hw/timer/a9gtimer.c
+++ b/hw/timer/a9gtimer.c
@@ -318,6 +318,12 @@ static void a9_gtimer_realize(DeviceState *dev, Error **errp)
}
}
+static bool vmstate_a9_gtimer_control_needed(void *opaque)
+{
+ A9GTimerState *s = opaque;
+ return s->control != 0;
+}
+
static const VMStateDescription vmstate_a9_gtimer_per_cpu = {
.name = "arm.cortex-a9-global-timer.percpu",
.version_id = 1,
@@ -331,6 +337,17 @@ static const VMStateDescription vmstate_a9_gtimer_per_cpu = {
}
};
+static const VMStateDescription vmstate_a9_gtimer_control = {
+ .name = "arm.cortex-a9-global-timer.control",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .needed = vmstate_a9_gtimer_control_needed,
+ .fields = (VMStateField[]) {
+ VMSTATE_UINT32(control, A9GTimerState),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
static const VMStateDescription vmstate_a9_gtimer = {
.name = "arm.cortex-a9-global-timer",
.version_id = 1,
@@ -344,6 +361,10 @@ static const VMStateDescription vmstate_a9_gtimer = {
1, vmstate_a9_gtimer_per_cpu,
A9GTimerPerCPU),
VMSTATE_END_OF_LIST()
+ },
+ .subsections = (const VMStateDescription*[]) {
+ &vmstate_a9_gtimer_control,
+ NULL
}
};