Module Name:    src
Committed By:   bouyer
Date:           Thu Apr  9 16:12:50 UTC 2020

Modified Files:
        src/sys/arch/amd64/amd64 [bouyer-xenpvh]: machdep.c
        src/sys/arch/i386/i386 [bouyer-xenpvh]: machdep.c

Log Message:
For RB_POWERDONW, call HYPERVISOR_shutdown() in all cases where the
hypercall page is available. A PVHHVM domU now properly exits on
halt -p


To generate a diff of this commit:
cvs rdiff -u -r1.346 -r1.346.4.1 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.825 -r1.825.4.1 src/sys/arch/i386/i386/machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.346 src/sys/arch/amd64/amd64/machdep.c:1.346.4.1
--- src/sys/arch/amd64/amd64/machdep.c:1.346	Fri Jan 31 08:21:11 2020
+++ src/sys/arch/amd64/amd64/machdep.c	Thu Apr  9 16:12:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.346 2020/01/31 08:21:11 maxv Exp $	*/
+/*	$NetBSD: machdep.c,v 1.346.4.1 2020/04/09 16:12:50 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -110,7 +110,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.346 2020/01/31 08:21:11 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.346.4.1 2020/04/09 16:12:50 bouyer Exp $");
 
 #include "opt_modular.h"
 #include "opt_user_ldt.h"
@@ -729,9 +729,12 @@ haltsys:
 
 		acpi_enter_sleep_state(ACPI_STATE_S5);
 #endif
-#ifdef XENPV
-		HYPERVISOR_shutdown();
-#endif /* XENPV */
+#ifdef XEN
+		if (vm_guest == VM_GUEST_XENPV ||
+		    vm_guest == VM_GUEST_XENPVH ||
+		    vm_guest == VM_GUEST_XENPVHVM)
+			HYPERVISOR_shutdown();
+#endif /* XEN */
 	}
 
 	cpu_broadcast_halt();

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.825 src/sys/arch/i386/i386/machdep.c:1.825.4.1
--- src/sys/arch/i386/i386/machdep.c:1.825	Fri Jan 31 08:21:11 2020
+++ src/sys/arch/i386/i386/machdep.c	Thu Apr  9 16:12:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.825 2020/01/31 08:21:11 maxv Exp $	*/
+/*	$NetBSD: machdep.c,v 1.825.4.1 2020/04/09 16:12:50 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009, 2017
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.825 2020/01/31 08:21:11 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.825.4.1 2020/04/09 16:12:50 bouyer Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_freebsd.h"
@@ -793,10 +793,12 @@ haltsys:
 #else
 		__USE(s);
 #endif
-#ifdef XENPV
-		HYPERVISOR_shutdown();
-		for (;;);
-#endif
+#ifdef XEN
+		if (vm_guest == VM_GUEST_XENPV ||
+		    vm_guest == VM_GUEST_XENPVH ||
+		    vm_guest == VM_GUEST_XENPVHVM)
+			HYPERVISOR_shutdown();
+#endif /* XEN */
 	}
 
 #ifdef MULTIPROCESSOR

Reply via email to