diff options
author | Christoffer Dall <cdall@cs.columbia.edu> | 2013-01-20 18:28:08 -0500 |
---|---|---|
committer | Christoffer Dall <c.dall@virtualopensystems.com> | 2013-01-23 13:29:12 -0500 |
commit | 86ce85352f0da7e1431ad8efcb04323819a620e7 (patch) | |
tree | 0f5a0a971b0092c9cfd74659254f76a4c7117294 /arch/arm/kvm/trace.h | |
parent | d5d8184d35c990b1324d9b30bcd0e4e8aa08f56d (diff) |
KVM: ARM: Inject IRQs and FIQs from userspace
All interrupt injection is now based on the VM ioctl KVM_IRQ_LINE. This
works semantically well for the GIC as we in fact raise/lower a line on
a machine component (the gic). The IOCTL uses the follwing struct.
struct kvm_irq_level {
union {
__u32 irq; /* GSI */
__s32 status; /* not used for KVM_IRQ_LEVEL */
};
__u32 level; /* 0 or 1 */
};
ARM can signal an interrupt either at the CPU level, or at the in-kernel irqchip
(GIC), and for in-kernel irqchip can tell the GIC to use PPIs designated for
specific cpus. The irq field is interpreted like this:
bits: | 31 ... 24 | 23 ... 16 | 15 ... 0 |
field: | irq_type | vcpu_index | irq_number |
The irq_type field has the following values:
- irq_type[0]: out-of-kernel GIC: irq_number 0 is IRQ, irq_number 1 is FIQ
- irq_type[1]: in-kernel GIC: SPI, irq_number between 32 and 1019 (incl.)
(the vcpu_index field is ignored)
- irq_type[2]: in-kernel GIC: PPI, irq_number between 16 and 31 (incl.)
The irq_number thus corresponds to the irq ID in as in the GICv2 specs.
This is documented in Documentation/kvm/api.txt.
Reviewed-by: Will Deacon <will.deacon@arm.com>
Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Christoffer Dall <c.dall@virtualopensystems.com>
Diffstat (limited to 'arch/arm/kvm/trace.h')
-rw-r--r-- | arch/arm/kvm/trace.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/arm/kvm/trace.h b/arch/arm/kvm/trace.h index 862b2cc12fbe..105d1f79909a 100644 --- a/arch/arm/kvm/trace.h +++ b/arch/arm/kvm/trace.h | |||
@@ -39,6 +39,31 @@ TRACE_EVENT(kvm_exit, | |||
39 | TP_printk("PC: 0x%08lx", __entry->vcpu_pc) | 39 | TP_printk("PC: 0x%08lx", __entry->vcpu_pc) |
40 | ); | 40 | ); |
41 | 41 | ||
42 | TRACE_EVENT(kvm_irq_line, | ||
43 | TP_PROTO(unsigned int type, int vcpu_idx, int irq_num, int level), | ||
44 | TP_ARGS(type, vcpu_idx, irq_num, level), | ||
45 | |||
46 | TP_STRUCT__entry( | ||
47 | __field( unsigned int, type ) | ||
48 | __field( int, vcpu_idx ) | ||
49 | __field( int, irq_num ) | ||
50 | __field( int, level ) | ||
51 | ), | ||
52 | |||
53 | TP_fast_assign( | ||
54 | __entry->type = type; | ||
55 | __entry->vcpu_idx = vcpu_idx; | ||
56 | __entry->irq_num = irq_num; | ||
57 | __entry->level = level; | ||
58 | ), | ||
59 | |||
60 | TP_printk("Inject %s interrupt (%d), vcpu->idx: %d, num: %d, level: %d", | ||
61 | (__entry->type == KVM_ARM_IRQ_TYPE_CPU) ? "CPU" : | ||
62 | (__entry->type == KVM_ARM_IRQ_TYPE_PPI) ? "VGIC PPI" : | ||
63 | (__entry->type == KVM_ARM_IRQ_TYPE_SPI) ? "VGIC SPI" : "UNKNOWN", | ||
64 | __entry->type, __entry->vcpu_idx, __entry->irq_num, __entry->level) | ||
65 | ); | ||
66 | |||
42 | TRACE_EVENT(kvm_unmap_hva, | 67 | TRACE_EVENT(kvm_unmap_hva, |
43 | TP_PROTO(unsigned long hva), | 68 | TP_PROTO(unsigned long hva), |
44 | TP_ARGS(hva), | 69 | TP_ARGS(hva), |