KVM: MMU: Mark sp mmio cached when creating mmio spte
authorTakuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
Tue, 12 Mar 2013 08:44:40 +0000 (17:44 +0900)
committerGleb Natapov <gleb@redhat.com>
Thu, 14 Mar 2013 08:21:10 +0000 (10:21 +0200)
This will be used not to zap unrelated mmu pages when creating/moving
a memory slot later.

Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/mmu.c

index ef7f4a5cf8c7aa6e5bd4055f24db16280948ff2f..9b75cae83d1014b6af45cea0ff55db7e67343fb3 100644 (file)
@@ -230,6 +230,7 @@ struct kvm_mmu_page {
 #endif
 
        int write_flooding_count;
+       bool mmio_cached;
 };
 
 struct kvm_pio_request {
index fdacabba6f62ea1f045d554c91df6d46147e4eb6..de45ec19534621c36d07243657a8955877fca518 100644 (file)
@@ -199,8 +199,11 @@ EXPORT_SYMBOL_GPL(kvm_mmu_set_mmio_spte_mask);
 
 static void mark_mmio_spte(u64 *sptep, u64 gfn, unsigned access)
 {
+       struct kvm_mmu_page *sp =  page_header(__pa(sptep));
+
        access &= ACC_WRITE_MASK | ACC_USER_MASK;
 
+       sp->mmio_cached = true;
        trace_mark_mmio_spte(sptep, gfn, access);
        mmu_spte_set(sptep, shadow_mmio_mask | access | gfn << PAGE_SHIFT);
 }