summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mmu.c
diff options
context:
space:
mode:
authorXiaoguang Chen2016-10-09 09:41:44 +0200
committerPaolo Bonzini2016-11-02 21:32:17 +0100
commitb5f5fdca65dbccbafe08a481957629d67003db34 (patch)
tree205baae9ed80c7d08738e50ea20661bc9c94947a /arch/x86/kvm/mmu.c
parentKVM: VMX: refactor setup of global page-sized bitmaps (diff)
downloadkernel-qcow2-linux-b5f5fdca65dbccbafe08a481957629d67003db34.tar.gz
kernel-qcow2-linux-b5f5fdca65dbccbafe08a481957629d67003db34.tar.xz
kernel-qcow2-linux-b5f5fdca65dbccbafe08a481957629d67003db34.zip
KVM: x86: add track_flush_slot page track notifier
When a memory slot is being moved or removed users of page track can be notified. So users can drop write-protection for the pages in that memory slot. This notifier type is needed by KVMGT to sync up its shadow page table when memory slot is being moved or removed. Register the notifier type track_flush_slot to receive memslot move and remove event. Reviewed-by: Xiao Guangrong <guangrong.xiao@intel.com> Signed-off-by: Chen Xiaoguang <xiaoguang.chen@intel.com> [Squashed commits to avoid bisection breakage and reworded the subject.] Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r--arch/x86/kvm/mmu.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index d3a94ea9f6ac..25ca7621474a 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -4609,11 +4609,18 @@ void kvm_mmu_setup(struct kvm_vcpu *vcpu)
init_kvm_mmu(vcpu);
}
+static void kvm_mmu_invalidate_zap_pages_in_memslot(struct kvm *kvm,
+ struct kvm_memory_slot *slot)
+{
+ kvm_mmu_invalidate_zap_all_pages(kvm);
+}
+
void kvm_mmu_init_vm(struct kvm *kvm)
{
struct kvm_page_track_notifier_node *node = &kvm->arch.mmu_sp_tracker;
node->track_write = kvm_mmu_pte_write;
+ node->track_flush_slot = kvm_mmu_invalidate_zap_pages_in_memslot;
kvm_page_track_register_notifier(kvm, node);
}