From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753239AbdHJTQX (ORCPT ); Thu, 10 Aug 2017 15:16:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59722 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752639AbdHJTQW (ORCPT ); Thu, 10 Aug 2017 15:16:22 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B77086B34C Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=alex.williamson@redhat.com Date: Thu, 10 Aug 2017 13:16:18 -0600 From: Alex Williamson To: Robin Murphy Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, eric.auger@redhat.com, shameerali.kolothum.thodi@huawei.com, marc.zyngier@arm.com Subject: Re: [PATCH 1/2] vfio/type1: Cope with hardware MSI reserved regions Message-ID: <20170810131618.30500ce6@w520.home> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 10 Aug 2017 19:16:22 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 27 Jul 2017 15:54:13 +0100 Robin Murphy wrote: > For ARM-based systems with a GICv3 ITS to provide interrupt isolation, > but hardware limitations which are worked around by having MSIs bypass > SMMU translation (e.g. HiSilicon Hip06/Hip07), VFIO neglects to check > for the IRQ_DOMAIN_FLAG_MSI_REMAP capability, (and thus erroneously > demands unsafe_interrupts) if a software-managed MSI region is absent. > > Fix this by always checking for isolation capability at both the IRQ > domain and IOMMU domain levels, rather than predicating that on whether > MSIs require an IOMMU mapping (which was always slightly tenuous logic). > > Signed-off-by: Robin Murphy > --- > drivers/vfio/vfio_iommu_type1.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) I've pushed these to my next branch with Eric's R-b and Shameerali's T-b for v4.14. Thanks, Alex > diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c > index 8549cb111627..2328be628f21 100644 > --- a/drivers/vfio/vfio_iommu_type1.c > +++ b/drivers/vfio/vfio_iommu_type1.c > @@ -1265,8 +1265,8 @@ 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 = irq_domain_check_msi_remap() || > + iommu_capable(bus, IOMMU_CAP_INTR_REMAP); > > if (!allow_unsafe_interrupts && !msi_remap) { > pr_warn("%s: No interrupt remapping support. Use the module param \"allow_unsafe_interrupts\" to enable VFIO IOMMU support on this platform\n",