svn commit: r256071 - in head/sys: dev/hyperv/vmbus x86/xen

Justin T. Gibbs gibbs at FreeBSD.org
Sat Oct 5 19:51:10 UTC 2013


Author: gibbs
Date: Sat Oct  5 19:51:09 2013
New Revision: 256071
URL: http://svnweb.freebsd.org/changeset/base/256071

Log:
  Correct panic caused by attaching both Xen PV and HyperV virtualization
  aware drivers on Xen hypervisors that advertise support for some
  HyperV features.
  
  x86/xen/hvm.c:
  	When running in HVM mode on a Xen hypervisor, set vm_guest
  	to VM_GUEST_XEN so other virtualization aware components in
  	the FreeBSD kernel can detect this mode is active.
  
  dev/hyperv/vmbus/hv_hv.c:
  	Use vm_guest to ignore Xen's HyperV emulation when Xen is
  	detected and Xen PV drivers are active.
  
  Reported by:	Shanker Balan
  Submitted by:	Roger Pau Monné
  Sponsored by:	Citrix Systems R&D
  Reviewed by:	gibbs
  Approved by:	re (Xen blanket)

Modified:
  head/sys/dev/hyperv/vmbus/hv_hv.c
  head/sys/x86/xen/hvm.c

Modified: head/sys/dev/hyperv/vmbus/hv_hv.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_hv.c	Sat Oct  5 19:29:48 2013	(r256070)
+++ head/sys/dev/hyperv/vmbus/hv_hv.c	Sat Oct  5 19:51:09 2013	(r256071)
@@ -29,6 +29,8 @@
 /**
  * Implements low-level interactions with Hypver-V/Azure
  */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -88,6 +90,14 @@ hv_vmbus_query_hypervisor_presence(void)
 {
 	u_int regs[4];
 	int hyper_v_detected = 0;
+
+	/*
+	 * When Xen is detected and native Xen PV support is enabled,
+	 * ignore Xen's HyperV emulation.
+	 */
+	if (vm_guest == VM_GUEST_XEN)
+		return (0);
+
 	do_cpuid(1, regs);
 	if (regs[2] & 0x80000000) { /* if(a hypervisor is detected) */
 		/* make sure this really is Hyper-V */

Modified: head/sys/x86/xen/hvm.c
==============================================================================
--- head/sys/x86/xen/hvm.c	Sat Oct  5 19:29:48 2013	(r256070)
+++ head/sys/x86/xen/hvm.c	Sat Oct  5 19:51:09 2013	(r256071)
@@ -700,6 +700,7 @@ xen_hvm_init(enum xen_hvm_init_type init
 
 		setup_xen_features();
 		cpu_ops = xen_hvm_cpu_ops;
+ 		vm_guest = VM_GUEST_XEN;
 		break;
 	case XEN_HVM_INIT_RESUME:
 		if (error != 0)


More information about the svn-src-all mailing list