Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Jun 2014 08:46:31 +0000 (UTC)
From:      Roger Pau Monné <royger@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r267531 - head/sys/dev/xen/control
Message-ID:  <201406160846.s5G8kVfB074738@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: royger
Date: Mon Jun 16 08:46:31 2014
New Revision: 267531
URL: http://svnweb.freebsd.org/changeset/base/267531

Log:
  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.

Modified:
  head/sys/dev/xen/control/control.c

Modified: head/sys/dev/xen/control/control.c
==============================================================================
--- head/sys/dev/xen/control/control.c	Mon Jun 16 08:45:51 2014	(r267530)
+++ head/sys/dev/xen/control/control.c	Mon Jun 16 08:46:31 2014	(r267531)
@@ -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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406160846.s5G8kVfB074738>