Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/xen/include Catchup hypercall interfaces for HYPERV...



details:   https://anonhg.NetBSD.org/src/rev/b3d37ce43e1f
branches:  trunk
changeset: 448830:b3d37ce43e1f
user:      cherry <cherry%NetBSD.org@localhost>
date:      Sun Feb 10 11:10:34 2019 +0000

description:
Catchup hypercall interfaces for HYPERVISOR_sched_op which use
arguments to __XEN_INTERFACE_VERSION__ >= 0x00030201

We've been using the sched_op_compat API with sched_op arguments.

fixes PR port-xen/53965

diffstat:

 sys/arch/xen/include/amd64/hypercalls.h |  44 ++++++++++++++++++++++++++++-
 sys/arch/xen/include/i386/hypercalls.h  |  49 +++++++++++++++++++++++++++++++-
 2 files changed, 89 insertions(+), 4 deletions(-)

diffs (176 lines):

diff -r 9d0f912fb5be -r b3d37ce43e1f sys/arch/xen/include/amd64/hypercalls.h
--- a/sys/arch/xen/include/amd64/hypercalls.h   Sun Feb 10 10:35:51 2019 +0000
+++ b/sys/arch/xen/include/amd64/hypercalls.h   Sun Feb 10 11:10:34 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hypercalls.h,v 1.11 2019/02/02 12:32:55 cherry Exp $ */
+/* $NetBSD: hypercalls.h,v 1.12 2019/02/10 11:10:34 cherry Exp $ */
 /******************************************************************************
  * hypercall.h
  * 
@@ -320,8 +320,18 @@
 HYPERVISOR_suspend(
        unsigned long srec)
 {
+#if __XEN_INTERFACE_VERSION__ >= 0x00030201
+
+       struct sched_shutdown shutdown_reason = {
+               .reason = SHUTDOWN_suspend,
+       };
+
+       return _hypercall3(int, sched_op, SCHEDOP_shutdown,
+           &shutdown_reason, srec);
+#else
        return _hypercall3(int, sched_op, SCHEDOP_shutdown,
                                 SHUTDOWN_suspend, srec);
+#endif
 }
 
 static inline long
@@ -342,21 +352,51 @@
 HYPERVISOR_shutdown(
        void)
 {
-       return _hypercall2(int, sched_op, SCHEDOP_shutdown, SHUTDOWN_poweroff);
+#if __XEN_INTERFACE_VERSION__ >= 0x00030201
+
+       struct sched_shutdown shutdown_reason = {
+               .reason = SHUTDOWN_poweroff,
+       };
+
+       return _hypercall2(int, sched_op, SCHEDOP_shutdown,
+           &shutdown_reason);
+#else
+-      return _hypercall2(int, sched_op, SCHEDOP_shutdown, SHUTDOWN_poweroff);
+#endif
 }
 
 static inline long
 HYPERVISOR_crash(
        void)
 {
+#if __XEN_INTERFACE_VERSION__ >= 0x00030201
+
+       struct sched_shutdown shutdown_reason = {
+               .reason = SHUTDOWN_crash,
+       };
+
+       return _hypercall2(int, sched_op, SCHEDOP_shutdown,
+           &shutdown_reason);
+#else
        return _hypercall2(int, sched_op, SCHEDOP_shutdown, SHUTDOWN_crash);
+#endif
 }
 
 static inline long
 HYPERVISOR_reboot(
        void)
 {
+#if __XEN_INTERFACE_VERSION__ >= 0x00030201
+
+       struct sched_shutdown shutdown_reason = {
+               .reason = SHUTDOWN_reboot,
+       };
+
+       return _hypercall2(int, sched_op, SCHEDOP_shutdown,
+           &shutdown_reason);
+#else
        return _hypercall2(int, sched_op, SCHEDOP_shutdown, SHUTDOWN_reboot);
+#endif
 }
 
 static inline int
diff -r 9d0f912fb5be -r b3d37ce43e1f sys/arch/xen/include/i386/hypercalls.h
--- a/sys/arch/xen/include/i386/hypercalls.h    Sun Feb 10 10:35:51 2019 +0000
+++ b/sys/arch/xen/include/i386/hypercalls.h    Sun Feb 10 11:10:34 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hypercalls.h,v 1.18 2019/02/02 12:32:55 cherry Exp $   */
+/*     $NetBSD: hypercalls.h,v 1.19 2019/02/10 11:10:34 cherry Exp $   */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -368,9 +368,21 @@
     long ret;
     unsigned long ign1, ign2;
 
+#if __XEN_INTERFACE_VERSION__ >= 0x00030201
+
+    struct sched_shutdown shutdown_reason = {
+           .reason = SHUTDOWN_poweroff
+    };
+
     _hypercall(__HYPERVISOR_sched_op,
+       _harg("1" (SCHEDOP_shutdown), "2"  (&shutdown_reason)),
+       _harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
+#else
+     _hypercall(__HYPERVISOR_sched_op,
        _harg("1" (SCHEDOP_shutdown), "2" (SHUTDOWN_poweroff)),
-       _harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
+       _harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
+
+#endif 
 
     return ret;
 }
@@ -381,9 +393,20 @@
     long ret;
     unsigned long ign1, ign2;
 
+#if __XEN_INTERFACE_VERSION__ >= 0x00030201
+
+    struct sched_shutdown shutdown_reason = {
+           .reason = SHUTDOWN_crash
+    };
+
+    _hypercall(__HYPERVISOR_sched_op,
+       _harg("1" (SCHEDOP_shutdown), "2"  (&shutdown_reason)),
+       _harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
+#else
     _hypercall(__HYPERVISOR_sched_op,
        _harg("1" (SCHEDOP_shutdown), "2" (SHUTDOWN_crash)),
        _harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
+#endif
 
     return ret;
 }
@@ -394,9 +417,20 @@
     long ret;
     unsigned long ign1, ign2;
 
+#if __XEN_INTERFACE_VERSION__ >= 0x00030201
+
+    struct sched_shutdown shutdown_reason = {
+           .reason = SHUTDOWN_reboot
+    };
+
+    _hypercall(__HYPERVISOR_sched_op,
+       _harg("1" (SCHEDOP_shutdown), "2"  (&shutdown_reason)),
+       _harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
+#else
     _hypercall(__HYPERVISOR_sched_op,
        _harg("1" (SCHEDOP_shutdown), "2" (SHUTDOWN_reboot)),
        _harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
+#endif
 
     return ret;
 }
@@ -407,9 +441,20 @@
     long ret;
     unsigned long ign1, ign2, ign3;
 
+#if __XEN_INTERFACE_VERSION__ >= 0x00030201
+
+    struct sched_shutdown shutdown_reason = {
+           .reason = SHUTDOWN_suspend
+    };
+
+    _hypercall(__HYPERVISOR_sched_op,
+       _harg("1" (SCHEDOP_shutdown), "2"  (&shutdown_reason), "3" (srec)),
+       _harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)));
+#else
     _hypercall(__HYPERVISOR_sched_op,
        _harg("1" (SCHEDOP_shutdown), "2" (SHUTDOWN_suspend), "3" (srec)),
        _harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)));
+#endif
 
     return ret;
 }



Home | Main Index | Thread Index | Old Index