[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALMp9eSPgy7RdT9TwKkRD5oh6-74XfCCP_UZ1mJWj6Nb9P4P7w@mail.gmail.com>
Date: Tue, 21 Oct 2025 15:34:22 -0700
From: Jim Mattson <jmattson@...gle.com>
To: Yosry Ahmed <yosry.ahmed@...ux.dev>
Cc: Paolo Bonzini <pbonzini@...hat.com>, Shuah Khan <shuah@...nel.org>,
Sean Christopherson <seanjc@...gle.com>, Bibo Mao <maobibo@...ngson.cn>,
Huacai Chen <chenhuacai@...nel.org>, Andrew Jones <ajones@...tanamicro.com>,
Claudio Imbrenda <imbrenda@...ux.ibm.com>, "Pratik R. Sampat" <prsampat@....com>,
Kai Huang <kai.huang@...el.com>, Eric Auger <eric.auger@...hat.com>,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
linux-kselftest@...r.kernel.org
Subject: Re: [PATCH 3/4] KVM: selftests: Add VM_MODE_PXXV57_4K VM mode
On Wed, Oct 15, 2025 at 2:23 PM Yosry Ahmed <yosry.ahmed@...ux.dev> 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 <jmattson@...gle.com>
> > ---
> > .../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
> >
>
Powered by blists - more mailing lists