diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-12 16:22:12 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-12 16:22:12 -0500 |
commit | 1baa5efbeb6eb75de697f7b5931094be33f12005 (patch) | |
tree | 30358fcebb950305929306c6654f8a585f1f5500 /virt | |
parent | c9bed1cf51011c815d88288b774865d013ca78a8 (diff) | |
parent | 45bdbcfdf241149642fb6c25ab0c209d59c371b7 (diff) |
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull KVM updates from Paolo Bonzini:
"PPC changes will come next week.
- s390: Support for runtime instrumentation within guests, support of
248 VCPUs.
- ARM: rewrite of the arm64 world switch in C, support for 16-bit VM
identifiers. Performance counter virtualization missed the boat.
- x86: Support for more Hyper-V features (synthetic interrupt
controller), MMU cleanups"
* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (115 commits)
kvm: x86: Fix vmwrite to SECONDARY_VM_EXEC_CONTROL
kvm/x86: Hyper-V SynIC timers tracepoints
kvm/x86: Hyper-V SynIC tracepoints
kvm/x86: Update SynIC timers on guest entry only
kvm/x86: Skip SynIC vector check for QEMU side
kvm/x86: Hyper-V fix SynIC timer disabling condition
kvm/x86: Reorg stimer_expiration() to better control timer restart
kvm/x86: Hyper-V unify stimer_start() and stimer_restart()
kvm/x86: Drop stimer_stop() function
kvm/x86: Hyper-V timers fix incorrect logical operation
KVM: move architecture-dependent requests to arch/
KVM: renumber vcpu->request bits
KVM: document which architecture uses each request bit
KVM: Remove unused KVM_REQ_KICK to save a bit in vcpu->requests
kvm: x86: Check kvm_write_guest return value in kvm_write_wall_clock
KVM: s390: implement the RI support of guest
kvm/s390: drop unpaired smp_mb
kvm: x86: fix comment about {mmu,nested_mmu}.gva_to_gpa
KVM: x86: MMU: Use clear_page() instead of init_shadow_page_table()
arm/arm64: KVM: Detect vGIC presence at runtime
...
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/arm/vgic-v3.c | 11 | ||||
-rw-r--r-- | virt/kvm/arm/vgic.c | 2 | ||||
-rw-r--r-- | virt/kvm/async_pf.c | 3 | ||||
-rw-r--r-- | virt/kvm/irqchip.c | 7 | ||||
-rw-r--r-- | virt/kvm/kvm_main.c | 46 |
5 files changed, 23 insertions, 46 deletions
diff --git a/virt/kvm/arm/vgic-v3.c b/virt/kvm/arm/vgic-v3.c index 487d6357b7e7..453eafd4dd6e 100644 --- a/virt/kvm/arm/vgic-v3.c +++ b/virt/kvm/arm/vgic-v3.c | |||
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | #include <asm/kvm_emulate.h> | 29 | #include <asm/kvm_emulate.h> |
30 | #include <asm/kvm_arm.h> | 30 | #include <asm/kvm_arm.h> |
31 | #include <asm/kvm_asm.h> | ||
31 | #include <asm/kvm_mmu.h> | 32 | #include <asm/kvm_mmu.h> |
32 | 33 | ||
33 | /* These are for GICv2 emulation only */ | 34 | /* These are for GICv2 emulation only */ |
@@ -36,18 +37,12 @@ | |||
36 | #define GICH_LR_PHYSID_CPUID (7UL << GICH_LR_PHYSID_CPUID_SHIFT) | 37 | #define GICH_LR_PHYSID_CPUID (7UL << GICH_LR_PHYSID_CPUID_SHIFT) |
37 | #define ICH_LR_VIRTUALID_MASK (BIT_ULL(32) - 1) | 38 | #define ICH_LR_VIRTUALID_MASK (BIT_ULL(32) - 1) |
38 | 39 | ||
39 | /* | ||
40 | * LRs are stored in reverse order in memory. make sure we index them | ||
41 | * correctly. | ||
42 | */ | ||
43 | #define LR_INDEX(lr) (VGIC_V3_MAX_LRS - 1 - lr) | ||
44 | |||
45 | static u32 ich_vtr_el2; | 40 | static u32 ich_vtr_el2; |
46 | 41 | ||
47 | static struct vgic_lr vgic_v3_get_lr(const struct kvm_vcpu *vcpu, int lr) | 42 | static struct vgic_lr vgic_v3_get_lr(const struct kvm_vcpu *vcpu, int lr) |
48 | { | 43 | { |
49 | struct vgic_lr lr_desc; | 44 | struct vgic_lr lr_desc; |
50 | u64 val = vcpu->arch.vgic_cpu.vgic_v3.vgic_lr[LR_INDEX(lr)]; | 45 | u64 val = vcpu->arch.vgic_cpu.vgic_v3.vgic_lr[VGIC_V3_LR_INDEX(lr)]; |
51 | 46 | ||
52 | if (vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3) | 47 | if (vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3) |
53 | lr_desc.irq = val & ICH_LR_VIRTUALID_MASK; | 48 | lr_desc.irq = val & ICH_LR_VIRTUALID_MASK; |
@@ -111,7 +106,7 @@ static void vgic_v3_set_lr(struct kvm_vcpu *vcpu, int lr, | |||
111 | lr_val |= ((u64)lr_desc.hwirq) << ICH_LR_PHYS_ID_SHIFT; | 106 | lr_val |= ((u64)lr_desc.hwirq) << ICH_LR_PHYS_ID_SHIFT; |
112 | } | 107 | } |
113 | 108 | ||
114 | vcpu->arch.vgic_cpu.vgic_v3.vgic_lr[LR_INDEX(lr)] = lr_val; | 109 | vcpu->arch.vgic_cpu.vgic_v3.vgic_lr[VGIC_V3_LR_INDEX(lr)] = lr_val; |
115 | 110 | ||
116 | if (!(lr_desc.state & LR_STATE_MASK)) | 111 | if (!(lr_desc.state & LR_STATE_MASK)) |
117 | vcpu->arch.vgic_cpu.vgic_v3.vgic_elrsr |= (1U << lr); | 112 | vcpu->arch.vgic_cpu.vgic_v3.vgic_elrsr |= (1U << lr); |
diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 7a2f449bd85d..043032c6a5a4 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c | |||
@@ -878,7 +878,7 @@ static int vgic_handle_mmio_write(struct kvm_vcpu *vcpu, | |||
878 | true); | 878 | true); |
879 | } | 879 | } |
880 | 880 | ||
881 | struct kvm_io_device_ops vgic_io_ops = { | 881 | static struct kvm_io_device_ops vgic_io_ops = { |
882 | .read = vgic_handle_mmio_read, | 882 | .read = vgic_handle_mmio_read, |
883 | .write = vgic_handle_mmio_write, | 883 | .write = vgic_handle_mmio_write, |
884 | }; | 884 | }; |
diff --git a/virt/kvm/async_pf.c b/virt/kvm/async_pf.c index 77d42be6970e..353159922456 100644 --- a/virt/kvm/async_pf.c +++ b/virt/kvm/async_pf.c | |||
@@ -57,8 +57,7 @@ int kvm_async_pf_init(void) | |||
57 | 57 | ||
58 | void kvm_async_pf_deinit(void) | 58 | void kvm_async_pf_deinit(void) |
59 | { | 59 | { |
60 | if (async_pf_cache) | 60 | kmem_cache_destroy(async_pf_cache); |
61 | kmem_cache_destroy(async_pf_cache); | ||
62 | async_pf_cache = NULL; | 61 | async_pf_cache = NULL; |
63 | } | 62 | } |
64 | 63 | ||
diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c index f0b08a2a48ba..fe84e1a95dd5 100644 --- a/virt/kvm/irqchip.c +++ b/virt/kvm/irqchip.c | |||
@@ -166,6 +166,10 @@ out: | |||
166 | return r; | 166 | return r; |
167 | } | 167 | } |
168 | 168 | ||
169 | void __attribute__((weak)) kvm_arch_irq_routing_update(struct kvm *kvm) | ||
170 | { | ||
171 | } | ||
172 | |||
169 | int kvm_set_irq_routing(struct kvm *kvm, | 173 | int kvm_set_irq_routing(struct kvm *kvm, |
170 | const struct kvm_irq_routing_entry *ue, | 174 | const struct kvm_irq_routing_entry *ue, |
171 | unsigned nr, | 175 | unsigned nr, |
@@ -219,9 +223,10 @@ int kvm_set_irq_routing(struct kvm *kvm, | |||
219 | old = kvm->irq_routing; | 223 | old = kvm->irq_routing; |
220 | rcu_assign_pointer(kvm->irq_routing, new); | 224 | rcu_assign_pointer(kvm->irq_routing, new); |
221 | kvm_irq_routing_update(kvm); | 225 | kvm_irq_routing_update(kvm); |
226 | kvm_arch_irq_routing_update(kvm); | ||
222 | mutex_unlock(&kvm->irq_lock); | 227 | mutex_unlock(&kvm->irq_lock); |
223 | 228 | ||
224 | kvm_arch_irq_routing_update(kvm); | 229 | kvm_arch_post_irq_routing_update(kvm); |
225 | 230 | ||
226 | synchronize_srcu_expedited(&kvm->irq_srcu); | 231 | synchronize_srcu_expedited(&kvm->irq_srcu); |
227 | 232 | ||
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 484079efea5b..314c7774652e 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -206,16 +206,6 @@ void kvm_reload_remote_mmus(struct kvm *kvm) | |||
206 | kvm_make_all_cpus_request(kvm, KVM_REQ_MMU_RELOAD); | 206 | kvm_make_all_cpus_request(kvm, KVM_REQ_MMU_RELOAD); |
207 | } | 207 | } |
208 | 208 | ||
209 | void kvm_make_mclock_inprogress_request(struct kvm *kvm) | ||
210 | { | ||
211 | kvm_make_all_cpus_request(kvm, KVM_REQ_MCLOCK_INPROGRESS); | ||
212 | } | ||
213 | |||
214 | void kvm_make_scan_ioapic_request(struct kvm *kvm) | ||
215 | { | ||
216 | kvm_make_all_cpus_request(kvm, KVM_REQ_SCAN_IOAPIC); | ||
217 | } | ||
218 | |||
219 | int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id) | 209 | int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id) |
220 | { | 210 | { |
221 | struct page *page; | 211 | struct page *page; |
@@ -1164,15 +1154,15 @@ struct kvm_memory_slot *kvm_vcpu_gfn_to_memslot(struct kvm_vcpu *vcpu, gfn_t gfn | |||
1164 | return __gfn_to_memslot(kvm_vcpu_memslots(vcpu), gfn); | 1154 | return __gfn_to_memslot(kvm_vcpu_memslots(vcpu), gfn); |
1165 | } | 1155 | } |
1166 | 1156 | ||
1167 | int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn) | 1157 | bool kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn) |
1168 | { | 1158 | { |
1169 | struct kvm_memory_slot *memslot = gfn_to_memslot(kvm, gfn); | 1159 | struct kvm_memory_slot *memslot = gfn_to_memslot(kvm, gfn); |
1170 | 1160 | ||
1171 | if (!memslot || memslot->id >= KVM_USER_MEM_SLOTS || | 1161 | if (!memslot || memslot->id >= KVM_USER_MEM_SLOTS || |
1172 | memslot->flags & KVM_MEMSLOT_INVALID) | 1162 | memslot->flags & KVM_MEMSLOT_INVALID) |
1173 | return 0; | 1163 | return false; |
1174 | 1164 | ||
1175 | return 1; | 1165 | return true; |
1176 | } | 1166 | } |
1177 | EXPORT_SYMBOL_GPL(kvm_is_visible_gfn); | 1167 | EXPORT_SYMBOL_GPL(kvm_is_visible_gfn); |
1178 | 1168 | ||
@@ -2257,7 +2247,7 @@ static int create_vcpu_fd(struct kvm_vcpu *vcpu) | |||
2257 | static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id) | 2247 | static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id) |
2258 | { | 2248 | { |
2259 | int r; | 2249 | int r; |
2260 | struct kvm_vcpu *vcpu, *v; | 2250 | struct kvm_vcpu *vcpu; |
2261 | 2251 | ||
2262 | if (id >= KVM_MAX_VCPUS) | 2252 | if (id >= KVM_MAX_VCPUS) |
2263 | return -EINVAL; | 2253 | return -EINVAL; |
@@ -2281,12 +2271,10 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id) | |||
2281 | r = -EINVAL; | 2271 | r = -EINVAL; |
2282 | goto unlock_vcpu_destroy; | 2272 | goto unlock_vcpu_destroy; |
2283 | } | 2273 | } |
2284 | 2274 | if (kvm_get_vcpu_by_id(kvm, id)) { | |
2285 | kvm_for_each_vcpu(r, v, kvm) | 2275 | r = -EEXIST; |
2286 | if (v->vcpu_id == id) { | 2276 | goto unlock_vcpu_destroy; |
2287 | r = -EEXIST; | 2277 | } |
2288 | goto unlock_vcpu_destroy; | ||
2289 | } | ||
2290 | 2278 | ||
2291 | BUG_ON(kvm->vcpus[atomic_read(&kvm->online_vcpus)]); | 2279 | BUG_ON(kvm->vcpus[atomic_read(&kvm->online_vcpus)]); |
2292 | 2280 | ||
@@ -3449,10 +3437,9 @@ static int kvm_init_debug(void) | |||
3449 | goto out; | 3437 | goto out; |
3450 | 3438 | ||
3451 | for (p = debugfs_entries; p->name; ++p) { | 3439 | for (p = debugfs_entries; p->name; ++p) { |
3452 | p->dentry = debugfs_create_file(p->name, 0444, kvm_debugfs_dir, | 3440 | if (!debugfs_create_file(p->name, 0444, kvm_debugfs_dir, |
3453 | (void *)(long)p->offset, | 3441 | (void *)(long)p->offset, |
3454 | stat_fops[p->kind]); | 3442 | stat_fops[p->kind])) |
3455 | if (p->dentry == NULL) | ||
3456 | goto out_dir; | 3443 | goto out_dir; |
3457 | } | 3444 | } |
3458 | 3445 | ||
@@ -3464,15 +3451,6 @@ out: | |||
3464 | return r; | 3451 | return r; |
3465 | } | 3452 | } |
3466 | 3453 | ||
3467 | static void kvm_exit_debug(void) | ||
3468 | { | ||
3469 | struct kvm_stats_debugfs_item *p; | ||
3470 | |||
3471 | for (p = debugfs_entries; p->name; ++p) | ||
3472 | debugfs_remove(p->dentry); | ||
3473 | debugfs_remove(kvm_debugfs_dir); | ||
3474 | } | ||
3475 | |||
3476 | static int kvm_suspend(void) | 3454 | static int kvm_suspend(void) |
3477 | { | 3455 | { |
3478 | if (kvm_usage_count) | 3456 | if (kvm_usage_count) |
@@ -3630,7 +3608,7 @@ EXPORT_SYMBOL_GPL(kvm_init); | |||
3630 | 3608 | ||
3631 | void kvm_exit(void) | 3609 | void kvm_exit(void) |
3632 | { | 3610 | { |
3633 | kvm_exit_debug(); | 3611 | debugfs_remove_recursive(kvm_debugfs_dir); |
3634 | misc_deregister(&kvm_dev); | 3612 | misc_deregister(&kvm_dev); |
3635 | kmem_cache_destroy(kvm_vcpu_cache); | 3613 | kmem_cache_destroy(kvm_vcpu_cache); |
3636 | kvm_async_pf_deinit(); | 3614 | kvm_async_pf_deinit(); |