aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/iommu.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-04 13:43:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-04 13:43:01 -0400
commit5e83f6fbdb020b70c0e413312801424d13c58d68 (patch)
treeca270178fa891813dbc47751c331fed975d3766c /virt/kvm/iommu.c
parentfe445c6e2cb62a566e1a89f8798de11459975710 (diff)
parent3444d7da1839b851eefedd372978d8a982316c36 (diff)
Merge branch 'kvm-updates/2.6.36' of git://git.kernel.org/pub/scm/virt/kvm/kvm
* 'kvm-updates/2.6.36' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (198 commits) KVM: VMX: Fix host GDT.LIMIT corruption KVM: MMU: using __xchg_spte more smarter KVM: MMU: cleanup spte set and accssed/dirty tracking KVM: MMU: don't atomicly set spte if it's not present KVM: MMU: fix page dirty tracking lost while sync page KVM: MMU: fix broken page accessed tracking with ept enabled KVM: MMU: add missing reserved bits check in speculative path KVM: MMU: fix mmu notifier invalidate handler for huge spte KVM: x86 emulator: fix xchg instruction emulation KVM: x86: Call mask notifiers from pic KVM: x86: never re-execute instruction with enabled tdp KVM: Document KVM_GET_SUPPORTED_CPUID2 ioctl KVM: x86: emulator: inc/dec can have lock prefix KVM: MMU: Eliminate redundant temporaries in FNAME(fetch) KVM: MMU: Validate all gptes during fetch, not just those used for new pages KVM: MMU: Simplify spte fetch() function KVM: MMU: Add gpte_valid() helper KVM: MMU: Add validate_direct_spte() helper KVM: MMU: Add drop_large_spte() helper KVM: MMU: Use __set_spte to link shadow pages ...
Diffstat (limited to 'virt/kvm/iommu.c')
-rw-r--r--virt/kvm/iommu.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
index 96048ee9e39e..62a9caf0563c 100644
--- a/virt/kvm/iommu.c
+++ b/virt/kvm/iommu.c
@@ -16,6 +16,8 @@
16 * 16 *
17 * Copyright (C) 2006-2008 Intel Corporation 17 * Copyright (C) 2006-2008 Intel Corporation
18 * Copyright IBM Corporation, 2008 18 * Copyright IBM Corporation, 2008
19 * Copyright 2010 Red Hat, Inc. and/or its affiliates.
20 *
19 * Author: Allen M. Kay <allen.m.kay@intel.com> 21 * Author: Allen M. Kay <allen.m.kay@intel.com>
20 * Author: Weidong Han <weidong.han@intel.com> 22 * Author: Weidong Han <weidong.han@intel.com>
21 * Author: Ben-Ami Yassour <benami@il.ibm.com> 23 * Author: Ben-Ami Yassour <benami@il.ibm.com>
@@ -106,7 +108,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)
106 get_order(page_size), flags); 108 get_order(page_size), flags);
107 if (r) { 109 if (r) {
108 printk(KERN_ERR "kvm_iommu_map_address:" 110 printk(KERN_ERR "kvm_iommu_map_address:"
109 "iommu failed to map pfn=%lx\n", pfn); 111 "iommu failed to map pfn=%llx\n", pfn);
110 goto unmap_pages; 112 goto unmap_pages;
111 } 113 }
112 114
@@ -124,9 +126,10 @@ unmap_pages:
124 126
125static int kvm_iommu_map_memslots(struct kvm *kvm) 127static int kvm_iommu_map_memslots(struct kvm *kvm)
126{ 128{
127 int i, r = 0; 129 int i, idx, r = 0;
128 struct kvm_memslots *slots; 130 struct kvm_memslots *slots;
129 131
132 idx = srcu_read_lock(&kvm->srcu);
130 slots = kvm_memslots(kvm); 133 slots = kvm_memslots(kvm);
131 134
132 for (i = 0; i < slots->nmemslots; i++) { 135 for (i = 0; i < slots->nmemslots; i++) {
@@ -134,6 +137,7 @@ static int kvm_iommu_map_memslots(struct kvm *kvm)
134 if (r) 137 if (r)
135 break; 138 break;
136 } 139 }
140 srcu_read_unlock(&kvm->srcu, idx);
137 141
138 return r; 142 return r;
139} 143}
@@ -283,15 +287,17 @@ static void kvm_iommu_put_pages(struct kvm *kvm,
283 287
284static int kvm_iommu_unmap_memslots(struct kvm *kvm) 288static int kvm_iommu_unmap_memslots(struct kvm *kvm)
285{ 289{
286 int i; 290 int i, idx;
287 struct kvm_memslots *slots; 291 struct kvm_memslots *slots;
288 292
293 idx = srcu_read_lock(&kvm->srcu);
289 slots = kvm_memslots(kvm); 294 slots = kvm_memslots(kvm);
290 295
291 for (i = 0; i < slots->nmemslots; i++) { 296 for (i = 0; i < slots->nmemslots; i++) {
292 kvm_iommu_put_pages(kvm, slots->memslots[i].base_gfn, 297 kvm_iommu_put_pages(kvm, slots->memslots[i].base_gfn,
293 slots->memslots[i].npages); 298 slots->memslots[i].npages);
294 } 299 }
300 srcu_read_unlock(&kvm->srcu, idx);
295 301
296 return 0; 302 return 0;
297} 303}