diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2009-12-23 11:35:16 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2010-03-01 10:35:43 -0500 |
commit | 46a26bf55714c1e2f17e34683292a389acb8e601 (patch) | |
tree | 3df70225ce6a076d7e4be604a5d72465383043ee /virt/kvm/iommu.c | |
parent | 2044892d4a005a78796c92fd1aef4633be896698 (diff) |
KVM: modify memslots layout in struct kvm
Have a pointer to an allocated region inside struct kvm.
[alex: fix ppc book 3s]
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'virt/kvm/iommu.c')
-rw-r--r-- | virt/kvm/iommu.c | 18 |
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: | |||
76 | static int kvm_iommu_map_memslots(struct kvm *kvm) | 76 | static 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, | |||
210 | static int kvm_iommu_unmap_memslots(struct kvm *kvm) | 213 | static 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; |