]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: VMX: Hoist construct_eptp() "up" in vmx.c
authorSean Christopherson <seanjc@google.com>
Fri, 19 Sep 2025 00:59:47 +0000 (17:59 -0700)
committerSean Christopherson <seanjc@google.com>
Fri, 17 Oct 2025 22:11:26 +0000 (15:11 -0700)
Move construct_eptp() further up in vmx.c so that it's above
vmx_flush_tlb_current(), its "first" user in vmx.c.  This will allow a
future patch to opportunistically make construct_eptp() local to vmx.c.

No functional change intended.

Link: https://lore.kernel.org/r/20250919005955.1366256-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/vmx/vmx.c

index f87c216d976d7d344c924aa4cc18fe1bf8f9b731..98506c7232913f206422bdbc042f43be29de264f 100644 (file)
@@ -3219,6 +3219,20 @@ static inline int vmx_get_current_vpid(struct kvm_vcpu *vcpu)
        return to_vmx(vcpu)->vpid;
 }
 
+u64 construct_eptp(struct kvm_vcpu *vcpu, hpa_t root_hpa, int root_level)
+{
+       u64 eptp = VMX_EPTP_MT_WB;
+
+       eptp |= (root_level == 5) ? VMX_EPTP_PWL_5 : VMX_EPTP_PWL_4;
+
+       if (enable_ept_ad_bits &&
+           (!is_guest_mode(vcpu) || nested_ept_ad_enabled(vcpu)))
+               eptp |= VMX_EPTP_AD_ENABLE_BIT;
+       eptp |= root_hpa;
+
+       return eptp;
+}
+
 void vmx_flush_tlb_current(struct kvm_vcpu *vcpu)
 {
        struct kvm_mmu *mmu = vcpu->arch.mmu;
@@ -3396,20 +3410,6 @@ static int vmx_get_max_ept_level(void)
        return 4;
 }
 
-u64 construct_eptp(struct kvm_vcpu *vcpu, hpa_t root_hpa, int root_level)
-{
-       u64 eptp = VMX_EPTP_MT_WB;
-
-       eptp |= (root_level == 5) ? VMX_EPTP_PWL_5 : VMX_EPTP_PWL_4;
-
-       if (enable_ept_ad_bits &&
-           (!is_guest_mode(vcpu) || nested_ept_ad_enabled(vcpu)))
-               eptp |= VMX_EPTP_AD_ENABLE_BIT;
-       eptp |= root_hpa;
-
-       return eptp;
-}
-
 void vmx_load_mmu_pgd(struct kvm_vcpu *vcpu, hpa_t root_hpa, int root_level)
 {
        struct kvm *kvm = vcpu->kvm;