KVM: x86/mmu: Fix wrong start gfn of tlb flushing with range
authorHou Wenlong <houwenlong.hwl@antgroup.com>
Mon, 10 Oct 2022 12:19:15 +0000 (20:19 +0800)
committerSean Christopherson <seanjc@google.com>
Tue, 24 Jan 2023 18:05:47 +0000 (10:05 -0800)
commit1b2dc7360463932d2e7cac9461de16ce6fa11cb7
tree51bf439e4b18738c08af52dadca5ce48b51b27b1
parent1e203847aa9245bd782d6dc904ece124ca1b89cb
KVM: x86/mmu: Fix wrong start gfn of tlb flushing with range

When a spte is dropped, the start gfn of tlb flushing should be the gfn
of spte not the base gfn of SP which contains the spte. Also introduce a
helper function to do range-based flushing when a spte is dropped, which
would help prevent future buggy use of
kvm_flush_remote_tlbs_with_address() in such case.

Fixes: c3134ce240eed ("KVM: Replace old tlb flush function with new one to flush a specified range.")
Suggested-by: David Matlack <dmatlack@google.com>
Signed-off-by: Hou Wenlong <houwenlong.hwl@antgroup.com>
Link: https://lore.kernel.org/r/72ac2169a261976f00c1703e88cda676dfb960f5.1665214747.git.houwenlong.hwl@antgroup.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/mmu/paging_tmpl.h