]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
xen/control: Introduce xen_has_pv_shutdown_handler
authorJulien Grall <julien.grall@linaro.org>
Fri, 4 Apr 2014 23:52:05 +0000 (00:52 +0100)
committerJulien Grall <julien.grall@citrix.com>
Mon, 2 Nov 2015 11:46:55 +0000 (11:46 +0000)
While x86 only register PV shutdown handler for PV guests. ARM guests
are always using HVM and requires the PV shutdown handler.

sys/dev/xen/control/control.c
sys/x86/include/xen/xen-os.h

index 2d92b691e3c4da86855aa02405e9084c0084ca19..eae0ad41d189fd2d1bae0b711bb8f686230a15b4 100644 (file)
@@ -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);
 
index 8f42e862c07978f9cf2216d77643801a5d55a60b..27074f5c1486de66018f469dcec22d41e0b38b55 100644 (file)
@@ -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_ */