thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
62547e
From 90fcfe4b07afc5299c5ee69fa663ca46b597fd4b Mon Sep 17 00:00:00 2001
62547e
From: Nico Boehr <nrb@linux.ibm.com>
62547e
Date: Wed, 12 Oct 2022 14:32:29 +0200
62547e
Subject: [PATCH] s390x/tod-kvm: don't save/restore the TOD in PV guests
62547e
MIME-Version: 1.0
62547e
Content-Type: text/plain; charset=UTF-8
62547e
Content-Transfer-Encoding: 8bit
62547e
62547e
RH-Author: Cédric Le Goater <clg@redhat.com>
62547e
RH-MergeRequest: 244: s390x/tod-kvm: don't save/restore the TOD in PV guests
62547e
RH-Bugzilla: 2155448
62547e
RH-Acked-by: David Hildenbrand <david@redhat.com>
62547e
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
62547e
RH-Acked-by: Thomas Huth <thuth@redhat.com>
62547e
RH-Commit: [1/1] 3cb3154dd7c1549c54cf8c0483b5f23b235f6db3
62547e
62547e
Under PV, the guest's TOD clock is under control of the ultravisor and the
62547e
hypervisor cannot change it.
62547e
62547e
With upcoming kernel changes[1], the Linux kernel will reject QEMU's
62547e
request to adjust the guest's clock in this case, so don't attempt to set
62547e
the clock.
62547e
62547e
This avoids the following warning message on save/restore of a PV guest:
62547e
62547e
warning: Unable to set KVM guest TOD clock: Operation not supported
62547e
62547e
[1] https://lore.kernel.org/all/20221011160712.928239-2-nrb@linux.ibm.com/
62547e
62547e
Fixes: c3347ed0d2ee ("s390x: protvirt: Support unpack facility")
62547e
Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
62547e
Message-Id: <20221012123229.1196007-1-nrb@linux.ibm.com>
62547e
[thuth: Add curly braces]
62547e
Signed-off-by: Thomas Huth <thuth@redhat.com>
62547e
(cherry picked from commit 38621181ae3cbec62e3490fbc14f6ac01642d07a)
62547e
Signed-off-by: Cédric Le Goater <clg@redhat.com>
62547e
---
62547e
 hw/s390x/tod-kvm.c | 9 +++++++++
62547e
 1 file changed, 9 insertions(+)
62547e
62547e
diff --git a/hw/s390x/tod-kvm.c b/hw/s390x/tod-kvm.c
62547e
index ec855811ae..c804c979b5 100644
62547e
--- a/hw/s390x/tod-kvm.c
62547e
+++ b/hw/s390x/tod-kvm.c
62547e
@@ -13,6 +13,7 @@
62547e
 #include "qemu/module.h"
62547e
 #include "sysemu/runstate.h"
62547e
 #include "hw/s390x/tod.h"
62547e
+#include "hw/s390x/pv.h"
62547e
 #include "kvm/kvm_s390x.h"
62547e
 
62547e
 static void kvm_s390_get_tod_raw(S390TOD *tod, Error **errp)
62547e
@@ -84,6 +85,14 @@ static void kvm_s390_tod_vm_state_change(void *opaque, bool running,
62547e
     S390TODState *td = opaque;
62547e
     Error *local_err = NULL;
62547e
 
62547e
+    /*
62547e
+     * Under PV, the clock is under ultravisor control, hence we cannot restore
62547e
+     * it on resume.
62547e
+     */
62547e
+    if (s390_is_pv()) {
62547e
+        return;
62547e
+    }
62547e
+
62547e
     if (running && td->stopped) {
62547e
         /* Set the old TOD when running the VM - start the TOD clock. */
62547e
         kvm_s390_set_tod_raw(&td->base, &local_err);
62547e
-- 
62547e
2.37.3
62547e