From patchwork Tue Mar 6 14:33:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 130809 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp4009477lja; Tue, 6 Mar 2018 06:33:30 -0800 (PST) X-Google-Smtp-Source: AG47ELviFa+JlRpx29R9BDSu6pdcu2fIYqOLreYKFEVRx5e9o1cIkTOLDvXsOjzW4ZIVJUDRxoW3 X-Received: by 2002:a17:902:7b92:: with SMTP id w18-v6mr16537882pll.159.1520346810260; Tue, 06 Mar 2018 06:33:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520346810; cv=none; d=google.com; s=arc-20160816; b=VKfeNj2ZVdff+FNQUBS4MCP0nSP+cogTjU9vEgoyq4llaL8u3vq/b9fbArxefqrlxW SUu7TRJsnUbCr1H2vIqDOXHXBvNclYgPbLXwAgVK86ZVKMsFvIsQ6RD53cXxWXHKgx17 1AoKXORpZUDLUXJ6vY+7hqdkXXI0Jn9RGkPzpoVXy7K8YwG+BrU6P5N7G1I3gBJzEIln PGIQ9tRd3DVT5rWLl6IvIXVJoLsaz6VCWDBcKEVE70DMyLpyq6Ci8pq0dELDYHESGRkz FethV2ayC3CL07DsBZRwGCFg2Oakooadh7wpoKoOn3unJ4Cc6f7VfoJphU9G0JP/4fj1 p1bw== 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:dkim-signature:dkim-filter :arc-authentication-results; bh=RPP6C8GEwPIMfGU/wMmx+cTYJHkADhamQlBDIoHKDVQ=; b=Mk88Vptk+IdvJIYIXxUQsuFwbLZtba57kinOCyuQiMx5kNfP3QLU3xK9KocjOm2AaR IRllyzYqRFgmwcY/Fb/zkhrmq1jQETRdWIUkZIULFP5H5GOsaOOY4HQmglQ0NuIWVriG /S9IDjI0I2IZiW0Rq3GZ1Ib0DGUxy1jcy1D6Wr6JBxIqkZvsZWcFzEx9SivyYMUx0b1c 2fYkcEWB7j/Pdxk2msJGAh7gLDBnZXfZoY+iW/oNd8J9l094fil9ZvYgF3uENfeKau0N dFqPYGDxM5PytF7H0VxDS1LtSfKq0KXlPy3gwCQ5M69t01pn9ZYEgtW+Z+aPIQ1Y065o ObmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=qy9P1fVb; 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 j8-v6si11016093plk.774.2018.03.06.06.33.30; Tue, 06 Mar 2018 06:33:30 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=qy9P1fVb; 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 S1753773AbeCFOd2 (ORCPT + 3 others); Tue, 6 Mar 2018 09:33:28 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:46318 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753682AbeCFOd0 (ORCPT ); Tue, 6 Mar 2018 09:33:26 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180306143324euoutp0127c382234a22a473f929ac7707e7bf30~ZW10WMM7R0522505225euoutp01Q; Tue, 6 Mar 2018 14:33:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180306143324euoutp0127c382234a22a473f929ac7707e7bf30~ZW10WMM7R0522505225euoutp01Q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1520346804; bh=6xibXLdbRhLsuLO5+jGqOoyM2tYv3mPFpbp0kfuGR4o=; h=From:To:Cc:Subject:Date:References:From; b=qy9P1fVbYE3wA5BJvNfa7wkp2cB4xKblibp0ssy3yVPG4KiIJ6MTgRmGNqL45+bjV uf943zGHTyzD7wl/+UunHPWRIDYmFFqfX6IYIC2llzndT0cqOXh5BHEJ1apDECtUMG 6DVYNHh7JR748cKxosNFG5cfxLSIuSR5Q25296OY= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180306143323eucas1p108a0bcb7af5002724ead8a540811fbac~ZW1zf_lIj2357523575eucas1p1I; Tue, 6 Mar 2018 14:33:23 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id DB.DB.05700.3B6AE9A5; Tue, 6 Mar 2018 14:33:23 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180306143322eucas1p258b0dfce5af79f19dd36fbb9b4013d5a~ZW1yvTvxC0851008510eucas1p2U; Tue, 6 Mar 2018 14:33:22 +0000 (GMT) X-AuditID: cbfec7f2-1c1ff70000011644-2d-5a9ea6b3e13c Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id D4.91.04183.2B6AE9A5; Tue, 6 Mar 2018 14:33:22 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P5600MGHB3ETD00@eusync1.samsung.com>; Tue, 06 Mar 2018 14:33:22 +0000 (GMT) From: Marek Szyprowski To: linux-clk@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Chanwoo Choi , Inki Dae , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH v3 0/6] Exynos5: cleanup clocks handling in power domains Date: Tue, 06 Mar 2018 15:33:06 +0100 Message-id: <20180306143312.21035-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.15.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrMIsWRmVeSWpSXmKPExsWy7djP87qbl82LMpj/V9hi44z1rBbXvzxn tZh0fwKLxfnzG9gtPvbcY7WYcX4fk8XaI3fZLQ6/aWd14PDYtKqTzaNvyypGj8+b5AKYo7hs UlJzMstSi/TtErgyrv88w1Sw3a5i7Um5BsZewy5GTg4JAROJnc9XsnUxcnEICaxglFhw/jQ7 hPOZUeL8sYdMMFVdS7tYIRLLGCUaGj5DVTUwSXxbMYsFpIpNwFCi620XG4gtIuAg8fnTa0aQ ImaBNiaJswf2g40SFvCUuL7/EHMXIwcHi4CqxNJFiSBhXgFbif2/3zFDbJOXWPx9J9hNEgJP WSVWX18KlXCRePDnEZQtLPHq+BZ2CFtG4vLkbhYIu16i7/sRJojmHkaJvS1ToX6wljh8/CIr iM0swCcxadt0sCMkBHglOtqEIEo8JH5s2wRV7ijRNPEy2HwhgViJ0+8XME1glFzAyLCKUTy1 tDg3PbXYMC+1XK84Mbe4NC9dLzk/dxMjMOpO/zv+aQfj10tJhxgFOBiVeHg5vOdGCbEmlhVX 5h5ilOBgVhLhjdCfFyXEm5JYWZValB9fVJqTWnyIUZqDRUmcN06jLkpIID2xJDU7NbUgtQgm y8TBKdXAmMOgEHVHdNeKPOP0Dtl0r4CireV9SpOjVc6pTFnc4Bpp7BYVtSHC793G21lVP3pP rbsd8fP53vPKgrsbd/87YbJbfXVfsX+LjMOybbXpnpH811d3z1BXi1H0PNeftXuBQ+TeG9G2 cp/OTPV1rEw7X7XnXwmH/7SqIBaLqJORfSeepeXvYFdWYinOSDTUYi4qTgQApSUpFLYCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJJMWRmVeSWpSXmKPExsVy+t/xy7qbls2LMng1Qddi44z1rBbXvzxn tZh0fwKLxfnzG9gtPvbcY7WYcX4fk8XaI3fZLQ6/aWd14PDYtKqTzaNvyypGj8+b5AKYo7hs UlJzMstSi/TtErgyrv88w1Sw3a5i7Um5BsZewy5GTg4JAROJrqVdrF2MXBxCAksYJY7O+M8G 4TQxSdz++okRpIpNwFCi620XG4gtIuAg8fnTa0aQImaBDiaJPXsfgiWEBTwlru8/xNzFyMHB IqAqsXRRIkiYV8BWYv/vd8wQ2+QlFn/fyTaBkWsBI8MqRpHU0uLc9NxiI73ixNzi0rx0veT8 3E2MwADYduznlh2MXe+CDzEKcDAq8fBu8JgbJcSaWFZcmXuIUYKDWUmEN0J/XpQQb0piZVVq UX58UWlOavEhRmkOFiVx3vMGlVFCAumJJanZqakFqUUwWSYOTqkGRrvtb5byfplmwNS+9u39 R+L7qlfmGPOxP2OP/vR3WrAyy3WzxWd3B324mX2q5rm148+oxD/FvC6WdSnn0wIPzJf28mbf abWoL3D+hf/bTM5O5bnCWdgb8linrECjOs4hNDx7lsPBuXZ25vt2TNkvO/ck0ysWMbE6FsuP 1wOnljXvWhuz/3PsASWW4oxEQy3mouJEAFGnnAr8AQAA X-CMS-MailID: 20180306143322eucas1p258b0dfce5af79f19dd36fbb9b4013d5a X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180306143322eucas1p258b0dfce5af79f19dd36fbb9b4013d5a X-RootMTR: 20180306143322eucas1p258b0dfce5af79f19dd36fbb9b4013d5a References: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Hello, This patchset performs cleanup of the clock handling during Exynos power domain power on/off sequences. This has been achieved by moving all clock related operations from Exynos power domain driver to respective Exynos clock controller drivers. Such change is possible after introducinng runtime power-management in common clock framework. Another nice result of this cleanup is removal of deplock warning reported in the following thread (the 'second issue'): https://www.spinics.net/lists/linux-samsung-soc/msg61766.html [ 5.932966] ====================================================== [ 5.937199] usb 5-1: new high-speed USB device number 2 using xhci-hcd [ 5.939073] WARNING: possible circular locking dependency detected [ 5.939110] 4.15.0-rc8-next-20180116 #1121 Tainted: G W [ 5.958143] ------------------------------------------------------ [ 5.964299] kworker/0:1/59 is trying to acquire lock: [ 5.969304] (&genpd->mlock){+.+.}, at: [<6abc3872>] genpd_runtime_resume+0x104/0x260 [ 5.977155] [ 5.977155] but task is already holding lock: [ 5.982926] (prepare_lock){+.+.}, at: [<74cef905>] clk_prepare_lock+0x10/0xf8 [ 5.990143] [ 5.990143] which lock already depends on the new lock. [ 5.990143] [ 5.998309] [ 5.998309] the existing dependency chain (in reverse order) is: [ 6.005739] [ 6.005739] -> #1 (prepare_lock){+.+.}: [ 6.011042] mutex_lock_nested+0x1c/0x24 [ 6.015419] clk_prepare_lock+0x50/0xf8 [ 6.019755] clk_unprepare+0x1c/0x2c [ 6.023841] exynos_pd_power+0x1a8/0x1e4 [ 6.028246] genpd_power_off+0x160/0x274 [ 6.032664] genpd_power_off_work_fn+0x2c/0x40 [ 6.037630] process_one_work+0x2d4/0x8f0 [ 6.042104] worker_thread+0x38/0x584 [ 6.046268] kthread+0x138/0x168 [ 6.049981] ret_from_fork+0x14/0x20 [ 6.054044] (null) [ 6.056794] [ 6.056794] -> #0 (&genpd->mlock){+.+.}: [ 6.062238] __mutex_lock+0x7c/0xa68 [ 6.066278] mutex_lock_nested+0x1c/0x24 [ 6.070703] genpd_runtime_resume+0x104/0x260 [ 6.075557] __rpm_callback+0xc0/0x21c [ 6.079792] rpm_callback+0x20/0x80 [ 6.083774] rpm_resume+0x558/0x7dc [ 6.087762] __pm_runtime_resume+0x60/0x98 [ 6.092367] clk_core_prepare+0x44/0x490 [ 6.096783] clk_prepare+0x20/0x30 [ 6.100674] amba_get_enable_pclk+0x2c/0x60 [ 6.105363] amba_device_try_add+0x8c/0x20c [ 6.110041] amba_deferred_retry_func+0x40/0xbc [ 6.115080] process_one_work+0x2d4/0x8f0 [ 6.119569] worker_thread+0x38/0x584 [ 6.123727] kthread+0x138/0x168 [ 6.127444] ret_from_fork+0x14/0x20 [ 6.131510] (null) [ 6.134263] [ 6.134263] other info that might help us debug this: [ 6.134263] [ 6.142328] Possible unsafe locking scenario: [ 6.142328] [ 6.148178] CPU0 CPU1 [ 6.152656] ---- ---- [ 6.157160] lock(prepare_lock); [ 6.160439] lock(&genpd->mlock); [ 6.166365] lock(prepare_lock); [ 6.172168] lock(&genpd->mlock); [ 6.175517] [ 6.175517] *** DEADLOCK *** [ 6.175517] [ 6.181475] 4 locks held by kworker/0:1/59: [ 6.185580] #0: ((wq_completion)"events"){+.+.}, at: [] process_one_work+0x210/0x8f0 [ 6.194407] #1: ((deferred_retry_work).work){+.+.}, at: [] process_one_work+0x210/0x8f0 [ 6.203422] #2: (deferred_devices_lock){+.+.}, at: [<3e940c1f>] amba_deferred_retry_func+0x1c/0xbc [ 6.212522] #3: (prepare_lock){+.+.}, at: [<74cef905>] clk_prepare_lock+0x10/0xf8 [ 6.220128] [ 6.220128] stack backtrace: [ 6.224438] CPU: 0 PID: 59 Comm: kworker/0:1 Tainted: G W 4.15.0-rc8-next-20180116 #1121 [ 6.233757] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [ 6.239791] Workqueue: events amba_deferred_retry_func [ 6.244929] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [ 6.252670] [] (show_stack) from [] (dump_stack+0x98/0xc4) [ 6.259877] [] (dump_stack) from [] (print_circular_bug.constprop.17+0x210/0x32c) [ 6.269077] [] (print_circular_bug.constprop.17) from [] (__lock_acquire+0x155c/0x1ac8) [ 6.278786] [] (__lock_acquire) from [] (lock_acquire+0xe0/0x2bc) [ 6.286558] [] (lock_acquire) from [] (__mutex_lock+0x7c/0xa68) [ 6.294181] [] (__mutex_lock) from [] (mutex_lock_nested+0x1c/0x24) [ 6.302161] [] (mutex_lock_nested) from [] (genpd_runtime_resume+0x104/0x260) [ 6.311008] [] (genpd_runtime_resume) from [] (__rpm_callback+0xc0/0x21c) [ 6.319484] [] (__rpm_callback) from [] (rpm_callback+0x20/0x80) [ 6.327185] [] (rpm_callback) from [] (rpm_resume+0x558/0x7dc) [ 6.334721] [] (rpm_resume) from [] (__pm_runtime_resume+0x60/0x98) [ 6.342706] [] (__pm_runtime_resume) from [] (clk_core_prepare+0x44/0x490) [ 6.351297] [] (clk_core_prepare) from [] (clk_prepare+0x20/0x30) [ 6.359081] [] (clk_prepare) from [] (amba_get_enable_pclk+0x2c/0x60) [ 6.367229] [] (amba_get_enable_pclk) from [] (amba_device_try_add+0x8c/0x20c) [ 6.376164] [] (amba_device_try_add) from [] (amba_deferred_retry_func+0x40/0xbc) [ 6.385361] [] (amba_deferred_retry_func) from [] (process_one_work+0x2d4/0x8f0) [ 6.394457] [] (process_one_work) from [] (worker_thread+0x38/0x584) [ 6.402497] [] (worker_thread) from [] (kthread+0x138/0x168) [ 6.409852] [] (kthread) from [] (ret_from_fork+0x14/0x20) This patchset affects Exynos5250 and Exynos5420/5422/5800 SoCs. Changes has been tested on Snow Chromebook (Exynos5250), Peach-Pit Chromebook2 (Exynos5420) and Odroid XU3/XU4 (Exynos5422) boards with latest linux-next kernel. If possible I would like to get patches 1-4 merged to current clk-next tree and patches 5-6 queued to next merge cycle. Best regards Marek Szyprowski Samsung R&D Institute Poland Changelog: v3: - simplified some names of the structures and functions as requested by Sylwester Nawrocki v2: - fixed minor style issues pointed by Krzysztof Kozlowski Patch summary: Marek Szyprowski (6): soc: samsung: pm_domains: Add blacklisting clock handling clk: samsung: Add Exynos5 sub-CMU clock driver clk: samsung: exynos5420: Move PD-dependent clocks to Exynos5 sub-CMU driver clk: samsung: exynos5250: Move PD-dependent clocks to Exynos5 sub-CMU driver soc: samsung: pm_domains: Deprecate support for clocks ARM: dts: exynos: Remove obsolete clock properties from power domains .../devicetree/bindings/power/pd-samsung.txt | 20 +-- arch/arm/boot/dts/exynos5250.dtsi | 4 - arch/arm/boot/dts/exynos5420.dtsi | 14 -- drivers/clk/samsung/Makefile | 2 + drivers/clk/samsung/clk-exynos5-subcmu.c | 189 +++++++++++++++++++++ drivers/clk/samsung/clk-exynos5-subcmu.h | 26 +++ drivers/clk/samsung/clk-exynos5250.c | 51 ++++-- drivers/clk/samsung/clk-exynos5420.c | 121 ++++++++++--- drivers/soc/samsung/pm_domains.c | 79 +-------- 9 files changed, 352 insertions(+), 154 deletions(-) create mode 100644 drivers/clk/samsung/clk-exynos5-subcmu.c create mode 100644 drivers/clk/samsung/clk-exynos5-subcmu.h -- 2.15.0 -- 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