KVM: x86/mmu: Support shadowing NPT when 5-level paging is enabled in host
authorWei Huang <wei.huang2@amd.com>
Wed, 18 Aug 2021 16:55:48 +0000 (11:55 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 20 Aug 2021 20:07:48 +0000 (16:07 -0400)
commitcb0f722aff6e9ba970a9fee9263c7821bbe811de
tree54e81f532ec0b4f5253ba93d13282f30a2aeaf75
parent746700d21fd52399c97aeb7791584bbf5426983c
KVM: x86/mmu: Support shadowing NPT when 5-level paging is enabled in host

When the 5-level page table CPU flag is set in the host, but the guest
has CR4.LA57=0 (including the case of a 32-bit guest), the top level of
the shadow NPT page tables will be fixed, consisting of one pointer to
a lower-level table and 511 non-present entries.  Extend the existing
code that creates the fixed PML4 or PDP table, to provide a fixed PML5
table if needed.

This is not needed on EPT because the number of layers in the tables
is specified in the EPTP instead of depending on the host CR4.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Wei Huang <wei.huang2@amd.com>
Message-Id: <20210818165549.3771014-3-wei.huang2@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/mmu/mmu.c