drm/amd/powerplay: apply Vega20 BACO workaround
Subsystems (2)
PATCH 1/1 drm/amd/powerplay: apply Vega20 BACO workaround
Applied vdci flush workaround for Vega20 BACO.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/soc15.c | 2 ++ .../gpu/drm/amd/powerplay/hwmgr/vega20_baco.c | 12 +++++++++++ .../gpu/drm/amd/powerplay/hwmgr/vega20_baco.h | 1 + .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 11 +++++++++- .../gpu/drm/amd/powerplay/inc/vega20_ppsmc.h | 3 ++- .../drm/amd/powerplay/smumgr/vega20_smumgr.c | 20 +++++++++++++++++++ .../drm/amd/powerplay/smumgr/vega20_smumgr.h | 1 + 8 files changed, 49 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -981,6 +981,7 @@ struct amdgpu_device {int asic_reset_res;struct work_struct xgmi_reset_work; +bool in_baco_reset; };static inline struct amdgpu_device *amdgpu_ttm_adev (struct ttm_bo_device *bdev)
drivers/gpu/drm/amd/amdgpu/soc15.c +2 -0
@@ -452,6 +452,8 @@ static int soc15_asic_baco_reset(struct amdgpu_device *adev)dev_info (adev->dev,"GPU BACO reset\n" ); + adev->in_baco_reset =1 ; +return 0 ; }
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_baco.c +12 -0
@@ -27,6 +27,7 @@#include "vega20_inc.h" #include "vega20_ppsmc.h" #include "vega20_baco.h" +#include "vega20_smumgr.h"
@@ -101,3 +102,14 @@ int vega20_baco_set_state(struct pp_hwmgr *hwmgr, enum BACO_STATE state)return 0 ; } + +int vega20_baco_apply_vdci_flush_workaround (struct pp_hwmgr *hwmgr) +{ +int ret =0 ; + + ret =vega20_set_pptable_driver_address (hwmgr); +if (ret) +return ret; + +return smum_send_msg_to_smc (hwmgr, PPSMC_MSG_BacoWorkAroundFlushVDCI); +}
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_baco.h +1 -0
@@ -28,5 +28,6 @@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);#endif
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +10 -1
@@ -443,6 +443,7 @@ static int vega20_init_sclk_threshold(struct pp_hwmgr *hwmgr)static int vega20_setup_asic_task (struct pp_hwmgr *hwmgr) { +struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev);int ret =0 ; ret =vega20_init_sclk_threshold (hwmgr);
@@ -450,7 +451,15 @@ static int vega20_setup_asic_task(struct pp_hwmgr *hwmgr)"Failed to init sclk threshold!" , return ret); -return 0 ; +if (adev->in_baco_reset) { + adev->in_baco_reset =0 ; + + ret =vega20_baco_apply_vdci_flush_workaround (hwmgr); +if (ret) +pr_err ("Failed to apply vega20 baco workaround!\n" ); + } + +return ret; }/*
drivers/gpu/drm/amd/powerplay/inc/vega20_ppsmc.h +2 -1
@@ -119,7 +119,8 @@#define PPSMC_MSG_PrepareMp1ForShutdown 0x5A#define PPSMC_MSG_SetMGpuFanBoostLimitRpm 0x5D#define PPSMC_MSG_GetAVFSVoltageByDpm 0x5F -#define PPSMC_Message_Count 0x60 +#define PPSMC_MSG_BacoWorkAroundFlushVDCI 0x60 +#define PPSMC_Message_Count 0x61typedef uint32_t PPSMC_Result ;typedef uint32_t PPSMC_Msg ;
drivers/gpu/drm/amd/powerplay/smumgr/vega20_smumgr.c +20 -0
@@ -367,6 +367,26 @@ static int vega20_set_tools_address(struct pp_hwmgr *hwmgr)return ret; } +int vega20_set_pptable_driver_address (struct pp_hwmgr *hwmgr) +{ +struct vega20_smumgr *priv = + (struct vega20_smumgr *)(hwmgr->smu_backend); +int ret =0 ; + +PP_ASSERT_WITH_CODE ((ret =vega20_send_msg_to_smc_with_parameter (hwmgr, + PPSMC_MSG_SetDriverDramAddrHigh, +upper_32_bits (priv->smu_tables.entry[TABLE_PPTABLE ].mc_addr))) ==0 , +"[SetPPtabeDriverAddress] Attempt to Set Dram Addr High Failed!" , + return ret); +PP_ASSERT_WITH_CODE ((ret =vega20_send_msg_to_smc_with_parameter (hwmgr, + PPSMC_MSG_SetDriverDramAddrLow, +lower_32_bits (priv->smu_tables.entry[TABLE_PPTABLE ].mc_addr))) ==0 , +"[SetPPtabeDriverAddress] Attempt to Set Dram Addr Low Failed!" , + return ret); + +return ret; +} +static int vega20_smu_init (struct pp_hwmgr *hwmgr) {struct vega20_smumgr *priv;
drivers/gpu/drm/amd/powerplay/smumgr/vega20_smumgr.h +1 -0
@@ -55,6 +55,7 @@ int vega20_set_activity_monitor_coeff(struct pp_hwmgr *hwmgr, uint8_t *table, uint16_t workload_type);int vega20_get_activity_monitor_coeff (struct pp_hwmgr *hwmgr,uint8_t *table,uint16_t workload_type); +int vega20_set_pptable_driver_address (struct pp_hwmgr *hwmgr);#endif
Signature · 6 lines
2.21.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
Alex Deucher
Acked-byQuoted 5 lines · Evan Quan
Applied vdci flush workaround for Vega20 BACO.
Change-Id Ia132ae30f826643bfba980402a92fbd0ae7a4236Signed-off-by Evan Quan <[email protected]>
Can we re-enable BACO with this fix?
Alex
Quoted 163 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/soc15.c | 2 ++ .../gpu/drm/amd/powerplay/hwmgr/vega20_baco.c | 12 +++++++++++ .../gpu/drm/amd/powerplay/hwmgr/vega20_baco.h | 1 + .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 11 +++++++++- .../gpu/drm/amd/powerplay/inc/vega20_ppsmc.h | 3 ++- .../drm/amd/powerplay/smumgr/vega20_smumgr.c | 20 +++++++++++++++++++ .../drm/amd/powerplay/smumgr/vega20_smumgr.h | 1 + 8 files changed, 49 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -981,6 +981,7 @@ struct amdgpu_device {int asic_reset_res;struct work_struct xgmi_reset_work; +bool in_baco_reset; };static inline struct amdgpu_device *amdgpu_ttm_adev (struct ttm_bo_device *bdev)drivers/gpu/drm/amd/amdgpu/soc15.c +2
-0@@ -452,6 +452,8 @@ static int soc15_asic_baco_reset(struct amdgpu_device *adev)dev_info (adev->dev,"GPU BACO reset\n" ); + adev->in_baco_reset =1 ; +return 0 ; }drivers/gpu/drm/amd/powerplay/hwmgr/vega20_baco.c +12
-0@@ -27,6 +27,7 @@#include "vega20_inc.h" #include "vega20_ppsmc.h" #include "vega20_baco.h" +#include "vega20_smumgr.h" @@ -101,3 +102,14 @@ int vega20_baco_set_state(struct pp_hwmgr *hwmgr, enum BACO_STATE state)return 0 ; } + +int vega20_baco_apply_vdci_flush_workaround (struct pp_hwmgr *hwmgr) +{ +int ret =0 ; + + ret =vega20_set_pptable_driver_address (hwmgr); +if (ret) +return ret; + +return smum_send_msg_to_smc (hwmgr, PPSMC_MSG_BacoWorkAroundFlushVDCI); +}drivers/gpu/drm/amd/powerplay/hwmgr/vega20_baco.h +1
-0@@ -28,5 +28,6 @@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);#endif drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +10
-1@@ -443,6 +443,7 @@ static int vega20_init_sclk_threshold(struct pp_hwmgr *hwmgr)static int vega20_setup_asic_task (struct pp_hwmgr *hwmgr) { +struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev);int ret =0 ; ret =vega20_init_sclk_threshold (hwmgr);@@ -450,7 +451,15 @@ static int vega20_setup_asic_task(struct pp_hwmgr *hwmgr)"Failed to init sclk threshold!" , return ret); -return 0 ; +if (adev->in_baco_reset) { + adev->in_baco_reset =0 ; + + ret =vega20_baco_apply_vdci_flush_workaround (hwmgr); +if (ret) +pr_err ("Failed to apply vega20 baco workaround!\n" ); + } + +return ret; }/* drivers/gpu/drm/amd/powerplay/inc/vega20_ppsmc.h +2
-1@@ -119,7 +119,8 @@#define PPSMC_MSG_PrepareMp1ForShutdown 0x5A#define PPSMC_MSG_SetMGpuFanBoostLimitRpm 0x5D#define PPSMC_MSG_GetAVFSVoltageByDpm 0x5F -#define PPSMC_Message_Count 0x60 +#define PPSMC_MSG_BacoWorkAroundFlushVDCI 0x60 +#define PPSMC_Message_Count 0x61typedef uint32_t PPSMC_Result ;typedef uint32_t PPSMC_Msg ;drivers/gpu/drm/amd/powerplay/smumgr/vega20_smumgr.c +20
-0@@ -367,6 +367,26 @@ static int vega20_set_tools_address(struct pp_hwmgr *hwmgr)return ret; } +int vega20_set_pptable_driver_address (struct pp_hwmgr *hwmgr) +{ +struct vega20_smumgr *priv = + (struct vega20_smumgr *)(hwmgr->smu_backend); +int ret =0 ; + +PP_ASSERT_WITH_CODE ((ret =vega20_send_msg_to_smc_with_parameter (hwmgr, + PPSMC_MSG_SetDriverDramAddrHigh, +upper_32_bits (priv->smu_tables.entry[TABLE_PPTABLE ].mc_addr))) ==0 , +"[SetPPtabeDriverAddress] Attempt to Set Dram Addr High Failed!" , + return ret); +PP_ASSERT_WITH_CODE ((ret =vega20_send_msg_to_smc_with_parameter (hwmgr, + PPSMC_MSG_SetDriverDramAddrLow, +lower_32_bits (priv->smu_tables.entry[TABLE_PPTABLE ].mc_addr))) ==0 , +"[SetPPtabeDriverAddress] Attempt to Set Dram Addr Low Failed!" , + return ret); + +return ret; +} +static int vega20_smu_init (struct pp_hwmgr *hwmgr) {struct vega20_smumgr *priv;drivers/gpu/drm/amd/powerplay/smumgr/vega20_smumgr.h +1
-1@@ -55,6 +55,7 @@ int vega20_set_activity_monitor_coeff(struct pp_hwmgr *hwmgr, uint8_t *table, uint16_t workload_type);int vega20_get_activity_monitor_coeff (struct pp_hwmgr *hwmgr,uint8_t *table,uint16_t workload_type); +int vega20_set_pptable_driver_address (struct pp_hwmgr *hwmgr);#endif --2.21.0
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): CADnq5_PAD=8+=16qPrKHfhze59UobFhYESPpd-C3u8gQv6D-Lw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Not now. There is still some issue to work out. I just added you to that thread.
Regards,
Evan
Quoted 184 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, March 07, 2019 10:46 AM
To: Quan, Evan <[email protected]>
Cc: amd-gfx list <[email protected]>; Xu, Feifei <[email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH] drm/amd/powerplay: apply Vega20 BACO workaroundQuoted 5 lines · Evan Quan
Applied vdci flush workaround for Vega20 BACO.
Change-Id Ia132ae30f826643bfba980402a92fbd0ae7a4236Signed-off-by Evan Quan <[email protected]>Acked-by Alex Deucher <[email protected]>Can we re-enable BACO with this fix?
Alex
Quoted 8 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/soc15.c | 2 ++ .../gpu/drm/amd/powerplay/hwmgr/vega20_baco.c | 12 +++++++++++ .../gpu/drm/amd/powerplay/hwmgr/vega20_baco.h | 1 + .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 11 +++++++++- .../gpu/drm/amd/powerplay/inc/vega20_ppsmc.h | 3 ++-
.../drm/amd/powerplay/smumgr/vega20_smumgr.c| 20+++++++++++++++++++
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_baco.c int vega20_baco_set_state(struct pp_hwmgr
Quoted 45 lines
.../drm/amd/powerplay/smumgr/vega20_smumgr.h| 1 +8 files changed, 49 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -981,6 +981,7 @@ struct amdgpu_device {int asic_reset_res;struct work_struct xgmi_reset_work; +bool in_baco_reset; }; static inline struct amdgpu_device *amdgpu_ttm_adev(struct
ttm_bo_device*bdev) diff --gita/drivers/gpu/drm/amd/amdgpu/soc15.cb/drivers/gpu/drm/amd/amdgpu/soc15.c
indexcc80f050cbf6..75a408a216b9100644drivers/gpu/drm/amd/amdgpu/soc15.c +2
-0@@ -452,6 +452,8 @@ static int soc15_asic_baco_reset(struct amdgpu_device *adev) dev_info(adev->dev, "GPU BACO reset\n"); + adev->in_baco_reset =1 ; +return 0 ; }drivers/gpu/drm/amd/powerplay/hwmgr/vega20_baco.c +1
-0@@ -27,6 +27,7 @@#include "vega20_inc.h" #include "vega20_ppsmc.h" #include "vega20_baco.h" +#include "vega20_smumgr.h" @@ -101,3 +102,14 @@ int vega20_baco_set_state(struct pp_hwmgr*hwmgr,
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_baco.c int vega20_baco_set_state(struct pp_hwmgr *hwmgr, enum BACO_STATE state)
Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_baco.c +2
-0enum BACO_STATE state)return 0 ; } + +int vega20_baco_apply_vdci_flush_workaround(struct pp_hwmgr*hwmgr) {
Quoted 15 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_baco.c +9
-0+int ret =0 ; + + ret =vega20_set_pptable_driver_address (hwmgr); +if (ret) +return ret; + +return smum_send_msg_to_smc (hwmgr, +PPSMC_MSG_BacoWorkAroundFlushVDCI); +}drivers/gpu/drm/amd/powerplay/hwmgr/vega20_baco.h +0
-0drivers/gpu/drm/amd/powerplay/hwmgr/vega20_baco.h line 29
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_baco.h +0
-0@@ -28,5 +28,6 @@extern int vega20_baco_get_capability (struct pp_hwmgr *hwmgr,bool *cap); extern int vega20_baco_get_state(struct pp_hwmgr *hwmgr,enum
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c static int vega20_setup_asic_task(struct
Quoted 21 lines
BACO_STATE*state); extern intvega20_baco_set_state(struct pp_hwmgr *hwmgr, enum BACO_STATE state);drivers/gpu/drm/amd/powerplay/hwmgr/vega20_baco.h +2
-0+extern int vega20_baco_apply_vdci_flush_workaround (struct pp_hwmgr +*hwmgr);#endif drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0@@ -443,6 +443,7 @@ static int vega20_init_sclk_threshold(struct pp_hwmgr *hwmgr)static int vega20_setup_asic_task (struct pp_hwmgr *hwmgr) { +struct amdgpu_device *adev = (struct amdgpu_device + *)(hwmgr->adev);int ret =0 ; ret =vega20_init_sclk_threshold (hwmgr);@@ -450,7 +451,15 @@ static int vega20_setup_asic_task(struct
pp_hwmgr*hwmgr)drivers/gpu/drm/amd/powerplay/smumgr/vega20_smumgr.c static int vega20_set_tools_address(struct
Quoted 37 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +9
-1"Failed to init sclk threshold!" , return ret); -return 0 ; +if (adev->in_baco_reset) { + adev->in_baco_reset =0 ; + + ret =vega20_baco_apply_vdci_flush_workaround (hwmgr); +if (ret) +pr_err ("Failed to apply vega20 baco workaround!\n" ); + } + +return ret; }/* drivers/gpu/drm/amd/powerplay/inc/vega20_ppsmc.h +2
-1@@ -119,7 +119,8 @@#define PPSMC_MSG_PrepareMp1ForShutdown 0x5A#define PPSMC_MSG_SetMGpuFanBoostLimitRpm 0x5D#define PPSMC_MSG_GetAVFSVoltageByDpm 0x5F -#define PPSMC_Message_Count 0x60 +#define PPSMC_MSG_BacoWorkAroundFlushVDCI 0x60 +#define PPSMC_Message_Count 0x61typedef uint32_t PPSMC_Result ;typedef uint32_t PPSMC_Msg ;drivers/gpu/drm/amd/powerplay/smumgr/vega20_smumgr.c +0
-0@@ -367,6 +367,26 @@ static int vega20_set_tools_address(struct
pp_hwmgr*hwmgr)drivers/gpu/drm/amd/powerplay/smumgr/vega20_smumgr.c static int vega20_set_tools_address(struct pp_hwmgr *hwmgr)
Quoted 9 lines
drivers/gpu/drm/amd/powerplay/smumgr/vega20_smumgr.c +6
-0return ret; } +int vega20_set_pptable_driver_address (struct pp_hwmgr *hwmgr) { +struct vega20_smumgr *priv = + (struct vega20_smumgr *)(hwmgr->smu_backend); +int ret =0 ; + + PP_ASSERT_WITH_CODE((ret =vega20_send_msg_to_smc_with_parameter(hwmgr,
drivers/gpu/drm/amd/powerplay/smumgr/vega20_smumgr.c static int vega20_set_tools_address(struct · line 379
Quoted 4 lines
drivers/gpu/drm/amd/powerplay/smumgr/vega20_smumgr.c +3
-0+ PPSMC_MSG_SetDriverDramAddrHigh, + upper_32_bits(priv- smu_tables.entry[TABLE_PPTABLE].mc_addr))) == 0, + "[SetPPtabeDriverAddress] Attempt to Set Dram Addr HighFailed!",
drivers/gpu/drm/amd/powerplay/smumgr/vega20_smumgr.c static int vega20_set_tools_address(struct · line 381
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/smumgr/vega20_smumgr.c +2
-0+ return ret); + PP_ASSERT_WITH_CODE((ret =vega20_send_msg_to_smc_with_parameter(hwmgr,
drivers/gpu/drm/amd/powerplay/smumgr/vega20_smumgr.c static int vega20_set_tools_address(struct · line 385
Quoted 4 lines
drivers/gpu/drm/amd/powerplay/smumgr/vega20_smumgr.c +3
-0+ PPSMC_MSG_SetDriverDramAddrLow, + lower_32_bits(priv- smu_tables.entry[TABLE_PPTABLE].mc_addr))) == 0, + "[SetPPtabeDriverAddress] Attempt to Set Dram Addr LowFailed!",
Quoted 28 lines
drivers/gpu/drm/amd/powerplay/smumgr/vega20_smumgr.h int vega20_set_activity_monitor_coeff(struct
Quoted 13 lines
drivers/gpu/drm/amd/powerplay/smumgr/vega20_smumgr.c +5
-0+ return ret); + +return ret; +} +static int vega20_smu_init (struct pp_hwmgr *hwmgr) {struct vega20_smumgr *priv;drivers/gpu/drm/amd/powerplay/smumgr/vega20_smumgr.h +0
-0@@ -55,6 +55,7 @@ int vega20_set_activity_monitor_coeff(struct
pp_hwmgr*hwmgr,Quoted 14 lines
drivers/gpu/drm/amd/powerplay/smumgr/vega20_smumgr.h +1
-1uint8_t *table, uint16_t workload_type); intvega20_get_activity_monitor_coeff (struct pp_hwmgr *hwmgr,uint8_t *table,uint16_t workload_type); +int vega20_set_pptable_driver_address (struct pp_hwmgr *hwmgr);#endif --2.21.0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx