From patchwork Thu Mar 12 18:19:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 11435179 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 530E213B1 for ; Thu, 12 Mar 2020 18:20:07 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2D074206EB for ; Thu, 12 Mar 2020 18:20:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NHUZDsRV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2D074206EB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=WdjVYXT22TBlMyNKMMHlXq32Xv7VW3/v+GKH93X5J78=; b=NHU ZDsRV4cf12IBgclUXeUXxE3Z7bzEz+Gwz3dQbPfz3X9Z8VNV83JaJPsStO2gd8gWWY0m9CML2Sjku CSJDRkTEJLd0LfabpGLM+R0Xqwizwz0vrkB8l1SC4VzkX4QkHNNXWA47/FGY9wA/tzKFBndQpb0Vy kZrcuxSmk8nQxkUoYmNd2mdWyTQpg8jeWaN5bVCr9KTeERIIB9WullxkmXb1Cs5XertjXrIihNbHU oxyhxLYetIabGPMo0ljEbGUUG0wpr8OETvLkCAgBLDn5M0qihPq57X/F7QLheAiObijVa3MLq2I2e /Ukt+8pKVlEioaRtVj4Au3pN0XpteIg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jCSR8-0003zY-As; Thu, 12 Mar 2020 18:20:02 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jCSR5-0003yc-JI for linux-arm-kernel@lists.infradead.org; Thu, 12 Mar 2020 18:20:01 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 184A130E; Thu, 12 Mar 2020 11:19:58 -0700 (PDT) Received: from donnerap.arm.com (donnerap.cambridge.arm.com [10.1.197.25]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BC9F43F67D; Thu, 12 Mar 2020 11:19:56 -0700 (PDT) From: Andre Przywara To: Alex Williamson , Cornelia Huck , Will Deacon , Robin Murphy Subject: [RFC PATCH] vfio: Ignore -ENODEV when getting MSI cookie Date: Thu, 12 Mar 2020 18:19:50 +0000 Message-Id: <20200312181950.60664-1-andre.przywara@arm.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200312_111959_686707_366788C6 X-CRM114-Status: GOOD ( 14.70 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Auger , Joerg Roedel , iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org When we try to get an MSI cookie for a VFIO device, that can fail if CONFIG_IOMMU_DMA is not set. In this case iommu_get_msi_cookie() returns -ENODEV, and that should not be fatal. Ignore that case and proceed with the initialisation. This fixes VFIO with a platform device on the Calxeda Midway (no MSIs). Signed-off-by: Andre Przywara Acked-by: Robin Murphy Reviewed-by: Eric Auger --- Hi, not sure this is the right fix, or we should rather check if the platform doesn't support MSIs at all (which doesn't seem to be easy to do). Or is this because arm-smmu.c always reserves an IOMMU_RESV_SW_MSI region? Also this seems to be long broken, actually since Eric introduced MSI support in 4.10-rc3, but at least since the initialisation order was fixed with f6810c15cf9. Grateful for any insight. Cheers, Andre drivers/vfio/vfio_iommu_type1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index a177bf2c6683..467e217ef09a 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c @@ -1786,7 +1786,7 @@ static int vfio_iommu_type1_attach_group(void *iommu_data, if (resv_msi) { ret = iommu_get_msi_cookie(domain->domain, resv_msi_base); - if (ret) + if (ret && ret != -ENODEV) goto out_detach; }