diff options
Diffstat (limited to 'usr/src/uts/i86pc/os/cpuid.c')
-rw-r--r-- | usr/src/uts/i86pc/os/cpuid.c | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/usr/src/uts/i86pc/os/cpuid.c b/usr/src/uts/i86pc/os/cpuid.c index a82d6d70e5..15969b2c02 100644 --- a/usr/src/uts/i86pc/os/cpuid.c +++ b/usr/src/uts/i86pc/os/cpuid.c @@ -114,13 +114,9 @@ uint_t pentiumpro_bug4064495; uint_t enable486; /* - * This is set if Solaris is booted in a fully virtualized mode: - * - as HVM guest under xVM - * - as guest under VMware - * check_for_hvm() has the logic to detect these 2 cases. - * This is not applicable if Solaris is booted as a para virtual guest. + * This is set to platform type Solaris is running on. */ -int platform_is_virt = 0; +static int platform_type = HW_NATIVE; /* * monitor/mwait info. @@ -429,12 +425,11 @@ cpuid_free_space(cpu_t *cpu) #if !defined(__xpv) static void -check_for_hvm() +determine_platform() { struct cpuid_regs cp; char *xen_str; uint32_t xen_signature[4]; - extern int xpv_is_hvm; /* * In a fully virtualized domain, Xen's pseudo-cpuid function @@ -449,13 +444,39 @@ check_for_hvm() xen_signature[2] = cp.cp_edx; xen_signature[3] = 0; xen_str = (char *)xen_signature; - if (strcmp("XenVMMXenVMM", xen_str) == 0 && cp.cp_eax <= 0x40000002) - xpv_is_hvm = 1; + if (strcmp("XenVMMXenVMM", xen_str) == 0 && cp.cp_eax <= 0x40000002) { + platform_type = HW_XEN_HVM; + } else if (vmware_platform()) { /* running under vmware hypervisor? */ + platform_type = HW_VMWARE; + } +} + +int +get_hwenv(void) +{ + return (platform_type); +} + +int +is_controldom(void) +{ + return (0); +} + +#else + +int +get_hwenv(void) +{ + return (HW_XEN_PV); +} - /* could we be running under vmware hypervisor */ - if (xpv_is_hvm || vmware_platform()) - platform_is_virt = 1; +int +is_controldom(void) +{ + return (DOMAIN_IS_INITDOMAIN(xen_info)); } + #endif /* __xpv */ uint_t @@ -1200,7 +1221,7 @@ cpuid_pass1(cpu_t *cpu) pass1_done: #if !defined(__xpv) - check_for_hvm(); + determine_platform(); #endif cpi->cpi_pass = 1; return (feature); |