mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-03 23:58:05 +00:00
KVM: x86/mmu: Merge kvm_{enable,disable}_tdp() into a common function
Combine kvm_enable_tdp() and kvm_disable_tdp() into a single function, kvm_configure_mmu(), in preparation for doing additional configuration during hardware setup. And because having separate helpers is silly. No functional change intended. Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
213e0e1f50
commit
bde7723559
4 changed files with 6 additions and 19 deletions
|
@ -1510,8 +1510,7 @@ void kvm_mmu_invlpg(struct kvm_vcpu *vcpu, gva_t gva);
|
||||||
void kvm_mmu_invpcid_gva(struct kvm_vcpu *vcpu, gva_t gva, unsigned long pcid);
|
void kvm_mmu_invpcid_gva(struct kvm_vcpu *vcpu, gva_t gva, unsigned long pcid);
|
||||||
void kvm_mmu_new_cr3(struct kvm_vcpu *vcpu, gpa_t new_cr3, bool skip_tlb_flush);
|
void kvm_mmu_new_cr3(struct kvm_vcpu *vcpu, gpa_t new_cr3, bool skip_tlb_flush);
|
||||||
|
|
||||||
void kvm_enable_tdp(void);
|
void kvm_configure_mmu(bool enable_tdp);
|
||||||
void kvm_disable_tdp(void);
|
|
||||||
|
|
||||||
static inline gpa_t translate_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access,
|
static inline gpa_t translate_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access,
|
||||||
struct x86_exception *exception)
|
struct x86_exception *exception)
|
||||||
|
|
|
@ -5559,18 +5559,11 @@ void kvm_mmu_invpcid_gva(struct kvm_vcpu *vcpu, gva_t gva, unsigned long pcid)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(kvm_mmu_invpcid_gva);
|
EXPORT_SYMBOL_GPL(kvm_mmu_invpcid_gva);
|
||||||
|
|
||||||
void kvm_enable_tdp(void)
|
void kvm_configure_mmu(bool enable_tdp)
|
||||||
{
|
{
|
||||||
tdp_enabled = true;
|
tdp_enabled = enable_tdp;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(kvm_enable_tdp);
|
EXPORT_SYMBOL_GPL(kvm_configure_mmu);
|
||||||
|
|
||||||
void kvm_disable_tdp(void)
|
|
||||||
{
|
|
||||||
tdp_enabled = false;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL_GPL(kvm_disable_tdp);
|
|
||||||
|
|
||||||
|
|
||||||
/* The return value indicates if tlb flush on all vcpus is needed. */
|
/* The return value indicates if tlb flush on all vcpus is needed. */
|
||||||
typedef bool (*slot_level_handler) (struct kvm *kvm, struct kvm_rmap_head *rmap_head);
|
typedef bool (*slot_level_handler) (struct kvm *kvm, struct kvm_rmap_head *rmap_head);
|
||||||
|
|
|
@ -1458,10 +1458,7 @@ static __init int svm_hardware_setup(void)
|
||||||
if (npt_enabled && !npt)
|
if (npt_enabled && !npt)
|
||||||
npt_enabled = false;
|
npt_enabled = false;
|
||||||
|
|
||||||
if (npt_enabled)
|
kvm_configure_mmu(npt_enabled);
|
||||||
kvm_enable_tdp();
|
|
||||||
else
|
|
||||||
kvm_disable_tdp();
|
|
||||||
pr_info("kvm: Nested Paging %sabled\n", npt_enabled ? "en" : "dis");
|
pr_info("kvm: Nested Paging %sabled\n", npt_enabled ? "en" : "dis");
|
||||||
|
|
||||||
if (nrips) {
|
if (nrips) {
|
||||||
|
|
|
@ -5320,7 +5320,6 @@ static void vmx_enable_tdp(void)
|
||||||
VMX_EPT_RWX_MASK, 0ull);
|
VMX_EPT_RWX_MASK, 0ull);
|
||||||
|
|
||||||
ept_set_mmio_spte_mask();
|
ept_set_mmio_spte_mask();
|
||||||
kvm_enable_tdp();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -7747,8 +7746,7 @@ static __init int hardware_setup(void)
|
||||||
|
|
||||||
if (enable_ept)
|
if (enable_ept)
|
||||||
vmx_enable_tdp();
|
vmx_enable_tdp();
|
||||||
else
|
kvm_configure_mmu(enable_ept);
|
||||||
kvm_disable_tdp();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Only enable PML when hardware supports PML feature, and both EPT
|
* Only enable PML when hardware supports PML feature, and both EPT
|
||||||
|
|
Loading…
Reference in a new issue