thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-s390x-tod-kvm-don-t-save-restore-the-TOD-in-PV-guest.patch

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