From patchwork Tue May 7 19:18:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Crouse X-Patchwork-Id: 10933657 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D105B13AD for ; Tue, 7 May 2019 19:18:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0E4828746 for ; Tue, 7 May 2019 19:18:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B4BE72894E; Tue, 7 May 2019 19:18:27 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6A18A28746 for ; Tue, 7 May 2019 19:18:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BF17E6E837; Tue, 7 May 2019 19:18:21 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.codeaurora.org (smtp.codeaurora.org [198.145.29.96]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6D2506E833; Tue, 7 May 2019 19:18:20 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 44D8361213; Tue, 7 May 2019 19:18:18 +0000 (UTC) Received: from jcrouse1-lnx.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jcrouse@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5FC3061194; Tue, 7 May 2019 19:18:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5FC3061194 From: Jordan Crouse To: freedreno@lists.freedesktop.org Subject: [PATCH 1/3] drm/msm/dpu: Fix error recovery after failing to enable clocks Date: Tue, 7 May 2019 13:18:09 -0600 Message-Id: <1557256691-25798-2-git-send-email-jcrouse@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1557256691-25798-1-git-send-email-jcrouse@codeaurora.org> References: <1557256691-25798-1-git-send-email-jcrouse@codeaurora.org> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1557256700; bh=Q/mJwJuOJwy/EQv6iKT7QRDV1FjoviOEpC04L2Tcpzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GXGiQMyi7VKPoUwP62hypwZmvvamlOKhee6AdOv780rokWrsitM7mxaIZXwKZy1f0 R6/nB26BT9oJVOfnvKVlXVn3ZveLUBidWJkTSdIrfda0vQ0TlgWvUabI9CffJp6DWy IDSCox2rZ5OWTPaIztGctxB5FixiwE/zNa7F2OME= X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1557256697; bh=Q/mJwJuOJwy/EQv6iKT7QRDV1FjoviOEpC04L2Tcpzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eF8zL64FNZTGzDK9ZVMecOUGA2iNRn2Jc8k37M/rPgQq742AAsyBP6rCz7puQVNAY TYI1gGniTkn5FVCIzdmk0WaxThd4R+ipmv+dfqGdm+ihRkyWhUsp+WKM2NxtyOwsbq nXzAjIFCB1ZgUal4J6Ct1Er17YcC8QJnthfZL4Rw= X-Mailman-Original-Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org X-Mailman-Original-Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=jcrouse@codeaurora.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kees Cook , "Gustavo A. R. Silva" , David Airlie , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Mamta Shukla , Sean Paul , Chandan Uddaraju , Rajesh Yadav MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP If enabling clocks fails in msm_dss_enable_clk() the code to unwind the settings starts at 'i' which is the clock that just failed. While this isn't harmful it does result in a number of warnings from the clock subsystem while trying to unpreare/disable the very clock that had just failed to prepare/enable. Skip the current failed clock during the unwind to to avoid the extra log spew. Signed-off-by: Jordan Crouse --- drivers/gpu/drm/msm/disp/dpu1/dpu_io_util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_io_util.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_io_util.c index 78833c2..a40a630 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_io_util.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_io_util.c @@ -114,9 +114,9 @@ int msm_dss_enable_clk(struct dss_clk *clk_arry, int num_clk, int enable) rc = -EPERM; } - if (rc) { - msm_dss_enable_clk(&clk_arry[i], - i, false); + if (rc && i) { + msm_dss_enable_clk(&clk_arry[i - 1], + i - 1, false); break; } } From patchwork Tue May 7 19:18:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Crouse X-Patchwork-Id: 10933659 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0FBC513AD for ; Tue, 7 May 2019 19:18:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F370E28746 for ; Tue, 7 May 2019 19:18:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E7B942894E; Tue, 7 May 2019 19:18:29 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A60B628746 for ; Tue, 7 May 2019 19:18:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 123706E836; Tue, 7 May 2019 19:18:23 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.codeaurora.org (smtp.codeaurora.org [198.145.29.96]) by gabe.freedesktop.org (Postfix) with ESMTPS id 907F76E836; Tue, 7 May 2019 19:18:21 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 335CA6141D; Tue, 7 May 2019 19:18:19 +0000 (UTC) Received: from jcrouse1-lnx.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jcrouse@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 0104B6122D; Tue, 7 May 2019 19:18:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 0104B6122D From: Jordan Crouse To: freedreno@lists.freedesktop.org Subject: [PATCH 2/3] drm/msm/dpu: Avoid a null de-ref while recovering from kms init fail Date: Tue, 7 May 2019 13:18:10 -0600 Message-Id: <1557256691-25798-3-git-send-email-jcrouse@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1557256691-25798-1-git-send-email-jcrouse@codeaurora.org> References: <1557256691-25798-1-git-send-email-jcrouse@codeaurora.org> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1557256701; bh=WmAf8oFe6jYa0ZDJBfWK83oRQDbYixmX8SwEtCrRmRo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J842SbsUNGi43C0ZcefrYcJAiKXgRAnvHSM0h2ZOqg8w+7YClM78psIZJAGY3upmp q7JVB7RHaUL40Rj47pWB7X7NyTx1QzB8GtFzoMHEXCxFBsHysxQQyXiA69WfLNzi6w JDYnTGF+al7zS/gEi+RBS9Ru3ERax3UiARkP9DIY= X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1557256699; bh=WmAf8oFe6jYa0ZDJBfWK83oRQDbYixmX8SwEtCrRmRo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BP4m2EGtwQ8mxr/7UXXTDo0zZpiO9oFVEL2ql5XL1QYVf9ODAftOh7G6S6cqnbSaq TeTOu6iI9vOdnEEztUWhRqh8oD6Q69YQwxA7RTMhQJ0rJ7mlCvcEd+p0bT+btJU8C8 DLcJTnL0Ih4V7/1pLLW3Cdw515RoChoUMRR0JL2k= X-Mailman-Original-Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org X-Mailman-Original-Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=jcrouse@codeaurora.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Bruce Wang , Sean Paul , Sravanthi Kollukuduru MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP In the failure path for dpu_kms_init() it is possible to get to the MMU destroy function with uninitialized MMU structs. Check for NULl and skip if needed. Signed-off-by: Jordan Crouse Reviewed-by: Kristian H. Kristensen --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 885bf88..1beaf29 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -56,7 +56,7 @@ static const char * const iommu_ports[] = { #define DPU_DEBUGFS_HWMASKNAME "hw_log_mask" static int dpu_kms_hw_init(struct msm_kms *kms); -static int _dpu_kms_mmu_destroy(struct dpu_kms *dpu_kms); +static void _dpu_kms_mmu_destroy(struct dpu_kms *dpu_kms); static unsigned long dpu_iomap_size(struct platform_device *pdev, const char *name) @@ -725,17 +725,20 @@ static const struct msm_kms_funcs kms_funcs = { #endif }; -static int _dpu_kms_mmu_destroy(struct dpu_kms *dpu_kms) +static void _dpu_kms_mmu_destroy(struct dpu_kms *dpu_kms) { struct msm_mmu *mmu; + if (!dpu_kms->base.aspace) + return; + mmu = dpu_kms->base.aspace->mmu; mmu->funcs->detach(mmu, (const char **)iommu_ports, ARRAY_SIZE(iommu_ports)); msm_gem_address_space_put(dpu_kms->base.aspace); - return 0; + dpu_kms->base.aspace = NULL; } static int _dpu_kms_mmu_init(struct dpu_kms *dpu_kms) From patchwork Tue May 7 19:18:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Crouse X-Patchwork-Id: 10933661 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D9694924 for ; Tue, 7 May 2019 19:18:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7FBE28746 for ; Tue, 7 May 2019 19:18:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BBD6F2894E; Tue, 7 May 2019 19:18:31 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 75C0528746 for ; Tue, 7 May 2019 19:18:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 33D1A6E83C; Tue, 7 May 2019 19:18:24 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.codeaurora.org (smtp.codeaurora.org [198.145.29.96]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3CF7B6E838; Tue, 7 May 2019 19:18:22 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 1F0E160E3E; Tue, 7 May 2019 19:18:21 +0000 (UTC) Received: from jcrouse1-lnx.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jcrouse@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5B6F861344; Tue, 7 May 2019 19:18:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5B6F861344 From: Jordan Crouse To: freedreno@lists.freedesktop.org Subject: [PATCH 3/3] drm/msm/adreno: Call pm_runtime_force_suspend() during unbind Date: Tue, 7 May 2019 13:18:11 -0600 Message-Id: <1557256691-25798-4-git-send-email-jcrouse@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1557256691-25798-1-git-send-email-jcrouse@codeaurora.org> References: <1557256691-25798-1-git-send-email-jcrouse@codeaurora.org> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1557256702; bh=n+MGgOW7piyvsLsiVz/M/CyxjIEwd0g1M8E54rA5OVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XG/3PAjd3WWpDHySxnHlAoJmdQ/JzF+lVfkHPu6yin5Aw/Rv6yS9jdBaY5LmfD1kn JPaJUAcKISSpQJqSCraF25qJCrzoPSJIA2DB8mE4+z8NG35O1dpKPjGcmCW3csir/F 64SJASZYmCHovA74fKd+aoD3UGhkVAo7eT2BInFM= X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1557256700; bh=n+MGgOW7piyvsLsiVz/M/CyxjIEwd0g1M8E54rA5OVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eFfbIWItF/1Ia0+70Hz48u0g8rIP3oXgcQpDfC6oBcWjbpdil1uo5O6RwQwydYh07 pQ2Kr5Ni0EQl56N1vkSl6uYx9brD+FodCxLuBgQxLs9+8dyxL/LCufzJFdjQAKO9cT 7XaYv2nAsslmO1lik9eirL/extk5jcKdrUhW+PY8= X-Mailman-Original-Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org X-Mailman-Original-Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=jcrouse@codeaurora.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Douglas Anderson , Jonathan Marek , David Airlie , linux-arm-msm@vger.kernel.org, Sharat Masetty , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Stephen Boyd , Mamta Shukla , Andy Gross , Sean Paul , Daniel Mack MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The GPU specific pm_suspend code assumes that the hardware is active when the function is called, which it usually is when called as part of pm_runtime. But during unbind, the pm_suspend functions are called blindly resulting in a bit of a when the hardware wasn't already active (or booted, in the case of the GMU). Instead of calling the pm_suspend function directly, use pm_runtime_force_suspend() which should check the correct state of runtime and call the functions on our behalf or skip them if they are not needed. Signed-off-by: Jordan Crouse --- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 4 +--- drivers/gpu/drm/msm/adreno/adreno_device.c | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index 9155daf..447706d 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -1230,9 +1230,7 @@ void a6xx_gmu_remove(struct a6xx_gpu *a6xx_gpu) if (IS_ERR_OR_NULL(gmu->mmio)) return; - a6xx_gmu_stop(a6xx_gpu); - - pm_runtime_disable(gmu->dev); + pm_runtime_force_suspend(gmu->dev); if (!IS_ERR(gmu->gxpd)) { pm_runtime_disable(gmu->gxpd); diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm/msm/adreno/adreno_device.c index b907245..3dd90df 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_device.c +++ b/drivers/gpu/drm/msm/adreno/adreno_device.c @@ -351,7 +351,7 @@ static void adreno_unbind(struct device *dev, struct device *master, { struct msm_gpu *gpu = dev_get_drvdata(dev); - gpu->funcs->pm_suspend(gpu); + pm_runtime_force_suspend(dev); gpu->funcs->destroy(gpu); set_gpu_pdev(dev_get_drvdata(master), NULL);