aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/ia64/kvm/kvm-ia64.c10
-rw-r--r--arch/powerpc/kvm/book3s.c2
-rw-r--r--arch/x86/kvm/mmu.c11
-rw-r--r--arch/x86/kvm/vmx.c4
-rw-r--r--arch/x86/kvm/x86.c4
5 files changed, 17 insertions, 14 deletions
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index 5fdeec5fddcf..1ca1dbf48117 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -1377,12 +1377,14 @@ static void free_kvm(struct kvm *kvm)
1377 1377
1378static void kvm_release_vm_pages(struct kvm *kvm) 1378static void kvm_release_vm_pages(struct kvm *kvm)
1379{ 1379{
1380 struct kvm_memslots *slots;
1380 struct kvm_memory_slot *memslot; 1381 struct kvm_memory_slot *memslot;
1381 int i, j; 1382 int i, j;
1382 unsigned long base_gfn; 1383 unsigned long base_gfn;
1383 1384
1384 for (i = 0; i < kvm->nmemslots; i++) { 1385 slots = kvm->memslots;
1385 memslot = &kvm->memslots[i]; 1386 for (i = 0; i < slots->nmemslots; i++) {
1387 memslot = &slots->memslots[i];
1386 base_gfn = memslot->base_gfn; 1388 base_gfn = memslot->base_gfn;
1387 1389
1388 for (j = 0; j < memslot->npages; j++) { 1390 for (j = 0; j < memslot->npages; j++) {
@@ -1802,7 +1804,7 @@ static int kvm_ia64_sync_dirty_log(struct kvm *kvm,
1802 if (log->slot >= KVM_MEMORY_SLOTS) 1804 if (log->slot >= KVM_MEMORY_SLOTS)
1803 goto out; 1805 goto out;
1804 1806
1805 memslot = &kvm->memslots[log->slot]; 1807 memslot = &kvm->memslots->memslots[log->slot];
1806 r = -ENOENT; 1808 r = -ENOENT;
1807 if (!memslot->dirty_bitmap) 1809 if (!memslot->dirty_bitmap)
1808 goto out; 1810 goto out;
@@ -1840,7 +1842,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
1840 /* If nothing is dirty, don't bother messing with page tables. */ 1842 /* If nothing is dirty, don't bother messing with page tables. */
1841 if (is_dirty) { 1843 if (is_dirty) {
1842 kvm_flush_remote_tlbs(kvm); 1844 kvm_flush_remote_tlbs(kvm);
1843 memslot = &kvm->memslots[log->slot]; 1845 memslot = &kvm->memslots->memslots[log->slot];
1844 n = ALIGN(memslot->npages, BITS_PER_LONG) / 8; 1846 n = ALIGN(memslot->npages, BITS_PER_LONG) / 8;
1845 memset(memslot->dirty_bitmap, 0, n); 1847 memset(memslot->dirty_bitmap, 0, n);
1846 } 1848 }
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index 803505d3e455..bb8873dcb20f 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -865,7 +865,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
865 865
866 /* If nothing is dirty, don't bother messing with page tables. */ 866 /* If nothing is dirty, don't bother messing with page tables. */
867 if (is_dirty) { 867 if (is_dirty) {
868 memslot = &kvm->memslots[log->slot]; 868 memslot = &kvm->memslots->memslots[log->slot];
869 869
870 ga = memslot->base_gfn << PAGE_SHIFT; 870 ga = memslot->base_gfn << PAGE_SHIFT;
871 ga_end = ga + (memslot->npages << PAGE_SHIFT); 871 ga_end = ga + (memslot->npages << PAGE_SHIFT);
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) {
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 74a66f0c00b4..18698799e365 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -1503,8 +1503,8 @@ static void enter_pmode(struct kvm_vcpu *vcpu)
1503static gva_t rmode_tss_base(struct kvm *kvm) 1503static gva_t rmode_tss_base(struct kvm *kvm)
1504{ 1504{
1505 if (!kvm->arch.tss_addr) { 1505 if (!kvm->arch.tss_addr) {
1506 gfn_t base_gfn = kvm->memslots[0].base_gfn + 1506 gfn_t base_gfn = kvm->memslots->memslots[0].base_gfn +
1507 kvm->memslots[0].npages - 3; 1507 kvm->memslots->memslots[0].npages - 3;
1508 return base_gfn << PAGE_SHIFT; 1508 return base_gfn << PAGE_SHIFT;
1509 } 1509 }
1510 return kvm->arch.tss_addr; 1510 return kvm->arch.tss_addr;
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 8798504ace11..3b81cb9da8b8 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2427,7 +2427,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
2427 spin_lock(&kvm->mmu_lock); 2427 spin_lock(&kvm->mmu_lock);
2428 kvm_mmu_slot_remove_write_access(kvm, log->slot); 2428 kvm_mmu_slot_remove_write_access(kvm, log->slot);
2429 spin_unlock(&kvm->mmu_lock); 2429 spin_unlock(&kvm->mmu_lock);
2430 memslot = &kvm->memslots[log->slot]; 2430 memslot = &kvm->memslots->memslots[log->slot];
2431 n = ALIGN(memslot->npages, BITS_PER_LONG) / 8; 2431 n = ALIGN(memslot->npages, BITS_PER_LONG) / 8;
2432 memset(memslot->dirty_bitmap, 0, n); 2432 memset(memslot->dirty_bitmap, 0, n);
2433 } 2433 }
@@ -5223,7 +5223,7 @@ int kvm_arch_set_memory_region(struct kvm *kvm,
5223 int user_alloc) 5223 int user_alloc)
5224{ 5224{
5225 int npages = mem->memory_size >> PAGE_SHIFT; 5225 int npages = mem->memory_size >> PAGE_SHIFT;
5226 struct kvm_memory_slot *memslot = &kvm->memslots[mem->slot]; 5226 struct kvm_memory_slot *memslot = &kvm->memslots->memslots[mem->slot];
5227 5227
5228 /*To keep backward compatibility with older userspace, 5228 /*To keep backward compatibility with older userspace,
5229 *x86 needs to hanlde !user_alloc case. 5229 *x86 needs to hanlde !user_alloc case.