aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/iommu.c
diff options
context:
space:
mode:
Diffstat (limited to 'virt/kvm/iommu.c')
-rw-r--r--virt/kvm/iommu.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
index 15147583abd1..bc697a66a883 100644
--- a/virt/kvm/iommu.c
+++ b/virt/kvm/iommu.c
@@ -76,10 +76,13 @@ unmap_pages:
76static int kvm_iommu_map_memslots(struct kvm *kvm) 76static int kvm_iommu_map_memslots(struct kvm *kvm)
77{ 77{
78 int i, r = 0; 78 int i, r = 0;
79 struct kvm_memslots *slots;
79 80
80 for (i = 0; i < kvm->nmemslots; i++) { 81 slots = kvm->memslots;
81 r = kvm_iommu_map_pages(kvm, kvm->memslots[i].base_gfn, 82
82 kvm->memslots[i].npages); 83 for (i = 0; i < slots->nmemslots; i++) {
84 r = kvm_iommu_map_pages(kvm, slots->memslots[i].base_gfn,
85 slots->memslots[i].npages);
83 if (r) 86 if (r)
84 break; 87 break;
85 } 88 }
@@ -210,10 +213,13 @@ static void kvm_iommu_put_pages(struct kvm *kvm,
210static int kvm_iommu_unmap_memslots(struct kvm *kvm) 213static int kvm_iommu_unmap_memslots(struct kvm *kvm)
211{ 214{
212 int i; 215 int i;
216 struct kvm_memslots *slots;
217
218 slots = kvm->memslots;
213 219
214 for (i = 0; i < kvm->nmemslots; i++) { 220 for (i = 0; i < slots->nmemslots; i++) {
215 kvm_iommu_put_pages(kvm, kvm->memslots[i].base_gfn, 221 kvm_iommu_put_pages(kvm, slots->memslots[i].base_gfn,
216 kvm->memslots[i].npages); 222 slots->memslots[i].npages);
217 } 223 }
218 224
219 return 0; 225 return 0;