aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
authorTodd Poynor <toddpoynor@google.com>2012-05-08 11:39:15 -0700
committerTodd Poynor <toddpoynor@google.com>2012-05-08 11:39:15 -0700
commit6bb60d745d723659777f56e0871d40ee94d94773 (patch)
tree0db925b25a18621f75b429ef81dee0cfc66a130f /virt/kvm
parentd333f20f36615711c33d50f47cf2ca097c678010 (diff)
parent52f91d889a2c2a0f9e0b5e97fa7be8b584834016 (diff)
downloadkernel_samsung_tuna-6bb60d745d723659777f56e0871d40ee94d94773.zip
kernel_samsung_tuna-6bb60d745d723659777f56e0871d40ee94d94773.tar.gz
kernel_samsung_tuna-6bb60d745d723659777f56e0871d40ee94d94773.tar.bz2
Merge branch 'android-3.0' into android-omap-3.0
Diffstat (limited to 'virt/kvm')
-rw-r--r--virt/kvm/iommu.c12
-rw-r--r--virt/kvm/kvm_main.c5
2 files changed, 11 insertions, 6 deletions
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
index 62a9caf..fb0f6e4 100644
--- a/virt/kvm/iommu.c
+++ b/virt/kvm/iommu.c
@@ -285,6 +285,11 @@ static void kvm_iommu_put_pages(struct kvm *kvm,
}
}
+void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot)
+{
+ kvm_iommu_put_pages(kvm, slot->base_gfn, slot->npages);
+}
+
static int kvm_iommu_unmap_memslots(struct kvm *kvm)
{
int i, idx;
@@ -293,10 +298,9 @@ static int kvm_iommu_unmap_memslots(struct kvm *kvm)
idx = srcu_read_lock(&kvm->srcu);
slots = kvm_memslots(kvm);
- for (i = 0; i < slots->nmemslots; i++) {
- kvm_iommu_put_pages(kvm, slots->memslots[i].base_gfn,
- slots->memslots[i].npages);
- }
+ for (i = 0; i < slots->nmemslots; i++)
+ kvm_iommu_unmap_pages(kvm, &slots->memslots[i]);
+
srcu_read_unlock(&kvm->srcu, idx);
return 0;
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 96ebc06..6b39ba9 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -796,12 +796,13 @@ skip_lpage:
if (r)
goto out_free;
- /* map the pages in iommu page table */
+ /* map/unmap the pages in iommu page table */
if (npages) {
r = kvm_iommu_map_pages(kvm, &new);
if (r)
goto out_free;
- }
+ } else
+ kvm_iommu_unmap_pages(kvm, &old);
r = -ENOMEM;
slots = kzalloc(sizeof(struct kvm_memslots), GFP_KERNEL);