From patchwork Tue May 23 13:01:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sricharan Ramabadhran X-Patchwork-Id: 9742501 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 35287601C2 for ; Tue, 23 May 2017 13:06:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2174E28754 for ; Tue, 23 May 2017 13:06:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15DA4287D6; Tue, 23 May 2017 13:06:20 +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 C40E128754 for ; Tue, 23 May 2017 13:06:18 +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=qewtiIXqACmTaVuGZw6Y+q88Q7biRKrHEOS6/FdLGeI=; b=ewiJXFiE3GndC8gYsb9MDfkkmM /P/7FPsd33K541Jda0vvWmd0PoGCobP0cpYosM0R8brZterGco6+AJ5KcTRF7E4Rt5WkthITrdMCC awvuOzX9gRwKrxDDwO7FGastYD6Chvb6E208ckiY/YVx+5BnAu+H91Hxr2UpcbbJ3jNQfItGMhktr LyCExFK8DNhW3dyDRtKxiNMq2Dzrjcg9jHAwbPbK5TrdP6+q2nqux4nYgh48qE8QgHoZONXS5e0Bq /9xLVJo0nPkr5XyL0PxhzuporYrk8UuKCTcwhFH8RheoRi26oQ9wgkknUokYTL1+X3obFgDuJNx+k QjbonorA==; 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 1dD9Vx-0005jU-3r; Tue, 23 May 2017 13:06:17 +0000 Received: from casper.infradead.org ([85.118.1.10]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dD9VW-0005BP-8Q for linux-arm-kernel@bombadil.infradead.org; Tue, 23 May 2017 13:05:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Ekf4fAMSH7OkJE1AeMzqfGVv78Xzm8YGfpQxSnninsw=; b=vL00Er33LAvugoxhIxC8foi+g YKNhpqu5yskHG7X9PdwUMr3LxcjZW+7nS0A6BEAUnsuy06+hSJrzd5Zw/MTH8RK2YNe0O0MajvLFy 2XyiEmso4/FOdrBIUdv92v4CYRCT7LVrLFLd1+HhVGHFJg/wcLmMoAe4VrGMFW5+KvhePLa3HqDhe 5Kl93KOtSfH2j102U6mR/yDLy7RgbPOth9wLqHo7PAgr3dsayW7B7o+A+AmZYU9fJg5grkzcPVL4B HOD+fEElbOgCbO0AeKOxlOnv0tb9yXkMMnLKUh7H22HH/fRd4AON+ODg4NflZ1JWtagRA7SMtFu8t g9sLHRALg==; Received: from smtp.codeaurora.org ([198.145.29.96]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dD9SY-0003Ap-6t for linux-arm-kernel@lists.infradead.org; Tue, 23 May 2017 13:02:48 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 87AC260D5B; Tue, 23 May 2017 13:02:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1495544544; bh=GS0VmBbFqA+mMVjjEQ4NsRjDy+Ng8jPmx0QeX2zCkH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eUDTkfv6BTwWtas1eccq0UuHT5cXaoq5hAvHuaKMhO0TnVh46omc8Wp/ctOwizCaD cqrKNWUdRzbUZAaxlDOAG+bBi7oZj0VpG8hq7BXpINxeE2XN5oo+ymFL76DzjI2jOP k05cgG+ZnyOM0QUIMRJdmQ5/n+PZn3BCMioVaxyY= 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 59E7360392; Tue, 23 May 2017 13:02:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1495544541; bh=GS0VmBbFqA+mMVjjEQ4NsRjDy+Ng8jPmx0QeX2zCkH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RfMsDpkBUe0lZFx4WOO7fUaVyiSVtPJ2PpLmbQxsLyyn4RiiSPuhrNnQ7E6BncN/z G0jNF3v/CxFIOGPH8J80qm0lf9kVUSReE8mVTRwsfTt9yJp3UWykYP91VoB81im/AY emjCTsVZeW/Zk85/KVZzdw51wOuLw8KyKxuxCrUY= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 59E7360392 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 Subject: [PATCH v5 5/5] ACPI/IORT: Move the check to get iommu_ops from translated fwspec Date: Tue, 23 May 2017 18:31:33 +0530 Message-Id: <1495544493-14219-5-git-send-email-sricharan@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1495544493-14219-1-git-send-email-sricharan@codeaurora.org> References: <1495544493-14219-1-git-send-email-sricharan@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170523_140246_569316_988EB7BB X-CRM114-Status: GOOD ( 19.18 ) 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 --- [v5] new patch 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;