linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: eric.auger@linaro.org (Eric Auger)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 7/7] KVM: arm: implement kvm_set_msi by gsi direct mapping
Date: Mon, 03 Aug 2015 11:11:19 +0200	[thread overview]
Message-ID: <55BF3037.4090605@linaro.org> (raw)
In-Reply-To: <55BE7C32.8070707@arm.com>

On 08/02/2015 10:23 PM, Andre Przywara wrote:
> On 31/07/15 13:59, Eric Auger wrote:
>> Hi Andre,
>> On 07/11/2015 01:17 AM, Andre Przywara wrote:
>>> On 09/07/15 09:22, Eric Auger wrote:
>>>> If the ITS modality is not available, let's simply support MSI
>>>> injection by transforming the MSI.data into an SPI ID.
>>>>
>>>> This becomes possible to use KVM_SIGNAL_MSI ioctl for arm too.
>>>>
>>>> Signed-off-by: Eric Auger <eric.auger@linaro.org>
>>>>
>>>> ---
>>>>
>>>> v1 -> v2:
>>>> - introduce vgic_v2m_inject_msi in vgic-v2-emul.c following Andre's
>>>>   advice
>>>> ---
>>>>  arch/arm/kvm/Kconfig        |  1 +
>>>>  virt/kvm/arm/vgic-v2-emul.c | 12 ++++++++++++
>>>>  2 files changed, 13 insertions(+)
>>>>
>>>> diff --git a/arch/arm/kvm/Kconfig b/arch/arm/kvm/Kconfig
>>>> index 151e710..0f58baf 100644
>>>> --- a/arch/arm/kvm/Kconfig
>>>> +++ b/arch/arm/kvm/Kconfig
>>>> @@ -31,6 +31,7 @@ config KVM
>>>>  	select KVM_VFIO
>>>>  	select HAVE_KVM_EVENTFD
>>>>  	select HAVE_KVM_IRQFD
>>>> +	select HAVE_KVM_MSI
>>>
>>> I wonder if this requires some more code to only advertise
>>> KVM_CAP_SIGNAL_MSI if userland actually sets up a GICv2M?
>>> Otherwise userland could get the idea of being able to inectj MSIs
>>> without the guest actually being prepared for that (because the GICv2M
>>> driver did not initialize).
>> Not sure I get what you mean here. By directly transforming the user
>> provided MSI msg into an SPI ID, do we really have to care about GICv2M?
> 
> By user provided message you mean from user space? So this is an
> emulated device, which the guest programs with an MSI payload and a
> doorbell address at least? So how would a guest know these things
> without having a MSI capable interrupt controller?
> 
> Or are we talking about different things here?

I meant GICv2m is emulated on user-side today so I don't see how the
kernel could check anything. For the MSI injection, in that case, we
only use irqfd standard IRQ injection.

Cheers

Eric
> 
> Cheers,
> Andre.
> 
>>
>> Best Regards
>>
>> Eric
>>>
>>> Cheers,
>>> Andre.
>>>
>>>>  	select HAVE_KVM_IRQCHIP
>>>>  	select HAVE_KVM_IRQ_ROUTING
>>>>  	depends on ARM_VIRT_EXT && ARM_LPAE && ARM_ARCH_TIMER
>>>> diff --git a/virt/kvm/arm/vgic-v2-emul.c b/virt/kvm/arm/vgic-v2-emul.c
>>>> index 1390797..43013cc 100644
>>>> --- a/virt/kvm/arm/vgic-v2-emul.c
>>>> +++ b/virt/kvm/arm/vgic-v2-emul.c
>>>> @@ -478,6 +478,17 @@ static bool vgic_v2_queue_sgi(struct kvm_vcpu *vcpu, int irq)
>>>>  }
>>>>  
>>>>  /**
>>>> + * Emulates GICv2M MSI injection by injecting the SPI ID matching
>>>> + * the msi data
>>>> + * @kvm: pointer to the kvm struct
>>>> + * @msi: the msi struct handle
>>>> + */
>>>> +static int vgic_v2m_inject_msi(struct kvm *kvm, struct kvm_msi *msi)
>>>> +{
>>>> +	return kvm_vgic_inject_irq(kvm, 0, msi->data, 1);
>>>> +}
>>>> +
>>>> +/**
>>>>   * kvm_vgic_map_resources - Configure global VGIC state before running any VCPUs
>>>>   * @kvm: pointer to the kvm struct
>>>>   *
>>>> @@ -566,6 +577,7 @@ void vgic_v2_init_emulation(struct kvm *kvm)
>>>>  	dist->vm_ops.add_sgi_source = vgic_v2_add_sgi_source;
>>>>  	dist->vm_ops.init_model = vgic_v2_init_model;
>>>>  	dist->vm_ops.map_resources = vgic_v2_map_resources;
>>>> +	dist->vm_ops.inject_msi = vgic_v2m_inject_msi;
>>>>  
>>>>  	kvm->arch.max_vcpus = VGIC_V2_MAX_CPUS;
>>>>  }
>>>>
>>>
>>
> 

  reply	other threads:[~2015-08-03  9:11 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-09  8:22 [PATCH v2 0/7] KVM: arm/arm64: gsi routing support Eric Auger
2015-07-09  8:22 ` [PATCH v2 1/7] KVM: api: introduce KVM_IRQ_ROUTING_EXTENDED_MSI Eric Auger
2015-07-10 22:42   ` Andre Przywara
2015-07-13  9:25     ` Eric Auger
2015-07-09  8:22 ` [PATCH v2 2/7] KVM: kvm_host: add devid in kvm_kernel_irq_routing_entry Eric Auger
2015-07-09  8:22 ` [PATCH v2 3/7] KVM: irqchip: convey devid to kvm_set_msi Eric Auger
2015-07-10 23:15   ` Andre Przywara
2015-07-17  7:27   ` Pavel Fedin
2015-07-17 10:09     ` Paolo Bonzini
2015-07-17 10:21       ` Pavel Fedin
2015-07-18 18:39         ` Eric Auger
2015-07-09  8:22 ` [PATCH v2 4/7] KVM: arm/arm64: enable irqchip routing Eric Auger
2015-07-10 23:15   ` Andre Przywara
2015-07-13  9:58     ` Eric Auger
2015-07-15  7:29       ` Pavel Fedin
2015-07-09  8:22 ` [PATCH v2 5/7] KVM: arm/arm64: build a default routing table Eric Auger
2015-07-09  8:22 ` [PATCH v2 6/7] KVM: arm/arm64: enable MSI routing Eric Auger
2015-07-10 23:16   ` Andre Przywara
2015-07-09  8:22 ` [PATCH v2 7/7] KVM: arm: implement kvm_set_msi by gsi direct mapping Eric Auger
2015-07-10 23:17   ` Andre Przywara
2015-07-31 12:59     ` Eric Auger
2015-08-02 20:23       ` Andre Przywara
2015-08-03  9:11         ` Eric Auger [this message]
2015-07-09 14:37 ` [PATCH v2 0/7] KVM: arm/arm64: gsi routing support Pavel Fedin
2015-07-09 15:25   ` Andre Przywara
2015-07-09 15:52     ` Pavel Fedin
2015-07-09 17:11       ` Eric Auger
2015-07-09 18:08         ` Pavel Fedin

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=55BF3037.4090605@linaro.org \
    --to=eric.auger@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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).