diff options
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kvm/i8254.c | 2 | ||||
-rw-r--r-- | arch/x86/kvm/i8259.c | 4 | ||||
-rw-r--r-- | arch/x86/kvm/vmx.c | 8 | ||||
-rw-r--r-- | arch/x86/kvm/x86.c | 16 |
4 files changed, 15 insertions, 15 deletions
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index 4b433de02e5b..6a74246f80c6 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c | |||
@@ -605,7 +605,7 @@ static const struct kvm_io_device_ops speaker_dev_ops = { | |||
605 | .write = speaker_ioport_write, | 605 | .write = speaker_ioport_write, |
606 | }; | 606 | }; |
607 | 607 | ||
608 | /* Caller must have writers lock on slots_lock */ | 608 | /* Caller must hold slots_lock */ |
609 | struct kvm_pit *kvm_create_pit(struct kvm *kvm, u32 flags) | 609 | struct kvm_pit *kvm_create_pit(struct kvm *kvm, u32 flags) |
610 | { | 610 | { |
611 | struct kvm_pit *pit; | 611 | struct kvm_pit *pit; |
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c index b7d145b20953..d5753a75d58c 100644 --- a/arch/x86/kvm/i8259.c +++ b/arch/x86/kvm/i8259.c | |||
@@ -533,9 +533,9 @@ struct kvm_pic *kvm_create_pic(struct kvm *kvm) | |||
533 | * Initialize PIO device | 533 | * Initialize PIO device |
534 | */ | 534 | */ |
535 | kvm_iodevice_init(&s->dev, &picdev_ops); | 535 | kvm_iodevice_init(&s->dev, &picdev_ops); |
536 | down_write(&kvm->slots_lock); | 536 | mutex_lock(&kvm->slots_lock); |
537 | ret = kvm_io_bus_register_dev(kvm, KVM_PIO_BUS, &s->dev); | 537 | ret = kvm_io_bus_register_dev(kvm, KVM_PIO_BUS, &s->dev); |
538 | up_write(&kvm->slots_lock); | 538 | mutex_unlock(&kvm->slots_lock); |
539 | if (ret < 0) { | 539 | if (ret < 0) { |
540 | kfree(s); | 540 | kfree(s); |
541 | return NULL; | 541 | return NULL; |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 22ab7137d1d0..f04e2ff21383 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -2223,7 +2223,7 @@ static int alloc_apic_access_page(struct kvm *kvm) | |||
2223 | struct kvm_userspace_memory_region kvm_userspace_mem; | 2223 | struct kvm_userspace_memory_region kvm_userspace_mem; |
2224 | int r = 0; | 2224 | int r = 0; |
2225 | 2225 | ||
2226 | down_write(&kvm->slots_lock); | 2226 | mutex_lock(&kvm->slots_lock); |
2227 | if (kvm->arch.apic_access_page) | 2227 | if (kvm->arch.apic_access_page) |
2228 | goto out; | 2228 | goto out; |
2229 | kvm_userspace_mem.slot = APIC_ACCESS_PAGE_PRIVATE_MEMSLOT; | 2229 | kvm_userspace_mem.slot = APIC_ACCESS_PAGE_PRIVATE_MEMSLOT; |
@@ -2236,7 +2236,7 @@ static int alloc_apic_access_page(struct kvm *kvm) | |||
2236 | 2236 | ||
2237 | kvm->arch.apic_access_page = gfn_to_page(kvm, 0xfee00); | 2237 | kvm->arch.apic_access_page = gfn_to_page(kvm, 0xfee00); |
2238 | out: | 2238 | out: |
2239 | up_write(&kvm->slots_lock); | 2239 | mutex_unlock(&kvm->slots_lock); |
2240 | return r; | 2240 | return r; |
2241 | } | 2241 | } |
2242 | 2242 | ||
@@ -2245,7 +2245,7 @@ static int alloc_identity_pagetable(struct kvm *kvm) | |||
2245 | struct kvm_userspace_memory_region kvm_userspace_mem; | 2245 | struct kvm_userspace_memory_region kvm_userspace_mem; |
2246 | int r = 0; | 2246 | int r = 0; |
2247 | 2247 | ||
2248 | down_write(&kvm->slots_lock); | 2248 | mutex_lock(&kvm->slots_lock); |
2249 | if (kvm->arch.ept_identity_pagetable) | 2249 | if (kvm->arch.ept_identity_pagetable) |
2250 | goto out; | 2250 | goto out; |
2251 | kvm_userspace_mem.slot = IDENTITY_PAGETABLE_PRIVATE_MEMSLOT; | 2251 | kvm_userspace_mem.slot = IDENTITY_PAGETABLE_PRIVATE_MEMSLOT; |
@@ -2260,7 +2260,7 @@ static int alloc_identity_pagetable(struct kvm *kvm) | |||
2260 | kvm->arch.ept_identity_pagetable = gfn_to_page(kvm, | 2260 | kvm->arch.ept_identity_pagetable = gfn_to_page(kvm, |
2261 | kvm->arch.ept_identity_map_addr >> PAGE_SHIFT); | 2261 | kvm->arch.ept_identity_map_addr >> PAGE_SHIFT); |
2262 | out: | 2262 | out: |
2263 | up_write(&kvm->slots_lock); | 2263 | mutex_unlock(&kvm->slots_lock); |
2264 | return r; | 2264 | return r; |
2265 | } | 2265 | } |
2266 | 2266 | ||
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 53bc06a68105..aff3479867a8 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -2208,14 +2208,14 @@ static int kvm_vm_ioctl_set_nr_mmu_pages(struct kvm *kvm, | |||
2208 | if (kvm_nr_mmu_pages < KVM_MIN_ALLOC_MMU_PAGES) | 2208 | if (kvm_nr_mmu_pages < KVM_MIN_ALLOC_MMU_PAGES) |
2209 | return -EINVAL; | 2209 | return -EINVAL; |
2210 | 2210 | ||
2211 | down_write(&kvm->slots_lock); | 2211 | mutex_lock(&kvm->slots_lock); |
2212 | spin_lock(&kvm->mmu_lock); | 2212 | spin_lock(&kvm->mmu_lock); |
2213 | 2213 | ||
2214 | kvm_mmu_change_mmu_pages(kvm, kvm_nr_mmu_pages); | 2214 | kvm_mmu_change_mmu_pages(kvm, kvm_nr_mmu_pages); |
2215 | kvm->arch.n_requested_mmu_pages = kvm_nr_mmu_pages; | 2215 | kvm->arch.n_requested_mmu_pages = kvm_nr_mmu_pages; |
2216 | 2216 | ||
2217 | spin_unlock(&kvm->mmu_lock); | 2217 | spin_unlock(&kvm->mmu_lock); |
2218 | up_write(&kvm->slots_lock); | 2218 | mutex_unlock(&kvm->slots_lock); |
2219 | return 0; | 2219 | return 0; |
2220 | } | 2220 | } |
2221 | 2221 | ||
@@ -2292,7 +2292,7 @@ static int kvm_vm_ioctl_set_memory_alias(struct kvm *kvm, | |||
2292 | if (!aliases) | 2292 | if (!aliases) |
2293 | goto out; | 2293 | goto out; |
2294 | 2294 | ||
2295 | down_write(&kvm->slots_lock); | 2295 | mutex_lock(&kvm->slots_lock); |
2296 | 2296 | ||
2297 | /* invalidate any gfn reference in case of deletion/shrinking */ | 2297 | /* invalidate any gfn reference in case of deletion/shrinking */ |
2298 | memcpy(aliases, kvm->arch.aliases, sizeof(struct kvm_mem_aliases)); | 2298 | memcpy(aliases, kvm->arch.aliases, sizeof(struct kvm_mem_aliases)); |
@@ -2328,7 +2328,7 @@ static int kvm_vm_ioctl_set_memory_alias(struct kvm *kvm, | |||
2328 | r = 0; | 2328 | r = 0; |
2329 | 2329 | ||
2330 | out_unlock: | 2330 | out_unlock: |
2331 | up_write(&kvm->slots_lock); | 2331 | mutex_unlock(&kvm->slots_lock); |
2332 | out: | 2332 | out: |
2333 | return r; | 2333 | return r; |
2334 | } | 2334 | } |
@@ -2462,7 +2462,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, | |||
2462 | unsigned long is_dirty = 0; | 2462 | unsigned long is_dirty = 0; |
2463 | unsigned long *dirty_bitmap = NULL; | 2463 | unsigned long *dirty_bitmap = NULL; |
2464 | 2464 | ||
2465 | down_write(&kvm->slots_lock); | 2465 | mutex_lock(&kvm->slots_lock); |
2466 | 2466 | ||
2467 | r = -EINVAL; | 2467 | r = -EINVAL; |
2468 | if (log->slot >= KVM_MEMORY_SLOTS) | 2468 | if (log->slot >= KVM_MEMORY_SLOTS) |
@@ -2512,7 +2512,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, | |||
2512 | out_free: | 2512 | out_free: |
2513 | vfree(dirty_bitmap); | 2513 | vfree(dirty_bitmap); |
2514 | out: | 2514 | out: |
2515 | up_write(&kvm->slots_lock); | 2515 | mutex_unlock(&kvm->slots_lock); |
2516 | return r; | 2516 | return r; |
2517 | } | 2517 | } |
2518 | 2518 | ||
@@ -2625,7 +2625,7 @@ long kvm_arch_vm_ioctl(struct file *filp, | |||
2625 | sizeof(struct kvm_pit_config))) | 2625 | sizeof(struct kvm_pit_config))) |
2626 | goto out; | 2626 | goto out; |
2627 | create_pit: | 2627 | create_pit: |
2628 | down_write(&kvm->slots_lock); | 2628 | mutex_lock(&kvm->slots_lock); |
2629 | r = -EEXIST; | 2629 | r = -EEXIST; |
2630 | if (kvm->arch.vpit) | 2630 | if (kvm->arch.vpit) |
2631 | goto create_pit_unlock; | 2631 | goto create_pit_unlock; |
@@ -2634,7 +2634,7 @@ long kvm_arch_vm_ioctl(struct file *filp, | |||
2634 | if (kvm->arch.vpit) | 2634 | if (kvm->arch.vpit) |
2635 | r = 0; | 2635 | r = 0; |
2636 | create_pit_unlock: | 2636 | create_pit_unlock: |
2637 | up_write(&kvm->slots_lock); | 2637 | mutex_unlock(&kvm->slots_lock); |
2638 | break; | 2638 | break; |
2639 | case KVM_IRQ_LINE_STATUS: | 2639 | case KVM_IRQ_LINE_STATUS: |
2640 | case KVM_IRQ_LINE: { | 2640 | case KVM_IRQ_LINE: { |