From patchwork Tue Jan 19 23:13:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 12031035 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 B13C0C433E0 for ; Tue, 19 Jan 2021 23:15:56 +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 3775122CAD for ; Tue, 19 Jan 2021 23:15:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3775122CAD 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 90A376E040; Tue, 19 Jan 2021 23:15:55 +0000 (UTC) Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9DFEB6E040 for ; Tue, 19 Jan 2021 23:15:54 +0000 (UTC) Received: by mail-qt1-x82f.google.com with SMTP id z9so5136682qtv.6 for ; Tue, 19 Jan 2021 15:15:54 -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:mime-version :content-transfer-encoding; bh=zFDeRRXpIwJ9CiC4D5FKzuA49LZcu+/pdjtRByjt0xo=; b=EUpoc6ZmND4/VQFJlNvyzA1vM7qWFDa/JLRRBwFMkWpVdv1v4LoWIcmIzkguUXq4O2 tyCX3jHlX+jcXwNSTt507WhTtYKJ6hNRmnimOffTJaoQsly+XNAPPohBnwSDAR3Pw7mf GAAYeakFrr5Nw6EaAksJJ4qmBCLvBjNorGfCYAM92sqSqZ9UJaK0jUAIpXQuV9lZ1Y7m M5X2YQqK9t+4MWgNCi1LesjtdXpibBLzox8J/xrVALmGUWZbwi9quSbOpMF1GCtFbGDI Gja0M1RRHfTMFryrqq8gUdkILJHBnrAxTMolFg3Z0vV/ZPFMmjSYIBRNlMKaoDqyzbux 6eZA== 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:mime-version :content-transfer-encoding; bh=zFDeRRXpIwJ9CiC4D5FKzuA49LZcu+/pdjtRByjt0xo=; b=iDCV2xXuE6nROJjliezb/zYdWMhrQPrFd/E3XLd0frp81+70Y9BqSWCSBItH1KI5rq ysqNqkCm81RlYBVbdBowMKxh09bRTZYUo1NQVxmFhEK7mV9ENdXDIxrtUyHHX0speLAP NZbLcfCbEzPMH9+XQmVepU6L0k/3Nfpnq4LuIV4bkl7nMIwElxi27M6k1ihcZB3tNQaB HlhVwDN09rqsjZ2QCiWvLF4QRxPLA/wMm5Akztspp/m/7YvU3rRaiu1kjs+kqFNxV8Aj tskX9HnW3GH5fFRJduROFo1Ril4bDcXsLvsHRGpuZBq9dsN9JT53vJOQ+7yzawY4fmQV Qgfw== X-Gm-Message-State: AOAM531cgDqAQMJ/bqtDKzsy969sQGezSScBw6+nPs7XFipWnnLSqipC zIXBHeuFt8BLyTIDKVDAaym8wiwJMPQ= X-Google-Smtp-Source: ABdhPJxRxBvysOQ/vcLW6AKkF0q0Axqn6H/FqkJq5ehZ2p0mvcqwsD3v6dCpUYb+zlxOYcf6ECom8g== X-Received: by 2002:ac8:5c41:: with SMTP id j1mr6663954qtj.306.1611098153671; Tue, 19 Jan 2021 15:15:53 -0800 (PST) Received: from localhost.localdomain ([177.194.79.136]) by smtp.gmail.com with ESMTPSA id e38sm94564qtb.30.2021.01.19.15.15.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 15:15:52 -0800 (PST) From: Fabio Estevam To: robdclark@gmail.com Subject: [PATCH v2 1/2] drm/msm: Call shutdown conditionally Date: Tue, 19 Jan 2021 20:13:40 -0300 Message-Id: <20210119231341.2498036-1-festevam@gmail.com> X-Mailer: git-send-email 2.25.1 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" Issuing a 'reboot' command in i.MX5 leads to the following flow: [ 24.557742] [] (msm_atomic_commit_tail) from [] (commit_tail+0xa4/0x1b0) [ 24.566349] [] (commit_tail) from [] (drm_atomic_helper_commit+0x154/0x188) [ 24.575193] [] (drm_atomic_helper_commit) from [] (drm_atomic_helper_disable_all+0x154/0x1c0) [ 24.585599] [] (drm_atomic_helper_disable_all) from [] (drm_atomic_helper_shutdown+0x94/0x12c) [ 24.596094] [] (drm_atomic_helper_shutdown) from 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_atomic_helper_shutdown() conditionally. Cc: Fixes: 9d5cbf5fe46e ("drm/msm: add shutdown support for display platform_driver") Suggested-by: Rob Clark Signed-off-by: Fabio Estevam --- Changes since v1: - Explain in the commit log that the problem happens after a 'reboot' command. drivers/gpu/drm/msm/msm_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 108c405e03dd..c082b72b9e3b 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1311,7 +1311,8 @@ static void msm_pdev_shutdown(struct platform_device *pdev) { struct drm_device *drm = platform_get_drvdata(pdev); - drm_atomic_helper_shutdown(drm); + if (get_mdp_ver(pdev)) + drm_atomic_helper_shutdown(drm); } static const struct of_device_id dt_match[] = {