summaryrefslogtreecommitdiffstats
path: root/sys/dev/pv/xen.c
diff options
context:
space:
mode:
authorreyk <reyk@openbsd.org>2017-01-10 17:16:39 +0000
committerreyk <reyk@openbsd.org>2017-01-10 17:16:39 +0000
commit0f265ed38c421156a6317ea5c28b91625d1e17d5 (patch)
tree3d0b2063f43f41ade9cdf8cdec3bd2e04309eda7 /sys/dev/pv/xen.c
parentsimplify; NODE_ENDED does no harm in man(7) (diff)
downloadwireguard-openbsd-0f265ed38c421156a6317ea5c28b91625d1e17d5.tar.xz
wireguard-openbsd-0f265ed38c421156a6317ea5c28b91625d1e17d5.zip
Introduce pvbus_reboot() and pvbus_shutdown() to move the repeated
tasks from the PV drivers into a central place. While here, we figured out that it is not needed to check for allowpowerdown on the hypervisor-initiated shutdown requests. OK mikeb@
Diffstat (limited to 'sys/dev/pv/xen.c')
-rw-r--r--sys/dev/pv/xen.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/sys/dev/pv/xen.c b/sys/dev/pv/xen.c
index c1a05e32816..dbc1d670a17 100644
--- a/sys/dev/pv/xen.c
+++ b/sys/dev/pv/xen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xen.c,v 1.70 2016/12/21 12:17:15 mikeb Exp $ */
+/* $OpenBSD: xen.c,v 1.71 2017/01/10 17:16:39 reyk Exp $ */
/*
* Copyright (c) 2015 Mike Belopuhov
@@ -223,27 +223,9 @@ xen_control(void *arg)
xs_setprop(sc, "control", "shutdown", "", 0);
if (strcmp(action, "halt") == 0 || strcmp(action, "poweroff") == 0) {
- extern int allowpowerdown;
-
- if (allowpowerdown == 0)
- return;
-
- suspend_randomness();
-
- log(LOG_KERN | LOG_NOTICE, "Shutting down in response to "
- "request from Xen host\n");
- prsignal(initprocess, SIGUSR2);
+ pvbus_shutdown(&sc->sc_dev);
} else if (strcmp(action, "reboot") == 0) {
- extern int allowpowerdown;
-
- if (allowpowerdown == 0)
- return;
-
- suspend_randomness();
-
- log(LOG_KERN | LOG_NOTICE, "Rebooting in response to request "
- "from Xen host\n");
- prsignal(initprocess, SIGINT);
+ pvbus_reboot(&sc->sc_dev);
} else if (strcmp(action, "crash") == 0) {
panic("xen told us to do this");
} else if (strcmp(action, "suspend") == 0) {