RE: [PATCH] drm/amd/display: fix the NULL pointer that missed set_disp_pattern_generator callback

2020-11-01 Thread Zhu, Changfeng
[AMD Official Use Only - Internal Distribution Only]

Tested-by: Changfeng 

BR,
Changfeng.

-Original Message-
From: Huang, Ray  
Sent: Monday, November 2, 2020 12:58 PM
To: amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander ; Zhu, Changfeng 
; Li, Roman ; Huang, Ray 

Subject: [PATCH] drm/amd/display: fix the NULL pointer that missed 
set_disp_pattern_generator callback

This patch is to fix the NULL pointer that missed set_disp_pattern_generator 
callback on DCN301

[  505.054167] BUG: kernel NULL pointer dereference, address:  
[  505.054176] #PF: supervisor instruction fetch in kernel mode [  505.054181] 
#PF: error_code(0x0010) - not-present page [  505.054185] PGD 0 P4D 0 [  
505.054199] Oops: 0010 [#1] SMP NOPTI
[  505.054211] CPU: 6 PID: 1306 Comm: modprobe Tainted: GW  OE 
5.9.0-rc5-custom #1
[  505.054216] Hardware name: AMD Chachani-VN/Chachani-VN, BIOS 
WCH0A29N_RAPV16.FD 10/29/2020 [  505.054225] RIP: 0010:0x0 [  505.054234] Code: 
Bad RIP value.
[  505.054239] RSP: 0018:b88541c66f60 EFLAGS: 00010206 [  505.054245] RAX: 
 RBX: 91283607 RCX: 0003 [  505.054248] 
RDX: 000c RSI: 9128365001e8 RDI: 91283607 [  
505.054252] RBP: b88541c66fd8 R08: 0002 R09: b88541c66fa2 [ 
 505.054265] R10: 9580 R11: 0008 R12: 9128365001e8 
[  505.054272] R13: 000c R14: 0438 R15: 
9128a48bd000 [  505.054279] FS:  7f09f999f540() 
GS:9128b3f8() knlGS: [  505.054284] CS:  0010 DS: 
 ES:  CR0: 80050033 [  505.054288] CR2: ffd6 CR3: 
0002db98c000 CR4: 00350ee0 [  505.054291] Call Trace:
[  505.055024]  dcn20_blank_pixel_data+0x148/0x260 [amdgpu] [  505.055730]  
dcn20_enable_stream_timing+0x381/0x47c [amdgpu] [  505.056641]  
dce110_apply_ctx_to_hw+0x337/0x577 [amdgpu] [  505.056667]  ? 
put_object+0x2f/0x40 [  505.057329]  dc_commit_state+0x4b3/0x9d0 [amdgpu] [  
505.058030]  amdgpu_dm_atomic_commit_tail+0x405/0x1ec6 [amdgpu] [  505.058053]  
? update_stack_state+0x103/0x170 [  505.058071]  ? 
__module_text_address+0x12/0x60

Signed-off-by: Huang Rui 
---
 drivers/gpu/drm/amd/display/dc/dcn301/dcn301_init.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_init.c 
b/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_init.c
index 6d9587c39efd..bdad72140cbc 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_init.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_init.c
@@ -97,6 +97,7 @@ static const struct hw_sequencer_funcs dcn301_funcs = {
.set_backlight_level = dcn21_set_backlight_level,
.set_abm_immediate_disable = dcn21_set_abm_immediate_disable,
.set_pipe = dcn21_set_pipe,
+   .set_disp_pattern_generator = dcn30_set_disp_pattern_generator,
 };
 
 static const struct hwseq_private_funcs dcn301_private_funcs = {
--
2.25.1
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amd/display: fix the NULL pointer that missed set_disp_pattern_generator callback

2020-11-01 Thread Huang Rui
This patch is to fix the NULL pointer that missed set_disp_pattern_generator 
callback on DCN301

[  505.054167] BUG: kernel NULL pointer dereference, address: 
[  505.054176] #PF: supervisor instruction fetch in kernel mode
[  505.054181] #PF: error_code(0x0010) - not-present page
[  505.054185] PGD 0 P4D 0
[  505.054199] Oops: 0010 [#1] SMP NOPTI
[  505.054211] CPU: 6 PID: 1306 Comm: modprobe Tainted: GW  OE 
5.9.0-rc5-custom #1
[  505.054216] Hardware name: AMD Chachani-VN/Chachani-VN, BIOS 
WCH0A29N_RAPV16.FD 10/29/2020
[  505.054225] RIP: 0010:0x0
[  505.054234] Code: Bad RIP value.
[  505.054239] RSP: 0018:b88541c66f60 EFLAGS: 00010206
[  505.054245] RAX:  RBX: 91283607 RCX: 0003
[  505.054248] RDX: 000c RSI: 9128365001e8 RDI: 91283607
[  505.054252] RBP: b88541c66fd8 R08: 0002 R09: b88541c66fa2
[  505.054265] R10: 9580 R11: 0008 R12: 9128365001e8
[  505.054272] R13: 000c R14: 0438 R15: 9128a48bd000
[  505.054279] FS:  7f09f999f540() GS:9128b3f8() 
knlGS:
[  505.054284] CS:  0010 DS:  ES:  CR0: 80050033
[  505.054288] CR2: ffd6 CR3: 0002db98c000 CR4: 00350ee0
[  505.054291] Call Trace:
[  505.055024]  dcn20_blank_pixel_data+0x148/0x260 [amdgpu]
[  505.055730]  dcn20_enable_stream_timing+0x381/0x47c [amdgpu]
[  505.056641]  dce110_apply_ctx_to_hw+0x337/0x577 [amdgpu]
[  505.056667]  ? put_object+0x2f/0x40
[  505.057329]  dc_commit_state+0x4b3/0x9d0 [amdgpu]
[  505.058030]  amdgpu_dm_atomic_commit_tail+0x405/0x1ec6 [amdgpu]
[  505.058053]  ? update_stack_state+0x103/0x170
[  505.058071]  ? __module_text_address+0x12/0x60

Signed-off-by: Huang Rui 
---
 drivers/gpu/drm/amd/display/dc/dcn301/dcn301_init.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_init.c 
b/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_init.c
index 6d9587c39efd..bdad72140cbc 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_init.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_init.c
@@ -97,6 +97,7 @@ static const struct hw_sequencer_funcs dcn301_funcs = {
.set_backlight_level = dcn21_set_backlight_level,
.set_abm_immediate_disable = dcn21_set_abm_immediate_disable,
.set_pipe = dcn21_set_pipe,
+   .set_disp_pattern_generator = dcn30_set_disp_pattern_generator,
 };
 
 static const struct hwseq_private_funcs dcn301_private_funcs = {
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/amdgpu: fix NULL pointer crash on navi10 headless SKU

2020-11-01 Thread Yin, Tianci (Rico)
[AMD Public Use]

Thanks very much Hawking!


Hi Alex,

The amdgpu_device_ip_get_ip_block() depends on the adev->ip_blocks that 
initialized by nv_set_ip_blocks().
In nv_set_ip_blocks(), whether add dm_ip_block depends on 
amdgpu_device_has_dc_support().
And amdgpu_device_has_dc_support() depends on 
amdgpu_device_asic_has_dc_support(),
So amdgpu_device_asic_has_dc_support() can't conditional on 
amdgpu_device_ip_get_ip_block(), it makes a dependency loop.

I have just checked the atombios object table in the headless VBIOS, and find 
DCN and VCN are still there.
[  174.815714] [drm:amdgpu_discovery_reg_base_init [amdgpu]] DMU(271) #0 v2.0.2:
[  174.815771] [drm:amdgpu_discovery_reg_base_init [amdgpu]] 0x0012
[  174.815829] [drm:amdgpu_discovery_reg_base_init [amdgpu]] 0x00c0
[  174.815887] [drm:amdgpu_discovery_reg_base_init [amdgpu]] 0x34c0
[  174.815945] [drm:amdgpu_discovery_reg_base_init [amdgpu]] 0x9000
[  174.816002] [drm:amdgpu_discovery_reg_base_init [amdgpu]] 0x02403c00
[  174.821854] [drm:amdgpu_discovery_reg_base_init [amdgpu]] UVD(12) #0 v2.0.0:
[  174.821908] [drm:amdgpu_discovery_reg_base_init [amdgpu]] 0x7800
[  174.821962] [drm:amdgpu_discovery_reg_base_init [amdgpu]] 0x7e00
[  174.822017] [drm:amdgpu_discovery_reg_base_init [amdgpu]] 0x02403000
So I think DAL driver can't tell it's a normal ASIC or headless ASIC.

Thanks!
Rico


From: Deucher, Alexander 
Sent: Friday, October 30, 2020 22:18
To: Zhang, Hawking ; Yin, Tianci (Rico) 
; amd-gfx@lists.freedesktop.org 

Cc: Tuikov, Luben ; Chen, Guchun ; 
Cui, Flora ; Xu, Feifei ; Long, Gang 

Subject: Re: [PATCH] drm/amdgpu: fix NULL pointer crash on navi10 headless SKU


[AMD Public Use]

Maybe it would be easier to check if the DCE IP exists? E.g.,
if (!amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_DCE) ||
(!amdgpu_device_has_dc_support(adev))
...

Also do we even need to skip DCN init for these cards, or will the display code 
handle it automatically since there will be no displays in the atombios object 
table.  We didn't do anything special for display with the polaris blockchain 
cards.

Alex


From: Zhang, Hawking 
Sent: Friday, October 30, 2020 9:00 AM
To: Yin, Tianci (Rico) ; amd-gfx@lists.freedesktop.org 

Cc: Tuikov, Luben ; Deucher, Alexander 
; Chen, Guchun ; Cui, Flora 
; Xu, Feifei ; Long, Gang 

Subject: RE: [PATCH] drm/amdgpu: fix NULL pointer crash on navi10 headless SKU


[AMD Public Use]


[AMD Public Use]



I see, thanks for the clarifying. The patch is



Reviewed-by: Hawking Zhang 



I was thinking to have a new flag like AMD_IS_HEADLESS in amd_chip_flag, but 
after think it a bit more, that’s just complicated the case, I agree with your 
current approach.



Regards,
Hawking

From: Yin, Tianci (Rico) 
Sent: Friday, October 30, 2020 20:05
To: Zhang, Hawking ; amd-gfx@lists.freedesktop.org
Cc: Tuikov, Luben ; Deucher, Alexander 
; Chen, Guchun ; Cui, Flora 
; Xu, Feifei ; Long, Gang 

Subject: Re: [PATCH] drm/amdgpu: fix NULL pointer crash on navi10 headless SKU



[AMD Public Use]



Hi Hawking,



amdgpu_device_asic_has_dc_support() is referrenced by amdgpu_pci_probe(),

at that point, adev has not been allocated yet.



My change can make it to right code path.

int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
{

...

if (!amdgpu_device_has_dc_support(adev))

drm_helper_hpd_irq_event(dev);   //right path for headless SKU

else

drm_kms_helper_hotplug_event(dev);  //wrong path for headless SKU

...

}



Thanks!

Rico





From: Zhang, Hawking mailto:hawking.zh...@amd.com>>
Sent: Friday, October 30, 2020 19:48
To: Yin, Tianci (Rico) mailto:tianci@amd.com>>; 
amd-gfx@lists.freedesktop.org 
mailto:amd-gfx@lists.freedesktop.org>>
Cc: Tuikov, Luben mailto:luben.tui...@amd.com>>; Deucher, 
Alexander mailto:alexander.deuc...@amd.com>>; Chen, 
Guchun mailto:guchun.c...@amd.com>>; Cui, Flora 
mailto:flora@amd.com>>; Xu, Feifei 
mailto:feifei...@amd.com>>; Long, Gang 
mailto:gang.l...@amd.com>>; Yin, Tianci (Rico) 
mailto:tianci@amd.com>>
Subject: RE: [PATCH] drm/amdgpu: fix NULL pointer crash on navi10 headless SKU



[AMD Public Use]

I'm not sure I get your point on changing amdgpu_device_has_dc_support() 
interface by adding new parameter. but it seems to me change input parameter 
from pdev to adev for nv_is_headless_sku is more straightforward.

Regards,
Hawking
-Original Message-
From: Tianci Yin mailto:tianci@amd.com>>
Sent: Friday, October 30, 2020 19:32
To: amd-gfx@lists.freedesktop.org
Cc: Tuikov, Luben mailto:luben.tui...@amd.com>>; Deucher, 
Alexander mailto:alexander.deuc...@amd.com>>; Zhang, 
Hawking mailto:hawking.zh...@amd.com>>; Chen, Guchun 
mailto:guchun.c...@amd.com>>; Cui, Flora 
mailto:flora@amd.com>>; Xu, Feifei 
mailto:feifei...@amd.com>>; Long, 

RE: [PATCH] drm/amdgpu: allow TMZ on vangogh

2020-11-01 Thread Liu, Aaron
[AMD Official Use Only - Internal Distribution Only]

Reviewed-by: Aaron Liu 

--
Best Regards
Aaron Liu

-Original Message-
From: amd-gfx  On Behalf Of Alex Deucher
Sent: Friday, October 30, 2020 4:32 AM
To: amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander 
Subject: [PATCH] drm/amdgpu: allow TMZ on vangogh

Uses the same pathes as navi.

Signed-off-by: Alex Deucher 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
index fa799600a58f..1449489cbe78 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
@@ -393,6 +393,7 @@ void amdgpu_gmc_tmz_set(struct amdgpu_device *adev)
case CHIP_NAVI10:
case CHIP_NAVI14:
case CHIP_NAVI12:
+   case CHIP_VANGOGH:
/* Don't enable it by default yet.
 */
if (amdgpu_tmz < 1) {
-- 
2.25.4

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfxdata=04%7C01%7Caaron.liu%40amd.com%7C82d0483b13524710b29108d87c49a8c5%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637396003106457573%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=mB41tmZeWCKW7i0%2BBCQPLHkGU39%2FIldbjcrt8kfYt7Y%3Dreserved=0
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [Outreachy kernel] [PATCH] drm/amdgpu: use DEFINE_DEBUGFS_ATTRIBUTE with debugfs_create_file_unsafe()

2020-11-01 Thread Julia Lawall



On Sat, 31 Oct 2020, Joe Perches wrote:

> On Fri, 2020-10-30 at 09:03 +0100, Greg KH wrote:
> > On Fri, Oct 30, 2020 at 01:27:16PM +0530, Deepak R Varma wrote:
> > > On Fri, Oct 30, 2020 at 08:11:20AM +0100, Greg KH wrote:
> > > > On Fri, Oct 30, 2020 at 08:52:45AM +0530, Deepak R Varma wrote:
> > > > > Using DEFINE_DEBUGFS_ATTRIBUTE macro with debugfs_create_file_unsafe()
> > > > > function in place of the debugfs_create_file() function will make the
> > > > > file operation struct "reset" aware of the file's lifetime. Additional
> > > > > details here: https://lists.archive.carbon60.com/linux/kernel/2369498
> > > > >
> > > > > Issue reported by Coccinelle script:
> > > > > scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci
> []
> > There is a reason we didn't just do a global search/replace for this in
> > the kernel when the new functions were added, so I don't know why
> > checkpatch is now saying it must be done.
>
> I think it's not a checkpatch warning here.

That is correct, it's a coccinelle script.

julia

>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/0b818156537f354904938f437cbb9dd02e765653.camel%40perches.com.
>
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [Outreachy kernel] [PATCH] drm/amdgpu: use DEFINE_DEBUGFS_ATTRIBUTE with debugfs_create_file_unsafe()

2020-11-01 Thread Joe Perches
On Fri, 2020-10-30 at 09:03 +0100, Greg KH wrote:
> On Fri, Oct 30, 2020 at 01:27:16PM +0530, Deepak R Varma wrote:
> > On Fri, Oct 30, 2020 at 08:11:20AM +0100, Greg KH wrote:
> > > On Fri, Oct 30, 2020 at 08:52:45AM +0530, Deepak R Varma wrote:
> > > > Using DEFINE_DEBUGFS_ATTRIBUTE macro with debugfs_create_file_unsafe()
> > > > function in place of the debugfs_create_file() function will make the
> > > > file operation struct "reset" aware of the file's lifetime. Additional
> > > > details here: https://lists.archive.carbon60.com/linux/kernel/2369498
> > > > 
> > > > Issue reported by Coccinelle script:
> > > > scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci
[]
> There is a reason we didn't just do a global search/replace for this in
> the kernel when the new functions were added, so I don't know why
> checkpatch is now saying it must be done.

I think it's not a checkpatch warning here.

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx