aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/mmu.c11
-rw-r--r--arch/x86/kvm/vmx.c4
-rw-r--r--arch/x86/kvm/x86.c4
3 files changed, 10 insertions, 9 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) {
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.