Commit ca46f328 authored by Roger Pau Monné's avatar Roger Pau Monné
Browse files

xen: use an hypercall for shutdown and reboot

When running as a Xen guest it's easier to use an hypercall in order
to do power management operations (power off, power cycle). Do this
for all supported guest types (HVM and PVH). Note that for HVM the
power operation could also be done using ACPI, but there's no reason
to differentiate between PVH and HVM.

While there fix the shutdown handler to properly differentiate between
power cycle and power off requests.

Reported by: Freddy DISSAUX
MFC: 1 week
Sponsored by: Citrix Systems R&D
parent 9b6aa99e
......@@ -347,17 +347,12 @@ xctrl_crash()
static void
xen_pv_shutdown_final(void *arg, int howto)
shutdown_final(void *arg, int howto)
* Inform the hypervisor that shutdown is complete.
* This is not necessary in HVM domains since Xen
* emulates ACPI in that mode and FreeBSD's ACPI
* support will request this transition.
if (howto & (RB_HALT | RB_POWEROFF))
/* Inform the hypervisor that shutdown is complete. */
if (howto & RB_POWEROFF)
else if (howto & RB_POWERCYCLE)
......@@ -453,9 +448,8 @@ xctrl_attach(device_t dev)
xctrl->xctrl_watch.max_pending = 1;
if (xen_pv_shutdown_handler())
EVENTHANDLER_REGISTER(shutdown_final, xen_pv_shutdown_final, NULL,
EVENTHANDLER_REGISTER(shutdown_final, shutdown_final, NULL,
return (0);
......@@ -56,13 +56,6 @@ xen_has_percpu_evtchn(void)
return (!xen_hvm_domain() || xen_vector_callback_enabled);
static inline bool
return (xen_pv_domain());
static inline bool
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment