hw/arm/virt: Disable pl011 clock migration if needed
PATCH 1/1 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
--- hw/char/pl011.c | 9 +++++++++ hw/core/machine.c | 1 + include/hw/char/pl011.h | 1 + 3 files changed, 11 insertions(+)
hw/char/pl011.c +9 -0
@@ -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 (), };
hw/core/machine.c +1 -0
@@ -52,6 +52,7 @@ GlobalProperty hw_compat_5_1[] = { { "virtio-scsi-device", "num_queues", "1"}, { "nvme", "use-intel-id", "on"}, { "pvpanic", "events", "1"}, /* PVPANIC_PANICKED */ + { "pl011", "migrate-clk", "off" }, };const size_t hw_compat_5_1_len =G_N_ELEMENTS (hw_compat_5_1);
include/hw/char/pl011.h +1 -0
@@ -50,6 +50,7 @@ struct PL011State {CharBackend chr;qemu_irq irq[6 ];Clock *clk; +bool migrate_clk;const unsigned char *id; };
Signature · 1 line
2.23.0
Quoted 16 lines · Gavin Shan
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-migrationCc [email protected] # v5.2.0+Fixes aac63e0e6ea3 ("hw/char/pl011: add a clock input")Suggested-by Andrew Jones <[email protected]>Signed-off-by Gavin Shan <[email protected]>
Quoted 5 lines
--- hw/char/pl011.c | 9 +++++++++ hw/core/machine.c | 1 + include/hw/char/pl011.h | 1 + 3 files changed, 11 insertions(+)
And I agree with applying to 5.2 stable.
Thanks,
drew
Peter Maydell
AppliedQuoted 10 lines · Gavin Shan
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.
Quoted 7 lines
virt-5.2 or newer: migration
virt-5.1 or older: non-migrationCc [email protected] # v5.2.0+Fixes aac63e0e6ea3 ("hw/char/pl011: add a clock input")Suggested-by Andrew Jones <[email protected]>Signed-off-by Gavin Shan <[email protected]>
Applied to target-arm.next, thanks.
-- PMM