aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mmu.c
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2009-12-23 11:35:16 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2010-03-01 10:35:43 -0500
commit46a26bf55714c1e2f17e34683292a389acb8e601 (patch)
tree3df70225ce6a076d7e4be604a5d72465383043ee /arch/x86/kvm/mmu.c
parent2044892d4a005a78796c92fd1aef4633be896698 (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 'arch/x86/kvm/mmu.c')
-rw-r--r--arch/x86/kvm/mmu.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 4f499d7f7106..81f84d326a84 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -807,13 +807,14 @@ static int kvm_handle_hva(struct kvm *kvm, unsigned long hva,
807{ 807{
808 int i, j; 808 int i, j;
809 int retval = 0; 809 int retval = 0;
810 struct kvm_memslots *slots = kvm->memslots;
810 811
811 /* 812 /*
812 * If mmap_sem isn't taken, we can look the memslots with only 813 * If mmap_sem isn't taken, we can look the memslots with only
813 * the mmu_lock by skipping over the slots with userspace_addr == 0. 814 * the mmu_lock by skipping over the slots with userspace_addr == 0.
814 */ 815 */
815 for (i = 0; i < kvm->nmemslots; i++) { 816 for (i = 0; i < slots->nmemslots; i++) {
816 struct kvm_memory_slot *memslot = &kvm->memslots[i]; 817 struct kvm_memory_slot *memslot = &slots->memslots[i];
817 unsigned long start = memslot->userspace_addr; 818 unsigned long start = memslot->userspace_addr;
818 unsigned long end; 819 unsigned long end;
819 820
@@ -3021,8 +3022,8 @@ unsigned int kvm_mmu_calculate_mmu_pages(struct kvm *kvm)
3021 unsigned int nr_mmu_pages; 3022 unsigned int nr_mmu_pages;
3022 unsigned int nr_pages = 0; 3023 unsigned int nr_pages = 0;
3023 3024
3024 for (i = 0; i < kvm->nmemslots; i++) 3025 for (i = 0; i < kvm->memslots->nmemslots; i++)
3025 nr_pages += kvm->memslots[i].npages; 3026 nr_pages += kvm->memslots->memslots[i].npages;
3026 3027
3027 nr_mmu_pages = nr_pages * KVM_PERMILLE_MMU_PAGES / 1000; 3028 nr_mmu_pages = nr_pages * KVM_PERMILLE_MMU_PAGES / 1000;
3028 nr_mmu_pages = max(nr_mmu_pages, 3029 nr_mmu_pages = max(nr_mmu_pages,
@@ -3295,7 +3296,7 @@ static int count_rmaps(struct kvm_vcpu *vcpu)
3295 int i, j, k; 3296 int i, j, k;
3296 3297
3297 for (i = 0; i < KVM_MEMORY_SLOTS; ++i) { 3298 for (i = 0; i < KVM_MEMORY_SLOTS; ++i) {
3298 struct kvm_memory_slot *m = &vcpu->kvm->memslots[i]; 3299 struct kvm_memory_slot *m = &vcpu->kvm->memslots->memslots[i];
3299 struct kvm_rmap_desc *d; 3300 struct kvm_rmap_desc *d;
3300 3301
3301 for (j = 0; j < m->npages; ++j) { 3302 for (j = 0; j < m->npages; ++j) {