From patchwork Thu Jun 4 06:07:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyungwon Hwang X-Patchwork-Id: 6543921 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 16C469F1C1 for ; Thu, 4 Jun 2015 06:07:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DC64320742 for ; Thu, 4 Jun 2015 06:07:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9951E20729 for ; Thu, 4 Jun 2015 06:07:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AD4426EA8F; Wed, 3 Jun 2015 23:07:38 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by gabe.freedesktop.org (Postfix) with ESMTP id BC2BB6EA8E for ; Wed, 3 Jun 2015 23:07:37 -0700 (PDT) Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NPE01OXGP0O3N90@mailout3.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 04 Jun 2015 15:07:36 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.112]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id BA.3C.20564.72BEF655; Thu, 4 Jun 2015 15:07:36 +0900 (KST) X-AuditID: cbfee690-f796f6d000005054-48-556feb27be18 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 12.CB.05312.72BEF655; Thu, 4 Jun 2015 15:07:35 +0900 (KST) Received: from localhost.localdomain ([10.252.82.145]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NPE00IU3P0GP6K0@mmp2.samsung.com>; Thu, 04 Jun 2015 15:07:35 +0900 (KST) From: Hyungwon Hwang To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, inki.dae@samsung.com Subject: [PATCH] drm/exynos: dsi: check whether dsi is enabled before sending data Date: Thu, 04 Jun 2015 15:07:26 +0900 Message-id: <1433398046-4177-1-git-send-email-human.hwang@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBLMWRmVeSWpSXmKPExsWyRsSkQFfjdX6owb4PjBbXvzxntbjy9T2b xdIZfawWk+5PYLF4ce8ii8WM8/uYLGZMfsnmwO5xv/s4k0ffllWMHp83yQUwR3HZpKTmZJal FunbJXBlvJ++lrHgg1TF4U+9rA2MP8S6GDk5JARMJC58fsMIYYtJXLi3nq2LkYtDSGApo8TD l+9YYIomHD/PApGYziix7d1/VgjnB6PEm0+X2UGq2AT0JBZc+wFkc3CICMRJTFheC2IyC5RJ tJ7LAKkQFgiReHukBWwmi4CqxP11q5lAbF4BN4lNj35D7ZKTOHlsMth4CYH3bBJtnW+ZIBoE JL5NPsQCMlNCQFZi0wFmiHpJiYMrbrBMYBRcwMiwilE0tSC5oDgpvchErzgxt7g0L10vOT93 EyMwQE//ezZhB+O9A9aHGAU4GJV4eC2O5YcKsSaWFVfmHmI0BdowkVlKNDkfGAd5JfGGxmZG FqYmpsZG5pZmSuK8r6V+BgsJpCeWpGanphakFsUXleakFh9iZOLglGpglP7/tWVPJNtexQ3B TWcXVSoYb3t58caGmY5xXzZZqjQaBXh9uzyh/0qyFpfP4gn3V6j8zPFZV3a01DI74V84z/+v IR/PXljvLXKv9FSuVZ9G++rzhU82PeQwEttjmR7APzcnRVCx9yKD0fYtj+cURvXtU/XkYNJ3 zXU++ObjjAVhn6O6NaZ+UWIpzkg01GIuKk4EACCFSrNLAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpikeLIzCtJLcpLzFFi42I5/e+xoK766/xQg3UrLS2uf3nOanHl63s2 i6Uz+lgtJt2fwGLx4t5FFosZ5/cxWcyY/JLNgd3jfvdxJo++LasYPT5vkgtgjmpgtMlITUxJ LVJIzUvOT8nMS7dV8g6Od443NTMw1DW0tDBXUshLzE21VXLxCdB1y8wB2q6kUJaYUwoUCkgs LlbSt8M0ITTETdcCpjFC1zckCK7HyAANJKxhzHg/fS1jwQepisOfelkbGH+IdTFyckgImEhM OH6eBcIWk7hwbz1bFyMXh5DAdEaJbe/+s0I4Pxgl3ny6zA5SxSagJ7Hg2g8gm4NDRCBOYsLy WhCTWaBMovVcBkiFsECIxNsjLWAzWQRUJe6vW80EYvMKuElsevQbapecxMljk1knMHIvYGRY xSiaWpBcUJyUnmukV5yYW1yal66XnJ+7iREc/s+kdzCuarA4xCjAwajEw2txLD9UiDWxrLgy 9xCjBAezkgiv32mgEG9KYmVValF+fFFpTmrxIUZToO0TmaVEk/OBsZlXEm9obGJmZGlkbmhh ZGyuJM57Mt8nVEggPbEkNTs1tSC1CKaPiYNTqoEx2XNfwkXTRRuaFpolHDEMzUn7arF8yqFy fa1lpWUvzP79Wnbkxhb7qNin99pFCiJXPZ1U7sN24lPfgtcaU6bKiAbfvDnBqGe1df3h/f// 3mUUi7/S4qXpv5FVJrQuYtHzJx/fBYjtbmV6mrHy5nSJfVP+pG9t9ObQ27ZTSkXHs6ggpP/6 OfdJSizFGYmGWsxFxYkA048OEpUCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Cc: cw00.choi@samsung.com, sw0312.kim@samsung.com, Hyungwon Hwang X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP exynos_dsi_host_transfer() can be called through a panel driver while DSI is turning down. It is possible because the function checks only whether DSI is initialized or not, and there is a moment which DSI is set by uninitialized, but DSI is still turning down. To prevent it, DSI must be set by disabled before starting to be turned down, and exynos_dsi_host_transfer() must check whether DSI is enabled or not. Kernel dump: [ 4721.351448] Unhandled fault: synchronous external abort (0x96000210) at 0xffffff800015e018 [ 4721.351809] Internal error: : 96000210 [#1] PREEMPT SMP [ 4721.352031] Modules linked in: [ 4721.352173] CPU: 2 PID: 300 Comm: deviced Tainted: G W 4.0.4-01017-g7964a87 #1 [ 4721.353989] Hardware name: Samsung DRACO board (DT) [ 4721.358852] task: ffffffc0a0b70000 ti: ffffffc0a00ec000 task.ti: ffffffc0a00ec000 [ 4721.366327] PC is at exynos_dsi_enable_lane+0x14/0x5c [ 4721.371353] LR is at exynos_dsi_host_transfer+0x834/0x8d8 [ 4721.376731] pc : [] lr : [] pstate: 60000145 [ 4721.384107] sp : ffffffc0a00efbe0 [ 4721.387405] x29: ffffffc0a00efbe0 x28: ffffffc0a00ec000 [ 4721.392699] x27: ffffffc000968000 x26: 0000000000000040 [ 4721.397994] x25: ffffffc000f74dc0 x24: ffffffc0a00efec8 [ 4721.403290] x23: ffffffc0a4815400 x22: ffffffc0009f2729 [ 4721.408584] x21: ffffffc0a00efcc8 x20: ffffffc0a4a2a848 [ 4721.413879] x19: ffffffc0a4a2a818 x18: 0000000000000004 [ 4721.419173] x17: 0000007faa5cddf0 x16: ffffffc0001a40a8 [ 4721.424469] x15: 0000000000000009 x14: 000000000000000d [ 4721.429762] x13: 6e6e6f63206b726f x12: 0000000000000010 [ 4721.435058] x11: 0101010101010101 x10: 0000000000000000 [ 4721.440353] x9 : 000000000000000a x8 : 8386838282818381 [ 4721.445648] x7 : ffffffc0a201efe8 x6 : 0000000000000000 [ 4721.450943] x5 : 00000000fffffffa x4 : ffffffc0a201f170 [ 4721.456237] x3 : ffffff800015e000 x2 : ffffff800015e018 [ 4721.461531] x1 : 000000000000000f x0 : ffffffc0a4a2a818 [ 4721.466826] [ 4721.468305] Process deviced (pid: 300, stack limit = 0xffffffc0a00ec028) [ 4721.474989] Stack: (0xffffffc0a00efbe0 to 0xffffffc0a00f0000) [ 4721.480720] fbe0: a00efca0 ffffffc0 0042c944 ffffffc0 a0f2d680 ffffffc0 00000024 00000000 [ 4721.488895] fc00: a4b6d000 ffffffc0 009f2729 ffffffc0 a4815400 ffffffc0 a00efec8 ffffffc0 Signed-off-by: Hyungwon Hwang --- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 1cfc4be07..6413339 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -1408,6 +1408,9 @@ static ssize_t exynos_dsi_host_transfer(struct mipi_dsi_host *host, struct exynos_dsi_transfer xfer; int ret; + if (!(dsi->state & DSIM_STATE_ENABLED)) + return -EINVAL; + if (!(dsi->state & DSIM_STATE_INITIALIZED)) { ret = exynos_dsi_init(dsi); if (ret) @@ -1551,9 +1554,10 @@ static void exynos_dsi_disable(struct exynos_dsi *dsi) drm_panel_disable(dsi->panel); exynos_dsi_set_display_enable(dsi, false); drm_panel_unprepare(dsi->panel); - exynos_dsi_poweroff(dsi); dsi->state &= ~DSIM_STATE_ENABLED; + + exynos_dsi_poweroff(dsi); } static void exynos_dsi_dpms(struct exynos_drm_display *display, int mode)