From patchwork Thu Aug 20 03:41:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 248003 Delivered-To: patches@linaro.org Received: by 2002:a05:6e02:522:0:0:0:0 with SMTP id h2csp1001872ils; Wed, 19 Aug 2020 20:41:05 -0700 (PDT) X-Received: by 2002:a17:90a:ce0f:: with SMTP id f15mr863675pju.96.1597894865281; Wed, 19 Aug 2020 20:41:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597894865; cv=none; d=google.com; s=arc-20160816; b=NLuLfgoBVqbK2dYgin9erD7nJ2730wy8iq0oZhfL9v84WzokUcGZhhWI4EUpPGCz0q Mi3WcEJxxmh1GtaF+mFv+0Pt5XJ8Nsyk6udLU4Nk/6AwUqX0i/Imyf1n5W1fCiVpuZuP bWcjkld1UeKomyZRUfb5/HWLE3AN/sBBhlefzuNxH18FtKV2XuAyxHxERlE48Hie9FS3 r1YEckVbwjwFk2iVrWJ888Avy/zFt6Yf6YyPkU5kdzEhPkW6kQne+OFkwo2yEMpvibXD Jv5WeFkHYxKHoyHcr7Dw+PZeponq8/vzZjyMObDWUwq9B13hsZ+nMGCn0sFsZDg/6uyh CrWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=B9EvtRMB5UVF86YnoHZC/uHFJ9AM6zutWYeLdC0SWPo=; b=F5e33Qgr4fXfXPXuOnPGUTuVMqoUkBUMSO17Q+OW3354Ve6jxXMUY0TudkOGRYlvBR Nswl3IigEEPZyMIEoShamW8VVjoZuiwaVYh5qVEKcnIfNNMM+phSQE+DX1ne5Al7Tn05 j1flG6/SOyVUUpoqitTqLWOpbDXbA6xHAgoxYzj1va55NlmJwvvvqi8u1bd4glCDrA58 Si+kUblpIUpagaGaq/ZJGeOhLnizjxGZmFE5Ugwcx4cJqD3SaaD5rQG55JRfbBxLi4k3 uik+dBhzYPQgGMAXWHUm7VKdlK9U2elMliKh1DOWxUT79zlF3sLso+mDCQA6BEYIUPNz 4lpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J6C7ICzF; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id x28sor287061pgl.86.2020.08.19.20.41.05 for (Google Transport Security); Wed, 19 Aug 2020 20:41:05 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J6C7ICzF; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=B9EvtRMB5UVF86YnoHZC/uHFJ9AM6zutWYeLdC0SWPo=; b=J6C7ICzFYJGV3tWZk5soVRVxCRF4eadzc/OAyuvKSnyBUVeWXBJufUSp5SrId1XKLj 6r8wz5IPJFIHX0hv0Wcz3JhYOlDMDmjjvsYRvUIi9AvCpajh4gxxFFK0oTZ40OErAzvJ f+6KcTMpbTTJYB31y7uvlnnh0BWMfpBEFWYAZ+0czMfx7bY9/uzn6Z1Clf70GKetDBlG XD9018HxSAbapSc9yzX4y2kX8+LEnZuLQu3B+K28eZJAwtBKLALb8UhkI7rsm9x78qae JuNYMBjzUhSe8+1cnTN0L9cAdrvRNRHgAgnB41Zy7/htCDlJKnQG5p1JjhX/4saRcFsK wE7A== 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; bh=B9EvtRMB5UVF86YnoHZC/uHFJ9AM6zutWYeLdC0SWPo=; b=XW0NWq8xgYbCvBTBSo3sV6OWTts17wIjCDmvu7m5de1ekauP6YeEpmiKOrjzGAenjF e9237wTyyz9rDof6IZ6bhCgxvpnBKZbR/DYSPvAK/8NlyXBeI58V+U+k+HwyX39X1krQ mDmgbq+pL9lhsNQ7vE5+ZTZnecdI6F1Zw2ChQKUAAuCPtpWVIp17SZixvblSFx/bb1U9 YTC85anUvWhPxEpfYsuoOdPYwo9EdOgSN48N00Tvoh13AhyuT1fxYORSM+Ryfisk9wK5 X7EEIVuyO4K5YbwEOQWc/qr4hinDPA6rrc89PwIR79PmBW5gJrnkMDBFX58sWayT+ZW+ MfQA== X-Gm-Message-State: AOAM532Hy0x1bWI5wB+06wdg3s21Y449jrVQAYpX3o8oYeHJgIdDjUjL VdTP2SV+N1oAymyuk84XBthmDzRX X-Google-Smtp-Source: ABdhPJw4A1teuRlyb1TkMhqLDkqloYQulBKDv393Chr/svrFg49o9APmr8NElPKuIMXNWDkeTvOLiA== X-Received: by 2002:a63:5552:: with SMTP id f18mr1054188pgm.298.1597894864955; Wed, 19 Aug 2020 20:41:04 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y126sm786477pfy.138.2020.08.19.20.41.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Aug 2020 20:41:04 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Mauro Carvalho Chehab , Greg Kroah-Hartman , Manivannan Sadhasivam , dri-devel , Liwei Cai , Xinliang Liu , Laurent Pinchart , Sam Ravnborg , Sumit Semwal , Chen Feng Subject: [PATCH 3/3] drm: hikey9xxx: Fix null pointer crash on reboot Date: Thu, 20 Aug 2020 03:41:00 +0000 Message-Id: <20200820034100.128062-2-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200820034100.128062-1-john.stultz@linaro.org> References: <20200820033939.127932-1-john.stultz@linaro.org> <20200820034100.128062-1-john.stultz@linaro.org> This is against Mauro's tree here: https://gitlab.freedesktop.org/mchehab_kernel/hikey-970/-/commits/master/ On reboot we see the following crash: [ 608.746787] Unable to handle kernel read from unreadable memory at virtual address 00000000000000a8 ... [ 608.822101] CPU: 3 PID: 234 Comm: kworker/3:2 Not tainted 5.8.0-00183-g03481a190c60-dirty #32 [ 608.830626] Hardware name: HiKey960 (DT) [ 608.834571] Workqueue: events drm_mode_rmfb_work_fn [ 608.839454] pstate: 80400005 (Nzcv daif +PAN -UAO BTYPE=--) [ 608.845031] pc : drm_gem_fb_get_obj+0x10/0x28 [ 608.849390] lr : drm_fb_cma_get_gem_obj+0x10/0x20 [ 608.854093] sp : ffffffc012f63b10 [ 608.857404] x29: ffffffc012f63b10 x28: ffffff8212282e00 [ 608.862716] x27: 0000000000000000 x26: ffffff8217501800 [ 608.868027] x25: 0000000000000000 x24: ffffffc012f63d60 [ 608.873339] x23: 0000000000000001 x22: ffffff8217504080 [ 608.878652] x21: ffffffc0119b9000 x20: ffffff8212282e00 [ 608.883963] x19: ffffff82175047c0 x18: ffffffffffffffff [ 608.889275] x17: ffffff8219c97708 x16: ffffff8219c97728 [ 608.894586] x15: ffffffc0119b9d08 x14: 0000000000000000 [ 608.899898] x13: 0000000000000000 x12: 0000000000000000 [ 608.905209] x11: 0000003c00000000 x10: 0000046500000441 [ 608.910519] x9 : ffffffc0119b9d08 x8 : ffffffc011bf7000 [ 608.915830] x7 : 0000000000000898 x6 : ffffff8217504080 [ 608.921142] x5 : ffffff8212282e00 x4 : ffffffc0111935e0 [ 608.926454] x3 : 0000000000000000 x2 : ffffffc0119b9d08 [ 608.931764] x1 : 0000000000000000 x0 : 0000000000000000 [ 608.937079] Call trace: [ 608.939531] drm_gem_fb_get_obj+0x10/0x28 [ 608.943547] hisi_fb_pan_display+0x50/0x1f8 [ 608.947736] dss_plane_atomic_update+0x10/0x20 [ 608.952183] drm_atomic_helper_commit_planes+0xe0/0x228 [ 608.957412] drm_atomic_helper_commit_tail+0x34/0x80 [ 608.962377] commit_tail+0x150/0x180 [ 608.965955] drm_atomic_helper_commit+0x164/0x178 [ 608.970665] drm_atomic_commit+0x4c/0x60 [ 608.974591] drm_framebuffer_remove+0x3f4/0x440 [ 608.979123] drm_mode_rmfb_work_fn+0x48/0x68 [ 608.983398] process_one_work+0x1ec/0x4b0 [ 608.987408] worker_thread+0x208/0x478 [ 608.991160] kthread+0x140/0x150 [ 608.994390] ret_from_fork+0x10/0x30 [ 608.997972] Code: d503233f 71000c3f 540000a8 8b214c01 (f9405420) [ 609.004069] ---[ end trace a837c42fc434e1a4 ]--- Which is due to the plane->state->fb value being null. Fix this with a solution used in a different version of this patch series. Cc: Mauro Carvalho Chehab Cc: Greg Kroah-Hartman Cc: Manivannan Sadhasivam Cc: dri-devel Cc: Liwei Cai Cc: Xinliang Liu Cc: Laurent Pinchart Cc: Sam Ravnborg Cc: Sumit Semwal Cc: Chen Feng Signed-off-by: John Stultz --- drivers/staging/hikey9xx/gpu/kirin9xx_drm_dss.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.17.1 diff --git a/drivers/staging/hikey9xx/gpu/kirin9xx_drm_dss.c b/drivers/staging/hikey9xx/gpu/kirin9xx_drm_dss.c index f2e99c766927..7adbd924bec2 100644 --- a/drivers/staging/hikey9xx/gpu/kirin9xx_drm_dss.c +++ b/drivers/staging/hikey9xx/gpu/kirin9xx_drm_dss.c @@ -702,6 +702,13 @@ static int dss_plane_atomic_check(struct drm_plane *plane, static void dss_plane_atomic_update(struct drm_plane *plane, struct drm_plane_state *old_state) { + struct drm_plane_state *state = plane->state; + + if (!state->fb) { + state->visible = false; + return; + } + hisi_fb_pan_display(plane); }