Re: [PATCH] drm/msm/disp/dpu: Use proper define for drm_encoder_init() 'encoder_type'

2018-08-17 Thread Sai Prakash Ranjan

On 8/17/2018 5:06 AM, Stephen Boyd wrote:

We got a bug report that this function oopses when trying to do a kasprintf().

PC is at string+0x2c/0x60
LR is at vsnprintf+0x28c/0x4ec
pc : [] lr : [] pstate: a0c00049
sp : ff80095fb540
x29: ff80095fb540 x28: ff8008ad42bc
x27: ffd8 x26: 
x25: ff8008c216c8 x24: 
x23:  x22: ff80095fb720
x21:  x20: ff80095fb720
x19: ff80095fb6f0 x18: 000a
x17: b42ba473 x16: ff800805bbe8
x15: 000a157d x14: 000c
x13:  x12: 000f
x11: 0003 x10: 0001
x9 : 0040 x8 : 001c
x7 :  x6 : 
x5 : 0228 x4 : 
x3 : 0a00ff04 x2 : 7961
x1 :  x0 : 
Process kworker/3:1 (pid: 61, stack limit = 0xff80095f8000)
Call trace:
Exception stack(0xff80095fb400 to 0xff80095fb540)
b400:   7961 0a00ff04
b420:  0228  
b440: 001c 0040 0001 0003
b460: 000f  000c 000a157d
b480: ff800805bbe8 b42ba473 000a ff80095fb6f0
b4a0: ff80095fb720  ff80095fb720 
b4c0:  ff8008c216c8  ffd8
b4e0: ff8008ad42bc ff80095fb540 ff80088d5fc4 ff80095fb540
b500: ff80088d35d8 a0c00049 ff80095fb550 ff80080d06a4
b520:  ff80088d5e0c ff80095fb540 ff80088d35d8
[] string+0x2c/0x60
[] vsnprintf+0x28c/0x4ec
[] kvasprintf+0x68/0x100
[] kasprintf+0x60/0x80
[] drm_encoder_init+0x134/0x164
[] dpu_encoder_init+0x60/0x94
[] _dpu_kms_drm_obj_init+0xa0/0x424
[] dpu_kms_hw_init+0x61c/0x6bc
[] msm_drm_bind+0x380/0x67c
[] try_to_bring_up_master+0x228/0x264
[] component_master_add_with_match+0x90/0xc0
[] msm_pdev_probe+0x260/0x2c8
[] platform_drv_probe+0x58/0xa8
[] driver_probe_device+0x2d8/0x40c
[] __device_attach_driver+0xd4/0x10c
[] bus_for_each_drv+0xb4/0xd0
[] __device_attach+0xd0/0x160
[] device_initial_probe+0x24/0x30
[] bus_probe_device+0x38/0x98
[] deferred_probe_work_func+0x144/0x148
[] process_one_work+0x218/0x3bc
[] process_scheduled_works+0x44/0x48
[] worker_thread+0x288/0x32c
[] kthread+0x134/0x13c
[] ret_from_fork+0x10/0x18
Code: 910003fd 2a0403e6 eb0400ff 5460 (38646845)

Looking at the code I see that drm_encoder_init() is called from the DPU
code with 'DRM_MODE_CONNECTOR_DSI' passed in as the 'encoder_type'
argument (follow from _dpu_kms_initialize_dsi()). That corresponds to
the integer 16. That is then indexed into drm_encoder_enum_list in
drm_encoder_init() to look up the name of the encoder. If you're still
following along, that's an encoder not a connector! We really want to
use DRM_MODE_ENCODER_DSI (integer 6) instead of DRM_MODE_CONNECTOR_DSI
here, or we'll go out of bounds of the encoder array. Pass the right
thing and everything is fine.

Cc: Jeykumar Sankaran 
Cc: Jordan Crouse 
Cc: Sean Paul 
Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
Signed-off-by: Stephen Boyd 
---
  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 7dd6bd2d6d37..74cc204b07e8 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -450,7 +450,7 @@ static void _dpu_kms_initialize_dsi(struct drm_device *dev,
int i, rc;
  
  	/*TODO: Support two independent DSI connectors */

-   encoder = dpu_encoder_init(dev, DRM_MODE_CONNECTOR_DSI);
+   encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI);
if (IS_ERR_OR_NULL(encoder)) {
DPU_ERROR("encoder init failed for dsi display\n");
return;



I have tested this on sdm845 mtp and it does fix the issue.
Tested-by: Sai Prakash Ranjan 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/msm/disp/dpu: Use proper define for drm_encoder_init() 'encoder_type'

2018-08-17 Thread Jeykumar Sankaran

On 2018-08-16 16:36, Stephen Boyd wrote:

We got a bug report that this function oopses when trying to do a
kasprintf().

PC is at string+0x2c/0x60
LR is at vsnprintf+0x28c/0x4ec
pc : [] lr : [] pstate: a0c00049
sp : ff80095fb540
x29: ff80095fb540 x28: ff8008ad42bc
x27: ffd8 x26: 
x25: ff8008c216c8 x24: 
x23:  x22: ff80095fb720
x21:  x20: ff80095fb720
x19: ff80095fb6f0 x18: 000a
x17: b42ba473 x16: ff800805bbe8
x15: 000a157d x14: 000c
x13:  x12: 000f
x11: 0003 x10: 0001
x9 : 0040 x8 : 001c
x7 :  x6 : 
x5 : 0228 x4 : 
x3 : 0a00ff04 x2 : 7961
x1 :  x0 : 
Process kworker/3:1 (pid: 61, stack limit = 0xff80095f8000)
Call trace:
Exception stack(0xff80095fb400 to 0xff80095fb540)
b400:   7961 
0a00ff04
b420:  0228  

b440: 001c 0040 0001 
0003
b460: 000f  000c 
000a157d
b480: ff800805bbe8 b42ba473 000a 
ff80095fb6f0
b4a0: ff80095fb720  ff80095fb720 

b4c0:  ff8008c216c8  
ffd8
b4e0: ff8008ad42bc ff80095fb540 ff80088d5fc4 
ff80095fb540
b500: ff80088d35d8 a0c00049 ff80095fb550 
ff80080d06a4
b520:  ff80088d5e0c ff80095fb540 
ff80088d35d8

[] string+0x2c/0x60
[] vsnprintf+0x28c/0x4ec
[] kvasprintf+0x68/0x100
[] kasprintf+0x60/0x80
[] drm_encoder_init+0x134/0x164
[] dpu_encoder_init+0x60/0x94
[] _dpu_kms_drm_obj_init+0xa0/0x424
[] dpu_kms_hw_init+0x61c/0x6bc
[] msm_drm_bind+0x380/0x67c
[] try_to_bring_up_master+0x228/0x264
[] component_master_add_with_match+0x90/0xc0
[] msm_pdev_probe+0x260/0x2c8
[] platform_drv_probe+0x58/0xa8
[] driver_probe_device+0x2d8/0x40c
[] __device_attach_driver+0xd4/0x10c
[] bus_for_each_drv+0xb4/0xd0
[] __device_attach+0xd0/0x160
[] device_initial_probe+0x24/0x30
[] bus_probe_device+0x38/0x98
[] deferred_probe_work_func+0x144/0x148
[] process_one_work+0x218/0x3bc
[] process_scheduled_works+0x44/0x48
[] worker_thread+0x288/0x32c
[] kthread+0x134/0x13c
[] ret_from_fork+0x10/0x18
Code: 910003fd 2a0403e6 eb0400ff 5460 (38646845)

Looking at the code I see that drm_encoder_init() is called from the 
DPU

code with 'DRM_MODE_CONNECTOR_DSI' passed in as the 'encoder_type'
argument (follow from _dpu_kms_initialize_dsi()). That corresponds to
the integer 16. That is then indexed into drm_encoder_enum_list in
drm_encoder_init() to look up the name of the encoder. If you're still
following along, that's an encoder not a connector! We really want to
use DRM_MODE_ENCODER_DSI (integer 6) instead of DRM_MODE_CONNECTOR_DSI
here, or we'll go out of bounds of the encoder array. Pass the right
thing and everything is fine.

Cc: Jeykumar Sankaran 
Cc: Jordan Crouse 
Cc: Sean Paul 
Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
Signed-off-by: Stephen Boyd 
---


Reviewed-by: Jeykumar Sankaran 


 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 7dd6bd2d6d37..74cc204b07e8 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -450,7 +450,7 @@ static void _dpu_kms_initialize_dsi(struct 
drm_device

*dev,
int i, rc;

/*TODO: Support two independent DSI connectors */
-   encoder = dpu_encoder_init(dev, DRM_MODE_CONNECTOR_DSI);
+   encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI);
if (IS_ERR_OR_NULL(encoder)) {
DPU_ERROR("encoder init failed for dsi display\n");
return;


--
Jeykumar S
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/msm/disp/dpu: Use proper define for drm_encoder_init() 'encoder_type'

2018-08-17 Thread Stephen Boyd
We got a bug report that this function oopses when trying to do a kasprintf().

PC is at string+0x2c/0x60
LR is at vsnprintf+0x28c/0x4ec
pc : [] lr : [] pstate: a0c00049
sp : ff80095fb540
x29: ff80095fb540 x28: ff8008ad42bc
x27: ffd8 x26: 
x25: ff8008c216c8 x24: 
x23:  x22: ff80095fb720
x21:  x20: ff80095fb720
x19: ff80095fb6f0 x18: 000a
x17: b42ba473 x16: ff800805bbe8
x15: 000a157d x14: 000c
x13:  x12: 000f
x11: 0003 x10: 0001
x9 : 0040 x8 : 001c
x7 :  x6 : 
x5 : 0228 x4 : 
x3 : 0a00ff04 x2 : 7961
x1 :  x0 : 
Process kworker/3:1 (pid: 61, stack limit = 0xff80095f8000)
Call trace:
Exception stack(0xff80095fb400 to 0xff80095fb540)
b400:   7961 0a00ff04
b420:  0228  
b440: 001c 0040 0001 0003
b460: 000f  000c 000a157d
b480: ff800805bbe8 b42ba473 000a ff80095fb6f0
b4a0: ff80095fb720  ff80095fb720 
b4c0:  ff8008c216c8  ffd8
b4e0: ff8008ad42bc ff80095fb540 ff80088d5fc4 ff80095fb540
b500: ff80088d35d8 a0c00049 ff80095fb550 ff80080d06a4
b520:  ff80088d5e0c ff80095fb540 ff80088d35d8
[] string+0x2c/0x60
[] vsnprintf+0x28c/0x4ec
[] kvasprintf+0x68/0x100
[] kasprintf+0x60/0x80
[] drm_encoder_init+0x134/0x164
[] dpu_encoder_init+0x60/0x94
[] _dpu_kms_drm_obj_init+0xa0/0x424
[] dpu_kms_hw_init+0x61c/0x6bc
[] msm_drm_bind+0x380/0x67c
[] try_to_bring_up_master+0x228/0x264
[] component_master_add_with_match+0x90/0xc0
[] msm_pdev_probe+0x260/0x2c8
[] platform_drv_probe+0x58/0xa8
[] driver_probe_device+0x2d8/0x40c
[] __device_attach_driver+0xd4/0x10c
[] bus_for_each_drv+0xb4/0xd0
[] __device_attach+0xd0/0x160
[] device_initial_probe+0x24/0x30
[] bus_probe_device+0x38/0x98
[] deferred_probe_work_func+0x144/0x148
[] process_one_work+0x218/0x3bc
[] process_scheduled_works+0x44/0x48
[] worker_thread+0x288/0x32c
[] kthread+0x134/0x13c
[] ret_from_fork+0x10/0x18
Code: 910003fd 2a0403e6 eb0400ff 5460 (38646845)

Looking at the code I see that drm_encoder_init() is called from the DPU
code with 'DRM_MODE_CONNECTOR_DSI' passed in as the 'encoder_type'
argument (follow from _dpu_kms_initialize_dsi()). That corresponds to
the integer 16. That is then indexed into drm_encoder_enum_list in
drm_encoder_init() to look up the name of the encoder. If you're still
following along, that's an encoder not a connector! We really want to
use DRM_MODE_ENCODER_DSI (integer 6) instead of DRM_MODE_CONNECTOR_DSI
here, or we'll go out of bounds of the encoder array. Pass the right
thing and everything is fine.

Cc: Jeykumar Sankaran 
Cc: Jordan Crouse 
Cc: Sean Paul 
Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
Signed-off-by: Stephen Boyd 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 7dd6bd2d6d37..74cc204b07e8 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -450,7 +450,7 @@ static void _dpu_kms_initialize_dsi(struct drm_device *dev,
int i, rc;
 
/*TODO: Support two independent DSI connectors */
-   encoder = dpu_encoder_init(dev, DRM_MODE_CONNECTOR_DSI);
+   encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI);
if (IS_ERR_OR_NULL(encoder)) {
DPU_ERROR("encoder init failed for dsi display\n");
return;
-- 
Sent by a computer through tubes

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel