[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240301101410.356007-3-kraxel@redhat.com>
Date: Fri, 1 Mar 2024 11:14:08 +0100
From: Gerd Hoffmann <kraxel@...hat.com>
To: kvm@...r.kernel.org
Cc: Gerd Hoffmann <kraxel@...hat.com>,
Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)),
"H. Peter Anvin" <hpa@...or.com>,
linux-kernel@...r.kernel.org (open list:X86 ARCHITECTURE (32-BIT AND 64-BIT))
Subject: [PATCH 2/3] kvm/vmx: limit guest_phys_bits to 48 without 5-level ept
If EPT has no support for 5-level paging the guest physical address
space is limited to 48 bits. Adjust kvm_caps.guest_phys_bits
accordingly.
Signed-off-by: Gerd Hoffmann <kraxel@...hat.com>
---
arch/x86/kvm/vmx/vmx.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 1111d9d08903..8bd644a5022d 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -7899,6 +7899,11 @@ static __init void vmx_set_cpu_caps(void)
if (cpu_has_vmx_waitpkg())
kvm_cpu_cap_check_and_set(X86_FEATURE_WAITPKG);
+
+ if (enable_ept &&
+ !cpu_has_vmx_ept_5levels() &&
+ kvm_caps.guest_phys_bits > 48)
+ kvm_caps.guest_phys_bits = 48;
}
static void vmx_request_immediate_exit(struct kvm_vcpu *vcpu)
--
2.44.0
Powered by blists - more mailing lists