From: Yong He <alexyonghe@xxxxxxxxxxx> Expand max number of LRU cache of previous CR3s, so that we could cache more entry when needed, such as KPTI is enabled inside guest. Signed-off-by: Yong He <alexyonghe@xxxxxxxxxxx> --- arch/x86/include/asm/kvm_host.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 4a68cb3eb..02528d4a2 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -430,11 +430,12 @@ struct kvm_mmu_root_info { #define KVM_MMU_ROOT_INFO_INVALID \ ((struct kvm_mmu_root_info) { .pgd = INVALID_PAGE, .hpa = INVALID_PAGE }) -#define KVM_MMU_NUM_PREV_ROOTS 3 +#define KVM_MMU_NUM_PREV_ROOTS 3 +#define KVM_MMU_NUM_PREV_ROOTS_MAX 11 #define KVM_MMU_ROOT_CURRENT BIT(0) #define KVM_MMU_ROOT_PREVIOUS(i) BIT(1+i) -#define KVM_MMU_ROOTS_ALL (BIT(1 + KVM_MMU_NUM_PREV_ROOTS) - 1) +#define KVM_MMU_ROOTS_ALL (BIT(1 + KVM_MMU_NUM_PREV_ROOTS_MAX) - 1) #define KVM_HAVE_MMU_RWLOCK @@ -469,7 +470,7 @@ struct kvm_mmu { */ u32 pkru_mask; - struct kvm_mmu_root_info prev_roots[KVM_MMU_NUM_PREV_ROOTS]; + struct kvm_mmu_root_info prev_roots[KVM_MMU_NUM_PREV_ROOTS_MAX]; /* * Bitmap; bit set = permission fault -- 2.43.5