drm/amd/pm: bug fix for baco reset
Subsystems (3)
Kenneth Feng
maintainerPATCH 1/1 drm/amd/pm: bug fix for baco reset
On vega20, rocm-smi gets the wrong gfx voltage after baco reset. This can be reproduced as below.
:~$ rocm-smi --showvoltage GPU[0] : Voltage (mV): 737 :~$ rocm-smi -d0 --gpureset GPU[0] : GPU reset was successful :~$ rocm-smi --showvoltage GPU[0] : Voltage (mV): 1550
Root cause: telemetry is disabled in the asic_init after baco exit. This fix targets to re-enable telemetry then all the power and voltage info can be fetched correctly, mp1 firmware also depends on this setting for dpm arbitration.
--- .../drm/amd/pm/powerplay/hwmgr/vega20_baco.c | 17 +++++++++++++++++ .../drm/amd/pm/powerplay/hwmgr/vega20_baco.h | 2 +- .../drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c | 1 + 3 files changed, 19 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_baco.c +17 -0
@@ -28,9 +28,16 @@#include "vega20_ppsmc.h" #include "vega20_baco.h" #include "vega20_smumgr.h" +#include "smuio/smuio_9_0_offset.h" +#include "smuio/smuio_9_0_sh_mask.h" #include "amdgpu_ras.h" +#define mmSMUSVI0_TFN 0x2 +#define SMUSVI0_TFN___PLANE0_MASK 0x1 +#define SMUSVI0_TFN___PLANE1_MASK 0x2 +#define mmSMUSVI0_TFN_BASE_IDX 0 +static const struct soc15_baco_cmd_entry clean_baco_tbl[] = { {CMD_WRITE ,SOC15_REG_ENTRY (NBIF ,0 , mmBIOS_SCRATCH_6),0 ,0 ,0 ,0 },
@@ -120,3 +127,13 @@ int vega20_baco_apply_vdci_flush_workaround(struct pp_hwmgr *hwmgr)return smum_send_msg_to_smc (hwmgr, PPSMC_MSG_BacoWorkAroundFlushVDCI,NULL ); } + +void vega20_baco_override_telemetry_parameters (struct pp_hwmgr *hwmgr) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev); +uint32_t data =RREG32_SOC15 (SMUIO ,0 , mmSMUSVI0_TFN); + + data &= (~SMUSVI0_TFN___PLANE0_MASK ); + data |=SMUSVI0_TFN___PLANE1_MASK ; +WREG32_SOC15 (SMUIO ,0 , mmSMUSVI0_TFN, data); +}
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_baco.h +1 -1
@@ -29,5 +29,5 @@ extern int vega20_baco_get_capability(struct pp_hwmgr *hwmgr, bool *cap);extern int vega20_baco_get_state (struct pp_hwmgr *hwmgr,enum BACO_STATE *state);extern int vega20_baco_set_state (struct pp_hwmgr *hwmgr,enum BACO_STATE state);extern int vega20_baco_apply_vdci_flush_workaround (struct pp_hwmgr *hwmgr); - +extern void vega20_baco_override_telemetry_parameters (struct pp_hwmgr *hwmgr);#endif
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c +1 -0
@@ -503,6 +503,7 @@ static int vega20_setup_asic_task(struct pp_hwmgr *hwmgr) ret =vega20_baco_apply_vdci_flush_workaround (hwmgr);if (ret)pr_err ("Failed to apply vega20 baco workaround!\n" ); +vega20_baco_override_telemetry_parameters (hwmgr); }return ret;
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Public Use]
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Kenneth Feng
Sent: Thursday, March 18, 2021 12:07 PM
To: [email protected]
Cc: Feng, Kenneth <[email protected]>
Subject: [PATCH] drm/amd/pm: bug fix for baco reset
On vega20, rocm-smi gets the wrong gfx voltage after baco reset. This can be reproduced as below.
:~$ rocm-smi --showvoltage GPU[0] : Voltage (mV): 737 :~$ rocm-smi -d0 --gpureset GPU[0] : GPU reset was successful :~$ rocm-smi --showvoltage GPU[0] : Voltage (mV): 1550
Root cause: telemetry is disabled in the asic_init after baco exit. This fix targets to re-enable telemetry then all the power and voltage info can be fetched correctly, mp1 firmware also depends on this setting for dpm arbitration.
--- .../drm/amd/pm/powerplay/hwmgr/vega20_baco.c | 17 +++++++++++++++++ .../drm/amd/pm/powerplay/hwmgr/vega20_baco.h | 2 +- .../drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c | 1 + 3 files changed, 19 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_baco.c +17 -0
@@ -28,9 +28,16 @@#include "vega20_ppsmc.h" #include "vega20_baco.h" #include "vega20_smumgr.h" +#include "smuio/smuio_9_0_offset.h" +#include "smuio/smuio_9_0_sh_mask.h" #include "amdgpu_ras.h" +#define mmSMUSVI0_TFN 0x2 +#define SMUSVI0_TFN___PLANE0_MASK 0x1 +#define SMUSVI0_TFN___PLANE1_MASK 0x2 +#define mmSMUSVI0_TFN_BASE_IDX 0 +static const struct soc15_baco_cmd_entry clean_baco_tbl[] = { {CMD_WRITE ,SOC15_REG_ENTRY (NBIF ,0 , mmBIOS_SCRATCH_6),0 ,0 ,0 ,0 },
@@ -120,3 +127,13 @@ int vega20_baco_apply_vdci_flush_workaround(struct pp_hwmgr *hwmgr)return smum_send_msg_to_smc (hwmgr, PPSMC_MSG_BacoWorkAroundFlushVDCI,NULL ); } + +void vega20_baco_override_telemetry_parameters (struct pp_hwmgr *hwmgr) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev); +uint32_t data =RREG32_SOC15 (SMUIO ,0 , mmSMUSVI0_TFN); + + data &= (~SMUSVI0_TFN___PLANE0_MASK ); + data |=SMUSVI0_TFN___PLANE1_MASK ; +WREG32_SOC15 (SMUIO ,0 , mmSMUSVI0_TFN, data); +}
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_baco.h +1 -1
@@ -29,5 +29,5 @@ extern int vega20_baco_get_capability(struct pp_hwmgr *hwmgr, bool *cap);extern int vega20_baco_get_state (struct pp_hwmgr *hwmgr,enum BACO_STATE *state);extern int vega20_baco_set_state (struct pp_hwmgr *hwmgr,enum BACO_STATE state);extern int vega20_baco_apply_vdci_flush_workaround (struct pp_hwmgr *hwmgr); - +extern void vega20_baco_override_telemetry_parameters (struct pp_hwmgr *hwmgr);#endif
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c +1 -0
@@ -503,6 +503,7 @@ static int vega20_setup_asic_task(struct pp_hwmgr *hwmgr) ret =vega20_baco_apply_vdci_flush_workaround (hwmgr);if (ret)pr_err ("Failed to apply vega20 baco workaround!\n" ); +vega20_baco_override_telemetry_parameters (hwmgr); }return ret;
Signature · 10 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Cevan.quan%40amd.com%7C7fee5a2166be4f31286408d8e9c33f55%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637516372084403923%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=KEFE61ILud7i%2F28piougWFNBBSYz%2B5mi3dBfHSghllw%3D&reserved=0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Public Use]
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Kenneth Feng
Sent: Thursday, March 18, 2021 9:37 AM
To: [email protected]
Cc: Feng, Kenneth <[email protected]>
Subject: [PATCH] drm/amd/pm: bug fix for baco reset
On vega20, rocm-smi gets the wrong gfx voltage after baco reset. This can be reproduced as below.
:~$ rocm-smi --showvoltage GPU[0] : Voltage (mV): 737 :~$ rocm-smi -d0 --gpureset GPU[0] : GPU reset was successful :~$ rocm-smi --showvoltage GPU[0] : Voltage (mV): 1550
Root cause: telemetry is disabled in the asic_init after baco exit.
This fix targets to re-enable telemetry then all the power and voltage info can be fetched correctly, mp1 firmware also depends on this setting for dpm arbitration.
--- .../drm/amd/pm/powerplay/hwmgr/vega20_baco.c | 17 +++++++++++++++++ .../drm/amd/pm/powerplay/hwmgr/vega20_baco.h | 2 +- .../drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c | 1 + 3 files changed, 19 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_baco.c +7 -0
@@ -28,9 +28,16 @@#include "vega20_ppsmc.h" #include "vega20_baco.h" #include "vega20_smumgr.h" +#include "smuio/smuio_9_0_offset.h" +#include "smuio/smuio_9_0_sh_mask.h" #include "amdgpu_ras.h" +#define mmSMUSVI0_TFN 0x2 +#define SMUSVI0_TFN___PLANE0_MASK 0x1 +#define SMUSVI0_TFN___PLANE1_MASK 0x2 +#define mmSMUSVI0_TFN_BASE_IDX 0 +static const struct soc15_baco_cmd_entry clean_baco_tbl[] = { {CMD_WRITE, SOC15_REG_ENTRY(NBIF, 0, mmBIOS_SCRATCH_6), 0, 0, 0, 0}, @@ -120,3 +127,13 @@ int vega20_baco_apply_vdci_flush_workaround(struct pp_hwmgr *hwmgr)
return smum_send_msg_to_smc(hwmgr, PPSMC_MSG_BacoWorkAroundFlushVDCI, NULL); }
+
+void vega20_baco_override_telemetry_parameters(struct pp_hwmgr *hwmgr) +{
+ struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev);
+ uint32_t data = RREG32_SOC15(SMUIO, 0, mmSMUSVI0_TFN);
+
< > This most likely needs a !VF check. Register may not be accessible for VF cases.
Thanks,
Lijo
+ data &= (~SMUSVI0_TFN___PLANE0_MASK);
+ data |= SMUSVI0_TFN___PLANE1_MASK;
+ WREG32_SOC15(SMUIO, 0, mmSMUSVI0_TFN, data); }
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_baco.h +2 -1
@@ -29,5 +29,5 @@ extern int vega20_baco_get_capability(struct pp_hwmgr *hwmgr, bool *cap); extern int vega20_baco_get_state(struct pp_hwmgr *hwmgr, enum BACO_STATE *state); extern int vega20_baco_set_state(struct pp_hwmgr *hwmgr, enum BACO_STATE state); extern int vega20_baco_apply_vdci_flush_workaround(struct pp_hwmgr *hwmgr); - +extern void vega20_baco_override_telemetry_parameters (struct pp_hwmgr +*hwmgr);#endif
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c +1 -0
@@ -503,6 +503,7 @@ static int vega20_setup_asic_task(struct pp_hwmgr *hwmgr) ret =vega20_baco_apply_vdci_flush_workaround (hwmgr);if (ret)pr_err ("Failed to apply vega20 baco workaround!\n" ); +vega20_baco_override_telemetry_parameters (hwmgr); }return ret;
--
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Clijo.lazar%40amd.com%7C7fee5a2166be4f31286408d8e9c33f55%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637516372082911361%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=yzMgTiFkTVDmMQ%2FxNH4Zztx3NQRXPSCKw7pflm3VUZY%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx