From patchwork Mon Mar 5 08:57:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10258437 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CD5D36037E for ; Mon, 5 Mar 2018 08:58:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAE2028997 for ; Mon, 5 Mar 2018 08:58:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE5A62899D; Mon, 5 Mar 2018 08:58:33 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1A1D628997 for ; Mon, 5 Mar 2018 08:58:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-reply-to:Message-id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Ld4SvPvVymOQZI1UKvY7j7v5a23c3heKSWAywYiLK04=; b=VgFHFYF9yldsac/GhSJN8Qbb7F 5kuyvi1c9VIxoG1TmqRYstdPvaznJU+NKklEmBRV/K9FbHZ5Rexim0ocXhXy/LQuQL14S5WoCzgQN Z73usF2kD2M4bJrr8BqEEOiD3w52r4LASWdU89GOtSyxncwxX7N1aDC14+MgPvp5+M4P02nCY/Tof OMnqSrbgfxyOoYaAt3GFlQCFsBm/fbAoasQ75st9Sa8ei70reEUPlOAF8ie6FOYWt2ikYHQ89uZsv 0KUiajbHZEgtj/GIRmtxM14ZxYXzkwE+h8RSAABj1HEYZ2uS+peezT6T7B2mZGYhpewMbWCWqChEL VbJmmIhQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eslwz-0004as-Ui; Mon, 05 Mar 2018 08:58:29 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eslwv-0004Y0-Ca for linux-rockchip@lists.infradead.org; Mon, 05 Mar 2018 08:58:27 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180305085807euoutp0165e6ec3b1d50ca804489aa97fbcb5758~Y_nyaO_bQ2387723877euoutp010; Mon, 5 Mar 2018 08:58:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180305085807euoutp0165e6ec3b1d50ca804489aa97fbcb5758~Y_nyaO_bQ2387723877euoutp010 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1520240287; bh=57KaNWJ6guqoQmLx4kMXs7dxo6OYcCRPNcq4/6Gu90s=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=cdu3tbCF1YiOkS1tb6V5sMiGN4skt9NC4jQHWro423s53qoWWLN+4JjsCCYip+c/w qjDtM7l4KAHRI2s1WV2nYNlP+8KUhufrQ8GbdMXjz8kxWs7PDH4Dq5I4qhwC5ki4tt 2KauM69ws9zdjKAXMZCICHOO9XL1p5BSRolF71Tw= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180305085806eucas1p174d39e8acaf9941cac09d7ff3869bbd9~Y_nxlvKuw0637906379eucas1p1J; Mon, 5 Mar 2018 08:58:06 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 35.F8.10409.E960D9A5; Mon, 5 Mar 2018 08:58:06 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180305085805eucas1p23b768fec0ab88387084b7b6bfc7c7b53~Y_nwyv_yI2292322923eucas1p26; Mon, 5 Mar 2018 08:58:05 +0000 (GMT) X-AuditID: cbfec7f5-f95739c0000028a9-76-5a9d069ee833 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 6E.E1.04178.D960D9A5; Mon, 5 Mar 2018 08:58:05 +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 <0P5400MEY0WMAI90@eusync1.samsung.com>; Mon, 05 Mar 2018 08:58:05 +0000 (GMT) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-rockchip@lists.infradead.org Subject: [PATCH 2/3] drm/bridge: analogix_dp: Postpone enabling runtime power management Date: Mon, 05 Mar 2018 09:57:40 +0100 Message-id: <20180305085741.18896-3-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.15.0 In-reply-to: <20180305085741.18896-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSa0hTYRjHfc9tZ9bq5djlxZbJspKglhn4RhcK+nC+lBLUh9Ft5XFJc9aO 0wxsp9KaK+cFJPOWlYmIeccblrW0QRfFtAv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/9VLbBY/d81jsWi7LuYg7DG74SKLx+W+XiaPHXeXMHrs nHWX3WN2x0xWj/vdx5k8Ni+p9/g7az+LR9+WVYwe26/NY/b4vEkugDuKyyYlNSezLLVI3y6B K+PFphXMBT0aFZcnHGBtYPyv1MXIySEhYCLRcOs9cxcjF4eQwBJGiSc3rzFCOE1MEo/3/mEH qWITMJToetvFBmKLCORILP4+HcxmFtjKKvH3YxCILSwQJbG7rY8VxGYRUJVYtaaRBcTmFbCV uPL4NRPENnmg3p1gvZwCdhJzFh5jBrGFgGruPb7HPIGRZwEjwypGkdTS4tz03GJDveLE3OLS vHS95PzcTYzAUN927OfmHYyXNgYfYhTgYFTi4RUonBMlxJpYVlyZe4hRgoNZSYS37DNQiDcl sbIqtSg/vqg0J7X4EKM0B4uSOO95g8ooIYH0xJLU7NTUgtQimCwTB6dUA6P9j/+CiVapUz4f OKWVZ3gxI7WkYPGu3/1V53f/spiotWfBPpbVi+e4neOwrQxy+tsruePusepsMReB3Wf6/tdp P1/+uKdOZaW5paD5f+njhf5/Ex8VtMf6aGlrBdY6ZInxVH/ivcEU8GZBwIaH9wSqknxX2jxa fLHq6qvaHXtPJXnXH9CwUFZiKc5INNRiLipOBAA3IfzPcQIAAA== X-CMS-MailID: 20180305085805eucas1p23b768fec0ab88387084b7b6bfc7c7b53 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180305085805eucas1p23b768fec0ab88387084b7b6bfc7c7b53 X-RootMTR: 20180305085805eucas1p23b768fec0ab88387084b7b6bfc7c7b53 References: <20180305085741.18896-1-m.szyprowski@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180305_005825_776168_E8C66C72 X-CRM114-Status: GOOD ( 13.57 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Douglas Anderson , Archit Taneja , Thierry Escande , =?UTF-8?q?Heiko=20St=C3=BCbner?= , Lin Huang , Bartlomiej Zolnierkiewicz , Sandy Huang , Tomasz Figa , Andrzej Hajda , Thierry Reding , Sean Paul , Laurent Pinchart , Enric Balletbo i Serra , Haixia Shi , Zain Wang , Marek Szyprowski MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Enabling runtime power management early in analogix_dp_bind() causes following kernel NULL pointer dereference: Unable to handle kernel NULL pointer dereference at virtual address 000007d8 pgd = 28ffa2e4 [000007d8] *pgd=00000000 Internal error: Oops: 5 [#1] PREEMPT SMP ARM Modules linked in: CPU: 6 PID: 69 Comm: kworker/6:1 Not tainted 4.16.0-rc1-00062-ge25751974ba8 #3622 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) Workqueue: events deferred_probe_work_func PC is at analogix_dp_resume+0x8/0xc0 LR is at pm_generic_runtime_resume+0x2c/0x38 pc : [] lr : [] psr: a0000113 sp : ee13fbd8 ip : 0000001a fp : 00000001 r10: ee0eb080 r9 : c0552bd8 r8 : c0fb1d98 r7 : eebb1010 r6 : eeae9808 r5 : 00000000 r4 : d4850415 r3 : ee0ed010 r2 : b2d05e00 r1 : 00000000 r0 : 00000000 Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none Control: 10c5387d Table: 2000406a DAC: 00000051 Process kworker/6:1 (pid: 69, stack limit = 0x913205b4) Stack: (0xee13fbd8 to 0xee140000) ... [] (analogix_dp_resume) from [] (pm_generic_runtime_resume+0x2c/0x38) [] (pm_generic_runtime_resume) from [] (__genpd_runtime_resume+0x2c/0x8c) [] (__genpd_runtime_resume) from [] (genpd_runtime_resume+0x14c/0x258) [] (genpd_runtime_resume) from [] (__rpm_callback+0x134/0x214) [] (__rpm_callback) from [] (rpm_callback+0x20/0x80) [] (rpm_callback) from [] (rpm_resume+0x3a0/0x734) [] (rpm_resume) from [] (__pm_runtime_resume+0x64/0x9c) [] (__pm_runtime_resume) from [] (__device_attach+0x8c/0x134) [] (__device_attach) from [] (bus_probe_device+0x88/0x90) [] (bus_probe_device) from [] (device_add+0x3a8/0x580) [] (device_add) from [] (i2c_register_adapter+0xd4/0x3ec) [] (i2c_register_adapter) from [] (analogix_dp_bind+0x2a0/0x410) [] (analogix_dp_bind) from [] (exynos_dp_bind+0x9c/0x12c) [] (exynos_dp_bind) from [] (component_bind_all+0xfc/0x258) [] (component_bind_all) from [] (exynos_drm_bind+0x15c/0x28c) [] (exynos_drm_bind) from [] (try_to_bring_up_master+0x1b8/0x29c) [] (try_to_bring_up_master) from [] (component_add+0xa0/0x170) [] (component_add) from [] (exynos_dp_probe+0x64/0xb8) [] (exynos_dp_probe) from [] (platform_drv_probe+0x50/0xb0) [] (platform_drv_probe) from [] (driver_probe_device+0x2b8/0x4a0) [] (driver_probe_device) from [] (bus_for_each_drv+0x44/0x8c) [] (bus_for_each_drv) from [] (__device_attach+0xa0/0x134) [] (__device_attach) from [] (bus_probe_device+0x88/0x90) [] (bus_probe_device) from [] (deferred_probe_work_func+0x3c/0x168) [] (deferred_probe_work_func) from [] (process_one_work+0x1d0/0x7bc) [] (process_one_work) from [] (worker_thread+0x34/0x4dc) [] (worker_thread) from [] (kthread+0x128/0x164) [] (kthread) from [] (ret_from_fork+0x14/0x20) Exception stack(0xee13ffb0 to 0xee13fff8) ffa0: 00000000 00000000 00000000 00000000 ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 Code: e2800e37 eafee601 e92d4070 e1a05000 (e59067d8) ---[ end trace bf6046013df7cab2 ]--- This oops happens, because analogix_dp_bind() calls drm_dp_aux_register() which registers i2c adapter. I2C core tries to runtime get i2c host device during registration. This ends in analogix_dp_resume(), but dp context is NULL there. dp context is set in exynos_dp_bind() after executing analogix_dp_bind(). Fix this issue by postponing enabling runtime power management after drm_dp_aux_register(). Signed-off-by: Marek Szyprowski Tested-by: Heiko Stuebner Reviewed-by: Heiko Stuebner --- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 8475749baae5..b391d149db91 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -1376,8 +1376,6 @@ analogix_dp_bind(struct device *dev, struct drm_device *drm_dev, return ERR_PTR(-ENODEV); } - pm_runtime_enable(dev); - ret = devm_request_threaded_irq(&pdev->dev, dp->irq, analogix_dp_hardirq, analogix_dp_irq_thread, @@ -1397,7 +1395,9 @@ analogix_dp_bind(struct device *dev, struct drm_device *drm_dev, ret = drm_dp_aux_register(&dp->aux); if (ret) - goto err_disable_pm_runtime; + return ERR_PTR(ret); + + pm_runtime_enable(dev); ret = analogix_dp_create_bridge(drm_dev, dp); if (ret) {