Skip to content

Commit 0943a83

Browse files
xinyunliuwenlingz
authored andcommitted
[hv] set ECX.bit31 to indicate the presence of a hypervisor
ECS.bit31 is not used and always return 0 in SDM Vol.2A 3-195. It's a standard way to indicate whether there is a hypervisor. Tracked-On: #2490 Ref: https://lwn.net/Articles/301888/ Signed-off-by: Xinyun Liu <xinyun.liu@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
1 parent f6758fd commit 0943a83

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

hypervisor/arch/x86/guest/vcpuid.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,9 @@ void guest_cpuid(struct acrn_vcpu *vcpu, uint32_t *eax, uint32_t *ebx, uint32_t
345345
/*mask vmx to guest os */
346346
*ecx &= ~CPUID_ECX_VMX;
347347

348+
/* set Hypervisor Present Bit */
349+
*ecx |= CPUID_ECX_HV;
350+
348351
/*no xsave support for guest if it is not enabled on host*/
349352
if ((*ecx & CPUID_ECX_OSXSAVE) == 0U) {
350353
*ecx &= ~CPUID_ECX_XSAVE;

hypervisor/include/arch/x86/cpuid.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#define CPUID_ECX_XSAVE (1U<<26U)
4242
#define CPUID_ECX_OSXSAVE (1U<<27U)
4343
#define CPUID_ECX_AVX (1U<<28U)
44+
#define CPUID_ECX_HV (1U<<31U)
4445
#define CPUID_EDX_FPU (1U<<0U)
4546
#define CPUID_EDX_VME (1U<<1U)
4647
#define CPUID_EDX_DE (1U<<2U)

0 commit comments

Comments
 (0)