diff options
author | Andrey Smetanin <asmetanin@virtuozzo.com> | 2015-11-10 07:36:34 -0500 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2015-11-25 11:24:22 -0500 |
commit | 5c919412fe61c35947816fdbd5f7bd09fe0dd073 (patch) | |
tree | e2435a515aac386a05869a20edc61dc5f9d2047d /arch/x86/include | |
parent | d62caabb41f33d96333f9ef15e09cd26e1c12760 (diff) |
kvm/x86: Hyper-V synthetic interrupt controller
SynIC (synthetic interrupt controller) is a lapic extension,
which is controlled via MSRs and maintains for each vCPU
- 16 synthetic interrupt "lines" (SINT's); each can be configured to
trigger a specific interrupt vector optionally with auto-EOI
semantics
- a message page in the guest memory with 16 256-byte per-SINT message
slots
- an event flag page in the guest memory with 16 2048-bit per-SINT
event flag areas
The host triggers a SINT whenever it delivers a new message to the
corresponding slot or flips an event flag bit in the corresponding area.
The guest informs the host that it can try delivering a message by
explicitly asserting EOI in lapic or writing to End-Of-Message (EOM)
MSR.
The userspace (qemu) triggers interrupts and receives EOM notifications
via irqfd with resampler; for that, a GSI is allocated for each
configured SINT, and irq_routing api is extended to support GSI-SINT
mapping.
Changes v4:
* added activation of SynIC by vcpu KVM_ENABLE_CAP
* added per SynIC active flag
* added deactivation of APICv upon SynIC activation
Changes v3:
* added KVM_CAP_HYPERV_SYNIC and KVM_IRQ_ROUTING_HV_SINT notes into
docs
Changes v2:
* do not use posted interrupts for Hyper-V SynIC AutoEOI vectors
* add Hyper-V SynIC vectors into EOI exit bitmap
* Hyper-V SyniIC SINT msr write logic simplified
Signed-off-by: Andrey Smetanin <asmetanin@virtuozzo.com>
Reviewed-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Gleb Natapov <gleb@kernel.org>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Roman Kagan <rkagan@virtuozzo.com>
CC: Denis V. Lunev <den@openvz.org>
CC: qemu-devel@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/include')
-rw-r--r-- | arch/x86/include/asm/kvm_host.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index bac0d540f49c..bab47b61d2b0 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/pvclock_gtod.h> | 25 | #include <linux/pvclock_gtod.h> |
26 | #include <linux/clocksource.h> | 26 | #include <linux/clocksource.h> |
27 | #include <linux/irqbypass.h> | 27 | #include <linux/irqbypass.h> |
28 | #include <linux/hyperv.h> | ||
28 | 29 | ||
29 | #include <asm/pvclock-abi.h> | 30 | #include <asm/pvclock-abi.h> |
30 | #include <asm/desc.h> | 31 | #include <asm/desc.h> |
@@ -374,10 +375,24 @@ struct kvm_mtrr { | |||
374 | struct list_head head; | 375 | struct list_head head; |
375 | }; | 376 | }; |
376 | 377 | ||
378 | /* Hyper-V synthetic interrupt controller (SynIC)*/ | ||
379 | struct kvm_vcpu_hv_synic { | ||
380 | u64 version; | ||
381 | u64 control; | ||
382 | u64 msg_page; | ||
383 | u64 evt_page; | ||
384 | atomic64_t sint[HV_SYNIC_SINT_COUNT]; | ||
385 | atomic_t sint_to_gsi[HV_SYNIC_SINT_COUNT]; | ||
386 | DECLARE_BITMAP(auto_eoi_bitmap, 256); | ||
387 | DECLARE_BITMAP(vec_bitmap, 256); | ||
388 | bool active; | ||
389 | }; | ||
390 | |||
377 | /* Hyper-V per vcpu emulation context */ | 391 | /* Hyper-V per vcpu emulation context */ |
378 | struct kvm_vcpu_hv { | 392 | struct kvm_vcpu_hv { |
379 | u64 hv_vapic; | 393 | u64 hv_vapic; |
380 | s64 runtime_offset; | 394 | s64 runtime_offset; |
395 | struct kvm_vcpu_hv_synic synic; | ||
381 | }; | 396 | }; |
382 | 397 | ||
383 | struct kvm_vcpu_arch { | 398 | struct kvm_vcpu_arch { |