Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

ACPI shutdown for NetBSD/xen



			Hi port-xen@,

after a short review of NetBSD/xen's and xen's own 4.5.0's source code,
I did not find anything preventing a regular ACPI shutdown (sleep statee
5) from working with NetBSD as DOM0, just like when running natively
(like GENERIC).

I just tested this successfully on an amd64 DOM0 (running NetBSD 7 with
a Lenovo ThinkPad T440s laptop), and also have a patch for i386
(untested, though the patch is almost identical).

Thoughts, comments, objections to commit?

Both patches are here:
http://git.edgebsd.org/gitweb/?p=edgebsd-src.git;a=commit;h=f6d98f09
http://git.edgebsd.org/gitweb/?p=edgebsd-src.git;a=commit;h=10b1d40d
(EdgeBSD's khorben/xen-acpi-shutdown branch)

I am also attaching them here.

HTH,
-- 
khorben
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index 7261704..1bd68ee 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -674,14 +674,13 @@ haltsys:
 	doshutdownhooks();
 
         if ((howto & RB_POWERDOWN) == RB_POWERDOWN) {
-#ifndef XEN
 #if NACPICA > 0
 		if (s != IPL_NONE)
 			splx(s);
 
 		acpi_enter_sleep_state(ACPI_STATE_S5);
 #endif
-#else /* XEN */
+#ifdef XEN
 		HYPERVISOR_shutdown();
 #endif /* XEN */
 	}
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index a10b94a..6bcf1a7 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -760,10 +760,6 @@ haltsys:
 	doshutdownhooks();
 
 	if ((howto & RB_POWERDOWN) == RB_POWERDOWN) {
-#ifdef XEN
-		HYPERVISOR_shutdown();
-		for (;;);
-#endif
 #if NACPICA > 0
 		if (s != IPL_NONE)
 			splx(s);
@@ -772,6 +768,10 @@ haltsys:
 #else
 		__USE(s);
 #endif
+#ifdef XEN
+		HYPERVISOR_shutdown();
+		for (;;);
+#endif
 	}
 
 #ifdef MULTIPROCESSOR


Home | Main Index | Thread Index | Old Index