diff --git a/hypervisor/arch/x86/cpu_caps.c b/hypervisor/arch/x86/cpu_caps.c index bc5eadfec..10bacec1f 100644 --- a/hypervisor/arch/x86/cpu_caps.c +++ b/hypervisor/arch/x86/cpu_caps.c @@ -206,6 +206,11 @@ static void detect_vmx_mmu_cap(void) cpu_caps.vmx_vpid = (uint32_t) (val >> 32U); } +static bool pcpu_vmx_set_32bit_addr_width(void) +{ + return ((msr_read(MSR_IA32_VMX_BASIC) & MSR_IA32_VMX_BASIC_ADDR_WIDTH) != 0UL); +} + static void detect_xsave_cap(void) { uint32_t unused; @@ -464,6 +469,9 @@ int32_t detect_hardware_support(void) } else if (is_vmx_disabled()) { printf("%s, VMX can not be enabled\n", __func__); ret = -ENODEV; + } else if (pcpu_vmx_set_32bit_addr_width()) { + printf("%s, Only support Intel 64 architecture.\n", __func__); + ret = -ENODEV; } else if (!pcpu_has_cap(X86_FEATURE_X2APIC)) { printf("%s, x2APIC not supported\n", __func__); ret = -ENODEV; diff --git a/hypervisor/include/arch/x86/msr.h b/hypervisor/include/arch/x86/msr.h index d311f8dbe..afa57268d 100644 --- a/hypervisor/include/arch/x86/msr.h +++ b/hypervisor/include/arch/x86/msr.h @@ -571,6 +571,9 @@ /* Miscellaneous data */ #define MSR_IA32_MISC_UNRESTRICTED_GUEST (1U<<5U) +/* Width of physical address used by VMX related region */ +#define MSR_IA32_VMX_BASIC_ADDR_WIDTH (1UL << 48U) + /* 5 high-order bits in every field are reserved */ #define PAT_FIELD_RSV_BITS (0xF8UL)