xen: add shutdown hook for PVH
Add the PV shutdown hook to PVH. Sponsored by: Citrix Systems R&D Approved by: gibbs dev/xen/control/control.c: - Make xen_pv_shutdown_final available on XENHVM builds. - Register the Xen PV shutdown hook for PVH guests.
This commit is contained in:
parent
ea13728e4a
commit
d5f09830c2
@ -316,21 +316,6 @@ xctrl_suspend()
|
||||
EVENTHANDLER_INVOKE(power_resume);
|
||||
}
|
||||
|
||||
static void
|
||||
xen_pv_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))
|
||||
HYPERVISOR_shutdown(SHUTDOWN_poweroff);
|
||||
else
|
||||
HYPERVISOR_shutdown(SHUTDOWN_reboot);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* HVM mode suspension. */
|
||||
@ -440,6 +425,21 @@ xctrl_crash()
|
||||
panic("Xen directed crash");
|
||||
}
|
||||
|
||||
static void
|
||||
xen_pv_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))
|
||||
HYPERVISOR_shutdown(SHUTDOWN_poweroff);
|
||||
else
|
||||
HYPERVISOR_shutdown(SHUTDOWN_reboot);
|
||||
}
|
||||
|
||||
/*------------------------------ Event Reception -----------------------------*/
|
||||
static void
|
||||
xctrl_on_watch_event(struct xs_watch *watch, const char **vec, unsigned int len)
|
||||
@ -522,10 +522,9 @@ xctrl_attach(device_t dev)
|
||||
xctrl->xctrl_watch.callback_data = (uintptr_t)xctrl;
|
||||
xs_register_watch(&xctrl->xctrl_watch);
|
||||
|
||||
#ifndef XENHVM
|
||||
EVENTHANDLER_REGISTER(shutdown_final, xen_pv_shutdown_final, NULL,
|
||||
SHUTDOWN_PRI_LAST);
|
||||
#endif
|
||||
if (xen_pv_domain())
|
||||
EVENTHANDLER_REGISTER(shutdown_final, xen_pv_shutdown_final, NULL,
|
||||
SHUTDOWN_PRI_LAST);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user