From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754566AbdCBPtH (ORCPT ); Thu, 2 Mar 2017 10:49:07 -0500 Received: from victor.provo.novell.com ([137.65.250.26]:58640 "EHLO prv3-mh.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753206AbdCBPqj (ORCPT ); Thu, 2 Mar 2017 10:46:39 -0500 Subject: Re: [PATCH 2/2] vfio: type1: conditionally check MSI remapping at irq domain level To: Auger Eric , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, marc.zyngier@arm.com, alex.williamson@redhat.com Cc: will.deacon@arm.com References: <20170302100132.20502-1-yousaf.kaukab@suse.com> <20170302100132.20502-2-yousaf.kaukab@suse.com> <164781c3-af63-b3a1-332f-420b54384b5f@redhat.com> <4304c447-0523-08a0-3327-e974bedc3c73@suse.com> <3e45414d-9463-164e-d57d-4065f8195ee7@redhat.com> From: Mian Yousaf Kaukab Message-ID: <3104e7e2-b2cc-a844-41bc-5d3f28d4fa3a@suse.com> Date: Thu, 2 Mar 2017 16:01:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: <3e45414d-9463-164e-d57d-4065f8195ee7@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/02/2017 02:46 PM, Auger Eric wrote: > Hi, > > On 02/03/2017 13:38, Mian Yousaf Kaukab wrote: >> On 03/02/2017 11:24 AM, Auger Eric wrote: >>> Hi, >>> >>> On 02/03/2017 11:01, Mian Yousaf Kaukab wrote: >>>> Check only if irq domains are available. >>>> >>>> Signed-off-by: Mian Yousaf Kaukab >>>> --- >>>> drivers/vfio/vfio_iommu_type1.c | 5 +++-- >>>> 1 file changed, 3 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/drivers/vfio/vfio_iommu_type1.c >>>> b/drivers/vfio/vfio_iommu_type1.c >>>> index bd6f293c4ebd..e3ed50e40ead 100644 >>>> --- a/drivers/vfio/vfio_iommu_type1.c >>>> +++ b/drivers/vfio/vfio_iommu_type1.c >>>> @@ -1287,8 +1287,9 @@ static int vfio_iommu_type1_attach_group(void >>>> *iommu_data, >>>> INIT_LIST_HEAD(&domain->group_list); >>>> list_add(&group->next, &domain->group_list); >>>> - msi_remap = resv_msi ? irq_domain_check_msi_remap() : >>>> - iommu_capable(bus, IOMMU_CAP_INTR_REMAP); >>>> + msi_remap = resv_msi && IS_ENABLED(CONFIG_IRQ_DOMAIN) ? >>>> + irq_domain_check_msi_remap() : >>>> + iommu_capable(bus, IOMMU_CAP_INTR_REMAP); >>> Is that patch actually needed after [PATCH 1/2] irqdomain: add empty >>> irq_domain_check_msi_remap. irq_domain_check_msi_remap() should be >>> defined and if you follow my suggestion, would return false. Anyway in >>> your case resv_msi should be false. >> I agree its an overkill if resv_msi is guaranteed to be false. What I am >> unsure about is that, if iommu have IOMMU_RESV_MSI regions that would >> mean that irq domains are selected in the build. If this is not >> guaranteed, then we need to add this check. > > Currently only ARM SMMUs advertise IOMMU_RESV_MSI regions. If attempting > to do passthrough on an ARM platform not implementing IRQ_DOMAIN the > unsafe IRQ assignment mode would need to be chosen (if > irq_domain_check_msi_remap() returns false as discussed before). Anyway > checking the interrupt remapping capability on IOMMU side would report > false as well since the capability is not exposed by ARM SMMU anymore.OK I will drop this patch. We get a warning anyway in case the capability is checked from the wrong place. BR, Yousaf