Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp586398ybz; Wed, 15 Apr 2020 14:35:38 -0700 (PDT) X-Google-Smtp-Source: APiQypK4ZTLOOUjtILx61WuLlwZXHgLeje77qPiTFoqskJTD1USqX01mbM6QEEqQaHWszfAKMThE X-Received: by 2002:a17:907:2155:: with SMTP id rk21mr7074879ejb.163.1586986538119; Wed, 15 Apr 2020 14:35:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586986538; cv=none; d=google.com; s=arc-20160816; b=H1pEeJP6Ng9I4j8n7CoyaVcS5hTW0PqxvUUH0wgRPy+iwC/xpzx68NTuqcInhkHBem ZqaTe90Iwyc+V6zDVtHqmpSC+iLKs+CyWnEYl3DqTU8ekA1o2yRXh6Z2qZpj9lcBOGtH JaHY1TLZrKJe6CEgLTdN3p+GCeZuFeiccr5tAR358PY0Xvx9vJBucTqDP99jiwwrfF8c GWD0yl9qAdZ7JHrM6me84eXUO1PWuzk1gc8v4DXU2dr9pH8Plb2g98n43Pm78vqwKdQ4 gJl0rLqDh3+MgrZn86EOZtfoixU0GhXDv5573sbSO3CcWx0DL7N1jpyrYTx5gA/PHzD6 4JHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=14/WgvBq1MQ1MxU11zqrUQOdNdEVETU0Kny1UxvmmA0=; b=EFeVDjRTFfwylkLgz1Lk15RlVsgafSYy4TQTst8JZKCtKY9tGoEVX/cQUWvU/Qufyq 6kHiAZ4zo3HSWKS2XyXF0h/sbRqv3cInAuuJxXv25S+SMAV11QA55FmH98TXrxKm7FgJ NrGmYjR95scFJ2fbrGsnArt62y3kug1l8NXlXPY7RlQaI0Bs8RAtzCdNjKQg+cpCH0f/ 4bZyGkmuENe9/wEuQDlpwbSc9Uk4ADKf5UCU9MTuq+fUbSW1t+usmQCIBd4nUTEZZOGQ lBAg8jcQls1uaR7Gduqo17JT3g/OQ/1IvijKkhYtgLas0DqPNSOc4dDN9dHgoR305aSA M6Ig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l1si12224732edq.314.2020.04.15.14.35.14; Wed, 15 Apr 2020 14:35:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730483AbgDNNVE (ORCPT + 99 others); Tue, 14 Apr 2020 09:21:04 -0400 Received: from 8bytes.org ([81.169.241.247]:35050 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502904AbgDNNQH (ORCPT ); Tue, 14 Apr 2020 09:16:07 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id C5CC776D; Tue, 14 Apr 2020 15:15:56 +0200 (CEST) From: Joerg Roedel To: Joerg Roedel , Will Deacon , Robin Murphy , Marek Szyprowski , Kukjin Kim , Krzysztof Kozlowski , David Woodhouse , Lu Baolu , Andy Gross , Bjorn Andersson , Matthias Brugger , Rob Clark , Heiko Stuebner , Gerald Schaefer , Thierry Reding , Jonathan Hunter , Jean-Philippe Brucker Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-s390@vger.kernel.org, linux-tegra@vger.kernel.org, virtualization@lists.linux-foundation.org, Joerg Roedel Subject: [PATCH v2 28/33] iommu/omap: Remove orphan_dev tracking Date: Tue, 14 Apr 2020 15:15:37 +0200 Message-Id: <20200414131542.25608-29-joro@8bytes.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200414131542.25608-1-joro@8bytes.org> References: <20200414131542.25608-1-joro@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel Remove the tracking of device which could not be probed because their IOMMU is not probed yet. Replace it with a call to bus_iommu_probe() when a new IOMMU is probed. Signed-off-by: Joerg Roedel --- drivers/iommu/omap-iommu.c | 54 +++----------------------------------- 1 file changed, 4 insertions(+), 50 deletions(-) diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index 887fefcb03b4..ecc9d0829a91 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -35,15 +35,6 @@ static const struct iommu_ops omap_iommu_ops; -struct orphan_dev { - struct device *dev; - struct list_head node; -}; - -static LIST_HEAD(orphan_dev_list); - -static DEFINE_SPINLOCK(orphan_lock); - #define to_iommu(dev) ((struct omap_iommu *)dev_get_drvdata(dev)) /* bitmap of the page sizes currently supported */ @@ -62,8 +53,6 @@ static DEFINE_SPINLOCK(orphan_lock); static struct platform_driver omap_iommu_driver; static struct kmem_cache *iopte_cachep; -static int _omap_iommu_add_device(struct device *dev); - /** * to_omap_domain - Get struct omap_iommu_domain from generic iommu_domain * @dom: generic iommu domain handle @@ -1177,7 +1166,6 @@ static int omap_iommu_probe(struct platform_device *pdev) struct omap_iommu *obj; struct resource *res; struct device_node *of = pdev->dev.of_node; - struct orphan_dev *orphan_dev, *tmp; if (!of) { pr_err("%s: only DT-based devices are supported\n", __func__); @@ -1260,13 +1248,8 @@ static int omap_iommu_probe(struct platform_device *pdev) dev_info(&pdev->dev, "%s registered\n", obj->name); - list_for_each_entry_safe(orphan_dev, tmp, &orphan_dev_list, node) { - err = _omap_iommu_add_device(orphan_dev->dev); - if (!err) { - list_del(&orphan_dev->node); - kfree(orphan_dev); - } - } + /* Re-probe bus to probe device attached to this IOMMU */ + bus_iommu_probe(&platform_bus_type); return 0; @@ -1657,7 +1640,7 @@ static phys_addr_t omap_iommu_iova_to_phys(struct iommu_domain *domain, return ret; } -static int _omap_iommu_add_device(struct device *dev) +static int omap_iommu_add_device(struct device *dev) { struct omap_iommu_arch_data *arch_data, *tmp; struct omap_iommu *oiommu; @@ -1666,8 +1649,6 @@ static int _omap_iommu_add_device(struct device *dev) struct platform_device *pdev; int num_iommus, i; int ret; - struct orphan_dev *orphan_dev; - unsigned long flags; /* * Allocate the archdata iommu structure for DT-based devices. @@ -1702,23 +1683,7 @@ static int _omap_iommu_add_device(struct device *dev) if (!pdev) { of_node_put(np); kfree(arch_data); - spin_lock_irqsave(&orphan_lock, flags); - list_for_each_entry(orphan_dev, &orphan_dev_list, - node) { - if (orphan_dev->dev == dev) - break; - } - spin_unlock_irqrestore(&orphan_lock, flags); - - if (orphan_dev && orphan_dev->dev == dev) - return -EPROBE_DEFER; - - orphan_dev = kzalloc(sizeof(*orphan_dev), GFP_KERNEL); - orphan_dev->dev = dev; - spin_lock_irqsave(&orphan_lock, flags); - list_add(&orphan_dev->node, &orphan_dev_list); - spin_unlock_irqrestore(&orphan_lock, flags); - return -EPROBE_DEFER; + return -ENODEV; } oiommu = platform_get_drvdata(pdev); @@ -1764,17 +1729,6 @@ static int _omap_iommu_add_device(struct device *dev) return 0; } -static int omap_iommu_add_device(struct device *dev) -{ - int ret; - - ret = _omap_iommu_add_device(dev); - if (ret == -EPROBE_DEFER) - return 0; - - return ret; -} - static void omap_iommu_remove_device(struct device *dev) { struct omap_iommu_arch_data *arch_data = dev->archdata.iommu; -- 2.17.1