On Tue, Aug 21, 2012 at 4:20 AM, Jan Kiszka <jan.kiszka@xxxxxxxxxxx> wrote: > On 2012-08-16 17:29, Christoffer Dall wrote: >> From: Christoffer Dall <cdall@xxxxxxxxxxxxxxx> >> >> Userspace can inject IRQs and FIQs through the KVM_IRQ_LINE VM ioctl. >> This ioctl is used since the sematics are in fact two lines that can be >> either raised or lowered on the VCPU - the IRQ and FIQ lines. >> >> KVM needs to know which VCPU it must operate on and whether the FIQ or >> IRQ line is raised/lowered. Hence both pieces of information is packed >> in the kvm_irq_level->irq field. The irq fild value will be: >> IRQ: vcpu_index << 1 >> FIQ: (vcpu_index << 1) | 1 >> >> This is documented in Documentation/kvm/api.txt. >> >> The effect of the ioctl is simply to simply raise/lower the >> corresponding irq_line field on the VCPU struct, which will cause the >> world-switch code to raise/lower virtual interrupts when running the >> guest on next switch. The wait_for_interrupt flag is also cleared for >> raised IRQs or FIQs causing an idle VCPU to become active again. CPUs >> in guest mode are kicked to make sure they refresh their interrupt status. >> >> Signed-off-by: Christoffer Dall <c.dall@xxxxxxxxxxxxxxxxxxxxxx> >> --- >> Documentation/virtual/kvm/api.txt | 12 ++++++--- >> arch/arm/include/asm/kvm.h | 9 +++++++ >> arch/arm/include/asm/kvm_arm.h | 1 + >> arch/arm/kvm/arm.c | 47 +++++++++++++++++++++++++++++++++++++ >> include/linux/kvm.h | 1 + >> 5 files changed, 66 insertions(+), 4 deletions(-) >> >> diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt >> index bf33aaa..8345b78 100644 >> --- a/Documentation/virtual/kvm/api.txt >> +++ b/Documentation/virtual/kvm/api.txt >> @@ -614,15 +614,19 @@ only go to the IOAPIC. On ia64, a IOSAPIC is created. >> 4.25 KVM_IRQ_LINE > > So this IOCTL is now used for injecting from a userspace GIC model to > the VCPUs, right? Then this version is OK as userspace should be able to > detect IRQ coalescing per IRQ generating device. > > However, injecting into an in-kernel GIC should use KVM_IRQ_LINE_STATUS > later on, keeping the door open for userspace implementing the IRQ > de-coalescing (for custom periodic timer devices). Have you thought > about how that IRQ injecting interface will look like, how the > interrupts will be specified? Do you actually plan to have both version > as ABI (with and without in-kernel irqchip)? > Hi Jan, this is being reworked when the in-kernel vgic support gets merged, see the discussion starting with this mail: https://lists.cs.columbia.edu/pipermail/kvmarm/2012-August/002922.html >> >> Capability: KVM_CAP_IRQCHIP >> -Architectures: x86, ia64 >> +Architectures: x86, ia64, arm >> Type: vm ioctl >> Parameters: struct kvm_irq_level >> Returns: 0 on success, -1 on error >> >> Sets the level of a GSI input to the interrupt controller model in the kernel. >> -Requires that an interrupt controller model has been previously created with >> -KVM_CREATE_IRQCHIP. Note that edge-triggered interrupts require the level >> -to be set to 1 and then back to 0. >> +On some architectures it is required that an interrupt controller model has > ^^^^ > Please be more specific to help the poor users of this interface > guessing if the should or should not call CREATE_IRQCHIP first. > ok, I will revise that text. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html