All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hw/arm/virt: Disable pl011 clock migration if needed
@ 2021-03-18  2:38 Gavin Shan
  2021-03-18  8:09 ` Andrew Jones
  2021-03-19 10:37 ` Peter Maydell
  0 siblings, 2 replies; 3+ messages in thread
From: Gavin Shan @ 2021-03-18  2:38 UTC (permalink / raw)
  To: qemu-arm
  Cc: peter.maydell, drjones, luc, ehabkost, qemu-devel, shan.gavin,
	marcandre.lureau, pbonzini

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>
---
 hw/char/pl011.c         | 9 +++++++++
 hw/core/machine.c       | 1 +
 include/hw/char/pl011.h | 1 +
 3 files changed, 11 insertions(+)

diff --git a/hw/char/pl011.c b/hw/char/pl011.c
index c5621a195f..dc85527a5f 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(),
 };
 
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 257a664ea2..9935c6ddd5 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -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);
 
diff --git a/include/hw/char/pl011.h b/include/hw/char/pl011.h
index 33e5e5317b..dc2c90eedc 100644
--- a/include/hw/char/pl011.h
+++ b/include/hw/char/pl011.h
@@ -50,6 +50,7 @@ struct PL011State {
     CharBackend chr;
     qemu_irq irq[6];
     Clock *clk;
+    bool migrate_clk;
     const unsigned char *id;
 };
 
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] hw/arm/virt: Disable pl011 clock migration if needed
  2021-03-18  2:38 [PATCH] hw/arm/virt: Disable pl011 clock migration if needed Gavin Shan
@ 2021-03-18  8:09 ` Andrew Jones
  2021-03-19 10:37 ` Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Jones @ 2021-03-18  8:09 UTC (permalink / raw)
  To: Gavin Shan
  Cc: peter.maydell, luc, ehabkost, qemu-devel, qemu-arm, shan.gavin,
	pbonzini, marcandre.lureau

On Thu, Mar 18, 2021 at 10:38:01AM +0800, Gavin Shan wrote:
> 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>
> ---
>  hw/char/pl011.c         | 9 +++++++++
>  hw/core/machine.c       | 1 +
>  include/hw/char/pl011.h | 1 +
>  3 files changed, 11 insertions(+)

Reviewed-by: Andrew Jones <drjones@redhat.com>

And I agree with applying to 5.2 stable.

Thanks,
drew



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hw/arm/virt: Disable pl011 clock migration if needed
  2021-03-18  2:38 [PATCH] hw/arm/virt: Disable pl011 clock migration if needed Gavin Shan
  2021-03-18  8:09 ` Andrew Jones
@ 2021-03-19 10:37 ` Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2021-03-19 10:37 UTC (permalink / raw)
  To: Gavin Shan
  Cc: Andrew Jones, Luc Michel, Eduardo Habkost, QEMU Developers,
	Shan Gavin, qemu-arm, Paolo Bonzini, Marc-André Lureau

On Thu, 18 Mar 2021 at 02:38, Gavin Shan <gshan@redhat.com> wrote:
>
> 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>



Applied to target-arm.next, thanks.

-- PMM


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-19 10:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18  2:38 [PATCH] hw/arm/virt: Disable pl011 clock migration if needed Gavin Shan
2021-03-18  8:09 ` Andrew Jones
2021-03-19 10:37 ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.