]> Git Repo - qemu.git/commitdiff
hw/s390x: rename tod-qemu.c to tod-tcg.c
authorCho, Yu-Chen <[email protected]>
Wed, 7 Jul 2021 10:53:12 +0000 (18:53 +0800)
committerCornelia Huck <[email protected]>
Wed, 7 Jul 2021 12:01:53 +0000 (14:01 +0200)
we stop short of renaming the actual qom object though,
so type remains TYPE_QEMU_S390_TOD, ie "s390-tod-qemu".

Signed-off-by: Claudio Fontana <[email protected]>
Signed-off-by: Cho, Yu-Chen <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Message-Id: <20210707105324[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
hw/s390x/meson.build
hw/s390x/tod-qemu.c [deleted file]
hw/s390x/tod-tcg.c [new file with mode: 0644]

index 327e9c93afa9dd0defda23edcd0dd4db43ed942d..02e81a9467e97439205f5b07413804abb4a6f5ca 100644 (file)
@@ -16,7 +16,7 @@ s390x_ss.add(files(
   'sclp.c',
   'sclpcpu.c',
   'sclpquiesce.c',
-  'tod-qemu.c',
+  'tod-tcg.c',
   'tod.c',
 ))
 s390x_ss.add(when: 'CONFIG_KVM', if_true: files(
diff --git a/hw/s390x/tod-qemu.c b/hw/s390x/tod-qemu.c
deleted file mode 100644 (file)
index e91b959..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * TOD (Time Of Day) clock - QEMU implementation
- *
- * Copyright 2018 Red Hat, Inc.
- * Author(s): David Hildenbrand <[email protected]>
- *
- * This work is licensed under the terms of the GNU GPL, version 2 or later.
- * See the COPYING file in the top-level directory.
- */
-
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-#include "qapi/error.h"
-#include "hw/s390x/tod.h"
-#include "qemu/timer.h"
-#include "qemu/cutils.h"
-#include "qemu/module.h"
-#include "cpu.h"
-#include "tcg_s390x.h"
-
-static void qemu_s390_tod_get(const S390TODState *td, S390TOD *tod,
-                              Error **errp)
-{
-    *tod = td->base;
-
-    tod->low += time2tod(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL));
-    if (tod->low < td->base.low) {
-        tod->high++;
-    }
-}
-
-static void qemu_s390_tod_set(S390TODState *td, const S390TOD *tod,
-                              Error **errp)
-{
-    CPUState *cpu;
-
-    td->base = *tod;
-
-    td->base.low -= time2tod(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL));
-    if (td->base.low > tod->low) {
-        td->base.high--;
-    }
-
-    /*
-     * The TOD has been changed and we have to recalculate the CKC values
-     * for all CPUs. We do this asynchronously, as "SET CLOCK should be
-     * issued only while all other activity on all CPUs .. has been
-     * suspended".
-     */
-    CPU_FOREACH(cpu) {
-        async_run_on_cpu(cpu, tcg_s390_tod_updated, RUN_ON_CPU_NULL);
-    }
-}
-
-static void qemu_s390_tod_class_init(ObjectClass *oc, void *data)
-{
-    S390TODClass *tdc = S390_TOD_CLASS(oc);
-
-    tdc->get = qemu_s390_tod_get;
-    tdc->set = qemu_s390_tod_set;
-}
-
-static void qemu_s390_tod_init(Object *obj)
-{
-    S390TODState *td = S390_TOD(obj);
-    struct tm tm;
-
-    qemu_get_timedate(&tm, 0);
-    td->base.high = 0;
-    td->base.low = TOD_UNIX_EPOCH + (time2tod(mktimegm(&tm)) * 1000000000ULL);
-    if (td->base.low < TOD_UNIX_EPOCH) {
-        td->base.high += 1;
-    }
-}
-
-static TypeInfo qemu_s390_tod_info = {
-    .name = TYPE_QEMU_S390_TOD,
-    .parent = TYPE_S390_TOD,
-    .instance_size = sizeof(S390TODState),
-    .instance_init = qemu_s390_tod_init,
-    .class_init = qemu_s390_tod_class_init,
-    .class_size = sizeof(S390TODClass),
-};
-
-static void register_types(void)
-{
-    type_register_static(&qemu_s390_tod_info);
-}
-type_init(register_types);
diff --git a/hw/s390x/tod-tcg.c b/hw/s390x/tod-tcg.c
new file mode 100644 (file)
index 0000000..aa44deb
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * TOD (Time Of Day) clock - TCG implementation
+ *
+ * Copyright 2018 Red Hat, Inc.
+ * Author(s): David Hildenbrand <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "qapi/error.h"
+#include "hw/s390x/tod.h"
+#include "qemu/timer.h"
+#include "qemu/cutils.h"
+#include "qemu/module.h"
+#include "cpu.h"
+#include "tcg_s390x.h"
+
+static void qemu_s390_tod_get(const S390TODState *td, S390TOD *tod,
+                              Error **errp)
+{
+    *tod = td->base;
+
+    tod->low += time2tod(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL));
+    if (tod->low < td->base.low) {
+        tod->high++;
+    }
+}
+
+static void qemu_s390_tod_set(S390TODState *td, const S390TOD *tod,
+                              Error **errp)
+{
+    CPUState *cpu;
+
+    td->base = *tod;
+
+    td->base.low -= time2tod(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL));
+    if (td->base.low > tod->low) {
+        td->base.high--;
+    }
+
+    /*
+     * The TOD has been changed and we have to recalculate the CKC values
+     * for all CPUs. We do this asynchronously, as "SET CLOCK should be
+     * issued only while all other activity on all CPUs .. has been
+     * suspended".
+     */
+    CPU_FOREACH(cpu) {
+        async_run_on_cpu(cpu, tcg_s390_tod_updated, RUN_ON_CPU_NULL);
+    }
+}
+
+static void qemu_s390_tod_class_init(ObjectClass *oc, void *data)
+{
+    S390TODClass *tdc = S390_TOD_CLASS(oc);
+
+    tdc->get = qemu_s390_tod_get;
+    tdc->set = qemu_s390_tod_set;
+}
+
+static void qemu_s390_tod_init(Object *obj)
+{
+    S390TODState *td = S390_TOD(obj);
+    struct tm tm;
+
+    qemu_get_timedate(&tm, 0);
+    td->base.high = 0;
+    td->base.low = TOD_UNIX_EPOCH + (time2tod(mktimegm(&tm)) * 1000000000ULL);
+    if (td->base.low < TOD_UNIX_EPOCH) {
+        td->base.high += 1;
+    }
+}
+
+static TypeInfo qemu_s390_tod_info = {
+    .name = TYPE_QEMU_S390_TOD,
+    .parent = TYPE_S390_TOD,
+    .instance_size = sizeof(S390TODState),
+    .instance_init = qemu_s390_tod_init,
+    .class_init = qemu_s390_tod_class_init,
+    .class_size = sizeof(S390TODClass),
+};
+
+static void register_types(void)
+{
+    type_register_static(&qemu_s390_tod_info);
+}
+type_init(register_types);
This page took 0.032185 seconds and 4 git commands to generate.