From: Julien Grall Date: Fri, 4 Apr 2014 23:52:05 +0000 (+0100) Subject: xen/control: Introduce xen_has_pv_shutdown_handler X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=cd0a5e4a61c8bd59ea212413e67e3ecb88170df3;p=people%2Fjulieng%2Ffreebsd.git xen/control: Introduce xen_has_pv_shutdown_handler While x86 only register PV shutdown handler for PV guests. ARM guests are always using HVM and requires the PV shutdown handler. --- diff --git a/sys/dev/xen/control/control.c b/sys/dev/xen/control/control.c index 2d92b691e3c4..eae0ad41d189 100644 --- a/sys/dev/xen/control/control.c +++ b/sys/dev/xen/control/control.c @@ -397,7 +397,7 @@ xctrl_attach(device_t dev) xctrl->xctrl_watch.callback_data = (uintptr_t)xctrl; xs_register_watch(&xctrl->xctrl_watch); - if (xen_pv_domain()) + if (xen_has_pv_shutdown_handler()) EVENTHANDLER_REGISTER(shutdown_final, xen_pv_shutdown_final, NULL, SHUTDOWN_PRI_LAST); diff --git a/sys/x86/include/xen/xen-os.h b/sys/x86/include/xen/xen-os.h index 8f42e862c079..27074f5c1486 100644 --- a/sys/x86/include/xen/xen-os.h +++ b/sys/x86/include/xen/xen-os.h @@ -81,6 +81,13 @@ cpu_to_vcpu_id(u_int cpuid) #define atomic_readandclear_xen_ulong(p) atomic_readandclear_long(p) +static inline bool +xen_has_pv_shutdown_handler(void) +{ + + return (xen_pv_domain()); +} + #endif /* !__ASSEMBLY__ */ #endif /* _MACHINE_X86_XEN_XEN_OS_H_ */