drm/amdgpu: remove power on/off SDMA in SMU hw_init/fini()
Subsystems (3)
PATCH 2/2 drm/amdgpu: only hw fini SMU fisrt for ASICs need that
In reply to Lang YuWe found some headaches on ASICs don't need that,
so remove that for them.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 47 +++++++++++++++------- 1 file changed, 32 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +32 -15
@@ -2656,6 +2656,36 @@ static int amdgpu_device_ip_late_init(struct amdgpu_device *adev)return 0 ; } +/** +* amdgpu_device_smu_fini_early - smu hw_fini wrapper +* +* @adev: amdgpu_device pointer +* +* For ASICs need to disable SMC first +*/ +static void amdgpu_device_smu_fini_early (struct amdgpu_device *adev) +{ +int i, r; + +if (adev->ip_versions[GC_HWIP ][0 ] >IP_VERSION (9 ,0 ,0 )) +return ; + +for (i =0 ; i < adev->num_ip_blocks; i++) { +if (!adev->ip_blocks[i].status.hw) +continue ; +if (adev->ip_blocks[i].version->type ==AMD_IP_BLOCK_TYPE_SMC ) { + r = adev->ip_blocks[i].version->funcs->hw_fini ((void *)adev); +/* XXX handle errors */ +if (r) { +DRM_DEBUG ("hw_fini of IP block <%s> failed %d\n" , + adev->ip_blocks[i].version->funcs->name, r); + } + adev->ip_blocks[i].status.hw = false; +break ; + } + } +} +static int amdgpu_device_ip_fini_early (struct amdgpu_device *adev) {int i, r;
@@ -2676,21 +2706,8 @@ static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev)amdgpu_device_set_pg_state (adev,AMD_PG_STATE_UNGATE );amdgpu_device_set_cg_state (adev,AMD_CG_STATE_UNGATE ); -/* need to disable SMC first */ -for (i =0 ; i < adev->num_ip_blocks; i++) { -if (!adev->ip_blocks[i].status.hw) -continue ; -if (adev->ip_blocks[i].version->type ==AMD_IP_BLOCK_TYPE_SMC ) { - r = adev->ip_blocks[i].version->funcs->hw_fini ((void *)adev); -/* XXX handle errors */ -if (r) { -DRM_DEBUG ("hw_fini of IP block <%s> failed %d\n" , - adev->ip_blocks[i].version->funcs->name, r); - } - adev->ip_blocks[i].status.hw = false; -break ; - } - } +/* Workaroud for ASICs need to disable SMC first */ +amdgpu_device_smu_fini_early (adev);for (i = adev->num_ip_blocks -1 ; i >=0 ; i--) {if (!adev->ip_blocks[i].status.hw)
Signature · 1 line
2.25.1
PATCH 1/2 drm/amdgpu: remove power on/off SDMA in SMU hw_init/fini()
Currently, we don't find some neccesities to power on/off SDMA in SMU hw_init/fini(). It makes more sense in SDMA hw_init/fini().
--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -5
@@ -1350,7 +1350,6 @@ static int smu_hw_init(void *handle) }if (smu->is_apu) { -smu_powergate_sdma (&adev->smu, false);smu_dpm_set_vcn_enable (smu, true);smu_dpm_set_jpeg_enable (smu, true);smu_set_gfx_cgpg (&adev->smu, true);
@@ -1512,10 +1511,6 @@ static int smu_hw_fini(void *handle)if (amdgpu_sriov_vf (adev)&& !amdgpu_sriov_is_pp_one_vf (adev))return 0 ; -if (smu->is_apu) { -smu_powergate_sdma (&adev->smu, true); - } -smu_dpm_set_vcn_enable (smu, false);smu_dpm_set_jpeg_enable (smu, false);
Signature · 1 line
2.25.1
[AMD Official Use Only]
Hi Lang,
the function of smu_powergate_sdma() is only valid on renoir chip.
if you want to remove it, please also remove following callback pointer in struct pptable_funcs{}. related macro definitions also need to be cleaned up.
int (*powergate_sdma)(struct smu_context *smu, bool gate);
Best Regards,
Kevin
________________________________
From: amd-gfx <[email protected]> on behalf of Lang Yu <[email protected]>
Sent: Wednesday, December 8, 2021 5:26 PM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Yu, Lang <[email protected]>; Lazar, Lijo <[email protected]>; Huang, Ray <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: remove power on/off SDMA in SMU hw_init/fini()
Currently, we don't find some neccesities to power on/off SDMA in SMU hw_init/fini(). It makes more sense in SDMA hw_init/fini().
--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -5
@@ -1350,7 +1350,6 @@ static int smu_hw_init(void *handle) }if (smu->is_apu) { -smu_powergate_sdma (&adev->smu, false);smu_dpm_set_vcn_enable (smu, true);smu_dpm_set_jpeg_enable (smu, true);smu_set_gfx_cgpg (&adev->smu, true);
@@ -1512,10 +1511,6 @@ static int smu_hw_fini(void *handle)if (amdgpu_sriov_vf (adev)&& !amdgpu_sriov_is_pp_one_vf (adev))return 0 ; -if (smu->is_apu) { -smu_powergate_sdma (&adev->smu, true); - } -smu_dpm_set_vcn_enable (smu, false);smu_dpm_set_jpeg_enable (smu, false);
--
2.25.1
Re: [PATCH 2/2] drm/amdgpu: only hw fini SMU fisrt for ASICs need that
In reply to Lang Yu[AMD Official Use Only]
Best Regards,
Kevin
________________________________
From: amd-gfx <[email protected]> on behalf of Lang Yu <[email protected]>
Sent: Wednesday, December 8, 2021 5:26 PM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Yu, Lang <[email protected]>; Lazar, Lijo <[email protected]>; Huang, Ray <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: only hw fini SMU fisrt for ASICs need that
We found some headaches on ASICs don't need that,
so remove that for them.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 47 +++++++++++++++------- 1 file changed, 32 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +32 -15
@@ -2656,6 +2656,36 @@ static int amdgpu_device_ip_late_init(struct amdgpu_device *adev)return 0 ; } +/** +* amdgpu_device_smu_fini_early - smu hw_fini wrapper +* +* @adev: amdgpu_device pointer +* +* For ASICs need to disable SMC first +*/ +static void amdgpu_device_smu_fini_early (struct amdgpu_device *adev) +{ +int i, r; + +if (adev->ip_versions[GC_HWIP ][0 ] >IP_VERSION (9 ,0 ,0 )) +return ; + +for (i =0 ; i < adev->num_ip_blocks; i++) { +if (!adev->ip_blocks[i].status.hw) +continue ; +if (adev->ip_blocks[i].version->type ==AMD_IP_BLOCK_TYPE_SMC ) { + r = adev->ip_blocks[i].version->funcs->hw_fini ((void *)adev); +/* XXX handle errors */ +if (r) { +DRM_DEBUG ("hw_fini of IP block <%s> failed %d\n" , + adev->ip_blocks[i].version->funcs->name, r); + } + adev->ip_blocks[i].status.hw = false; +break ; + } + } +} +static int amdgpu_device_ip_fini_early (struct amdgpu_device *adev) {int i, r;
@@ -2676,21 +2706,8 @@ static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev)amdgpu_device_set_pg_state (adev,AMD_PG_STATE_UNGATE );amdgpu_device_set_cg_state (adev,AMD_CG_STATE_UNGATE ); -/* need to disable SMC first */ -for (i =0 ; i < adev->num_ip_blocks; i++) { -if (!adev->ip_blocks[i].status.hw) -continue ; -if (adev->ip_blocks[i].version->type ==AMD_IP_BLOCK_TYPE_SMC ) { - r = adev->ip_blocks[i].version->funcs->hw_fini ((void *)adev); -/* XXX handle errors */ -if (r) { -DRM_DEBUG ("hw_fini of IP block <%s> failed %d\n" , - adev->ip_blocks[i].version->funcs->name, r); - } - adev->ip_blocks[i].status.hw = false; -break ; - } - } +/* Workaroud for ASICs need to disable SMC first */ +amdgpu_device_smu_fini_early (adev);for (i = adev->num_ip_blocks -1 ; i >=0 ; i--) {if (!adev->ip_blocks[i].status.hw)
--
2.25.1
Quoted 8 lines · Yang(Kevin)
[AMD Official Use Only]
Hi Lang,
the function ofsmu_powergate_sdma()is only valid on renoir chip. if you want to remove it, please also remove following callback pointer in struct pptable_funcs{}.
related macro definitions also need to be cleaned up.
int (*powergate_sdma)(structsmu_context*smu, bool gate);
It will be still called by amdgpu_dpm_set_powergating_by_smu() in sdma_v4_0_hw_init/fini().
Regards,
Lang
Quoted 47 lines
Best Regards,
Kevin
__________________________________________________________________
From: amd-gfx <[email protected]> on behalf of Lang
Yu <[email protected]>
Sent: Wednesday, December 8, 2021 5:26 PM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Yu, Lang
<[email protected]>; Lazar, Lijo <[email protected]>; Huang, Ray
<[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: remove power on/off SDMA in SMU
hw_init/fini()
Currently, we don't find some neccesities to power on/off
SDMA in SMU hw_init/fini(). It makes more sense in SDMA
hw_init/fini().
Signed-off-by: Lang Yu <[email protected]>
---
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index 5839918cb574..2d718c30c8eb 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -1350,7 +1350,6 @@ static int smu_hw_init(void *handle)
}
if (smu->is_apu) {
- smu_powergate_sdma(&adev->smu, false);
smu_dpm_set_vcn_enable(smu, true);
smu_dpm_set_jpeg_enable(smu, true);
smu_set_gfx_cgpg(&adev->smu, true);
@@ -1512,10 +1511,6 @@ static int smu_hw_fini(void *handle)
if (amdgpu_sriov_vf(adev)&& !amdgpu_sriov_is_pp_one_vf(adev))
return 0;
- if (smu->is_apu) {
- smu_powergate_sdma(&adev->smu, true);
- }
-
smu_dpm_set_vcn_enable(smu, false);
smu_dpm_set_jpeg_enable(smu, false);
--
2.25.1Wang, Yang(Kevin)
Reviewed-by[AMD Official Use Only]
OK, I miss this call path.
Best Regards,
Kevin
________________________________
From: Yu, Lang <[email protected]>
Sent: Wednesday, December 8, 2021 6:58 PM
To: Wang, Yang(Kevin) <[email protected]>
Cc: [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Lazar, Lijo <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 1/2] drm/amdgpu: remove power on/off SDMA in SMU hw_init/fini()
Quoted 8 lines · Yang(Kevin)
[AMD Official Use Only]
Hi Lang,
the function ofsmu_powergate_sdma()is only valid on renoir chip. if you want to remove it, please also remove following callback pointer in struct pptable_funcs{}.
related macro definitions also need to be cleaned up.
int (*powergate_sdma)(structsmu_context*smu, bool gate);
It will be still called by amdgpu_dpm_set_powergating_by_smu() in sdma_v4_0_hw_init/fini().
Regards,
Lang
Quoted 47 lines
Best Regards,
Kevin
__________________________________________________________________
From: amd-gfx <[email protected]> on behalf of Lang
Yu <[email protected]>
Sent: Wednesday, December 8, 2021 5:26 PM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Yu, Lang
<[email protected]>; Lazar, Lijo <[email protected]>; Huang, Ray
<[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: remove power on/off SDMA in SMU
hw_init/fini()
Currently, we don't find some neccesities to power on/off
SDMA in SMU hw_init/fini(). It makes more sense in SDMA
hw_init/fini().
Signed-off-by: Lang Yu <[email protected]>
---
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index 5839918cb574..2d718c30c8eb 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -1350,7 +1350,6 @@ static int smu_hw_init(void *handle)
}
if (smu->is_apu) {
- smu_powergate_sdma(&adev->smu, false);
smu_dpm_set_vcn_enable(smu, true);
smu_dpm_set_jpeg_enable(smu, true);
smu_set_gfx_cgpg(&adev->smu, true);
@@ -1512,10 +1511,6 @@ static int smu_hw_fini(void *handle)
if (amdgpu_sriov_vf(adev)&& !amdgpu_sriov_is_pp_one_vf(adev))
return 0;
- if (smu->is_apu) {
- smu_powergate_sdma(&adev->smu, true);
- }
-
smu_dpm_set_vcn_enable(smu, false);
smu_dpm_set_jpeg_enable(smu, false);
--
2.25.1Quoted 68 lines · Yang(Kevin)
[AMD Official Use Only]
OK, I miss this call path.
Reviewed-by Kevin Wang <[email protected]>Best Regards,
Kevin------------------------------------------------------------------------
*From:* Yu, Lang <[email protected]>
*Sent:* Wednesday, December 8, 2021 6:58 PM
*To:* Wang, Yang(Kevin) <[email protected]>
*Cc:* [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Lazar, Lijo <[email protected]>; Huang, Ray <[email protected]> *Subject:* Re: [PATCH 1/2] drm/amdgpu: remove power on/off SDMA in SMU hw_init/fini()Quoted 5 lines · Yang(Kevin)
[AMD Official Use Only]
Hi Lang,
the function ofsmu_powergate_sdma()is only valid on renoir chip. if you want to remove it, please also remove following callbackpointer
Quoted 3 lines
in struct pptable_funcs{}.
related macro definitions also need to be cleaned up. int (*powergate_sdma)(structsmu_context*smu, bool gate);It will be still called by
amdgpu_dpm_set_powergating_by_smu()in sdma_v4_0_hw_init/fini().
Regards,
LangQuoted 5 lines
Best Regards,
Kevin
__________________________________________________________________From: amd-gfx <[email protected]> on behalf
of Lang
Quoted 24 lines
Yu <[email protected]>
Sent: Wednesday, December 8, 2021 5:26 PM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Yu, Lang <[email protected]>; Lazar, Lijo <[email protected]>; Huang, Ray <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: remove power on/off SDMA in SMU hw_init/fini()Currently, we don't find some neccesities to power on/off SDMA in SMU hw_init/fini(). It makes more sense in SDMA hw_init/fini().
Signed-off-by Lang Yu <[email protected]>---
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c| 5 -----1 file changed, 5 deletions(-)diff --git
a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.cb/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.cindex5839918cb574..2d718c30c8eb100644
---a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c+++b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c@@ -1350,7 +1350,6 @@ static intsmu_hw_init(void *handle)}
Quoted 19 lines
Quoted 7 lines
if (
smu->is_apu) {
-smu_powergate_sdma(&adev->smu, false);smu_dpm_set_vcn_enable(smu, true);smu_dpm_set_jpeg_enable(smu, true);smu_set_gfx_cgpg(&adev->smu, true); @@ -1512,10 +1511,6 @@ static intsmu_hw_fini(void *handle)if (amdgpu_sriov_vf(adev)&&!amdgpu_sriov_is_pp_one_vf(adev))
Quoted 11 lines
return 0;
- if (
smu->is_apu) {
-smu_powergate_sdma(&adev->smu, true); - }
-
smu_dpm_set_vcn_enable(smu, false);smu_dpm_set_jpeg_enable(smu, false);--
2.25.1
Hi,
Could this patch be related to the stacktrace I get when setting amdgpu.dpm=0 on Renoir?
I tried to clear it up as much as possible (translated via OTR).
amdgpu 0000:07:00.0: amdgpu: amdgpu_device_ip_init failed
amdgpu 0000:07:00.0: amdgpu: Fatal error during GPU init
hid-multitouch 2003:04F3:ZACC.0001: Input,hiddeu 96, hidrawo: USB HID v1.10 Device CELAN Touchscreen on 00.3-4/inputor amdgpu 0000:07:00.0: amdgpu: amdgpu: finishing device.
[drm] free PSP TMR buffer
amdgpu: probe of 0000:07:00.0 failed with error -95
BUG: unable to handle page fault for address: ffffc90080ccc000 #PF: supervisor write access in kernel modes #PF: error_code(0x0002) - not-present page PGD cd7cc067 P4D cd7cc067 PUD 10d93b067 PMD 10db30067 PTE O Oops: 0002 (#1) SMP NOPTI CPU: 4 PID: 427 Conn: systend-udevd Tainted: G V 5.16.0-0.rcs.8.fc32.qubes.x86_64 eur Hardware name: LENOVO 20Y1S02400/2041502400, BIOS RIBET66U(1.35 ) 07/30/2021 RIP: e030:vcn_v2_0_sw_fini+0x72/0x90 [amdgpu] Code: 89 ef eB 41 17 FE FE 85 c0 75 08 48 69 ef e8 65 10 FE ER 48 Bb 54 24 08 65 48 2b 14 25 28 00 00 00 75 18 48 83 4 10 51 5d c3 c?> 03 00 00 00 00 66 70 24 04 e8 af 07 do ff eb be es RSP: e02b:feffc9004070bc18 EFLAGS: 00010202 RAX: 0000000000000001 RBX: ffffc900B0ccc000 RCX: 0000000000000000 RDX: 0000607ebf40a 100 RSI: feffc9004070bcic RDI: PEEEEEEfco2760401 RBP: ffff88810fe20000 ROB: 0000000000000000 RO9: 0000000080200018 R10: 0000000040000000 R11: 0000000000000004 R12: FF188810fe35a2er R13: fer88810fe36980 R14: 000000000000000b R15: ffff88810111137cf FS: 00007033B0a08b80C0000) GS: PEF 88814070000000000) knlGS:000000000000 CS: e030 DS: 0000 ES: 0000 CRO: 0000000080050033 CR2: ffffc90088ccc000 CR3: 0000000100b9c000 CR4: 0000000000050660 Call Trace: <TASK>
amdgpu_device_ip_fini.isra.O+Oxb6/0x1bo [amdgpu]
amdgpu_device_fini_sw+Ox16/Oxe0 [amdgpu]amdgpu_driver release_kms.0x12/0x30 [amdgpu]
devm_drm_dev_init_release+Ox3d/0x60 tarnir
devres_release_all.0xb8/0x100
really probe.x100/BX3108
_driver_probe_device.exfe/0x180P
driver probe_device-Oxle/8x90
_driver_attach•OxcB/Oxice
? _device_attach_driver Oxee/exeos
? _device_attach_driver.exe/Oxeos
bus_for_each_dev@x89/exdesBus_add_driver Ox149/Oxices
driver register.Ox8f/xee
? Oxffffffffcobddooos
do_one_initcall.0257/8x200
do_init_module=0x5c/8x260
_do_sys_finit_module.Oxae Exi1er
do_syscall_64.0x3b/Bx90
entry_SYSCALL_64_after_huframe.8x44 Axael
RIP: 0033:0x70308ee351345 Code: 00 c3 66 Ze of 1f 84 00 00 00 00 90 83 or le fa 48 89 68 48 89 67 48 89 46 48 89 ca 40 89 c2 40 69 cb 4c 8b 4c 24 08 of 05 <48> 30 01 to ff ff 73 01 c3 48 8b od 2b 6d Oc '00 f? d8 64 89 01 4 RSP: 002b:00007fff2a5c6198 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 RAX: ffffffffffffffda RBX: 00005a0b9881a640 RCX: 0000703d8ee35131 RDX: 0000000000000000 RSI: 00005a0b98819100 RDI: 00000000000000148 RBP: 0000000000020000 ROB: 0000000000000000 RO9; 00005ab9875700N R10: 0000000000000014 R11: 0000000000000246 R12: 0000000000000000 R13: 00005a0b98819000 R14: 00005ab9881b9a0 R15: 0000000000000006 <TASKS Modules linked in: hid_multitouch andgpul) commu_y2 gpu_sched
12c_algo_bit dem_ttn_helper ttn sdhcl_pcl crct1001f_pclmul crc32_pc Imul
drm_kms_helper crc32c_intel cqhci xhci_pci cec sdhci inmexhci_ci_remesaserio_raw ghash_clmulni_intel xhci_hcd muc_core ehci
Jhcd nume_core xen_acpl_processor xen_pr lucnd xen_pelback xen_blkback xen_gntalloc xen_gntdeu xen_eutchn uinputs
CR2: ffffc900B0cce000
--- end trace 6bbd70000e18e7a9 )---