mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 12:53:14 +01:00
KVM: x86/mmu: Fold kvm_mmu_zap_memslot() into kvm_arch_flush_shadow_memslot()
Fold kvm_mmu_zap_memslot() into its sole caller so that its GFN range structure can be used to trigger guest_memfd invalidations regardless of whether KVM will do a partial or full zap of the MMU. No functional change intended. Cc: [email protected] # 6.12.x Reviewed-by: Michael Roth <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
This commit is contained in:
1 parent
ed15cb2199
commit
06d38eaa78
1 file changed
+15
-20
+15
-20
@@ -7560,8 +7560,14 @@ out_flush:
|
||||
kvm_mmu_remote_flush_or_zap(kvm, &invalid_list, flush);
|
||||
}
|
||||
|
||||
static void kvm_mmu_zap_memslot(struct kvm *kvm,
|
||||
struct kvm_memory_slot *slot)
|
||||
static inline bool kvm_memslot_flush_zap_all(struct kvm *kvm)
|
||||
{
|
||||
return kvm->arch.vm_type == KVM_X86_DEFAULT_VM &&
|
||||
kvm_check_has_quirk(kvm, KVM_X86_QUIRK_SLOT_ZAP_ALL);
|
||||
}
|
||||
|
||||
void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
|
||||
struct kvm_memory_slot *slot)
|
||||
{
|
||||
struct kvm_gfn_range range = {
|
||||
.slot = slot,
|
||||
@@ -7572,25 +7578,14 @@ static void kvm_mmu_zap_memslot(struct kvm *kvm,
|
||||
};
|
||||
bool flush;
|
||||
|
||||
write_lock(&kvm->mmu_lock);
|
||||
flush = kvm_unmap_gfn_range(kvm, &range);
|
||||
kvm_mmu_zap_memslot_pages_and_flush(kvm, slot, flush);
|
||||
write_unlock(&kvm->mmu_lock);
|
||||
}
|
||||
|
||||
static inline bool kvm_memslot_flush_zap_all(struct kvm *kvm)
|
||||
{
|
||||
return kvm->arch.vm_type == KVM_X86_DEFAULT_VM &&
|
||||
kvm_check_has_quirk(kvm, KVM_X86_QUIRK_SLOT_ZAP_ALL);
|
||||
}
|
||||
|
||||
void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
|
||||
struct kvm_memory_slot *slot)
|
||||
{
|
||||
if (kvm_memslot_flush_zap_all(kvm))
|
||||
if (kvm_memslot_flush_zap_all(kvm)) {
|
||||
kvm_mmu_zap_all_fast(kvm);
|
||||
else
|
||||
kvm_mmu_zap_memslot(kvm, slot);
|
||||
} else {
|
||||
write_lock(&kvm->mmu_lock);
|
||||
flush = kvm_unmap_gfn_range(kvm, &range);
|
||||
kvm_mmu_zap_memslot_pages_and_flush(kvm, slot, flush);
|
||||
write_unlock(&kvm->mmu_lock);
|
||||
}
|
||||
}
|
||||
|
||||
void kvm_mmu_invalidate_mmio_sptes(struct kvm *kvm, u64 gen)
|
||||
|
||||
Reference in new issue
Block a user