aboutsummaryrefslogtreecommitdiff
path: root/hw/char/pl011.c
diff options
context:
space:
mode:
authorGavin Shan <gshan@redhat.com>2021-03-18 10:38:01 +0800
committerPeter Maydell <peter.maydell@linaro.org>2021-03-23 11:47:31 +0000
commite6fa978d8343ec7cf20b9c8b2dcb390646242457 (patch)
tree58d0e2cd190a483082ebafdf70c12197549c3865 /hw/char/pl011.c
parent5ca634afcf83215a9a54ca6e66032325b5ffb5f6 (diff)
downloadqemu-e6fa978d8343ec7cf20b9c8b2dcb390646242457.zip
qemu-e6fa978d8343ec7cf20b9c8b2dcb390646242457.tar.gz
qemu-e6fa978d8343ec7cf20b9c8b2dcb390646242457.tar.bz2
hw/arm/virt: Disable pl011 clock migration if needed
A clock is added by commit aac63e0e6ea3 ("hw/char/pl011: add a clock input") since v5.2.0 which corresponds to virt-5.2 machine type. It causes backwards migration failure from upstream to downstream (v5.1.0) when the machine type is specified with virt-5.1. This fixes the issue by following instructions from section "Connecting subsections to properties" in docs/devel/migration.rst. With this applied, the PL011 clock is migrated based on the machine type. virt-5.2 or newer: migration virt-5.1 or older: non-migration Cc: qemu-stable@nongnu.org # v5.2.0+ Fixes: aac63e0e6ea3 ("hw/char/pl011: add a clock input") Suggested-by: Andrew Jones <drjones@redhat.com> Signed-off-by: Gavin Shan <gshan@redhat.com> Reviewed-by: Andrew Jones <drjones@redhat.com> Message-id: 20210318023801.18287-1-gshan@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/char/pl011.c')
-rw-r--r--hw/char/pl011.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/char/pl011.c b/hw/char/pl011.c
index c5621a1..dc85527 100644
--- a/hw/char/pl011.c
+++ b/hw/char/pl011.c
@@ -322,10 +322,18 @@ static const MemoryRegionOps pl011_ops = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
+static bool pl011_clock_needed(void *opaque)
+{
+ PL011State *s = PL011(opaque);
+
+ return s->migrate_clk;
+}
+
static const VMStateDescription vmstate_pl011_clock = {
.name = "pl011/clock",
.version_id = 1,
.minimum_version_id = 1,
+ .needed = pl011_clock_needed,
.fields = (VMStateField[]) {
VMSTATE_CLOCK(clk, PL011State),
VMSTATE_END_OF_LIST()
@@ -363,6 +371,7 @@ static const VMStateDescription vmstate_pl011 = {
static Property pl011_properties[] = {
DEFINE_PROP_CHR("chardev", PL011State, chr),
+ DEFINE_PROP_BOOL("migrate-clk", PL011State, migrate_clk, true),
DEFINE_PROP_END_OF_LIST(),
};