From fbd54cb5fecaf7d64cca371aa5ff1b2a8a3d5a11 Mon Sep 17 00:00:00 2001 From: Hans Rosenfeld Date: Wed, 11 Oct 2017 15:55:00 +0200 Subject: 9792 support bhyve as a platform Reviewed by: Patrick Mooney Reviewed by: Robert Mustacchi Reviewed by: Toomas Soome Reviewed by: Yuri Pankov Reviewed by: Andy Fiddaman Approved by: Garrett D'Amore --- usr/src/uts/i86pc/io/pcplusmp/apic_common.c | 4 +++- usr/src/uts/i86pc/os/cpuid.c | 4 ++++ usr/src/uts/intel/sys/x86_archext.h | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/usr/src/uts/i86pc/io/pcplusmp/apic_common.c b/usr/src/uts/i86pc/io/pcplusmp/apic_common.c index 6e37c2ed59..a884694bfa 100644 --- a/usr/src/uts/i86pc/io/pcplusmp/apic_common.c +++ b/usr/src/uts/i86pc/io/pcplusmp/apic_common.c @@ -1675,6 +1675,7 @@ apic_check_msi_support() dev_info_t *cdip; char dev_type[16]; int dev_len; + int hwenv = get_hwenv(); DDI_INTR_IMPLDBG((CE_CONT, "apic_check_msi_support:\n")); @@ -1696,7 +1697,8 @@ apic_check_msi_support() continue; if (strcmp(dev_type, "pciex") == 0) return (PSM_SUCCESS); - if (strcmp(dev_type, "pci") == 0 && get_hwenv() == HW_KVM) + if (strcmp(dev_type, "pci") == 0 && + (hwenv == HW_KVM || hwenv == HW_BHYVE)) return (PSM_SUCCESS); } diff --git a/usr/src/uts/i86pc/os/cpuid.c b/usr/src/uts/i86pc/os/cpuid.c index 4ab084749b..1e5d470e0d 100644 --- a/usr/src/uts/i86pc/os/cpuid.c +++ b/usr/src/uts/i86pc/os/cpuid.c @@ -718,6 +718,10 @@ determine_platform(void) platform_type = HW_KVM; return; } + if (strcmp(hvstr, HVSIG_BHYVE) == 0) { + platform_type = HW_BHYVE; + return; + } if (strcmp(hvstr, HVSIG_MICROSOFT) == 0) platform_type = HW_MICROSOFT; } else { diff --git a/usr/src/uts/intel/sys/x86_archext.h b/usr/src/uts/intel/sys/x86_archext.h index b863a8e592..69669bd2b4 100644 --- a/usr/src/uts/intel/sys/x86_archext.h +++ b/usr/src/uts/intel/sys/x86_archext.h @@ -947,6 +947,7 @@ extern void reset_gdtr_limit(void); #define HVSIG_VMWARE "VMwareVMware" #define HVSIG_KVM "KVMKVMKVM" #define HVSIG_MICROSOFT "Microsoft Hv" +#define HVSIG_BHYVE "bhyve bhyve " /* * Defined hardware environments @@ -958,8 +959,10 @@ extern void reset_gdtr_limit(void); #define HW_VMWARE (1 << 3) /* Running on VMware hypervisor */ #define HW_KVM (1 << 4) /* Running on KVM hypervisor */ #define HW_MICROSOFT (1 << 5) /* Running on Microsoft hypervisor */ +#define HW_BHYVE (1 << 6) /* Running on bhyve hypervisor */ -#define HW_VIRTUAL (HW_XEN_HVM | HW_VMWARE | HW_KVM | HW_MICROSOFT) +#define HW_VIRTUAL (HW_XEN_HVM | HW_VMWARE | HW_KVM | HW_MICROSOFT | \ + HW_BHYVE) #endif /* _KERNEL */ -- cgit v1.2.3