diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-10 19:42:49 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-10 19:42:49 -0400 |
| commit | 519f526d391b0ef775aeb04c4b6f632ea6b3ee50 (patch) | |
| tree | 36985d7882734c136fc3c9a48e9d9abf9e97c1f1 /include | |
| parent | 06ab838c2024db468855118087db16d8fa905ddc (diff) | |
| parent | ba60c41ae392b473a1897faa0b8739fcb8759d69 (diff) | |
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull more kvm updates from Paolo Bonzini:
"ARM:
- Full debug support for arm64
- Active state switching for timer interrupts
- Lazy FP/SIMD save/restore for arm64
- Generic ARMv8 target
PPC:
- Book3S: A few bug fixes
- Book3S: Allow micro-threading on POWER8
x86:
- Compiler warnings
Generic:
- Adaptive polling for guest halt"
* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (49 commits)
kvm: irqchip: fix memory leak
kvm: move new trace event outside #ifdef CONFIG_KVM_ASYNC_PF
KVM: trace kvm_halt_poll_ns grow/shrink
KVM: dynamic halt-polling
KVM: make halt_poll_ns per-vCPU
Silence compiler warning in arch/x86/kvm/emulate.c
kvm: compile process_smi_save_seg_64() only for x86_64
KVM: x86: avoid uninitialized variable warning
KVM: PPC: Book3S: Fix typo in top comment about locking
KVM: PPC: Book3S: Fix size of the PSPB register
KVM: PPC: Book3S HV: Exit on H_DOORBELL if HOST_IPI is set
KVM: PPC: Book3S HV: Fix race in starting secondary threads
KVM: PPC: Book3S: correct width in XER handling
KVM: PPC: Book3S HV: Fix preempted vcore stolen time calculation
KVM: PPC: Book3S HV: Fix preempted vcore list locking
KVM: PPC: Book3S HV: Implement H_CLEAR_REF and H_CLEAR_MOD
KVM: PPC: Book3S HV: Fix bug in dirty page tracking
KVM: PPC: Book3S HV: Fix race in reading change bit when removing HPTE
KVM: PPC: Book3S HV: Implement dynamic micro-threading on POWER8
KVM: PPC: Book3S HV: Make use of unused threads when running guests
...
Diffstat (limited to 'include')
| -rw-r--r-- | include/kvm/arm_arch_timer.h | 7 | ||||
| -rw-r--r-- | include/kvm/arm_vgic.h | 39 | ||||
| -rw-r--r-- | include/linux/irqchip/arm-gic-v3.h | 3 | ||||
| -rw-r--r-- | include/linux/irqchip/arm-gic.h | 3 | ||||
| -rw-r--r-- | include/linux/kvm_host.h | 1 | ||||
| -rw-r--r-- | include/trace/events/kvm.h | 30 | ||||
| -rw-r--r-- | include/uapi/linux/kvm.h | 5 |
7 files changed, 82 insertions, 6 deletions
diff --git a/include/kvm/arm_arch_timer.h b/include/kvm/arm_arch_timer.h index e5966758c093..e1e4d7c38dda 100644 --- a/include/kvm/arm_arch_timer.h +++ b/include/kvm/arm_arch_timer.h | |||
| @@ -52,13 +52,16 @@ struct arch_timer_cpu { | |||
| 52 | 52 | ||
| 53 | /* Timer IRQ */ | 53 | /* Timer IRQ */ |
| 54 | const struct kvm_irq_level *irq; | 54 | const struct kvm_irq_level *irq; |
| 55 | |||
| 56 | /* VGIC mapping */ | ||
| 57 | struct irq_phys_map *map; | ||
| 55 | }; | 58 | }; |
| 56 | 59 | ||
| 57 | int kvm_timer_hyp_init(void); | 60 | int kvm_timer_hyp_init(void); |
| 58 | void kvm_timer_enable(struct kvm *kvm); | 61 | void kvm_timer_enable(struct kvm *kvm); |
| 59 | void kvm_timer_init(struct kvm *kvm); | 62 | void kvm_timer_init(struct kvm *kvm); |
| 60 | void kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu, | 63 | int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu, |
| 61 | const struct kvm_irq_level *irq); | 64 | const struct kvm_irq_level *irq); |
| 62 | void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu); | 65 | void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu); |
| 63 | void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu); | 66 | void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu); |
| 64 | void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu); | 67 | void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu); |
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h index 133ea00aa83b..d901f1a47be6 100644 --- a/include/kvm/arm_vgic.h +++ b/include/kvm/arm_vgic.h | |||
| @@ -95,11 +95,15 @@ enum vgic_type { | |||
| 95 | #define LR_STATE_ACTIVE (1 << 1) | 95 | #define LR_STATE_ACTIVE (1 << 1) |
| 96 | #define LR_STATE_MASK (3 << 0) | 96 | #define LR_STATE_MASK (3 << 0) |
| 97 | #define LR_EOI_INT (1 << 2) | 97 | #define LR_EOI_INT (1 << 2) |
| 98 | #define LR_HW (1 << 3) | ||
| 98 | 99 | ||
| 99 | struct vgic_lr { | 100 | struct vgic_lr { |
| 100 | u16 irq; | 101 | unsigned irq:10; |
| 101 | u8 source; | 102 | union { |
| 102 | u8 state; | 103 | unsigned hwirq:10; |
| 104 | unsigned source:3; | ||
| 105 | }; | ||
| 106 | unsigned state:4; | ||
| 103 | }; | 107 | }; |
| 104 | 108 | ||
| 105 | struct vgic_vmcr { | 109 | struct vgic_vmcr { |
| @@ -155,6 +159,19 @@ struct vgic_io_device { | |||
| 155 | struct kvm_io_device dev; | 159 | struct kvm_io_device dev; |
| 156 | }; | 160 | }; |
| 157 | 161 | ||
| 162 | struct irq_phys_map { | ||
| 163 | u32 virt_irq; | ||
| 164 | u32 phys_irq; | ||
| 165 | u32 irq; | ||
| 166 | bool active; | ||
| 167 | }; | ||
| 168 | |||
| 169 | struct irq_phys_map_entry { | ||
| 170 | struct list_head entry; | ||
| 171 | struct rcu_head rcu; | ||
| 172 | struct irq_phys_map map; | ||
| 173 | }; | ||
| 174 | |||
| 158 | struct vgic_dist { | 175 | struct vgic_dist { |
| 159 | spinlock_t lock; | 176 | spinlock_t lock; |
| 160 | bool in_kernel; | 177 | bool in_kernel; |
| @@ -252,6 +269,10 @@ struct vgic_dist { | |||
| 252 | struct vgic_vm_ops vm_ops; | 269 | struct vgic_vm_ops vm_ops; |
| 253 | struct vgic_io_device dist_iodev; | 270 | struct vgic_io_device dist_iodev; |
| 254 | struct vgic_io_device *redist_iodevs; | 271 | struct vgic_io_device *redist_iodevs; |
| 272 | |||
| 273 | /* Virtual irq to hwirq mapping */ | ||
| 274 | spinlock_t irq_phys_map_lock; | ||
| 275 | struct list_head irq_phys_map_list; | ||
| 255 | }; | 276 | }; |
| 256 | 277 | ||
| 257 | struct vgic_v2_cpu_if { | 278 | struct vgic_v2_cpu_if { |
| @@ -303,6 +324,9 @@ struct vgic_cpu { | |||
| 303 | struct vgic_v2_cpu_if vgic_v2; | 324 | struct vgic_v2_cpu_if vgic_v2; |
| 304 | struct vgic_v3_cpu_if vgic_v3; | 325 | struct vgic_v3_cpu_if vgic_v3; |
| 305 | }; | 326 | }; |
| 327 | |||
| 328 | /* Protected by the distributor's irq_phys_map_lock */ | ||
| 329 | struct list_head irq_phys_map_list; | ||
| 306 | }; | 330 | }; |
| 307 | 331 | ||
| 308 | #define LR_EMPTY 0xff | 332 | #define LR_EMPTY 0xff |
| @@ -317,16 +341,25 @@ int kvm_vgic_addr(struct kvm *kvm, unsigned long type, u64 *addr, bool write); | |||
| 317 | int kvm_vgic_hyp_init(void); | 341 | int kvm_vgic_hyp_init(void); |
| 318 | int kvm_vgic_map_resources(struct kvm *kvm); | 342 | int kvm_vgic_map_resources(struct kvm *kvm); |
| 319 | int kvm_vgic_get_max_vcpus(void); | 343 | int kvm_vgic_get_max_vcpus(void); |
| 344 | void kvm_vgic_early_init(struct kvm *kvm); | ||
| 320 | int kvm_vgic_create(struct kvm *kvm, u32 type); | 345 | int kvm_vgic_create(struct kvm *kvm, u32 type); |
| 321 | void kvm_vgic_destroy(struct kvm *kvm); | 346 | void kvm_vgic_destroy(struct kvm *kvm); |
| 347 | void kvm_vgic_vcpu_early_init(struct kvm_vcpu *vcpu); | ||
| 322 | void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu); | 348 | void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu); |
| 323 | void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu); | 349 | void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu); |
| 324 | void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu); | 350 | void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu); |
| 325 | int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int irq_num, | 351 | int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int irq_num, |
| 326 | bool level); | 352 | bool level); |
| 353 | int kvm_vgic_inject_mapped_irq(struct kvm *kvm, int cpuid, | ||
| 354 | struct irq_phys_map *map, bool level); | ||
| 327 | void vgic_v3_dispatch_sgi(struct kvm_vcpu *vcpu, u64 reg); | 355 | void vgic_v3_dispatch_sgi(struct kvm_vcpu *vcpu, u64 reg); |
| 328 | int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu); | 356 | int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu); |
| 329 | int kvm_vgic_vcpu_active_irq(struct kvm_vcpu *vcpu); | 357 | int kvm_vgic_vcpu_active_irq(struct kvm_vcpu *vcpu); |
| 358 | struct irq_phys_map *kvm_vgic_map_phys_irq(struct kvm_vcpu *vcpu, | ||
| 359 | int virt_irq, int irq); | ||
| 360 | int kvm_vgic_unmap_phys_irq(struct kvm_vcpu *vcpu, struct irq_phys_map *map); | ||
| 361 | bool kvm_vgic_get_phys_irq_active(struct irq_phys_map *map); | ||
| 362 | void kvm_vgic_set_phys_irq_active(struct irq_phys_map *map, bool active); | ||
| 330 | 363 | ||
| 331 | #define irqchip_in_kernel(k) (!!((k)->arch.vgic.in_kernel)) | 364 | #define irqchip_in_kernel(k) (!!((k)->arch.vgic.in_kernel)) |
| 332 | #define vgic_initialized(k) (!!((k)->arch.vgic.nr_cpus)) | 365 | #define vgic_initialized(k) (!!((k)->arch.vgic.nr_cpus)) |
diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h index 71e4faf33091..9eeeb9589acf 100644 --- a/include/linux/irqchip/arm-gic-v3.h +++ b/include/linux/irqchip/arm-gic-v3.h | |||
| @@ -270,9 +270,12 @@ | |||
| 270 | 270 | ||
| 271 | #define ICH_LR_EOI (1UL << 41) | 271 | #define ICH_LR_EOI (1UL << 41) |
| 272 | #define ICH_LR_GROUP (1UL << 60) | 272 | #define ICH_LR_GROUP (1UL << 60) |
| 273 | #define ICH_LR_HW (1UL << 61) | ||
| 273 | #define ICH_LR_STATE (3UL << 62) | 274 | #define ICH_LR_STATE (3UL << 62) |
| 274 | #define ICH_LR_PENDING_BIT (1UL << 62) | 275 | #define ICH_LR_PENDING_BIT (1UL << 62) |
| 275 | #define ICH_LR_ACTIVE_BIT (1UL << 63) | 276 | #define ICH_LR_ACTIVE_BIT (1UL << 63) |
| 277 | #define ICH_LR_PHYS_ID_SHIFT 32 | ||
| 278 | #define ICH_LR_PHYS_ID_MASK (0x3ffUL << ICH_LR_PHYS_ID_SHIFT) | ||
| 276 | 279 | ||
| 277 | #define ICH_MISR_EOI (1 << 0) | 280 | #define ICH_MISR_EOI (1 << 0) |
| 278 | #define ICH_MISR_U (1 << 1) | 281 | #define ICH_MISR_U (1 << 1) |
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h index af3d29f70781..b8901dfd9e95 100644 --- a/include/linux/irqchip/arm-gic.h +++ b/include/linux/irqchip/arm-gic.h | |||
| @@ -75,11 +75,12 @@ | |||
| 75 | 75 | ||
| 76 | #define GICH_LR_VIRTUALID (0x3ff << 0) | 76 | #define GICH_LR_VIRTUALID (0x3ff << 0) |
| 77 | #define GICH_LR_PHYSID_CPUID_SHIFT (10) | 77 | #define GICH_LR_PHYSID_CPUID_SHIFT (10) |
| 78 | #define GICH_LR_PHYSID_CPUID (7 << GICH_LR_PHYSID_CPUID_SHIFT) | 78 | #define GICH_LR_PHYSID_CPUID (0x3ff << GICH_LR_PHYSID_CPUID_SHIFT) |
| 79 | #define GICH_LR_STATE (3 << 28) | 79 | #define GICH_LR_STATE (3 << 28) |
| 80 | #define GICH_LR_PENDING_BIT (1 << 28) | 80 | #define GICH_LR_PENDING_BIT (1 << 28) |
| 81 | #define GICH_LR_ACTIVE_BIT (1 << 29) | 81 | #define GICH_LR_ACTIVE_BIT (1 << 29) |
| 82 | #define GICH_LR_EOI (1 << 19) | 82 | #define GICH_LR_EOI (1 << 19) |
| 83 | #define GICH_LR_HW (1 << 31) | ||
| 83 | 84 | ||
| 84 | #define GICH_VMCR_CTRL_SHIFT 0 | 85 | #define GICH_VMCR_CTRL_SHIFT 0 |
| 85 | #define GICH_VMCR_CTRL_MASK (0x21f << GICH_VMCR_CTRL_SHIFT) | 86 | #define GICH_VMCR_CTRL_MASK (0x21f << GICH_VMCR_CTRL_SHIFT) |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 81089cf1f0c1..1bef9e21e725 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
| @@ -242,6 +242,7 @@ struct kvm_vcpu { | |||
| 242 | int sigset_active; | 242 | int sigset_active; |
| 243 | sigset_t sigset; | 243 | sigset_t sigset; |
| 244 | struct kvm_vcpu_stat stat; | 244 | struct kvm_vcpu_stat stat; |
| 245 | unsigned int halt_poll_ns; | ||
| 245 | 246 | ||
| 246 | #ifdef CONFIG_HAS_IOMEM | 247 | #ifdef CONFIG_HAS_IOMEM |
| 247 | int mmio_needed; | 248 | int mmio_needed; |
diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h index a44062da684b..d6f83222a6a1 100644 --- a/include/trace/events/kvm.h +++ b/include/trace/events/kvm.h | |||
| @@ -358,6 +358,36 @@ TRACE_EVENT( | |||
| 358 | 358 | ||
| 359 | #endif | 359 | #endif |
| 360 | 360 | ||
| 361 | TRACE_EVENT(kvm_halt_poll_ns, | ||
| 362 | TP_PROTO(bool grow, unsigned int vcpu_id, int new, int old), | ||
| 363 | TP_ARGS(grow, vcpu_id, new, old), | ||
| 364 | |||
| 365 | TP_STRUCT__entry( | ||
| 366 | __field(bool, grow) | ||
| 367 | __field(unsigned int, vcpu_id) | ||
| 368 | __field(int, new) | ||
| 369 | __field(int, old) | ||
| 370 | ), | ||
| 371 | |||
| 372 | TP_fast_assign( | ||
| 373 | __entry->grow = grow; | ||
| 374 | __entry->vcpu_id = vcpu_id; | ||
| 375 | __entry->new = new; | ||
| 376 | __entry->old = old; | ||
| 377 | ), | ||
| 378 | |||
| 379 | TP_printk("vcpu %u: halt_poll_ns %d (%s %d)", | ||
| 380 | __entry->vcpu_id, | ||
| 381 | __entry->new, | ||
| 382 | __entry->grow ? "grow" : "shrink", | ||
| 383 | __entry->old) | ||
| 384 | ); | ||
| 385 | |||
| 386 | #define trace_kvm_halt_poll_ns_grow(vcpu_id, new, old) \ | ||
| 387 | trace_kvm_halt_poll_ns(true, vcpu_id, new, old) | ||
| 388 | #define trace_kvm_halt_poll_ns_shrink(vcpu_id, new, old) \ | ||
| 389 | trace_kvm_halt_poll_ns(false, vcpu_id, new, old) | ||
| 390 | |||
| 361 | #endif /* _TRACE_KVM_MAIN_H */ | 391 | #endif /* _TRACE_KVM_MAIN_H */ |
| 362 | 392 | ||
| 363 | /* This part must be outside protection */ | 393 | /* This part must be outside protection */ |
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 0d831f94f8a8..a9256f0331ae 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h | |||
| @@ -237,6 +237,7 @@ struct kvm_run { | |||
| 237 | __u32 count; | 237 | __u32 count; |
| 238 | __u64 data_offset; /* relative to kvm_run start */ | 238 | __u64 data_offset; /* relative to kvm_run start */ |
| 239 | } io; | 239 | } io; |
| 240 | /* KVM_EXIT_DEBUG */ | ||
| 240 | struct { | 241 | struct { |
| 241 | struct kvm_debug_exit_arch arch; | 242 | struct kvm_debug_exit_arch arch; |
| 242 | } debug; | 243 | } debug; |
| @@ -285,6 +286,7 @@ struct kvm_run { | |||
| 285 | __u32 data; | 286 | __u32 data; |
| 286 | __u8 is_write; | 287 | __u8 is_write; |
| 287 | } dcr; | 288 | } dcr; |
| 289 | /* KVM_EXIT_INTERNAL_ERROR */ | ||
| 288 | struct { | 290 | struct { |
| 289 | __u32 suberror; | 291 | __u32 suberror; |
| 290 | /* Available with KVM_CAP_INTERNAL_ERROR_DATA: */ | 292 | /* Available with KVM_CAP_INTERNAL_ERROR_DATA: */ |
| @@ -295,6 +297,7 @@ struct kvm_run { | |||
| 295 | struct { | 297 | struct { |
| 296 | __u64 gprs[32]; | 298 | __u64 gprs[32]; |
| 297 | } osi; | 299 | } osi; |
| 300 | /* KVM_EXIT_PAPR_HCALL */ | ||
| 298 | struct { | 301 | struct { |
| 299 | __u64 nr; | 302 | __u64 nr; |
| 300 | __u64 ret; | 303 | __u64 ret; |
| @@ -819,6 +822,8 @@ struct kvm_ppc_smmu_info { | |||
| 819 | #define KVM_CAP_DISABLE_QUIRKS 116 | 822 | #define KVM_CAP_DISABLE_QUIRKS 116 |
| 820 | #define KVM_CAP_X86_SMM 117 | 823 | #define KVM_CAP_X86_SMM 117 |
| 821 | #define KVM_CAP_MULTI_ADDRESS_SPACE 118 | 824 | #define KVM_CAP_MULTI_ADDRESS_SPACE 118 |
| 825 | #define KVM_CAP_GUEST_DEBUG_HW_BPS 119 | ||
| 826 | #define KVM_CAP_GUEST_DEBUG_HW_WPS 120 | ||
| 822 | 827 | ||
| 823 | #ifdef KVM_CAP_IRQ_ROUTING | 828 | #ifdef KVM_CAP_IRQ_ROUTING |
| 824 | 829 | ||
