diff options
-rw-r--r-- | arch/x86/include/asm/kvm_host.h | 1 | ||||
-rw-r--r-- | arch/x86/kvm/mmu.c | 22 |
2 files changed, 1 insertions, 22 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 90d05edbbfe2..966f2650b6ab 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -230,7 +230,6 @@ struct kvm_mmu_page { | |||
230 | #endif | 230 | #endif |
231 | 231 | ||
232 | int write_flooding_count; | 232 | int write_flooding_count; |
233 | bool mmio_cached; | ||
234 | }; | 233 | }; |
235 | 234 | ||
236 | struct kvm_pio_request { | 235 | struct kvm_pio_request { |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index c2121017f471..7113a0fb544c 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -246,13 +246,11 @@ static unsigned int kvm_current_mmio_generation(struct kvm *kvm) | |||
246 | static void mark_mmio_spte(struct kvm *kvm, u64 *sptep, u64 gfn, | 246 | static void mark_mmio_spte(struct kvm *kvm, u64 *sptep, u64 gfn, |
247 | unsigned access) | 247 | unsigned access) |
248 | { | 248 | { |
249 | struct kvm_mmu_page *sp = page_header(__pa(sptep)); | ||
250 | unsigned int gen = kvm_current_mmio_generation(kvm); | 249 | unsigned int gen = kvm_current_mmio_generation(kvm); |
251 | u64 mask = generation_mmio_spte_mask(gen); | 250 | u64 mask = generation_mmio_spte_mask(gen); |
252 | 251 | ||
253 | access &= ACC_WRITE_MASK | ACC_USER_MASK; | 252 | access &= ACC_WRITE_MASK | ACC_USER_MASK; |
254 | mask |= shadow_mmio_mask | access | gfn << PAGE_SHIFT; | 253 | mask |= shadow_mmio_mask | access | gfn << PAGE_SHIFT; |
255 | sp->mmio_cached = true; | ||
256 | 254 | ||
257 | trace_mark_mmio_spte(sptep, gfn, access, gen); | 255 | trace_mark_mmio_spte(sptep, gfn, access, gen); |
258 | mmu_spte_set(sptep, mask); | 256 | mmu_spte_set(sptep, mask); |
@@ -4364,24 +4362,6 @@ void kvm_mmu_invalidate_zap_all_pages(struct kvm *kvm) | |||
4364 | spin_unlock(&kvm->mmu_lock); | 4362 | spin_unlock(&kvm->mmu_lock); |
4365 | } | 4363 | } |
4366 | 4364 | ||
4367 | static void kvm_mmu_zap_mmio_sptes(struct kvm *kvm) | ||
4368 | { | ||
4369 | struct kvm_mmu_page *sp, *node; | ||
4370 | LIST_HEAD(invalid_list); | ||
4371 | |||
4372 | spin_lock(&kvm->mmu_lock); | ||
4373 | restart: | ||
4374 | list_for_each_entry_safe(sp, node, &kvm->arch.active_mmu_pages, link) { | ||
4375 | if (!sp->mmio_cached) | ||
4376 | continue; | ||
4377 | if (kvm_mmu_prepare_zap_page(kvm, sp, &invalid_list)) | ||
4378 | goto restart; | ||
4379 | } | ||
4380 | |||
4381 | kvm_mmu_commit_zap_page(kvm, &invalid_list); | ||
4382 | spin_unlock(&kvm->mmu_lock); | ||
4383 | } | ||
4384 | |||
4385 | static bool kvm_has_zapped_obsolete_pages(struct kvm *kvm) | 4365 | static bool kvm_has_zapped_obsolete_pages(struct kvm *kvm) |
4386 | { | 4366 | { |
4387 | return unlikely(!list_empty_careful(&kvm->arch.zapped_obsolete_pages)); | 4367 | return unlikely(!list_empty_careful(&kvm->arch.zapped_obsolete_pages)); |
@@ -4397,7 +4377,7 @@ void kvm_mmu_invalidate_mmio_sptes(struct kvm *kvm) | |||
4397 | * when mark memslot invalid. | 4377 | * when mark memslot invalid. |
4398 | */ | 4378 | */ |
4399 | if (unlikely(kvm_current_mmio_generation(kvm) >= (MMIO_MAX_GEN - 1))) | 4379 | if (unlikely(kvm_current_mmio_generation(kvm) >= (MMIO_MAX_GEN - 1))) |
4400 | kvm_mmu_zap_mmio_sptes(kvm); | 4380 | kvm_mmu_invalidate_zap_all_pages(kvm); |
4401 | } | 4381 | } |
4402 | 4382 | ||
4403 | static int mmu_shrink(struct shrinker *shrink, struct shrink_control *sc) | 4383 | static int mmu_shrink(struct shrinker *shrink, struct shrink_control *sc) |