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: 130623 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp2451846lja; Mon, 5 Mar 2018 00:58:12 -0800 (PST) X-Google-Smtp-Source: AG47ELtD5lH1xoI9MSLaU2uBFbTiDgIfYHNsIdOoFdjwSd9OPhS6D598kHjt5TXgVXkNRbv8Zl8w X-Received: by 2002:a17:902:4545:: with SMTP id m63-v6mr12174970pld.15.1520240292003; Mon, 05 Mar 2018 00:58:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520240291; cv=none; d=google.com; s=arc-20160816; b=vSAxn5wp24WlFnrimh2ESg4vCHJ8chlk+U8gCPwJO2SAwtCmOD14FGCrAT8K2q1dkw qzA25CMsstpcMML5R06XH66g3XepUV5IFR1rmms/bARCO61X1+oJsjCYr1wABVH9QlfL 2DqRhufWwXk2KAZdhx6rNrZC7tZyuioDg8YrW37YZrKx8k2FHUxY5zjFG2/Q9LgsTyZa H6JuOy/7pHzMGtMlvrt/BWGfd6biU53/g2Z2VA5Skp8uHAq9bqveF2nGyJrvyKgcz2Ds lf1NddgkoyFNXeVStZBsz+y7iMjnGr+IqznpszYWRgIW02KoaLSYBSATUvSOhfOCP9tq CfKg== 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:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=TCfDfKXAUe1M60KIDuUEXmCCWrPloPcrVp0oImGqo5U=; b=AsJg+EGaQrPKfr8bDXaYemNpOGfSyHXSzcBIa+7xICRndKEsodEr/tZ3H1Sy6T4BYG shQnpjQSTkWBuzO2uhwiBOj7UEhd7wUReMx8jfJX5WonkcFjqDgwqJmwm9UOZFoAIocY pc40h1L4CcSmGBUW3uS0S/LeLZVtUVaByrJw6vqqg7OXUwnJp6cqp5ppI+Mzm4olztvG el26gGpOD8sk/s6TDQpYuz7DUpfCFoUA8n6o9yrMur5IN0ItizpBVuyMMCNA2GirNyzM uILolFETYlW77tb3TgUNf0XlamiBx6ee2wWz+mpmyzx4XBt8E2Aeq6C3xx2lkqAKK+Hk 3JOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=cdu3tbCF; 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 f1-v6si8947909pld.744.2018.03.05.00.58.11; Mon, 05 Mar 2018 00:58:11 -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=cdu3tbCF; 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 S933484AbeCEI6L (ORCPT + 3 others); Mon, 5 Mar 2018 03:58:11 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:39589 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933491AbeCEI6J (ORCPT ); Mon, 5 Mar 2018 03:58:09 -0500 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 Cc: Marek Szyprowski , Archit Taneja , =?utf-8?q?Heiko_St=C3=BCbner?= , Thierry Escande , Tomasz Figa , Sean Paul , Bartlomiej Zolnierkiewicz , Laurent Pinchart , Thierry Reding , Sandy Huang , Enric Balletbo i Serra , Andrzej Hajda , Douglas Anderson , Haixia Shi , Zain Wang , Lin Huang 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+cFJPOWlYmIeccblrW0QRfFtAvKMlS6qVkOUyFnuq1v/+f5/57nzwMPS3IZdCAb a0gQjAatXsX4U40vZru2FDNFmm33nSzur+qi8VXLOI1r86pp/KbsGYP7piYYXDlgB3h+aJTG RTkpeKbmJYlvNAwROD27VIYnP8+TOK/7CYEfdThl2FnzBmBXmpvBme/eMni2tZjC1z+s2hfA F0g9FN9ryyD4Zmcp4FvynTK+wHKH5gdvOgi+vtTMz+W3U7ytoQLwTe+LSd5VFxS1ROO/O1rQ xyYKRvXeU/5nv9WVk+dvhV7szXpKS2BeZQVyFsEdqL51lrACf5aD5QC1jUvAW7gASmu7S/+n pP4J0muUAdRZ9thHSQRy/HlHLlIMDEPWcSuzqFdAPZq0jHkgEtbS6NFAC1g0AqAGtbvzPBAF N6CKyivUolbAPahveJTwxq1DD6ZbPIwc7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ooIYH0xJLU7NTUgtQimCwTB6dUA6P9j/+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> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org 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 --- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 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 Tested-by: Heiko Stuebner Reviewed-by: Heiko Stuebner 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) {