hv: mmu: add 1GB page capability check when CPU boot
Add 1GB large page support limit on our platform. Tracked-On: #1124 Signed-off-by: Li, Fei1 <fei1.li@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
parent
58fffcd3b9
commit
06ab2b829f
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue