26ba25
From 2c2a89b2c366969ef32d9ede7ff0af92d22eee10 Mon Sep 17 00:00:00 2001
26ba25
From: David Hildenbrand <david@redhat.com>
26ba25
Date: Fri, 21 Dec 2018 15:36:10 +0000
26ba25
Subject: [PATCH 08/22] s390x/tcg: rearm the CKC timer during migration
26ba25
26ba25
RH-Author: David Hildenbrand <david@redhat.com>
26ba25
Message-id: <20181221153614.27961-9-david@redhat.com>
26ba25
Patchwork-id: 83752
26ba25
O-Subject: [RHEL-8.0 qemu-kvm v2 PATCH 08/12] s390x/tcg: rearm the CKC timer during migration
26ba25
Bugzilla: 1653569
26ba25
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
26ba25
RH-Acked-by: Thomas Huth <thuth@redhat.com>
26ba25
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
26ba25
26ba25
If the CPU data is migrated after the TOD clock, the CKC timer of a CPU
26ba25
is not rearmed. Let's rearm it when loading the CPU state.
26ba25
26ba25
Introduce tcg-stub.c just like kvm-stub.c for tcg specific stubs.
26ba25
26ba25
Reviewed-by: Thomas Huth <thuth@redhat.com>
26ba25
Signed-off-by: David Hildenbrand <david@redhat.com>
26ba25
Message-Id: <20180627134410.4901-9-david@redhat.com>
26ba25
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
26ba25
(cherry picked from commit 7c12f710bad60dc7e509da4e80c77e952ef0490c)
26ba25
Signed-off-by: David Hildenbrand <david@redhat.com>
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 target/s390x/Makefile.objs |  1 +
26ba25
 target/s390x/machine.c     |  6 ++++++
26ba25
 target/s390x/tcg-stub.c    | 20 ++++++++++++++++++++
26ba25
 3 files changed, 27 insertions(+)
26ba25
 create mode 100644 target/s390x/tcg-stub.c
26ba25
26ba25
diff --git a/target/s390x/Makefile.objs b/target/s390x/Makefile.objs
26ba25
index 31932de..22a9a99 100644
26ba25
--- a/target/s390x/Makefile.objs
26ba25
+++ b/target/s390x/Makefile.objs
26ba25
@@ -5,6 +5,7 @@ obj-$(CONFIG_SOFTMMU) += machine.o ioinst.o arch_dump.o mmu_helper.o diag.o
26ba25
 obj-$(CONFIG_SOFTMMU) += sigp.o
26ba25
 obj-$(CONFIG_KVM) += kvm.o
26ba25
 obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
26ba25
+obj-$(call lnot,$(CONFIG_TCG)) += tcg-stub.o
26ba25
 
26ba25
 # build and run feature list generator
26ba25
 feat-src = $(SRC_PATH)/target/$(TARGET_BASE_ARCH)/
26ba25
diff --git a/target/s390x/machine.c b/target/s390x/machine.c
26ba25
index 8421deb..cb792aa 100644
26ba25
--- a/target/s390x/machine.c
26ba25
+++ b/target/s390x/machine.c
26ba25
@@ -19,6 +19,7 @@
26ba25
 #include "cpu.h"
26ba25
 #include "internal.h"
26ba25
 #include "kvm_s390x.h"
26ba25
+#include "tcg_s390x.h"
26ba25
 #include "sysemu/kvm.h"
26ba25
 
26ba25
 static int cpu_post_load(void *opaque, int version_id)
26ba25
@@ -34,6 +35,11 @@ static int cpu_post_load(void *opaque, int version_id)
26ba25
         return kvm_s390_vcpu_interrupt_post_load(cpu);
26ba25
     }
26ba25
 
26ba25
+    if (tcg_enabled()) {
26ba25
+        /* Rearm the CKC timer if necessary */
26ba25
+        tcg_s390_tod_updated(CPU(cpu), RUN_ON_CPU_NULL);
26ba25
+    }
26ba25
+
26ba25
     return 0;
26ba25
 }
26ba25
 
26ba25
diff --git a/target/s390x/tcg-stub.c b/target/s390x/tcg-stub.c
26ba25
new file mode 100644
26ba25
index 0000000..c93501d
26ba25
--- /dev/null
26ba25
+++ b/target/s390x/tcg-stub.c
26ba25
@@ -0,0 +1,20 @@
26ba25
+/*
26ba25
+ * QEMU TCG support -- s390x specific function stubs.
26ba25
+ *
26ba25
+ * Copyright (C) 2018 Red Hat Inc
26ba25
+ *
26ba25
+ * Authors:
26ba25
+ *   David Hildenbrand <david@redhat.com>
26ba25
+ *
26ba25
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
26ba25
+ * See the COPYING file in the top-level directory.
26ba25
+ */
26ba25
+
26ba25
+#include "qemu/osdep.h"
26ba25
+#include "qemu-common.h"
26ba25
+#include "cpu.h"
26ba25
+#include "tcg_s390x.h"
26ba25
+
26ba25
+void tcg_s390_tod_updated(CPUState *cs, run_on_cpu_data opaque)
26ba25
+{
26ba25
+}
26ba25
-- 
26ba25
1.8.3.1
26ba25