diff --git a/hypervisor/arch/x86/cpu.c b/hypervisor/arch/x86/cpu.c index e14102505..7a4a2844d 100644 --- a/hypervisor/arch/x86/cpu.c +++ b/hypervisor/arch/x86/cpu.c @@ -227,6 +227,11 @@ static int hardware_detect_support(void) return -ENODEV; } + if (!cpu_has_cap(X86_FEATURE_PAGE1GB)) { + pr_fatal("%s, not support 1GB page\n", __func__); + return -ENODEV; + } + if (!cpu_has_cap(X86_FEATURE_VMX)) { pr_fatal("%s, vmx not supported\n", __func__); return -ENODEV; diff --git a/hypervisor/arch/x86/mmu.c b/hypervisor/arch/x86/mmu.c index 7bb16fef2..b86bb4476 100644 --- a/hypervisor/arch/x86/mmu.c +++ b/hypervisor/arch/x86/mmu.c @@ -131,6 +131,11 @@ int check_vmx_mmu_cap(void) return -ENODEV; } + if (!cpu_has_vmx_ept_cap(VMX_EPT_1GB_PAGE)) { + pr_fatal("%s, ept not support 1GB large page\n", __func__); + return -ENODEV; + } + return 0; } @@ -187,18 +192,6 @@ void invept(struct vcpu *vcpu) } } -bool check_mmu_1gb_support(enum _page_table_type page_table_type) -{ - bool status = false; - - if (page_table_type == PTT_EPT) { - status = cpu_has_vmx_ept_cap(VMX_EPT_1GB_PAGE); - } else { - status = cpu_has_cap(X86_FEATURE_PAGE1GB); - } - return status; -} - uint64_t get_paging_pml4(void) { /* Return address to caller */ diff --git a/hypervisor/common/vm_load.c b/hypervisor/common/vm_load.c index 5b5316912..9d002815d 100644 --- a/hypervisor/common/vm_load.c +++ b/hypervisor/common/vm_load.c @@ -197,7 +197,7 @@ int general_sw_loader(struct vm *vm, struct vcpu *vcpu) * reserving. Current strategy is "total_mem_size in Giga - * remained 1G pages" for reserving. */ - if (is_vm0(vm) && check_mmu_1gb_support(PTT_PRIMARY)) { + if (is_vm0(vm)) { int32_t reserving_1g_pages; #ifdef CONFIG_REMAIN_1G_PAGES diff --git a/hypervisor/include/arch/x86/mmu.h b/hypervisor/include/arch/x86/mmu.h index 414bbc3cd..f4ae3ca4b 100644 --- a/hypervisor/include/arch/x86/mmu.h +++ b/hypervisor/include/arch/x86/mmu.h @@ -287,7 +287,6 @@ static inline void mem_write64(void *addr, uint64_t data) } uint64_t get_paging_pml4(void); -bool check_mmu_1gb_support(enum _page_table_type page_table_type); void *alloc_paging_struct(void); void free_paging_struct(void *ptr); void enable_paging(uint64_t pml4_base_addr);