On Wed, Oct 15, 2025 at 2:23 PM Yosry Ahmed <[email protected]> wrote: > > On Wed, Sep 17, 2025 at 02:48:39PM -0700, Jim Mattson wrote: > > Add a new VM mode, VM_MODE_PXXV57_4K, to support tests that require > > 5-level paging on x86. This mode sets up a 57-bit virtual address > > space and sets CR4.LA57 in the guest. > > > > Signed-off-by: Jim Mattson <[email protected]> > > --- > > .../testing/selftests/kvm/include/kvm_util.h | 1 + > > tools/testing/selftests/kvm/lib/kvm_util.c | 21 +++++++++++++++++ > > .../testing/selftests/kvm/lib/x86/processor.c | 23 ++++++++++++------- > > tools/testing/selftests/kvm/lib/x86/vmx.c | 7 +++--- > > 4 files changed, 41 insertions(+), 11 deletions(-) > > > > ... > > diff --git a/tools/testing/selftests/kvm/lib/x86/vmx.c > > b/tools/testing/selftests/kvm/lib/x86/vmx.c > > index d4d1208dd023..1b6d4a007798 100644 > > --- a/tools/testing/selftests/kvm/lib/x86/vmx.c > > +++ b/tools/testing/selftests/kvm/lib/x86/vmx.c > > @@ -401,11 +401,12 @@ void __nested_pg_map(struct vmx_pages *vmx, struct > > kvm_vm *vm, > > struct eptPageTableEntry *pt = vmx->eptp_hva, *pte; > > uint16_t index; > > > > - TEST_ASSERT(vm->mode == VM_MODE_PXXV48_4K, "Attempt to use " > > - "unknown or unsupported guest mode, mode: 0x%x", > > vm->mode); > > + TEST_ASSERT(vm->mode == VM_MODE_PXXV48_4K || > > + vm->mode == VM_MODE_PXXV57_4K, > > + "Unknown or unsupported guest mode: 0x%x", vm->mode); > > > > TEST_ASSERT((nested_paddr >> 48) == 0, > > - "Nested physical address 0x%lx requires 5-level paging", > > + "Nested physical address 0x%lx is > 48-bits and requires > > 5-level EPT", > > Shouldn't this assertion be updated now? We technically support 5-level > EPT so it should only fire if the mode is VM_MODE_PXXV48_4K. Maybe we > should use vm->va_bits?
I did update the assertion! :) init_vmcs_control_fields() hardcodes a page-walk-length of 4 in the EPTP, and the loop in __nested_pg_map() counts down from PG_LEVEL_512G. There is no support for 5-level EPT here. > > > nested_paddr); > > TEST_ASSERT((nested_paddr % page_size) == 0, > > "Nested physical address not on page boundary,\n" > > -- > > 2.51.0.470.ga7dc726c21-goog > > >

