Module Name: src
Committed By: cherry
Date: Sun Feb 10 11:10:34 UTC 2019
Modified Files:
src/sys/arch/xen/include/amd64: hypercalls.h
src/sys/arch/xen/include/i386: hypercalls.h
Log Message:
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
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/xen/include/amd64/hypercalls.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/xen/include/i386/hypercalls.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/xen/include/amd64/hypercalls.h
diff -u src/sys/arch/xen/include/amd64/hypercalls.h:1.11 src/sys/arch/xen/include/amd64/hypercalls.h:1.12
--- src/sys/arch/xen/include/amd64/hypercalls.h:1.11 Sat Feb 2 12:32:55 2019
+++ src/sys/arch/xen/include/amd64/hypercalls.h Sun Feb 10 11:10:34 2019
@@ -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 @@ static inline int
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 @@ static inline long
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
Index: src/sys/arch/xen/include/i386/hypercalls.h
diff -u src/sys/arch/xen/include/i386/hypercalls.h:1.18 src/sys/arch/xen/include/i386/hypercalls.h:1.19
--- src/sys/arch/xen/include/i386/hypercalls.h:1.18 Sat Feb 2 12:32:55 2019
+++ src/sys/arch/xen/include/i386/hypercalls.h Sun Feb 10 11:10:34 2019
@@ -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 @@ HYPERVISOR_shutdown(void)
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_poweroff)),
+ _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)));
+
+#endif
return ret;
}
@@ -381,9 +393,20 @@ HYPERVISOR_crash(void)
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 @@ HYPERVISOR_reboot(void)
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 @@ HYPERVISOR_suspend(unsigned long srec)
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;
}