From patchwork Thu Oct 20 07:22:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 78420 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp639062qge; Thu, 20 Oct 2016 00:23:53 -0700 (PDT) X-Received: by 10.98.100.207 with SMTP id y198mr18869411pfb.49.1476948233517; Thu, 20 Oct 2016 00:23:53 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yk1si36569458pab.231.2016.10.20.00.23.52; Thu, 20 Oct 2016 00:23:53 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756064AbcJTHXt (ORCPT + 4 others); Thu, 20 Oct 2016 03:23:49 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:20695 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754784AbcJTHXl (ORCPT ); Thu, 20 Oct 2016 03:23:41 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OFC0013Q4JDNM20@mailout4.w1.samsung.com>; Thu, 20 Oct 2016 08:23:37 +0100 (BST) Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20161020072337eucas1p218b6e6cd2fcb3bf019092bbb579dc766~-LJQOTzTP0144201442eucas1p2U; Thu, 20 Oct 2016 07:23:37 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges4.samsung.com (EUCPMTA) with SMTP id AD.FC.28332.8F078085; Thu, 20 Oct 2016 08:23:36 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20161020072336eucas1p24a2b020f69b6ae1f55e1760e6e0e94f9~-LJPPLeia2969329693eucas1p22; Thu, 20 Oct 2016 07:23:36 +0000 (GMT) X-AuditID: cbfec7f4-f791c6d000006eac-d5-580870f8b966 Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id A3.3B.07726.7E078085; Thu, 20 Oct 2016 08:23:19 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OFC0074C4J1JF30@eusync2.samsung.com>; Thu, 20 Oct 2016 08:23:36 +0100 (BST) From: Marek Szyprowski To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Joerg Roedel , Inki Dae , Kukjin Kim , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , "Rafael J. Wysocki" , Mark Brown , "Luis R. Rodriguez" , Greg Kroah-Hartman , Tomeu Vizoso , Lukas Wunner , Kevin Hilman , Tobias Jakobi , Tomasz Figa Subject: [PATCH v5 7/7] iommu/exynos: Use device dependency links to control runtime pm Date: Thu, 20 Oct 2016 09:22:53 +0200 Message-id: <1476948173-21093-8-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1476948173-21093-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSW0gUcRTG+8/Mzoyrk9NqdfIWLPjSxTIE/2mZhdEEPgglai+51aTSrsqO VoqQl/KysSpKKKklaVmmmZu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aDHj/D4mixfP pS3WHrnLbnFjwlNGizOnL7FatK3+wGqxatcfRou+tZfYHIQ9nhycx+Sx4+4SRo+ds+6ye2xa 1cnmsX/uGnaPyTeWM3r8O8buseVqO4tH35ZVjB6fN8l5zGjfxhrAHeVmk5GamJJapJCal5yf kpmXbqsUGuKma6GkkJeYm2qrFKHrGxKkpFCWmFMK5BkZoAEH5wD3YCV9uwS3jPZnp5kKdvFX 9J7+xN7A+JGni5GTQ0LAROLsmytsELaYxIV764FsLg4hgSWMEufXfYJympgk/n+fywpSxSZg KNH1tgssISLQyCixbetEdhCHWeAZi8SCH9vAZgkLREps2tXCBGKzCKhKHOpfARbnFfCQaL92 D2qfnMTJY5PBpnIKeErsXtPLDGILAdW837iOcQIj7wJGhlWMIqmlxbnpucWGesWJucWleel6 yfm5mxiB8bft2M/NOxgvbQw+xCjAwajEw5txjj1CiDWxrLgy9xCjBAezkgjvsRyOCCHelMTK qtSi/Pii0pzU4kOMpkBHTWSWEk3OB6aGvJJ4QxNDc0tDI2MLC3MjIyVx3pIPV8KFBNITS1Kz U1MLUotg+pg4OKUaGLsPRduanZ5UlOfuUXrkeMC3Vx/37vKxsLaYvDR/nXznnld+s7PcjISK 3xtLyjIle3Z+DZKsWvIgVcpARdrdzOuMed3scwe28E/N0vC/aBGy582yaY+ki9JWPmece2uO a/JMTmbbw67Sa8IfrX3vHjOzqPTha2Uzm9W523snGeZ77ehK6LeOV2Ipzkg01GIuKk4EAPR7 oJfVAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20161020072336eucas1p24a2b020f69b6ae1f55e1760e6e0e94f9 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRs=?= =?UTF-8?B?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRtT?= =?UTF-8?B?YW1zdW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20161020072336eucas1p24a2b020f69b6ae1f55e1760e6e0e94f9 X-RootMTR: 20161020072336eucas1p24a2b020f69b6ae1f55e1760e6e0e94f9 References: <1476948173-21093-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org This patch uses recently introduced device dependency links to track the runtime pm state of the master's device. This way each SYSMMU controller is set to runtime active only when its master's device is active and can restore or save its state instead of being activated all the time when attached to the given master device. This way SYSMMU controllers no longer prevents respective power domains to be turned off when master's device is not being used. Signed-off-by: Marek Szyprowski --- drivers/iommu/exynos-iommu.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 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 5e6d7bbf9b70..59b4f2ce4f5f 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -781,10 +781,6 @@ static void exynos_iommu_detach_device(struct iommu_domain *iommu_domain, if (!has_sysmmu(dev) || owner->domain != iommu_domain) return; - list_for_each_entry(data, &owner->controllers, owner_node) { - pm_runtime_put_sync(data->sysmmu); - } - mutex_lock(&owner->rpm_lock); list_for_each_entry(data, &owner->controllers, owner_node) { @@ -848,10 +844,6 @@ static int exynos_iommu_attach_device(struct iommu_domain *iommu_domain, mutex_unlock(&owner->rpm_lock); - list_for_each_entry(data, &owner->controllers, owner_node) { - pm_runtime_get_sync(data->sysmmu); - } - dev_dbg(dev, "%s: Attached IOMMU with pgtable %pa\n", __func__, &pagetable); @@ -1232,6 +1224,14 @@ 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; }