public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: kvm <kvm@vger.kernel.org>,
	"patches@linaro.org" <patches@linaro.org>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Alexander Graf <agraf@suse.de>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Avi Kivity <avi@redhat.com>
Subject: Re: [PATCH] kvm: Move kvm_allows_irq0_override() to target-i386
Date: Mon, 23 Jul 2012 19:51:43 +0200	[thread overview]
Message-ID: <500D8F2F.5090802@siemens.com> (raw)
In-Reply-To: <CAFEAcA8hBgVLyBuX7OLu7ctYFwhSn80E+9oqjTMCg4da8WJTQw@mail.gmail.com>

On 2012-07-23 19:41, Peter Maydell wrote:
> On 23 July 2012 17:55, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>> On 2012-07-23 17:19, Peter Maydell wrote:
>>> OK, let's see if we can get some agreement about naming here.
>>>
>>> First, some test-functions I think we definitely need:
>>>
>>>  kvm_interrupts_are_async()
>>>    -- true if interrupt delivery is asynchronous
>>>       default false in kvm_init, set true in kvm_irqchip_create,
>>>       architectures may set it true in kvm_arch_init [ARM will
>>>       do so; PPC might want to do so]
>>>
>>>  kvm_irqchip_in_kernel()
>>>    -- the user-settable option, actual behaviour is arch specific
>>>       on x86, true means (as it does now) LAPIC,IOAPIC,PIT in kernel
>>>       on ARM, we ignore this setting and just DTRT
>>
>> You should reject kernel_irqchip=off as long as you only support an
>> in-kernel GIC model.
> 
> Agreed. (At the moment we still have code in QEMU for out-of-kernel
> GIC models, which is legacy from before the VGIC implementation;
> depending on whether that actually vanishes from the kernel ABI
> or not I may include the QEMU code which makes arm_pic.c handle
> injecting interrupts to KVM via ioctl. But in that case we would
> reject =off for A15 and =on for non-A15 (slightly pointlessly
> since non-A15 will fail the "must be an A15" check.))
> 
>>>       on PPC, used as a convenience setting for whether to use
>>>       an in-kernel model of the interrupt controller
>>>       Shouldn't be used in non-target-specific code
>>>
>>> and two I'm not quite so sure about:
>>>
>>>  kvm_has_msi_routing()
>>>    -- true if we can do routing of MSIs
>>
>> GSI, not MSI.
>>
>>>       set true only if x86 and kvm_irqchip_in_kernel
>>
>> It means that the target architecture supports routing of various
>> interrupt sources (userspace, irqfds, in-kernel device models) to
>> different in-kernel IRQ sinks (CPU cores, irqchip models, whatever).
>> Interrupt messages via (binary-state) irqfd depend on it.
> 
> So I still don't actually understand what this interrupt routing
> is (as far as the kernel is concerned). Surely the way this should
> work is that you use KVM_IRQFD to say "this fd goes to this
> interrupt sink" (with some sensible scheme for encoding what the
> interrupt destination actually is, like an (irqchip,pin) tuple
> or something). Why does the kernel need to care about irq
> routing?

- to define where to inject if you have multiple irqchips to address, or
  if there is a special sink that reattaches payload (e.g. MSI
  messages) to a binary source like irqfd is
- to configure board-specific re-directions (like that IRQ0 override on
  x86)

> 
>>> kvm-all.c:kvm_irqchip_set_irq():
>>>  -- (just an assert) should be kvm_interrupts_are_async()
>>
>> The name kvm_irqchip_set_irq implies so far that it injects into an
>> in-kernel irqchip model. Either different functions for archs that don't
>> follow this concept need to be provided, or this function requires
>> renaming (kvm_set_irq_async or so).
> 
> Yes, renaming the function would probably be reasonable.
> (Currently my QEMU code for using the VGIC just does a direct
> ioctl itself though, because kvm_irqchip_set_irq() doesn't actually
> do very much and it's a bit awkward that it insists on fishing
> the ioctl number out from the KVMState.)

The latter has to do with legacy and lacking support for certain IOCTLs
on older kernels. However, it shouldn't hurt you to take the generic
route for the sake of consistency and a to ease instrumentations etc.

> 
>>> kvm-all.c:kvm_irqchip_assign_irqfd():
>>>  -- should be true if kvm_has_irqfds()
>>
>> The same issue. Plus there is that naming conflict again if we should
>> ever see irqfd without some in-kernel irqchip. But even s390 would have
>> a logical "irqchip" for me at the point it may route interrupt messages
>> from devices directly to the CPUs.
> 
> I don't think you can have irqfds without an irqchip because where
> would you be sending the interrupts?

To the CPU cores. But even that requires routing and arbitration if
there are multiple receivers. So I think s390 has an in-kernel (or
"in-hardware") irqchip, conceptually.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux

  reply	other threads:[~2012-07-23 17:51 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1342811652-16931-1-git-send-email-peter.maydell@linaro.org>
2012-07-21  6:57 ` [PATCH] kvm: Move kvm_allows_irq0_override() to target-i386 Jan Kiszka
2012-07-21  8:54   ` Peter Maydell
2012-07-21  9:14     ` Jan Kiszka
2012-07-21  9:30       ` Peter Maydell
2012-07-21  9:44         ` Jan Kiszka
2012-07-21  9:56           ` Peter Maydell
2012-07-21 10:22             ` Jan Kiszka
2012-07-21 10:53               ` Peter Maydell
2012-07-21 11:08                 ` Jan Kiszka
2012-07-21 12:17                   ` Peter Maydell
2012-07-21 12:35                     ` Jan Kiszka
2012-07-21 12:57                       ` Peter Maydell
2012-07-21 13:16                         ` Jan Kiszka
2012-07-23 12:04                           ` Cornelia Huck
2012-07-23 12:18                             ` Avi Kivity
2012-07-23 12:25                               ` Peter Maydell
2012-07-23 12:31                                 ` Avi Kivity
2012-07-23 12:34                                   ` Avi Kivity
2012-07-23 13:06                               ` Cornelia Huck
2012-07-23 13:14                                 ` Avi Kivity
2012-07-23 13:55                                   ` Cornelia Huck
2012-07-23 14:27                                     ` Avi Kivity
2012-07-23 15:01                                       ` Cornelia Huck
2012-07-23 12:26     ` Avi Kivity
2012-07-23 12:58       ` Peter Maydell
2012-07-23 13:09         ` Avi Kivity
2012-07-23 13:27           ` Peter Maydell
2012-07-23 13:38             ` Avi Kivity
2012-07-23 13:50               ` Peter Maydell
2012-07-23 14:30                 ` Avi Kivity
2012-07-23 17:58                   ` Peter Maydell
2012-07-24  8:50                     ` Avi Kivity
2012-07-24  8:54                       ` Peter Maydell
2012-07-24  8:58                         ` Jan Kiszka
2012-07-23 15:19       ` Peter Maydell
2012-07-23 16:55         ` Jan Kiszka
2012-07-23 17:41           ` Peter Maydell
2012-07-23 17:51             ` Jan Kiszka [this message]
2012-07-24  8:56         ` Avi Kivity

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=500D8F2F.5090802@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=agraf@suse.de \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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