From patchwork Fri Sep 15 11:05:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 112724 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp478440qgf; Fri, 15 Sep 2017 04:05:19 -0700 (PDT) X-Google-Smtp-Source: ADKCNb5rmC6HQUxgJgEQleq7YrgQO+OJtxvt5QC64z/xCkGPdILJcBIY3mTre3Gq6/KOu9XXw+fY X-Received: by 10.99.181.79 with SMTP id u15mr23977556pgo.116.1505473519560; Fri, 15 Sep 2017 04:05:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505473519; cv=none; d=google.com; s=arc-20160816; b=Rs3Rg3urH5U0I33vYjgKdoffJjlaBu2me93DtwCZuCi2zszfk/uaXLCSKj93p63UOq dF0KlPK7RjOmnPuZFoUqODasUSt9w++Dmz9D45aixJ8ZwZa3a4ROnbPzySQ0sp7PIVGf wkL93+RnGB/9yv2Bug0YAe0oShdkTHKxh/snMEOvrNOtitTplh5HXDUCLJa4TPDTnUW8 HRbl7nuLXpcqAHewxfuJPyfXmV+5YyLuwoYNnZ27e6nv4DCT8C951biC6EwvLzS6mSLa M8KdZtD8eP4jlLkgD1A6Ayb/ck96Y2kxFauFsb0XVfzSpWXe6iET8DJSEF8/TgWWm+t8 9yJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:message-id:date :subject:cc:to:from:arc-authentication-results; bh=HOs5jgcNJi+499UW5SH/9O2loE/q5aItLN8e5YGuR3U=; b=S9Rlcm+QWZhwnfsnzuEJtBZwhxRxgXvDi0Jmx6OLv9amCUESDEX7tvFoakkzGlJLDl 3S+ksYfT/D/OdpjTGql1T40FyPVCrXJ0hsFJJben0QJyjBPnpUUHfYHXv+Z4tnLBjifp 1HHnDw8NBwcvn1fhnkiAtNpHUnMn/O/8hV1JW3lM3uBwIEjB+l7ZKK7LeSiV7ynQA+SR wXV82nuJWmN4cujHCPTk9ZLHkvH0OfapPjf/TfqSFVucdh/yjxganupiUE2/CiOU1i+B 9QM0wj7nr97CKjfnj5CBjno7/jKS6ycRP+MyIfmk4O2+5b7jH6vFTR4Au9H7ba+TBDS1 MYLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p63si462526pga.741.2017.09.15.04.05.19; Fri, 15 Sep 2017 04:05:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751225AbdIOLFS (ORCPT + 4 others); Fri, 15 Sep 2017 07:05:18 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:56274 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751213AbdIOLFS (ORCPT ); Fri, 15 Sep 2017 07:05:18 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20170915110516euoutp015f53116d3edc28e58683d7949947f825~khC-LlcBr1529915299euoutp010; Fri, 15 Sep 2017 11:05:16 +0000 (GMT) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170915110515eucas1p2261a853c5ba6e4cc0926edd2685cbeea~khC_eQcrs0291002910eucas1p2K; Fri, 15 Sep 2017 11:05:15 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges5.samsung.com (EUCPMTA) with SMTP id 39.8F.12743.BE3BBB95; Fri, 15 Sep 2017 12:05:15 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170915110514eucas1p207463649130d3a9522a50c292b0d2521~khC9w2EkP1824618246eucas1p2Y; Fri, 15 Sep 2017 11:05:14 +0000 (GMT) X-AuditID: cbfec7f5-f79d06d0000031c7-96-59bbb3eb3a70 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 9F.DF.20118.AE3BBB95; Fri, 15 Sep 2017 12:05:14 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OWB0071QISMCLC0@eusync4.samsung.com>; Fri, 15 Sep 2017 12:05:14 +0100 (BST) From: Marek Szyprowski To: iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Joerg Roedel , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH] iommu/exynos: Rework runtime PM links management Date: Fri, 15 Sep 2017 13:05:08 +0200 Message-id: <1505473508-10094-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrJIsWRmVeSWpSXmKPExsWy7djP87qvN++ONNj5gc9i44z1rBYL9ltb dM7ewG5x/jyQmHF+H5PF2iN32R3YPJ4cnMfksWlVJ5vH5BvLGT36tqxi9Pi8SS6ANYrLJiU1 J7MstUjfLoErY9u6G0wFZ0Qrnl5dytjAeFWwi5GTQ0LAROLQ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jAIcjEo8vAITdkUKsSaWFVfmHmKU4GBWEuEN3rQ7Uog3 JbGyKrUoP76oNCe1+BCjNAeLkjhv757VkUIC6YklqdmpqQWpRTBZJg5OqQbG9p8p0t8bvvMI n9Vdv1pwgu22y0FtIvt+uNQLzTh/7aSHd2mJ1zUBxop2hnsmQhpfGEUO21596aaT6nTdI+zR HMk5QhN7Txo+WM+VEnVCuaB6m6qW3Nn99Z+brD55blfSWTvN7fo60xPLDbf+ny4QNO138F5D TtP5kjE+bTuCl041apmexn9ViaU4I9FQi7moOBEAFxepRgkCAAA= X-CMS-MailID: 20170915110514eucas1p207463649130d3a9522a50c292b0d2521 X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-CMS-RootMailID: 20170915110514eucas1p207463649130d3a9522a50c292b0d2521 X-RootMTR: 20170915110514eucas1p207463649130d3a9522a50c292b0d2521 References: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org add_device is a bit more suitable for establishing runtime PM links than the xlate callback. This change also makes it possible to implement proper cleanup - in remove_device callback. Signed-off-by: Marek Szyprowski --- drivers/iommu/exynos-iommu.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index f596fcc32898..91c548d49b92 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -263,6 +263,7 @@ struct exynos_iommu_domain { struct sysmmu_drvdata { struct device *sysmmu; /* SYSMMU controller device */ struct device *master; /* master device (owner) */ + struct device_link *link; /* runtime PM link to master */ void __iomem *sfrbase; /* our registers */ struct clk *clk; /* SYSMMU's clock */ struct clk *aclk; /* SYSMMU's aclk clock */ @@ -1250,6 +1251,8 @@ static struct iommu_group *get_device_iommu_group(struct device *dev) static int exynos_iommu_add_device(struct device *dev) { + struct exynos_iommu_owner *owner = dev->archdata.iommu; + struct sysmmu_drvdata *data; struct iommu_group *group; if (!has_sysmmu(dev)) @@ -1260,6 +1263,15 @@ static int exynos_iommu_add_device(struct device *dev) if (IS_ERR(group)) return PTR_ERR(group); + list_for_each_entry(data, &owner->controllers, owner_node) { + /* + * SYSMMU will be runtime activated via device link + * (dependency) to its master device, so there are no + * direct calls to pm_runtime_get/put in this driver. + */ + data->link = device_link_add(dev, data->sysmmu, + DL_FLAG_PM_RUNTIME); + } iommu_group_put(group); return 0; @@ -1268,6 +1280,7 @@ static int exynos_iommu_add_device(struct device *dev) static void exynos_iommu_remove_device(struct device *dev) { struct exynos_iommu_owner *owner = dev->archdata.iommu; + struct sysmmu_drvdata *data; if (!has_sysmmu(dev)) return; @@ -1283,6 +1296,9 @@ static void exynos_iommu_remove_device(struct device *dev) } } iommu_group_remove_device(dev); + + list_for_each_entry(data, &owner->controllers, owner_node) + device_link_del(data->link); } static int exynos_iommu_of_xlate(struct device *dev, @@ -1316,13 +1332,6 @@ static int exynos_iommu_of_xlate(struct device *dev, list_add_tail(&data->owner_node, &owner->controllers); data->master = dev; - /* - * SYSMMU will be runtime activated via device link (dependency) to its - * master device, so there are no direct calls to pm_runtime_get/put - * in this driver. - */ - device_link_add(dev, data->sysmmu, DL_FLAG_PM_RUNTIME); - return 0; }