From patchwork Mon Mar 29 07:58:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 410820 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp3435974jai; Mon, 29 Mar 2021 01:41:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmdMG2/vlODzc/7//PXkkVnzP4Wox3EVbXequLi0DAbbmkVT95HjYy4T4I9DricMkNIDsB X-Received: by 2002:aa7:c14a:: with SMTP id r10mr26417955edp.132.1617007175030; Mon, 29 Mar 2021 01:39:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617007175; cv=none; d=google.com; s=arc-20160816; b=RsNTw1Unv1XY+O9+c99KZqDkRoZvksNr+NWRzY6cmOJWEVJIM1jVIcT/siomfviVhW e2C6OPpjd+eIs8vQh30yb6uSBZyjAIqZ9Hzl9sK9pPgz5DiiWWskL+Rbx5rwd/Uh3I0v emPgaJm3ElHhI7BhRmRP1TKS1PiRAAuCUPqslZYRHf/XfUfxMOy/klUgy39DzUdx0eUd VVQN4+AJsaRmR0i6r00gxFc+cd3KfsPUeN5Fjeaun3rQ+w8TTWCO/WKBBIltO3VKuFB8 61cAJih4R82jdR6r6M0qZDL209Z7AbtxBjSeL5xMCH5UflOegGpdrjevcPbJNhfcDNgy v4kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=E+D6a7AjfrDpqWCNNLNFUZRMnruu6zDiUdO4L6+JDwg=; b=mcxRzHuvPcSSkaSe2whXa7NmCSyU7vA/ODwlzFRr6JA16eycR1yHMdS66rKWR/SKJk wzybkAYNtUKZA7mYs078X+c5CQlFVLKLkBLVNlRyfyomzX5+F9Q8SpdCJX0wNMFhduLx 6Go71t2zC4IZsEpoooMRd86TAbSPYbwYUqw5JzsjTYQNRU7HfePUXRrVqtP+UQZf4OJU gtSt32FIaZloURnJwTVJtxQJsC8QglwYSqixE0p6fEj5zHn9Ux30A7JmTtHe2jVk2heF napMmrPPcjfIWoDYnatTlQMx2r2qUbaoSf9DQ+DxL3ICP+7sY5SIn7tlutBL0qYV9/Tp ogXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=utia6mKG; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t22si11690307ejj.746.2021.03.29.01.39.34; Mon, 29 Mar 2021 01:39:35 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=utia6mKG; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231806AbhC2IjN (ORCPT + 12 others); Mon, 29 Mar 2021 04:39:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:60242 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234917AbhC2Ihf (ORCPT ); Mon, 29 Mar 2021 04:37:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 511FA61582; Mon, 29 Mar 2021 08:37:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617007049; bh=7hTQEDQr05Ekt974l7Fo/Vg95GL9txKc/LvyYcEnOqg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=utia6mKGYty6pHxBGQAao+BG+LSY6JuyRB5DqV0kbfe/iMs88EDWijs9Lkm0sSwT/ RDzgkBrOtCCBJqHoviuy1vr1Z5Hhm3X/kGbuWQ5L99zJ/rWLIuKZXNRF3hxEY1lHEi CpNm2Ko/r4LMgLbw9OrUjUZFfeSxM/6EvUamWKJI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Baryshkov , Fabio Estevam , Rob Clark , Sasha Levin Subject: [PATCH 5.11 195/254] drm/msm: fix shutdown hook in case GPU components failed to bind Date: Mon, 29 Mar 2021 09:58:31 +0200 Message-Id: <20210329075639.518258785@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210329075633.135869143@linuxfoundation.org> References: <20210329075633.135869143@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dmitry Baryshkov [ Upstream commit 623f279c77811475ac8fd5635cc4e4451aa71291 ] If GPU components have failed to bind, shutdown callback would fail with the following backtrace. Add safeguard check to stop that oops from happening and allow the board to reboot. [ 66.617046] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 [ 66.626066] Mem abort info: [ 66.628939] ESR = 0x96000006 [ 66.632088] EC = 0x25: DABT (current EL), IL = 32 bits [ 66.637542] SET = 0, FnV = 0 [ 66.640688] EA = 0, S1PTW = 0 [ 66.643924] Data abort info: [ 66.646889] ISV = 0, ISS = 0x00000006 [ 66.650832] CM = 0, WnR = 0 [ 66.653890] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000107f81000 [ 66.660505] [0000000000000000] pgd=0000000100bb2003, p4d=0000000100bb2003, pud=0000000100897003, pmd=0000000000000000 [ 66.671398] Internal error: Oops: 96000006 [#1] PREEMPT SMP [ 66.677115] Modules linked in: [ 66.680261] CPU: 6 PID: 352 Comm: reboot Not tainted 5.11.0-rc2-00309-g79e3faa756b2 #38 [ 66.688473] Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT) [ 66.695347] pstate: 60400005 (nZCv daif +PAN -UAO -TCO BTYPE=--) [ 66.701507] pc : msm_atomic_commit_tail+0x78/0x4e0 [ 66.706437] lr : commit_tail+0xa4/0x184 [ 66.710381] sp : ffff8000108f3af0 [ 66.713791] x29: ffff8000108f3af0 x28: ffff418c44337000 [ 66.719242] x27: 0000000000000000 x26: ffff418c40a24490 [ 66.724693] x25: ffffd3a842a4f1a0 x24: 0000000000000008 [ 66.730146] x23: ffffd3a84313f030 x22: ffff418c444ce000 [ 66.735598] x21: ffff418c408a4980 x20: 0000000000000000 [ 66.741049] x19: 0000000000000000 x18: ffff800010710fbc [ 66.746500] x17: 000000000000000c x16: 0000000000000001 [ 66.751954] x15: 0000000000010008 x14: 0000000000000068 [ 66.757405] x13: 0000000000000001 x12: 0000000000000000 [ 66.762855] x11: 0000000000000001 x10: 00000000000009b0 [ 66.768306] x9 : ffffd3a843192000 x8 : ffff418c44337000 [ 66.773757] x7 : 0000000000000000 x6 : 00000000a401b34e [ 66.779210] x5 : 00ffffffffffffff x4 : 0000000000000000 [ 66.784660] x3 : 0000000000000000 x2 : ffff418c444ce000 [ 66.790111] x1 : ffffd3a841dce530 x0 : ffff418c444cf000 [ 66.795563] Call trace: [ 66.798075] msm_atomic_commit_tail+0x78/0x4e0 [ 66.802633] commit_tail+0xa4/0x184 [ 66.806217] drm_atomic_helper_commit+0x160/0x390 [ 66.811051] drm_atomic_commit+0x4c/0x60 [ 66.815082] drm_atomic_helper_disable_all+0x1f4/0x210 [ 66.820355] drm_atomic_helper_shutdown+0x80/0x130 [ 66.825276] msm_pdev_shutdown+0x14/0x20 [ 66.829303] platform_shutdown+0x28/0x40 [ 66.833330] device_shutdown+0x158/0x330 [ 66.837357] kernel_restart+0x40/0xa0 [ 66.841122] __do_sys_reboot+0x228/0x250 [ 66.845148] __arm64_sys_reboot+0x28/0x34 [ 66.849264] el0_svc_common.constprop.0+0x74/0x190 [ 66.854187] do_el0_svc+0x24/0x90 [ 66.857595] el0_svc+0x14/0x20 [ 66.860739] el0_sync_handler+0x1a4/0x1b0 [ 66.864858] el0_sync+0x174/0x180 [ 66.868269] Code: 1ac020a0 2a000273 eb02007f 54ffff01 (f9400285) [ 66.874525] ---[ end trace 20dedb2a3229fec8 ]--- Fixes: 9d5cbf5fe46e ("drm/msm: add shutdown support for display platform_driver") Signed-off-by: Dmitry Baryshkov Signed-off-by: Fabio Estevam Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/msm_drv.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.30.1 diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 94525ac76d4e..fd2ac54caf9f 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1311,6 +1311,10 @@ static int msm_pdev_remove(struct platform_device *pdev) static void msm_pdev_shutdown(struct platform_device *pdev) { struct drm_device *drm = platform_get_drvdata(pdev); + struct msm_drm_private *priv = drm ? drm->dev_private : NULL; + + if (!priv || !priv->kms) + return; drm_atomic_helper_shutdown(drm); }