drm/msm: Do not run snapshot on non-DPU devices
Subsystems (3)
PATCH 1/1 drm/msm: Do not run snapshot on non-DPU devices
Since commit 98659487b845 ("drm/msm: add support to take dpu snapshot") the following NULL pointer dereference is seen on i.MX53:
[ 3.275493] msm msm: bound 30000000.gpu (ops a3xx_ops) [ 3.287174] [drm] Initialized msm 1.8.0 20130625 for msm on minor 0 [ 3.293915] 8<--- cut here --- [ 3.297012] Unable to handle kernel NULL pointer dereference at virtual address 00000028 [ 3.305244] pgd = (ptrval) [ 3.307989] [00000028] *pgd=00000000 [ 3.311624] Internal error: Oops: 805 [#1] SMP ARM [ 3.316430] Modules linked in: [ 3.319503] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.14.0+g682d702b426b #1 [ 3.326652] Hardware name: Freescale i.MX53 (Device Tree Support) [ 3.332754] PC is at __mutex_init+0x14/0x54 [ 3.336969] LR is at msm_disp_snapshot_init+0x24/0xa0
i.MX53 does not use the DPU controller.
Fix the problem by only calling msm_disp_snapshot_init() on platforms that use the DPU controller.
--- drivers/gpu/drm/msm/msm_drv.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/msm_drv.c +5 -4
@@ -630,10 +630,11 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)if (ret) goto err_msm_uninit; - ret =msm_disp_snapshot_init (ddev); -if (ret) -DRM_DEV_ERROR (dev,"msm_disp_snapshot_init failed ret = %d\n" , ret); - +if (kms) { + ret =msm_disp_snapshot_init (ddev); +if (ret) +DRM_DEV_ERROR (dev,"msm_disp_snapshot_init failed ret = %d\n" , ret); + }drm_mode_config_reset (ddev);#ifdef CONFIG_DRM_FBDEV_EMULATION
Signature · 1 line
2.25.1
Hi Fabio
Quoted 38 lines · Fabio Estevam
Since commit
98659487b845("drm/msm: add support to take dpu snapshot") the following NULL pointer dereference is seen on i.MX53:[ 3.275493] msm msm: bound 30000000.gpu (ops a3xx_ops) [ 3.287174] [drm] Initialized msm 1.8.0 20130625 for msm on minor 0 [ 3.293915] 8<--- cut here --- [ 3.297012] Unable to handle kernel NULL pointer dereference at virtual address 00000028 [ 3.305244] pgd = (ptrval) [ 3.307989] [00000028] *pgd=00000000 [ 3.311624] Internal error: Oops: 805 [#1] SMP ARM [ 3.316430] Modules linked in: [ 3.319503] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.14.0+g682d702b426b #1 [ 3.326652] Hardware name: Freescale i.MX53 (Device Tree Support) [ 3.332754] PC is at __mutex_init+0x14/0x54 [ 3.336969] LR is at msm_disp_snapshot_init+0x24/0xa0i.MX53 does not use the DPU controller.
Fix the problem by only calling
msm_disp_snapshot_init()on platforms that use the DPU controller.Fixes 98659487b845 ("drm/msm: add support to take dpu snapshot")Signed-off-by Fabio Estevam <[email protected]>--- drivers/gpu/drm/msm/msm_drv.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)drivers/gpu/drm/msm/msm_drv.c +0
-0@@ -630,10 +630,11 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) if (ret) goto err_msm_uninit;
drivers/gpu/drm/msm/msm_drv.c static int msm_drm_init(struct device *dev, · line 639
Quoted 10 lines
drivers/gpu/drm/msm/msm_drv.c +5
-4- ret =msm_disp_snapshot_init (ddev); -if (ret) -DRM_DEV_ERROR (dev,"msm_disp_snapshot_init failed ret = %d\n" , ret); - +if (kms) { + ret =msm_disp_snapshot_init (ddev); +if (ret) +DRM_DEV_ERROR (dev,"msm_disp_snapshot_init failed ret = %d\n" , ret); + }
Are you not using DPU or are you not using mdp4/mdp5 as well? Even if you are using any of mdps, kms should not be NULL. Hence wanted to check the test case.
Quoted 3 lines
drivers/gpu/drm/msm/msm_drv.c +0
-0drm_mode_config_reset (ddev);#ifdef
CONFIG_DRM_FBDEV_EMULATION
Hi Abhinav,
Quoted 3 lines · On Wed, Sep 15, 2021 at 11:22 PM <[email protected]> wrote:
Are you not using DPU or are you not using mdp4/mdp5 as well? Even if you are using any of mdps, kms should
not be NULL. Hence wanted to check the test case.
I am running i.MX53, which is an NXP SoC, not Qualcomm's.
It does not use DPU, nor MDP4/5 and kms is NULL in this case.
Some debug prints to confirm:
drivers/gpu/drm/msm/msm_drv.c +0 -0
@@ -557,18 +557,22 @@ static int msm_drm_init(struct device *dev,
const struct drm_driver *drv)
case KMS_MDP4:
kms = mdp4_kms_init(ddev);
priv->kms = kms;
+ pr_err("******** KMS_MDP4\n");
break;
case KMS_MDP5:
kms = mdp5_kms_init(ddev);
+ pr_err("******** KMS_MDP5\n");
break;
case KMS_DPU:
kms = dpu_kms_init(ddev);
+ pr_err("******** KMS_DPU\n");
priv->kms = kms;
break;
default:
/* valid only for the dummy headless case, where of_node=NULL */
WARN_ON(dev->of_node);
kms = NULL;
+ pr_err("******** KMS is NULL\n");
break;
}# dmesg | grep KMS [ 3.153215] ******** KMS is NULL
Hi Fabio
Thanks for confirming.
Although I have no issues with your change, I am curious why even msm is probing and/or binding. Your device tree should not be having any mdp/dpu nodes then.
Thanks
Abhinav
Quoted 43 lines · Fabio Estevam
Hi Abhinav,
Quoted 3 lines · On Wed, Sep 15, 2021 at 11:22 PM <[email protected]> wrote:
Are you not using DPU or are you not using mdp4/mdp5 as well? Even if you are using any of mdps, kms should
not be NULL. Hence wanted to check the test case.I am running i.MX53, which is an NXP SoC, not Qualcomm's.
It does not use DPU, nor MDP4/5 and kms is NULL in this case.
Some debug prints to confirm:
drivers/gpu/drm/msm/msm_drv.c +3
-0@@ -557,18 +557,22 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)case KMS_MDP4 : kms =mdp4_kms_init (ddev); priv->kms = kms; +pr_err ("******** KMS_MDP4\n" );break ;case KMS_MDP5 : kms =mdp5_kms_init (ddev); +pr_err ("******** KMS_MDP5\n" );break ;case KMS_DPU : kms =dpu_kms_init (ddev); +pr_err ("******** KMS_DPU\n" ); priv->kms = kms;break ;default :/* valid only for the dummy headless case, where of_node=NULL */
WARN_ON(dev->of_node); kms = NULL; + pr_err("******** KMS is NULL\n"); break; }# dmesg | grep KMS [ 3.153215] ******** KMS is NULL
Hi Abhinav,
Quoted 8 lines · On Thu, Sep 16, 2021 at 1:15 PM <[email protected]> wrote:
Hi Fabio
Thanks for confirming.
Although I have no issues with your change, I am curious why even msm is probing and/or binding.
Your device tree should not be having any mdp/dpu nodes then.
The i.MX53 does have the following GPU node:
compatible = "amd,imageon-200.0", "amd,imageon";
That's why it probes the msm driver.
However, i.MX53 does not have any of the Qualcomm display controllers.
It uses the i.MX IPU display controller instead.
Hope that clarifies.
Please reply with a Reviewed-by if you are happy with my fix.
Thanks
[email protected]
Reviewed-byHi Fabio
Ah, I did not realize that amd compatible is present in the list and its quite a surprise.
/*
* We don't know what's the best binding to link the gpu with the drm
device.
* Fow now, we just hunt for all the possible gpus that we support, and
add them
* as components.
*/
static const struct of_device_id msm_gpu_match[] = {
{ .compatible = "qcom,adreno" },
{ .compatible = "qcom,adreno-3xx" },
{ .compatible = "amd,imageon" },
{ .compatible = "qcom,kgsl-3d0" },
{ },
};https://github.com/torvalds/linux/commit/e6f6d63ed14c20528aa6df05a8f0707c183c6ba3
For this change itself,
Quoted 27 lines · Fabio Estevam
Hi Abhinav,
Quoted 8 lines · On Thu, Sep 16, 2021 at 1:15 PM <[email protected]> wrote:
Hi Fabio
Thanks for confirming.
Although I have no issues with your change, I am curious why even msm is probing and/or binding.
Your device tree should not be having any mdp/dpu nodes then.The i.MX53 does have the following GPU node:
compatible = "amd,imageon-200.0", "amd,imageon";
That's why it probes the msm driver.
However, i.MX53 does not have any of the Qualcomm display controllers.
It uses the i.MX IPU display controller instead.
Hope that clarifies.
Please reply with a Reviewed-by if you are happy with my fix.
Thanks