ARM: KVM: Enable in-kernel timers with user space gic

When running with KVM enabled, you can choose between emulating the
gic in kernel or user space. If the kernel supports in-kernel virtualization
of the interrupt controller, it will default to that. If not, if will
default to user space emulation.

Unfortunately when running in user mode gic emulation, we miss out on
timer events which are only available from kernel space. This patch leverages
the new kernel/user space notification mechanism for those timer events.

Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
Alexander Graf
2016-09-19 10:02:55 +02:00
committed by Bruce Rogers
parent d0a9c75825
commit 7cbcd176dd
6 changed files with 88 additions and 2 deletions

View File

@@ -205,6 +205,7 @@ struct kvm_hyperv_exit {
#define KVM_EXIT_S390_STSI 25
#define KVM_EXIT_IOAPIC_EOI 26
#define KVM_EXIT_HYPERV 27
#define KVM_EXIT_ARM_TIMER 28
/* For KVM_EXIT_INTERNAL_ERROR */
/* Emulate instruction failed. */
@@ -361,6 +362,10 @@ struct kvm_run {
} eoi;
/* KVM_EXIT_HYPERV */
struct kvm_hyperv_exit hyperv;
/* KVM_EXIT_ARM_TIMER */
struct {
__u8 timesource;
} arm_timer;
/* Fix the size of the union. */
char padding[256];
};
@@ -865,6 +870,7 @@ struct kvm_ppc_smmu_info {
#define KVM_CAP_SPAPR_TCE_64 125
#define KVM_CAP_ARM_PMU_V3 126
#define KVM_CAP_VCPU_ATTRIBUTES 127
#define KVM_CAP_ARM_TIMER 133
#ifdef KVM_CAP_IRQ_ROUTING
@@ -1312,4 +1318,12 @@ struct kvm_assigned_msix_entry {
__u16 padding[3];
};
/* Available with KVM_CAP_ARM_TIMER */
/* Bits for run->request_interrupt_window */
#define KVM_IRQWINDOW_VTIMER (1 << 0)
/* Bits for run->arm_timer.timesource */
#define KVM_ARM_TIMER_VTIMER (1 << 0)
#endif /* __LINUX_KVM_H */