kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Christoffer Dall <c.dall@virtualopensystems.com>,
	kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org,
	tech@virtualopensystems.com, Marc Zyngier <marc.zyngier@arm.com>
Subject: Re: [Android-virt] [PATCH v9 11/16] ARM: KVM: Inject IRQs and FIQs from userspace
Date: Tue, 07 Aug 2012 17:28:36 +0300	[thread overview]
Message-ID: <50212614.7090409@redhat.com> (raw)
In-Reply-To: <CAFEAcA9W8idGLuDP0m+jDXJvUkUAKEFiNYyWZHNwQcjbCZtCPw@mail.gmail.com>

On 08/07/2012 05:12 PM, Peter Maydell wrote:
> On 7 August 2012 14:59, Avi Kivity <avi@redhat.com> wrote:
>> On 08/06/2012 08:20 PM, Peter Maydell wrote:
>>> On 3 July 2012 10:01, Christoffer Dall <c.dall@virtualopensystems.com> wrote:
>>>> From: Christoffer Dall <cdall@cs.columbia.edu>
>>>>
>>>> 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.
>>>
>>> It occurred to me that rather than encoding the CPU index in the IRQ
>>> field value, maybe we should just use the per-vcpu version of
>>> KVM_IRQ_LINE the same way we do for injecting the per-CPU lines
>>> of the in-kernel (V)GIC ?
>>
>> What do you mean by "per-vcpu version of KVM_IRQ_LINE"?
> 
> The ARM VGIC implementation implements "I need to raise per-CPU
> interrupt X" by providing a vcpu ioctl KVM_IRQ_LINE (this is
> in addition to the vm ioctl KVM_IRQ_LINE which it uses for
> "I need to raise the external interrupt X").
> The patch updating the API documentation is this one:
> https://lists.cs.columbia.edu/pipermail/kvmarm/2012-July/001206.html

Yikes.  "vm ioctl (and vcpu_ioctl on ARM)" is just horrible.  First, use
a different ioctl.  Second, vcpu ioctls are synchronous, you must call
them from a vcpu thread (think syscall operating on current).  You want
something asynchronous.

How about using the vm ioctl, with a range of numbers allocated for
per-processor interrupts?  In fact the documentation appears to say you
already did this.

> 
>>> (The subtext here is that it would be cool to have QEMU's
>>> generic interrupt handling code for KVM be able to say "if
>>> you do a cpu_interrupt()/cpu_reset_interrupt() and async
>>> interrupt delivery is enabled then just do the per-vcpu ioctl".
>>> Then there wouldn't need to be any kvm-specific code in
>>> hw/arm_pic.c at all...)
>>
>> If you mean "vcpu ioctl", then no, vcpu ioctls must be called from the
>> vcpu thread.
> 
> That's a shame, because it's the obvious interface for "do something
> to this specific CPU".

We can do something new if needed.  So far all vcpu operations were
synchronous (mostly, get/set state).

-- 
error compiling committee.c: too many arguments to function

  reply	other threads:[~2012-08-07 14:28 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-03  8:59 [PATCH v9 00/16] KVM/ARM Implementation Christoffer Dall
2012-07-03  8:59 ` [PATCH v9 01/16] ARM: add mem_type prot_pte accessor Christoffer Dall
2012-07-20 14:54   ` Andreas Färber
2012-07-26 21:26     ` Christoffer Dall
2012-07-03  8:59 ` [PATCH v9 02/16] ARM: Add config option ARM_VIRT_EXT Christoffer Dall
2012-07-03  8:59 ` [PATCH v9 03/16] ARM: Section based HYP idmap Christoffer Dall
2012-07-03  8:59 ` [PATCH v9 04/16] KVM: Move KVM_IRQ_LINE to arch-generic code Christoffer Dall
2012-07-03 19:50   ` Marcelo Tosatti
2012-07-24 12:37     ` Christoffer Dall
2012-07-03  9:00 ` [PATCH v9 05/16] KVM: Guard mmu_notifier specific code with CONFIG_MMU_NOTIFIER Christoffer Dall
2012-07-03  9:00 ` [PATCH v9 06/16] ARM: KVM: Initial skeleton to compile KVM support Christoffer Dall
2012-07-03  9:00 ` [PATCH v9 07/16] ARM: KVM: Support Cortex-A15 VCPUs reset Christoffer Dall
2012-07-03  9:00 ` [PATCH v9 08/16] ARM: KVM: Hypervisor inititalization Christoffer Dall
2012-07-03  9:00 ` [PATCH v9 09/16] ARM: KVM: Module unloading support Christoffer Dall
2012-07-03  9:01 ` [PATCH v9 10/16] ARM: KVM: Memory virtualization setup Christoffer Dall
2012-07-03  9:01 ` [PATCH v9 11/16] ARM: KVM: Inject IRQs and FIQs from userspace Christoffer Dall
2012-08-06 17:20   ` [Android-virt] " Peter Maydell
2012-08-07 13:59     ` Avi Kivity
2012-08-07 14:12       ` Peter Maydell
2012-08-07 14:28         ` Avi Kivity [this message]
2012-08-07 14:36           ` Peter Maydell
2012-07-03  9:01 ` [PATCH v9 12/16] ARM: KVM: World-switch implementation Christoffer Dall
2012-07-03 10:07   ` Avi Kivity
2012-07-25 14:16     ` Christoffer Dall
2012-07-03  9:01 ` [PATCH v9 13/16] ARM: KVM: Emulation framework and CP15 emulation Christoffer Dall
2012-07-12  5:35   ` 김민규
2012-07-16 14:09     ` Christoffer Dall
2012-07-17 10:54       ` Min-gyu Kim
2012-07-03  9:01 ` [PATCH v9 14/16] ARM: KVM: Handle guest faults in KVM Christoffer Dall
2012-07-03  9:02 ` [PATCH v9 15/16] ARM: KVM: Handle I/O aborts Christoffer Dall
2012-07-03  9:02 ` [PATCH v9 16/16] ARM: KVM: Guest wait-for-interrupts (WFI) support Christoffer Dall
2012-07-03 13:10   ` Avi Kivity
2012-07-03 13:14     ` [Android-virt] " Peter Maydell
2012-07-03 13:24       ` Avi Kivity
2012-07-03 13:49         ` Peter Maydell
2012-07-03 15:57           ` Avi Kivity
2012-07-26 21:08           ` Christoffer Dall
2012-07-03 13:29 ` [PATCH v9 00/16] KVM/ARM Implementation Avi Kivity
2012-07-03 13:51   ` [Android-virt] " Peter Maydell
2012-07-26 21:15     ` Christoffer Dall
2012-07-26 21:21       ` Peter Maydell
2012-07-26 21:25         ` Christoffer Dall
2012-07-03 19:51   ` Marcelo Tosatti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50212614.7090409@redhat.com \
    --to=avi@redhat.com \
    --cc=c.dall@virtualopensystems.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=marc.zyngier@arm.com \
    --cc=peter.maydell@linaro.org \
    --cc=tech@virtualopensystems.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).