yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-s390x-tod-factor-out-TOD-into-separate-device.patch

ae23c9
From cd498a086077cab11fbc695336db52ba819201bd Mon Sep 17 00:00:00 2001
ae23c9
From: David Hildenbrand <david@redhat.com>
ae23c9
Date: Fri, 21 Dec 2018 15:36:05 +0000
ae23c9
Subject: [PATCH 03/22] s390x/tod: factor out TOD into separate device
ae23c9
ae23c9
RH-Author: David Hildenbrand <david@redhat.com>
ae23c9
Message-id: <20181221153614.27961-4-david@redhat.com>
ae23c9
Patchwork-id: 83749
ae23c9
O-Subject: [RHEL-8.0 qemu-kvm v2 PATCH 03/12] s390x/tod: factor out TOD into separate device
ae23c9
Bugzilla: 1653569
ae23c9
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
ae23c9
RH-Acked-by: Thomas Huth <thuth@redhat.com>
ae23c9
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
ae23c9
Conflicts:
ae23c9
	hw/s390x/s390-virtio-ccw.c: contextual conflict (console init
ae23c9
				    rework)
ae23c9
ae23c9
Let's treat this like a separate device. TCG will have to store the
ae23c9
actual state/time later on.
ae23c9
ae23c9
Include cpu-qom.h in kvm_s390x.h (due to S390CPU) to compile tod-kvm.c.
ae23c9
ae23c9
Reviewed-by: Thomas Huth <thuth@redhat.com>
ae23c9
Signed-off-by: David Hildenbrand <david@redhat.com>
ae23c9
Message-Id: <20180627134410.4901-4-david@redhat.com>
ae23c9
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
ae23c9
(cherry picked from commit 8046f374a64b81fdf4f71f7a433bf4035d501521)
ae23c9
Signed-off-by: David Hildenbrand <david@redhat.com>
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 hw/s390x/Makefile.objs     |   3 ++
ae23c9
 hw/s390x/s390-virtio-ccw.c |  57 ++--------------------
ae23c9
 hw/s390x/tod-kvm.c         |  64 ++++++++++++++++++++++++
ae23c9
 hw/s390x/tod-qemu.c        |  49 +++++++++++++++++++
ae23c9
 hw/s390x/tod.c             | 119 +++++++++++++++++++++++++++++++++++++++++++++
ae23c9
 include/hw/s390x/tod.h     |  46 ++++++++++++++++++
ae23c9
 target/s390x/cpu.c         |  32 ------------
ae23c9
 target/s390x/cpu.h         |   2 -
ae23c9
 target/s390x/kvm_s390x.h   |   2 +
ae23c9
 9 files changed, 286 insertions(+), 88 deletions(-)
ae23c9
 create mode 100644 hw/s390x/tod-kvm.c
ae23c9
 create mode 100644 hw/s390x/tod-qemu.c
ae23c9
 create mode 100644 hw/s390x/tod.c
ae23c9
 create mode 100644 include/hw/s390x/tod.h
ae23c9
ae23c9
diff --git a/hw/s390x/Makefile.objs b/hw/s390x/Makefile.objs
ae23c9
index 655d1ac..add89b1 100644
ae23c9
--- a/hw/s390x/Makefile.objs
ae23c9
+++ b/hw/s390x/Makefile.objs
ae23c9
@@ -14,6 +14,9 @@ obj-$(CONFIG_PCI) += s390-pci-bus.o s390-pci-inst.o
ae23c9
 obj-$(call lnot,$(CONFIG_PCI)) += s390-pci-stub.o
ae23c9
 obj-y += s390-skeys.o
ae23c9
 obj-y += s390-stattrib.o
ae23c9
+obj-y += tod.o
ae23c9
+obj-$(CONFIG_KVM) += tod-kvm.o
ae23c9
+obj-$(CONFIG_TCG) += tod-qemu.o
ae23c9
 obj-$(CONFIG_KVM) += s390-skeys-kvm.o
ae23c9
 obj-$(CONFIG_KVM) += s390-stattrib-kvm.o
ae23c9
 obj-y += s390-ccw.o
ae23c9
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
ae23c9
index 43a8213..8f93edc 100644
ae23c9
--- a/hw/s390x/s390-virtio-ccw.c
ae23c9
+++ b/hw/s390x/s390-virtio-ccw.c
ae23c9
@@ -36,6 +36,7 @@
ae23c9
 #include "migration/register.h"
ae23c9
 #include "cpu_models.h"
ae23c9
 #include "hw/nmi.h"
ae23c9
+#include "hw/s390x/tod.h"
ae23c9
 
ae23c9
 S390CPU *s390_cpu_addr2state(uint16_t cpu_addr)
ae23c9
 {
ae23c9
@@ -188,58 +189,6 @@ static void s390_memory_init(ram_addr_t mem_size)
ae23c9
     s390_stattrib_init();
ae23c9
 }
ae23c9
 
ae23c9
-#define S390_TOD_CLOCK_VALUE_MISSING    0x00
ae23c9
-#define S390_TOD_CLOCK_VALUE_PRESENT    0x01
ae23c9
-
ae23c9
-static void gtod_save(QEMUFile *f, void *opaque)
ae23c9
-{
ae23c9
-    uint64_t tod_low;
ae23c9
-    uint8_t tod_high;
ae23c9
-    int r;
ae23c9
-
ae23c9
-    r = s390_get_clock(&tod_high, &tod_low);
ae23c9
-    if (r) {
ae23c9
-        warn_report("Unable to get guest clock for migration: %s",
ae23c9
-                    strerror(-r));
ae23c9
-        error_printf("Guest clock will not be migrated "
ae23c9
-                     "which could cause the guest to hang.");
ae23c9
-        qemu_put_byte(f, S390_TOD_CLOCK_VALUE_MISSING);
ae23c9
-        return;
ae23c9
-    }
ae23c9
-
ae23c9
-    qemu_put_byte(f, S390_TOD_CLOCK_VALUE_PRESENT);
ae23c9
-    qemu_put_byte(f, tod_high);
ae23c9
-    qemu_put_be64(f, tod_low);
ae23c9
-}
ae23c9
-
ae23c9
-static int gtod_load(QEMUFile *f, void *opaque, int version_id)
ae23c9
-{
ae23c9
-    uint64_t tod_low;
ae23c9
-    uint8_t tod_high;
ae23c9
-    int r;
ae23c9
-
ae23c9
-    if (qemu_get_byte(f) == S390_TOD_CLOCK_VALUE_MISSING) {
ae23c9
-        warn_report("Guest clock was not migrated. This could "
ae23c9
-                    "cause the guest to hang.");
ae23c9
-        return 0;
ae23c9
-    }
ae23c9
-
ae23c9
-    tod_high = qemu_get_byte(f);
ae23c9
-    tod_low = qemu_get_be64(f);
ae23c9
-
ae23c9
-    r = s390_set_clock(&tod_high, &tod_low);
ae23c9
-    if (r) {
ae23c9
-        error_report("Unable to set KVM guest TOD clock: %s", strerror(-r));
ae23c9
-    }
ae23c9
-
ae23c9
-    return r;
ae23c9
-}
ae23c9
-
ae23c9
-static SaveVMHandlers savevm_gtod = {
ae23c9
-    .save_state = gtod_save,
ae23c9
-    .load_state = gtod_load,
ae23c9
-};
ae23c9
-
ae23c9
 static void s390_init_ipl_dev(const char *kernel_filename,
ae23c9
                               const char *kernel_cmdline,
ae23c9
                               const char *initrd_filename, const char *firmware,
ae23c9
@@ -350,8 +299,8 @@ static void ccw_init(MachineState *machine)
ae23c9
     /* Create VirtIO network adapters */
ae23c9
     s390_create_virtio_net(BUS(css_bus), "virtio-net-ccw");
ae23c9
 
ae23c9
-    /* Register savevm handler for guest TOD clock */
ae23c9
-    register_savevm_live(NULL, "todclock", 0, 1, &savevm_gtod, NULL);
ae23c9
+    /* init the TOD clock */
ae23c9
+    s390_init_tod();
ae23c9
 }
ae23c9
 
ae23c9
 static void s390_cpu_plug(HotplugHandler *hotplug_dev,
ae23c9
diff --git a/hw/s390x/tod-kvm.c b/hw/s390x/tod-kvm.c
ae23c9
new file mode 100644
ae23c9
index 0000000..df564ab
ae23c9
--- /dev/null
ae23c9
+++ b/hw/s390x/tod-kvm.c
ae23c9
@@ -0,0 +1,64 @@
ae23c9
+/*
ae23c9
+ * TOD (Time Of Day) clock - KVM implementation
ae23c9
+ *
ae23c9
+ * Copyright 2018 Red Hat, Inc.
ae23c9
+ * Author(s): David Hildenbrand <david@redhat.com>
ae23c9
+ *
ae23c9
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
ae23c9
+ * See the COPYING file in the top-level directory.
ae23c9
+ */
ae23c9
+
ae23c9
+#include "qemu/osdep.h"
ae23c9
+#include "qapi/error.h"
ae23c9
+#include "hw/s390x/tod.h"
ae23c9
+#include "kvm_s390x.h"
ae23c9
+
ae23c9
+static void kvm_s390_tod_get(const S390TODState *td, S390TOD *tod, Error **errp)
ae23c9
+{
ae23c9
+    int r;
ae23c9
+
ae23c9
+    r = kvm_s390_get_clock_ext(&tod->high, &tod->low);
ae23c9
+    if (r == -ENXIO) {
ae23c9
+        r = kvm_s390_get_clock(&tod->high, &tod->low);
ae23c9
+    }
ae23c9
+    if (r) {
ae23c9
+        error_setg(errp, "Unable to get KVM guest TOD clock: %s",
ae23c9
+                   strerror(-r));
ae23c9
+    }
ae23c9
+}
ae23c9
+
ae23c9
+static void kvm_s390_tod_set(S390TODState *td, const S390TOD *tod, Error **errp)
ae23c9
+{
ae23c9
+    int r;
ae23c9
+
ae23c9
+    r = kvm_s390_set_clock_ext(tod->high, tod->low);
ae23c9
+    if (r == -ENXIO) {
ae23c9
+        r = kvm_s390_set_clock(tod->high, tod->low);
ae23c9
+    }
ae23c9
+    if (r) {
ae23c9
+        error_setg(errp, "Unable to set KVM guest TOD clock: %s",
ae23c9
+                   strerror(-r));
ae23c9
+    }
ae23c9
+}
ae23c9
+
ae23c9
+static void kvm_s390_tod_class_init(ObjectClass *oc, void *data)
ae23c9
+{
ae23c9
+    S390TODClass *tdc = S390_TOD_CLASS(oc);
ae23c9
+
ae23c9
+    tdc->get = kvm_s390_tod_get;
ae23c9
+    tdc->set = kvm_s390_tod_set;
ae23c9
+}
ae23c9
+
ae23c9
+static TypeInfo kvm_s390_tod_info = {
ae23c9
+    .name = TYPE_KVM_S390_TOD,
ae23c9
+    .parent = TYPE_S390_TOD,
ae23c9
+    .instance_size = sizeof(S390TODState),
ae23c9
+    .class_init = kvm_s390_tod_class_init,
ae23c9
+    .class_size = sizeof(S390TODClass),
ae23c9
+};
ae23c9
+
ae23c9
+static void register_types(void)
ae23c9
+{
ae23c9
+    type_register_static(&kvm_s390_tod_info);
ae23c9
+}
ae23c9
+type_init(register_types);
ae23c9
diff --git a/hw/s390x/tod-qemu.c b/hw/s390x/tod-qemu.c
ae23c9
new file mode 100644
ae23c9
index 0000000..03ea1ce
ae23c9
--- /dev/null
ae23c9
+++ b/hw/s390x/tod-qemu.c
ae23c9
@@ -0,0 +1,49 @@
ae23c9
+/*
ae23c9
+ * TOD (Time Of Day) clock - QEMU implementation
ae23c9
+ *
ae23c9
+ * Copyright 2018 Red Hat, Inc.
ae23c9
+ * Author(s): David Hildenbrand <david@redhat.com>
ae23c9
+ *
ae23c9
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
ae23c9
+ * See the COPYING file in the top-level directory.
ae23c9
+ */
ae23c9
+
ae23c9
+#include "qemu/osdep.h"
ae23c9
+#include "qapi/error.h"
ae23c9
+#include "hw/s390x/tod.h"
ae23c9
+
ae23c9
+static void qemu_s390_tod_get(const S390TODState *td, S390TOD *tod,
ae23c9
+                              Error **errp)
ae23c9
+{
ae23c9
+    /* FIXME */
ae23c9
+    tod->high = 0;
ae23c9
+    tod->low = 0;
ae23c9
+}
ae23c9
+
ae23c9
+static void qemu_s390_tod_set(S390TODState *td, const S390TOD *tod,
ae23c9
+                              Error **errp)
ae23c9
+{
ae23c9
+    /* FIXME */
ae23c9
+}
ae23c9
+
ae23c9
+static void qemu_s390_tod_class_init(ObjectClass *oc, void *data)
ae23c9
+{
ae23c9
+    S390TODClass *tdc = S390_TOD_CLASS(oc);
ae23c9
+
ae23c9
+    tdc->get = qemu_s390_tod_get;
ae23c9
+    tdc->set = qemu_s390_tod_set;
ae23c9
+}
ae23c9
+
ae23c9
+static TypeInfo qemu_s390_tod_info = {
ae23c9
+    .name = TYPE_QEMU_S390_TOD,
ae23c9
+    .parent = TYPE_S390_TOD,
ae23c9
+    .instance_size = sizeof(S390TODState),
ae23c9
+    .class_init = qemu_s390_tod_class_init,
ae23c9
+    .class_size = sizeof(S390TODClass),
ae23c9
+};
ae23c9
+
ae23c9
+static void register_types(void)
ae23c9
+{
ae23c9
+    type_register_static(&qemu_s390_tod_info);
ae23c9
+}
ae23c9
+type_init(register_types);
ae23c9
diff --git a/hw/s390x/tod.c b/hw/s390x/tod.c
ae23c9
new file mode 100644
ae23c9
index 0000000..0501aff
ae23c9
--- /dev/null
ae23c9
+++ b/hw/s390x/tod.c
ae23c9
@@ -0,0 +1,119 @@
ae23c9
+/*
ae23c9
+ * TOD (Time Of Day) clock
ae23c9
+ *
ae23c9
+ * Copyright 2018 Red Hat, Inc.
ae23c9
+ * Author(s): David Hildenbrand <david@redhat.com>
ae23c9
+ *
ae23c9
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
ae23c9
+ * See the COPYING file in the top-level directory.
ae23c9
+ */
ae23c9
+
ae23c9
+#include "qemu/osdep.h"
ae23c9
+#include "hw/s390x/tod.h"
ae23c9
+#include "qapi/error.h"
ae23c9
+#include "qemu/error-report.h"
ae23c9
+#include "sysemu/kvm.h"
ae23c9
+#include "migration/register.h"
ae23c9
+
ae23c9
+void s390_init_tod(void)
ae23c9
+{
ae23c9
+    Object *obj;
ae23c9
+
ae23c9
+    if (kvm_enabled()) {
ae23c9
+        obj = object_new(TYPE_KVM_S390_TOD);
ae23c9
+    } else {
ae23c9
+        obj = object_new(TYPE_QEMU_S390_TOD);
ae23c9
+    }
ae23c9
+    object_property_add_child(qdev_get_machine(), TYPE_S390_TOD, obj, NULL);
ae23c9
+    object_unref(obj);
ae23c9
+
ae23c9
+    qdev_init_nofail(DEVICE(obj));
ae23c9
+}
ae23c9
+
ae23c9
+#define S390_TOD_CLOCK_VALUE_MISSING    0x00
ae23c9
+#define S390_TOD_CLOCK_VALUE_PRESENT    0x01
ae23c9
+
ae23c9
+static void s390_tod_save(QEMUFile *f, void *opaque)
ae23c9
+{
ae23c9
+    S390TODState *td = opaque;
ae23c9
+    S390TODClass *tdc = S390_TOD_GET_CLASS(td);
ae23c9
+    Error *err = NULL;
ae23c9
+    S390TOD tod;
ae23c9
+
ae23c9
+    tdc->get(td, &tod, &err;;
ae23c9
+    if (err) {
ae23c9
+        warn_report_err(err);
ae23c9
+        error_printf("Guest clock will not be migrated "
ae23c9
+                     "which could cause the guest to hang.");
ae23c9
+        qemu_put_byte(f, S390_TOD_CLOCK_VALUE_MISSING);
ae23c9
+        return;
ae23c9
+    }
ae23c9
+
ae23c9
+    qemu_put_byte(f, S390_TOD_CLOCK_VALUE_PRESENT);
ae23c9
+    qemu_put_byte(f, tod.high);
ae23c9
+    qemu_put_be64(f, tod.low);
ae23c9
+}
ae23c9
+
ae23c9
+static int s390_tod_load(QEMUFile *f, void *opaque, int version_id)
ae23c9
+{
ae23c9
+    S390TODState *td = opaque;
ae23c9
+    S390TODClass *tdc = S390_TOD_GET_CLASS(td);
ae23c9
+    Error *err = NULL;
ae23c9
+    S390TOD tod;
ae23c9
+
ae23c9
+    if (qemu_get_byte(f) == S390_TOD_CLOCK_VALUE_MISSING) {
ae23c9
+        warn_report("Guest clock was not migrated. This could "
ae23c9
+                    "cause the guest to hang.");
ae23c9
+        return 0;
ae23c9
+    }
ae23c9
+
ae23c9
+    tod.high = qemu_get_byte(f);
ae23c9
+    tod.low = qemu_get_be64(f);
ae23c9
+
ae23c9
+    tdc->set(td, &tod, &err;;
ae23c9
+    if (err) {
ae23c9
+        error_report_err(err);
ae23c9
+        return -1;
ae23c9
+    }
ae23c9
+    return 0;
ae23c9
+}
ae23c9
+
ae23c9
+static SaveVMHandlers savevm_tod = {
ae23c9
+    .save_state = s390_tod_save,
ae23c9
+    .load_state = s390_tod_load,
ae23c9
+};
ae23c9
+
ae23c9
+static void s390_tod_realize(DeviceState *dev, Error **errp)
ae23c9
+{
ae23c9
+    S390TODState *td = S390_TOD(dev);
ae23c9
+
ae23c9
+    /* Legacy migration interface */
ae23c9
+    register_savevm_live(NULL, "todclock", 0, 1, &savevm_tod, td);
ae23c9
+}
ae23c9
+
ae23c9
+static void s390_tod_class_init(ObjectClass *oc, void *data)
ae23c9
+{
ae23c9
+    DeviceClass *dc = DEVICE_CLASS(oc);
ae23c9
+
ae23c9
+    dc->desc = "TOD (Time Of Day) Clock";
ae23c9
+    dc->realize = s390_tod_realize;
ae23c9
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
ae23c9
+
ae23c9
+    /* We only have one TOD clock in the system attached to the machine */
ae23c9
+    dc->user_creatable = false;
ae23c9
+}
ae23c9
+
ae23c9
+static TypeInfo s390_tod_info = {
ae23c9
+    .name = TYPE_S390_TOD,
ae23c9
+    .parent = TYPE_DEVICE,
ae23c9
+    .instance_size = sizeof(S390TODState),
ae23c9
+    .class_init = s390_tod_class_init,
ae23c9
+    .class_size = sizeof(S390TODClass),
ae23c9
+    .abstract = true,
ae23c9
+};
ae23c9
+
ae23c9
+static void register_types(void)
ae23c9
+{
ae23c9
+    type_register_static(&s390_tod_info);
ae23c9
+}
ae23c9
+type_init(register_types);
ae23c9
diff --git a/include/hw/s390x/tod.h b/include/hw/s390x/tod.h
ae23c9
new file mode 100644
ae23c9
index 0000000..7096b57
ae23c9
--- /dev/null
ae23c9
+++ b/include/hw/s390x/tod.h
ae23c9
@@ -0,0 +1,46 @@
ae23c9
+/*
ae23c9
+ * TOD (Time Of Day) clock
ae23c9
+ *
ae23c9
+ * Copyright 2018 Red Hat, Inc.
ae23c9
+ * Author(s): David Hildenbrand <david@redhat.com>
ae23c9
+ *
ae23c9
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
ae23c9
+ * See the COPYING file in the top-level directory.
ae23c9
+ */
ae23c9
+
ae23c9
+#ifndef HW_S390_TOD_H
ae23c9
+#define HW_S390_TOD_H
ae23c9
+
ae23c9
+#include "hw/qdev.h"
ae23c9
+
ae23c9
+typedef struct S390TOD {
ae23c9
+    uint8_t high;
ae23c9
+    uint64_t low;
ae23c9
+} S390TOD;
ae23c9
+
ae23c9
+#define TYPE_S390_TOD "s390-tod"
ae23c9
+#define S390_TOD(obj) OBJECT_CHECK(S390TODState, (obj), TYPE_S390_TOD)
ae23c9
+#define S390_TOD_CLASS(oc) OBJECT_CLASS_CHECK(S390TODClass, (oc), \
ae23c9
+                                              TYPE_S390_TOD)
ae23c9
+#define S390_TOD_GET_CLASS(obj) OBJECT_GET_CLASS(S390TODClass, (obj), \
ae23c9
+                                                 TYPE_S390_TOD)
ae23c9
+#define TYPE_KVM_S390_TOD TYPE_S390_TOD "-kvm"
ae23c9
+#define TYPE_QEMU_S390_TOD TYPE_S390_TOD "-qemu"
ae23c9
+
ae23c9
+typedef struct S390TODState {
ae23c9
+    /* private */
ae23c9
+    DeviceState parent_obj;
ae23c9
+} S390TODState;
ae23c9
+
ae23c9
+typedef struct S390TODClass {
ae23c9
+    /* private */
ae23c9
+    DeviceClass parent_class;
ae23c9
+
ae23c9
+    /* public */
ae23c9
+    void (*get)(const S390TODState *td, S390TOD *tod, Error **errp);
ae23c9
+    void (*set)(S390TODState *td, const S390TOD *tod, Error **errp);
ae23c9
+} S390TODClass;
ae23c9
+
ae23c9
+void s390_init_tod(void);
ae23c9
+
ae23c9
+#endif
ae23c9
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
ae23c9
index 1f590d1..167d089 100644
ae23c9
--- a/target/s390x/cpu.c
ae23c9
+++ b/target/s390x/cpu.c
ae23c9
@@ -391,38 +391,6 @@ unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu)
ae23c9
     return s390_count_running_cpus();
ae23c9
 }
ae23c9
 
ae23c9
-int s390_get_clock(uint8_t *tod_high, uint64_t *tod_low)
ae23c9
-{
ae23c9
-    int r = 0;
ae23c9
-
ae23c9
-    if (kvm_enabled()) {
ae23c9
-        r = kvm_s390_get_clock_ext(tod_high, tod_low);
ae23c9
-        if (r == -ENXIO) {
ae23c9
-            return kvm_s390_get_clock(tod_high, tod_low);
ae23c9
-        }
ae23c9
-    } else {
ae23c9
-        /* Fixme TCG */
ae23c9
-        *tod_high = 0;
ae23c9
-        *tod_low = 0;
ae23c9
-    }
ae23c9
-
ae23c9
-    return r;
ae23c9
-}
ae23c9
-
ae23c9
-int s390_set_clock(uint8_t *tod_high, uint64_t *tod_low)
ae23c9
-{
ae23c9
-    int r = 0;
ae23c9
-
ae23c9
-    if (kvm_enabled()) {
ae23c9
-        r = kvm_s390_set_clock_ext(*tod_high, *tod_low);
ae23c9
-        if (r == -ENXIO) {
ae23c9
-            return kvm_s390_set_clock(*tod_high, *tod_low);
ae23c9
-        }
ae23c9
-    }
ae23c9
-    /* Fixme TCG */
ae23c9
-    return r;
ae23c9
-}
ae23c9
-
ae23c9
 int s390_set_memory_limit(uint64_t new_limit, uint64_t *hw_limit)
ae23c9
 {
ae23c9
     if (kvm_enabled()) {
ae23c9
diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
ae23c9
index 86d08fa..67118c8 100644
ae23c9
--- a/target/s390x/cpu.h
ae23c9
+++ b/target/s390x/cpu.h
ae23c9
@@ -691,8 +691,6 @@ static inline uint64_t s390_build_validity_mcic(void)
ae23c9
 
ae23c9
 
ae23c9
 /* cpu.c */
ae23c9
-int s390_get_clock(uint8_t *tod_high, uint64_t *tod_low);
ae23c9
-int s390_set_clock(uint8_t *tod_high, uint64_t *tod_low);
ae23c9
 void s390_crypto_reset(void);
ae23c9
 bool s390_get_squash_mcss(void);
ae23c9
 int s390_set_memory_limit(uint64_t new_limit, uint64_t *hw_limit);
ae23c9
diff --git a/target/s390x/kvm_s390x.h b/target/s390x/kvm_s390x.h
ae23c9
index 36eb34b..6e52287 100644
ae23c9
--- a/target/s390x/kvm_s390x.h
ae23c9
+++ b/target/s390x/kvm_s390x.h
ae23c9
@@ -10,6 +10,8 @@
ae23c9
 #ifndef KVM_S390X_H
ae23c9
 #define KVM_S390X_H
ae23c9
 
ae23c9
+#include "cpu-qom.h"
ae23c9
+
ae23c9
 struct kvm_s390_irq;
ae23c9
 
ae23c9
 void kvm_s390_floating_interrupt_legacy(struct kvm_s390_irq *irq);
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9