From owner-svn-src-head@FreeBSD.ORG Sat Oct 5 19:51:10 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 6FD16B93; Sat, 5 Oct 2013 19:51:10 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 40C4E22DF; Sat, 5 Oct 2013 19:51:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r95JpARn004359; Sat, 5 Oct 2013 19:51:10 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r95Jp9Jt004357; Sat, 5 Oct 2013 19:51:09 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201310051951.r95Jp9Jt004357@svn.freebsd.org> From: "Justin T. Gibbs" Date: Sat, 5 Oct 2013 19:51:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r256071 - in head/sys: dev/hyperv/vmbus x86/xen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Oct 2013 19:51:10 -0000 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 +__FBSDID("$FreeBSD$"); #include #include @@ -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)