aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/virtual/kvm/api.txt
diff options
context:
space:
mode:
authorChristoffer Dall <cdall@cs.columbia.edu>2013-01-20 18:28:08 -0500
committerChristoffer Dall <c.dall@virtualopensystems.com>2013-01-23 13:29:12 -0500
commit86ce85352f0da7e1431ad8efcb04323819a620e7 (patch)
tree0f5a0a971b0092c9cfd74659254f76a4c7117294 /Documentation/virtual/kvm/api.txt
parentd5d8184d35c990b1324d9b30bcd0e4e8aa08f56d (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 'Documentation/virtual/kvm/api.txt')
-rw-r--r--Documentation/virtual/kvm/api.txt25
1 files changed, 21 insertions, 4 deletions
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index 4237c27ea612..505049299298 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -615,15 +615,32 @@ created.
6154.25 KVM_IRQ_LINE 6154.25 KVM_IRQ_LINE
616 616
617Capability: KVM_CAP_IRQCHIP 617Capability: KVM_CAP_IRQCHIP
618Architectures: x86, ia64 618Architectures: x86, ia64, arm
619Type: vm ioctl 619Type: vm ioctl
620Parameters: struct kvm_irq_level 620Parameters: struct kvm_irq_level
621Returns: 0 on success, -1 on error 621Returns: 0 on success, -1 on error
622 622
623Sets the level of a GSI input to the interrupt controller model in the kernel. 623Sets the level of a GSI input to the interrupt controller model in the kernel.
624Requires that an interrupt controller model has been previously created with 624On some architectures it is required that an interrupt controller model has
625KVM_CREATE_IRQCHIP. Note that edge-triggered interrupts require the level 625been previously created with KVM_CREATE_IRQCHIP. Note that edge-triggered
626to be set to 1 and then back to 0. 626interrupts require the level to be set to 1 and then back to 0.
627
628ARM can signal an interrupt either at the CPU level, or at the in-kernel irqchip
629(GIC), and for in-kernel irqchip can tell the GIC to use PPIs designated for
630specific cpus. The irq field is interpreted like this:
631
632  bits: | 31 ... 24 | 23 ... 16 | 15 ... 0 |
633 field: | irq_type | vcpu_index | irq_id |
634
635The irq_type field has the following values:
636- irq_type[0]: out-of-kernel GIC: irq_id 0 is IRQ, irq_id 1 is FIQ
637- irq_type[1]: in-kernel GIC: SPI, irq_id between 32 and 1019 (incl.)
638 (the vcpu_index field is ignored)
639- irq_type[2]: in-kernel GIC: PPI, irq_id between 16 and 31 (incl.)
640
641(The irq_id field thus corresponds nicely to the IRQ ID in the ARM GIC specs)
642
643In both cases, level is used to raise/lower the line.
627 644
628struct kvm_irq_level { 645struct kvm_irq_level {
629 union { 646 union {