1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-01 08:27:59 +00:00

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)
This commit is contained in:
Justin T. Gibbs 2013-10-05 19:51:09 +00:00
parent 5b9d734b08
commit bf57e9793a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=256071
2 changed files with 11 additions and 0 deletions

View File

@ -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 */

View File

@ -700,6 +700,7 @@ xen_hvm_init(enum xen_hvm_init_type init_type)
setup_xen_features();
cpu_ops = xen_hvm_cpu_ops;
vm_guest = VM_GUEST_XEN;
break;
case XEN_HVM_INIT_RESUME:
if (error != 0)