From patchwork Tue Dec 11 13:43:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 10723793 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B907218A7 for ; Tue, 11 Dec 2018 13:44:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A90072A5B7 for ; Tue, 11 Dec 2018 13:44:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9CDFE2AFD2; Tue, 11 Dec 2018 13:44:09 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E72B2AFCD for ; Tue, 11 Dec 2018 13:44:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726585AbeLKNnt (ORCPT ); Tue, 11 Dec 2018 08:43:49 -0500 Received: from 8bytes.org ([81.169.241.247]:53282 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726286AbeLKNnt (ORCPT ); Tue, 11 Dec 2018 08:43:49 -0500 Received: by theia.8bytes.org (Postfix, from userid 1000) id C824E387; Tue, 11 Dec 2018 14:43:46 +0100 (CET) From: Joerg Roedel To: iommu@lists.linux-foundation.org Cc: Russell Currey , Sam Bobroff , oohall@gmail.com, Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Lorenzo Pieralisi , Hanjun Guo , Sudeep Holla , Dan Williams , Vinod Koul , Joerg Roedel , jroedel@suse.de, Mathias Nyman , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, dmaengine@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH 2/6] iommu/of: Use device_iommu_mapped() Date: Tue, 11 Dec 2018 14:43:39 +0100 Message-Id: <20181211134343.10664-3-joro@8bytes.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181211134343.10664-1-joro@8bytes.org> References: <20181211134343.10664-1-joro@8bytes.org> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Joerg Roedel Use Use device_iommu_mapped() to check if the device is already mapped by an IOMMU. Acked-by: Robin Murphy Signed-off-by: Joerg Roedel --- drivers/iommu/of_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index c5dd63072529..bfcf139503f0 100644 --- a/drivers/iommu/of_iommu.c +++ b/drivers/iommu/of_iommu.c @@ -220,7 +220,7 @@ const struct iommu_ops *of_iommu_configure(struct device *dev, * If we have reason to believe the IOMMU driver missed the initial * add_device callback for dev, replay it to get things in order. */ - if (ops && ops->add_device && dev->bus && !dev->iommu_group) + if (ops && ops->add_device && dev->bus && !device_iommu_mapped(dev)) err = ops->add_device(dev); /* Ignore all other errors apart from EPROBE_DEFER */