From patchwork Tue Jan 19 23:13:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 12031037 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E441C433E0 for ; Tue, 19 Jan 2021 23:16:01 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 41B7422CAD for ; Tue, 19 Jan 2021 23:16:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 41B7422CAD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 455576E046; Tue, 19 Jan 2021 23:16:00 +0000 (UTC) Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) by gabe.freedesktop.org (Postfix) with ESMTPS id D4CE46E046 for ; Tue, 19 Jan 2021 23:15:58 +0000 (UTC) Received: by mail-qt1-x835.google.com with SMTP id z6so8010419qtn.0 for ; Tue, 19 Jan 2021 15:15:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=op9FrWddONIxn+M8Vu02lYB/ZI0KbLq2QEuyw8GYI6U=; b=gSLoZAf+wj0Cbx2kVAUO7Dsd7pakalqeRQQkkuunp88VqihH7F2ZHeWrw0As42brAc mascdqYp1O05Na+QPckX6BwIB6wqQyFjHYqq/8j8V/kqFAINiWDSJcRQLchfOu0ou8VE SoXku3WcTYYdkrD0IkVedX6o1vaY1bo4nVFb8thY+haOcepesljR17g9ysr/snKAzrDk NzxvGC49rA59N0maw2bvdnbK/SoWPr689qh23QFhrbWslvOHYJn6qiGmli0MBItzGm2z Ha07mxP0ZsUcc4m3o/mdZ2M2IzwlSYw2azq5sJKZKeS/R8O8W4gMDEjWpKC1I3v74H3V 1zdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=op9FrWddONIxn+M8Vu02lYB/ZI0KbLq2QEuyw8GYI6U=; b=c8ghhWHS43pgghSIbjTu2Ms3lKisyiEln2j0FnF7JU0vrjwhKjfXQSBL2nkakk1x44 6ZScUyfoKdCR1rIr3gtO9tbid/iFpiW6770kT+OcAKUxAROSj4q4owPZqE6Ttvs0YVEy /LjFSDG6TSn3IZFK77KvwR9aeSVTodhHY389TVDpJl1OgGXKkfz4zMehF+MBAIJsKEEW XWapRyFudsUgzAAEWfKRDOeD6H46+jmv8J4OxZR3Y0OEV24fW5roB60iWmFPlsUv7iCO 1dJQ0qPbom9PWMKWyXOuSADQZ4vPceYMQPWn59udz8VtF0ws0YBrnonkjOjnqEEgKEeV sHDg== X-Gm-Message-State: AOAM532sHlgy22DxWEXYhFkZA4LEBG81GG3k+HGKZegj5Tngi8XQAtwq q/dOSlG9qePTP9+bSU/nAug= X-Google-Smtp-Source: ABdhPJwVXkoBnaF2j0YgiNzq1aipHcEFIpv7P7shzdyZMMOBZ52EL6ReDaQj1uoeprYvDBSWL5wzeg== X-Received: by 2002:ac8:71d6:: with SMTP id i22mr6608227qtp.206.1611098158009; Tue, 19 Jan 2021 15:15:58 -0800 (PST) Received: from localhost.localdomain ([177.194.79.136]) by smtp.gmail.com with ESMTPSA id e38sm94564qtb.30.2021.01.19.15.15.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 15:15:57 -0800 (PST) From: Fabio Estevam To: robdclark@gmail.com Subject: [PATCH v2 2/2] drm/msm: Call suspend/resume conditionally Date: Tue, 19 Jan 2021 20:13:41 -0300 Message-Id: <20210119231341.2498036-2-festevam@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210119231341.2498036-1-festevam@gmail.com> References: <20210119231341.2498036-1-festevam@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mkrishn@codeaurora.org, jonathan@marek.ca, airlied@linux.ie, dri-devel@lists.freedesktop.org, bjorn.andersson@linaro.org, stable@vger.kernel.org, kernel@pengutronix.de, kalyan_t@codeaurora.org, sean@poorly.run Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When putting iMX5 into suspend, the following flow is observed: [ 70.023427] [] (msm_atomic_commit_tail) from [] (commit_tail+0x9c/0x18c) [ 70.031890] [] (commit_tail) from [] (drm_atomic_helper_commit+0x1a0/0x1d4) [ 70.040627] [] (drm_atomic_helper_commit) from [] (drm_atomic_helper_disable_all+0x1c4/0x1d4) [ 70.050913] [] (drm_atomic_helper_disable_all) from [] (drm_atomic_helper_suspend+0xb8/0x170) [ 70.061198] [] (drm_atomic_helper_suspend) from [] (drm_mode_config_helper_suspend+0x24/0x58) In the i.MX5 case, priv->kms is not populated (as i.MX5 does not use any of the Qualcomm display controllers), causing a NULL pointer dereference in msm_atomic_commit_tail(): [ 24.268964] 8<--- cut here --- [ 24.274602] Unable to handle kernel NULL pointer dereference at virtual address 00000000 [ 24.283434] pgd = (ptrval) [ 24.286387] [00000000] *pgd=ca212831 [ 24.290788] Internal error: Oops: 17 [#1] SMP ARM [ 24.295609] Modules linked in: [ 24.298777] CPU: 0 PID: 197 Comm: init Not tainted 5.11.0-rc2-next-20210111 #333 [ 24.306276] Hardware name: Freescale i.MX53 (Device Tree Support) [ 24.312442] PC is at msm_atomic_commit_tail+0x54/0xb9c [ 24.317743] LR is at commit_tail+0xa4/0x1b0 Fix the problem by calling drm_mode_config_helper_suspend/resume() conditionally. Cc: Fixes: ca8199f13498 ("drm/msm/dpu: ensure device suspend happens during PM sleep") Signed-off-by: Fabio Estevam --- Changes since v1: - Newly introduced in this series. drivers/gpu/drm/msm/msm_drv.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index c082b72b9e3b..0d1a94e06912 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1072,14 +1072,17 @@ static int __maybe_unused msm_pm_prepare(struct device *dev) { struct drm_device *ddev = dev_get_drvdata(dev); - return drm_mode_config_helper_suspend(ddev); + if (of_device_get_match_data(dev)) + return drm_mode_config_helper_suspend(ddev); + return 0; } static void __maybe_unused msm_pm_complete(struct device *dev) { struct drm_device *ddev = dev_get_drvdata(dev); - drm_mode_config_helper_resume(ddev); + if (of_device_get_match_data(dev)) + drm_mode_config_helper_resume(ddev); } static const struct dev_pm_ops msm_pm_ops = {