diff options
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/ioapic.c | 2 | ||||
-rw-r--r-- | virt/kvm/kvm_main.c | 26 |
2 files changed, 7 insertions, 21 deletions
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c index 0b9df8303dcf..8df1ca104a7f 100644 --- a/virt/kvm/ioapic.c +++ b/virt/kvm/ioapic.c | |||
@@ -167,7 +167,7 @@ static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq) | |||
167 | 167 | ||
168 | ioapic_debug("dest=%x dest_mode=%x delivery_mode=%x " | 168 | ioapic_debug("dest=%x dest_mode=%x delivery_mode=%x " |
169 | "vector=%x trig_mode=%x\n", | 169 | "vector=%x trig_mode=%x\n", |
170 | entry->fields.dest, entry->fields.dest_mode, | 170 | entry->fields.dest_id, entry->fields.dest_mode, |
171 | entry->fields.delivery_mode, entry->fields.vector, | 171 | entry->fields.delivery_mode, entry->fields.vector, |
172 | entry->fields.trig_mode); | 172 | entry->fields.trig_mode); |
173 | 173 | ||
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 6330653480e4..22cdb960660a 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -467,6 +467,7 @@ static struct kvm *kvm_create_vm(void) | |||
467 | if (!kvm->buses[i]) | 467 | if (!kvm->buses[i]) |
468 | goto out_err; | 468 | goto out_err; |
469 | } | 469 | } |
470 | spin_lock_init(&kvm->mmu_lock); | ||
470 | 471 | ||
471 | r = kvm_init_mmu_notifier(kvm); | 472 | r = kvm_init_mmu_notifier(kvm); |
472 | if (r) | 473 | if (r) |
@@ -474,7 +475,6 @@ static struct kvm *kvm_create_vm(void) | |||
474 | 475 | ||
475 | kvm->mm = current->mm; | 476 | kvm->mm = current->mm; |
476 | atomic_inc(&kvm->mm->mm_count); | 477 | atomic_inc(&kvm->mm->mm_count); |
477 | spin_lock_init(&kvm->mmu_lock); | ||
478 | kvm_eventfd_init(kvm); | 478 | kvm_eventfd_init(kvm); |
479 | mutex_init(&kvm->lock); | 479 | mutex_init(&kvm->lock); |
480 | mutex_init(&kvm->irq_lock); | 480 | mutex_init(&kvm->irq_lock); |
@@ -648,7 +648,10 @@ int __kvm_set_memory_region(struct kvm *kvm, | |||
648 | goto out; | 648 | goto out; |
649 | if (mem->guest_phys_addr & (PAGE_SIZE - 1)) | 649 | if (mem->guest_phys_addr & (PAGE_SIZE - 1)) |
650 | goto out; | 650 | goto out; |
651 | if (user_alloc && (mem->userspace_addr & (PAGE_SIZE - 1))) | 651 | /* We can read the guest memory with __xxx_user() later on. */ |
652 | if (user_alloc && | ||
653 | ((mem->userspace_addr & (PAGE_SIZE - 1)) || | ||
654 | !access_ok(VERIFY_WRITE, mem->userspace_addr, mem->memory_size))) | ||
652 | goto out; | 655 | goto out; |
653 | if (mem->slot >= KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS) | 656 | if (mem->slot >= KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS) |
654 | goto out; | 657 | goto out; |
@@ -996,23 +999,6 @@ out: | |||
996 | return size; | 999 | return size; |
997 | } | 1000 | } |
998 | 1001 | ||
999 | int memslot_id(struct kvm *kvm, gfn_t gfn) | ||
1000 | { | ||
1001 | int i; | ||
1002 | struct kvm_memslots *slots = kvm_memslots(kvm); | ||
1003 | struct kvm_memory_slot *memslot = NULL; | ||
1004 | |||
1005 | for (i = 0; i < slots->nmemslots; ++i) { | ||
1006 | memslot = &slots->memslots[i]; | ||
1007 | |||
1008 | if (gfn >= memslot->base_gfn | ||
1009 | && gfn < memslot->base_gfn + memslot->npages) | ||
1010 | break; | ||
1011 | } | ||
1012 | |||
1013 | return memslot - slots->memslots; | ||
1014 | } | ||
1015 | |||
1016 | static unsigned long gfn_to_hva_many(struct kvm_memory_slot *slot, gfn_t gfn, | 1002 | static unsigned long gfn_to_hva_many(struct kvm_memory_slot *slot, gfn_t gfn, |
1017 | gfn_t *nr_pages) | 1003 | gfn_t *nr_pages) |
1018 | { | 1004 | { |
@@ -1300,7 +1286,7 @@ int kvm_read_guest_page(struct kvm *kvm, gfn_t gfn, void *data, int offset, | |||
1300 | addr = gfn_to_hva(kvm, gfn); | 1286 | addr = gfn_to_hva(kvm, gfn); |
1301 | if (kvm_is_error_hva(addr)) | 1287 | if (kvm_is_error_hva(addr)) |
1302 | return -EFAULT; | 1288 | return -EFAULT; |
1303 | r = copy_from_user(data, (void __user *)addr + offset, len); | 1289 | r = __copy_from_user(data, (void __user *)addr + offset, len); |
1304 | if (r) | 1290 | if (r) |
1305 | return -EFAULT; | 1291 | return -EFAULT; |
1306 | return 0; | 1292 | return 0; |