kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: Eric Auger <eric.auger@linaro.org>,
	"eric.auger@st.com" <eric.auger@st.com>,
	"christoffer.dall@linaro.org" <christoffer.dall@linaro.org>,
	Andre Przywara <Andre.Przywara@arm.com>,
	"p.fedin@samsung.com" <p.fedin@samsung.com>,
	"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Cc: "patches@linaro.org" <patches@linaro.org>
Subject: Re: [RFC 4/6] KVM: arm/arm64: enable irqchip routing
Date: Thu, 18 Jun 2015 19:07:30 +0100	[thread overview]
Message-ID: <558308E2.8010505@arm.com> (raw)
In-Reply-To: <55830747.7070101@linaro.org>

On 18/06/15 19:00, Eric Auger wrote:
> Hi Marc,
> On 06/18/2015 07:53 PM, Marc Zyngier wrote:
>> Hi Eric,
>>
>> On 18/06/15 18:40, Eric Auger wrote:
>>> This patch adds compilation and link against irqchip.
>>>
>>> On ARM, irqchip routing is not really useful since there is
>>> a single irqchip. However main motivation behind using irqchip
>>> code is to enable MSI routing code. With the support of in-kernel
>>> GICv3 ITS emulation, it now seems to be a MUST HAVE requirement.
>>>
>>> Functions previously implemented in vgic.c and substitute
>>> to more complex irqchip implementation are removed:
>>>
>>> - kvm_send_userspace_msi
>>> - kvm_irq_map_chip_pin
>>> - kvm_set_irq
>>> - kvm_irq_map_gsi.
>>>
>>> They implemented a kernel default identity GSI routing. This is now
>>> replaced by user-side provided routing.
>>>
>>> Routing standard hooks are now implemented in vgic:
>>> - kvm_set_routing_entry
>>> - kvm_set_irq
>>> - kvm_set_msi
>>>
>>> Both HAVE_KVM_IRQCHIP and HAVE_KVM_IRQ_ROUTING are defined.
>>> KVM_CAP_IRQ_ROUTING is advertised and KVM_SET_GSI_ROUTING is allowed.
>>>
>>> MSI routing is not yet allowed.
>>>
>>> Signed-off-by: Eric Auger <eric.auger@linaro.org>
>>> ---
>>>  Documentation/virtual/kvm/api.txt | 11 ++++--
>>>  arch/arm/include/asm/kvm_host.h   |  2 +
>>>  arch/arm/kvm/Kconfig              |  2 +
>>>  arch/arm/kvm/Makefile             |  2 +-
>>>  arch/arm64/include/asm/kvm_host.h |  1 +
>>>  arch/arm64/kvm/Kconfig            |  2 +
>>>  arch/arm64/kvm/Makefile           |  2 +-
>>>  include/kvm/arm_vgic.h            |  9 -----
>>>  virt/kvm/arm/vgic.c               | 78 ++++++++++++++++++++++++---------------
>>>  virt/kvm/irqchip.c                |  2 +
>>>  10 files changed, 67 insertions(+), 44 deletions(-)
>>>
>>> diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
>>> index bcec91e..2bc96e1 100644
>>> --- a/Documentation/virtual/kvm/api.txt
>>> +++ b/Documentation/virtual/kvm/api.txt
>>> @@ -1395,7 +1395,7 @@ KVM_ASSIGN_DEV_IRQ. Partial deassignment of host or guest IRQ is allowed.
>>>  4.52 KVM_SET_GSI_ROUTING
>>>  
>>>  Capability: KVM_CAP_IRQ_ROUTING
>>> -Architectures: x86 s390
>>> +Architectures: x86 s390 arm arm64
>>>  Type: vm ioctl
>>>  Parameters: struct kvm_irq_routing (in)
>>>  Returns: 0 on success, -1 on error
>>> @@ -2310,9 +2310,12 @@ Note that closing the resamplefd is not sufficient to disable the
>>>  irqfd.  The KVM_IRQFD_FLAG_RESAMPLE is only necessary on assignment
>>>  and need not be specified with KVM_IRQFD_FLAG_DEASSIGN.
>>>  
>>> -On ARM/ARM64, the gsi field in the kvm_irqfd struct specifies the Shared
>>> -Peripheral Interrupt (SPI) index, such that the GIC interrupt ID is
>>> -given by gsi + 32.
>>> +On ARM/ARM64, when GSI routing is not used, the gsi field in the
>>> +kvm_irqfd struct specifies the Shared Peripheral Interrupt (SPI) index,
>>> +such that the GIC interrupt ID is given by gsi + 32. When GSI routing is
>>> +setup:
>>> +- if irqchip routing: irqchip.pin + 32 is the SPI ID that is injected
>>> +- if MSI routing: the MSI data is used as interrupt ID (SPI or LPI).
>>
>> This feels just wrong. With GICv3, the MSI data is not the LPI at all.
>> It is an opaque value that gets translated into an LPI when combined
>> with the DeviceID.
> I agree with you. I need to rephrase that. In practice this is what
> should happen in the code since I use Andre's MSI injection routine
> which does the translation; except for GICv2 where last patch attempts
> to do direct gsi mapping from msi msg data!

Agreed. The code seems to do the right thing, only the documentation is
misleading.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

  reply	other threads:[~2015-06-18 18:07 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-18 17:40 [RFC 0/6] KVM: arm/arm64: gsi routing support Eric Auger
2015-06-18 17:40 ` [RFC 1/6] KVM: api: add kvm_irq_routing_extended_msi Eric Auger
2015-06-22 16:32   ` Andre Przywara
2015-06-23  7:36     ` Eric Auger
2015-06-18 17:40 ` [RFC 2/6] KVM: kvm_host: add kvm_extended_msi Eric Auger
2015-06-18 17:40 ` [RFC 3/6] KVM: irqchip: convey devid to kvm_set_msi Eric Auger
2015-06-18 17:40 ` [RFC 4/6] KVM: arm/arm64: enable irqchip routing Eric Auger
2015-06-18 17:53   ` Marc Zyngier
2015-06-18 18:00     ` Eric Auger
2015-06-18 18:07       ` Marc Zyngier [this message]
2015-06-18 17:40 ` [RFC 5/6] KVM: arm/arm64: enable MSI routing Eric Auger
2015-06-18 17:40 ` [RFC 6/6] KVM: arm: implement kvm_set_msi by gsi direct mapping Eric Auger
2015-06-19  6:37 ` [RFC 0/6] KVM: arm/arm64: gsi routing support Pavel Fedin
2015-06-22  8:31   ` Eric Auger
2015-06-22  8:40 ` Andre Przywara
2015-06-22  9:21   ` Eric Auger
2015-06-23  7:38     ` Pavel Fedin
2015-06-23  7:50       ` Eric Auger
2015-06-23  8:50         ` Pavel Fedin
2015-06-23  9:44           ` Eric Auger
2015-06-23  9:03     ` Andre Przywara
2015-06-23  9:33       ` Eric Auger
2015-06-23 12:53       ` Eric Auger
2015-06-24 12:20         ` Pavel Fedin
2015-06-24 13:03           ` Eric Auger
2015-06-25  8:46             ` Pavel Fedin
2015-06-26 16:17               ` Eric Auger

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=558308E2.8010505@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=Andre.Przywara@arm.com \
    --cc=christoffer.dall@linaro.org \
    --cc=eric.auger@linaro.org \
    --cc=eric.auger@st.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=p.fedin@samsung.com \
    --cc=patches@linaro.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;
as well as URLs for NNTP newsgroup(s).