From patchwork Sat May 27 13:47:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sricharan Ramabadhran X-Patchwork-Id: 9751911 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2471760249 for ; Sat, 27 May 2017 13:50:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AD5F28470 for ; Sat, 27 May 2017 13:50:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F06728475; Sat, 27 May 2017 13:50:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A5DC228425 for ; Sat, 27 May 2017 13:50:26 +0000 (UTC) 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:References: In-Reply-To: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:List-Owner; bh=jMWpiJR7mQaH8COSUvTzjOfl6y//5h/RgDIUcc4MrSE=; b=mUYIUXZnF3NPnqUDWsgGOPIuI2 /rlonv47tTRzfQkbgMuO/hdaqIA7Z5uhQjCZBtlWdGd8oM8dwhjDKlNMD4to+0K+e0yYTPqZMTbXR CGblR2a8icbLdg/yq61Dm0ALlZV4EqlEfPk/WUH/Sb+LFoBuuF3tt5KPfpY/mNX4EEUm96xCp/S4t PGdNJQlZRZ71PZP76l2d4MNbHgqYrqKSBmf8g/xRmO0Ke8jNECxJVgVhMV85vTfk0Tz9ZpvLm/OJn yF4RCCcJrCfNlOgtKf9ProeR8IJEMlwPthTUIptJQmrpcqYbLezoTopOxjBxHbzEnKpVjJkoQ3qMO 5mPcME6Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dEc6q-0003rd-P2; Sat, 27 May 2017 13:50:24 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dEc5Y-0001RM-RK for linux-arm-kernel@lists.infradead.org; Sat, 27 May 2017 13:49:06 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id B07E56146B; Sat, 27 May 2017 13:48:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1495892926; bh=WuqXeSIUZR9PncHyiEyDU8jJQsUph0kUnVMAC8bBg9c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f8BXTD0v1aa0DQUnviVWHYM+SA1CxrfdC8BhwWhttaqn2bTnnzfyfY+JVTemutKVv sggh5JDmzM33WBdvblDNMhI8Qss1nVCjyxAoqM7s+hak8R5SaIxBA/Lag/AtGmceO4 1dFFOBdgxNhwjxD89mUCshX7CTwVjHM/x9mvz+IQ= Received: from srichara-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sricharan@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 03BFC613BF; Sat, 27 May 2017 13:48:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1495892925; bh=WuqXeSIUZR9PncHyiEyDU8jJQsUph0kUnVMAC8bBg9c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N5P6gRracqnuJCXn4hLkx+FuG5n++JCCS1nF3og3Dh0OaHhAcM+Qxt8fYvbHNUxaC o0fT+ivMiWDGMQk59KLtIFWxe7hgd+Ae76nsxuHx6EB/+oslkK/PLsz2y4PNBibKZx aTH0P2EBkFDCMUOnDq9ccQZKooPpASKY0DPxAb2E= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 03BFC613BF Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=sricharan@codeaurora.org From: Sricharan R To: robin.murphy@arm.com, will.deacon@arm.com, joro@8bytes.org, lorenzo.pieralisi@arm.com, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, m.szyprowski@samsung.com, bhelgaas@google.com, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, tn@semihalf.com, hanjun.guo@linaro.org, okaya@codeaurora.org, robh+dt@kernel.org, frowand.list@gmail.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, sudeep.holla@arm.com, rjw@rjwysocki.net, lenb@kernel.org, catalin.marinas@arm.com, arnd@arndb.de, linux-arch@vger.kernel.org, laurent.pinchart@ideasonboard.com, j.neuschaefer@gmx.net, geert@linux-m68k.org, magnus.damm@gmail.com, nwatters@codeaurora.org, linux@armlinux.org.uk Subject: [PATCH v6 5/6] ACPI/IORT: Move the check to get iommu_ops from translated fwspec Date: Sat, 27 May 2017 19:17:44 +0530 Message-Id: <1495892865-9506-5-git-send-email-sricharan@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1495892865-9506-1-git-send-email-sricharan@codeaurora.org> References: <1495892865-9506-1-git-send-email-sricharan@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170527_064904_935143_3FB3AE99 X-CRM114-Status: GOOD ( 12.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sricharan@codeaurora.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Lorenzo Pieralisi With IOMMU probe deferral, iort_iommu_configure can be called multiple times for the same device. Hence we have a check to see if the device's fwspec is already translated and return the iommu_ops from that directly. But the check is wrongly placed in iort_iommu_xlate, which breaks devices with multiple sids. Move the check to iort_iommu_configure. Fixes: 5a1bb638d567 ("drivers: acpi: Handle IOMMU lookup failure with deferred probing or error") Tested-by: Nate Watterson Signed-off-by: Lorenzo Pieralisi --- drivers/acpi/arm64/iort.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index 16e101f..797b28d 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -666,14 +666,6 @@ static const struct iommu_ops *iort_iommu_xlate(struct device *dev, int ret = -ENODEV; struct fwnode_handle *iort_fwnode; - /* - * If we already translated the fwspec there - * is nothing left to do, return the iommu_ops. - */ - ops = iort_fwspec_iommu_ops(dev->iommu_fwspec); - if (ops) - return ops; - if (node) { iort_fwnode = iort_get_fwnode(node); if (!iort_fwnode) @@ -735,6 +727,14 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev) u32 streamid = 0; int err; + /* + * If we already translated the fwspec there + * is nothing left to do, return the iommu_ops. + */ + ops = iort_fwspec_iommu_ops(dev->iommu_fwspec); + if (ops) + return ops; + if (dev_is_pci(dev)) { struct pci_bus *bus = to_pci_dev(dev)->bus; u32 rid;