qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Auger <eric.auger@linaro.org>
To: Christoffer Dall <christoffer.dall@linaro.org>,
	Peter Maydell <peter.maydell@linaro.org>
Cc: Shlomo Pongratz <shlomo.pongratz@huawei.com>,
	Shlomo Pongratz <shlomopongratz@gmail.com>,
	Pavel Fedin <p.fedin@samsung.com>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v8 3/5] Introduce irqchip type specification for KVM
Date: Wed, 12 Aug 2015 16:14:31 +0200	[thread overview]
Message-ID: <55CB54C7.9070909@linaro.org> (raw)
In-Reply-To: <CAMJs5B_vfLEtRm_-GhFaKM3f+H7XnxYzwJDuZVePquM6i+Ua_w@mail.gmail.com>

Hi,
On 08/12/2015 03:23 PM, Christoffer Dall wrote:
> On Wed, Aug 12, 2015 at 2:59 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
>> On 12 August 2015 at 13:27, Pavel Fedin <p.fedin@samsung.com> wrote:
>>>  Hello!
>>>
>>>> I still think this is the wrong approach -- see my remarks
>>>> in the previous round of patch review.
>>>
>>>  You know... I thought a little bit...
>>>  So far, test = true in KVM_CREATE_DEVICE means that we just want to know whether this type is supported. No actual actions is done by the kernel. Is it correct? 
yes
If yes, we can just leave this test as it is, because if it says that
GICv2 is supported by KVM_CREATE_DEVICE, then:
>>> 1. We use new API. No KVM_IRQCHIP_CREATE.
>>> 2. GICv3 may be supported.
>>>
>>>  Therefore, if we do this check, and it succeeds, then we just
>>> proceed, and later actually try to create GICv3. If it fails for some
>>> reason, we will see error message anyway. So would it be OK just not
>>> to touch kvm_arch_irqchip_create() at all?
>>
>> No, because then if the kernel only supports GICv3 the
>> code in kvm_arch_irqchip_create() (as it is currently written)
>> will erroneously fall back to using the old API.
>>
>> Christoffer: the question was, why does kvm_arch_irqchip_create()
>> not only check the KVM_CAP_DEVICE_CTRL but also try to see
>> if it can KVM_CREATE_DEVICE the GICv2 in order to avoid
>> falling back to the old pre-KVM_CREATE_DEVICE API ? Are there
>> kernels which have the capability bit set but which can't
>> actually use KVM_CREATE_DEVICE to create the irqchip?
> 
> My thinking probably was that technically the KVM_CAP_DEVICE_CTRL is
> an orthogonal concept from how to create the vgic, and you could
> advertise this capability without also supporting the GICv2 device
> type.
> 
> However, I don't believe such kernels exist
the capability was advertised for arm/arm64 with GICv2
7330672  KVM: arm-vgic: Support KVM_CREATE_DEVICE for VGIC (1 year, 8
months ago) <Christoffer Dall>
so effectively I don't think we have any arm kernel advertising the CAP
without GICv3.

 and they cannot in the
> future as that would be because we would remove an actively supported
> API.
> 
>>
>> My preference here would be for kvm_arch_irqchip_create()
>> to just use 'is the KVM_CAP_DEVICE_CTRL capability set'
>> for its "can we use the new API" test; that will then
>> work whether we have a GICv2 or GICv3 in the host. (The
>> actual GIC device creation later on might fail, of course,
>> but that can be handled at that point. The only thing
>> we need to do as early as kvm_arch_irqchip_create is
>> determine whether we must use the old API.)
another way was proposed in the past was consisting in calling first
ret = kvm_create_device(s, KVM_DEV_TYPE_ARM_VGIC_V3, true);
if this succeeds this means we have the new API (the only one used vy
v3) and hence we have it as well for VGIC_V2, we can return ...
if this fails we just can say VGICv3 KVM device hasn't registered, try
KVM_DEV_TYPE_ARM_VGIC_V2
if we have it return else fall back to older API

I think it worked as well?

Besides I think Peter's suggestion is simpler.

For info we also use KVM VFIO device now.

Best Regards

Eric
>>
> I'm fine with this.
> 
> -Christoffer
> 

  reply	other threads:[~2015-08-12 14:15 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10 12:06 [Qemu-devel] [PATCH v8 0/5] vGICv3 support Pavel Fedin
2015-08-10 12:06 ` [Qemu-devel] [PATCH v8 1/5] Implement GIC-500 base class Pavel Fedin
2015-08-10 17:23   ` Peter Maydell
2015-08-11  7:53     ` Pavel Fedin
2015-08-11  9:20       ` Peter Maydell
2015-08-11  9:35         ` Pavel Fedin
2015-08-11 10:15           ` Peter Maydell
2015-08-11 10:39             ` Pavel Fedin
2015-08-11 10:42               ` Peter Maydell
2015-08-10 12:06 ` [Qemu-devel] [PATCH v8 2/5] Extract some reusable vGIC code Pavel Fedin
2015-08-10 17:34   ` Peter Maydell
2015-08-11  7:23     ` Pavel Fedin
2015-08-10 12:06 ` [Qemu-devel] [PATCH v8 3/5] Introduce irqchip type specification for KVM Pavel Fedin
2015-08-10 16:45   ` Peter Maydell
2015-08-12 11:44     ` Pavel Fedin
2015-08-12 11:45       ` Christoffer Dall
2015-08-12 12:27     ` Pavel Fedin
2015-08-12 12:59       ` Peter Maydell
2015-08-12 13:23         ` Christoffer Dall
2015-08-12 14:14           ` Eric Auger [this message]
2015-08-12 14:24             ` Christoffer Dall
2015-08-12 15:21               ` Eric Auger
2015-08-10 12:06 ` [Qemu-devel] [PATCH v8 4/5] Initial implementation of vGICv3 Pavel Fedin
2015-08-10 17:18   ` Peter Maydell
2015-08-10 12:06 ` [Qemu-devel] [PATCH v8 5/5] Add gicversion option to virt machine Pavel Fedin
2015-08-10 17:12   ` Peter Maydell
2015-08-13 11:02     ` 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=55CB54C7.9070909@linaro.org \
    --to=eric.auger@linaro.org \
    --cc=christoffer.dall@linaro.org \
    --cc=p.fedin@samsung.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shlomo.pongratz@huawei.com \
    --cc=shlomopongratz@gmail.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).