drm/amdgpu/powerplay: properly set PP_GFXOFF_MASK
Subsystems (2)
PATCH 1/2 drm/amdgpu/powerplay: properly set PP_GFXOFF_MASK
So that the setting reflects what the hw supports. This will be used in a subsequent patch so needs to be correct.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 ++ drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 7 +++++++ 2 files changed, 9 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +2 -0
@@ -719,6 +719,7 @@ static int smu_set_funcs(struct amdgpu_device *adev)switch (adev->asic_type) {case CHIP_VEGA20 : + adev->pm.pp_feature &= ~PP_GFXOFF_MASK ;vega20_set_ppt_funcs (smu);break ;case CHIP_NAVI10 :
@@ -727,6 +728,7 @@ static int smu_set_funcs(struct amdgpu_device *adev)navi10_set_ppt_funcs (smu);break ;case CHIP_ARCTURUS : + adev->pm.pp_feature &= ~PP_GFXOFF_MASK ;arcturus_set_ppt_funcs (smu);/* OD is not supported on Arcturus */ smu->od_enabled =false;
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +7 -0
@@ -81,6 +81,8 @@ static void hwmgr_init_workload_prority(struct pp_hwmgr *hwmgr)int hwmgr_early_init (struct pp_hwmgr *hwmgr) { +struct amdgpu_device *adev = hwmgr->adev; +if (!hwmgr)return -EINVAL ;
@@ -96,6 +98,7 @@ int hwmgr_early_init(struct pp_hwmgr *hwmgr)switch (hwmgr->chip_family) {case AMDGPU_FAMILY_CI : + adev->pm.pp_feature &= ~PP_GFXOFF_MASK ; hwmgr->smumgr_funcs = &ci_smu_funcs;ci_set_asic_special_caps (hwmgr); hwmgr->feature_mask &= ~(PP_VBI_TIME_SUPPORT_MASK |
@@ -106,12 +109,14 @@ int hwmgr_early_init(struct pp_hwmgr *hwmgr)smu7_init_function_pointers (hwmgr);break ;case AMDGPU_FAMILY_CZ : + adev->pm.pp_feature &= ~PP_GFXOFF_MASK ; hwmgr->od_enabled = false; hwmgr->smumgr_funcs = &smu8_smu_funcs; hwmgr->feature_mask &= ~PP_GFXOFF_MASK ;smu8_init_function_pointers (hwmgr);break ;case AMDGPU_FAMILY_VI : + adev->pm.pp_feature &= ~PP_GFXOFF_MASK ; hwmgr->feature_mask &= ~PP_GFXOFF_MASK ;switch (hwmgr->chip_id) {case CHIP_TOPAZ :
@@ -153,6 +158,7 @@ int hwmgr_early_init(struct pp_hwmgr *hwmgr)case AMDGPU_FAMILY_AI :switch (hwmgr->chip_id) {case CHIP_VEGA10 : + adev->pm.pp_feature &= ~PP_GFXOFF_MASK ; hwmgr->feature_mask &= ~PP_GFXOFF_MASK ; hwmgr->smumgr_funcs = &vega10_smu_funcs;vega10_hwmgr_init (hwmgr);
@@ -162,6 +168,7 @@ int hwmgr_early_init(struct pp_hwmgr *hwmgr)vega12_hwmgr_init (hwmgr);break ;case CHIP_VEGA20 : + adev->pm.pp_feature &= ~PP_GFXOFF_MASK ; hwmgr->feature_mask &= ~PP_GFXOFF_MASK ; hwmgr->smumgr_funcs = &vega20_smu_funcs;vega20_hwmgr_init (hwmgr);
Signature · 6 lines
2.23.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): 20191113162314.520605-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org
PATCH 2/2 drm/amdgpu: don't read registers if gfxoff is enabled (v2)
When gfxoff is enabled, accessing gfx registers via MMIO can lead to a hang.
v2: return cached registers properly.
--- drivers/gpu/drm/amd/amdgpu/nv.c | 27 ++++++++++++++++---------- drivers/gpu/drm/amd/amdgpu/soc15.c | 31 ++++++++++++++++++------------ 2 files changed, 36 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/amdgpu/nv.c +17 -10
@@ -201,17 +201,25 @@ static uint32_t nv_read_indexed_register(struct amdgpu_device *adev, u32 se_num,return val; } -static uint32_t nv_get_register_value (struct amdgpu_device *adev, +static int nv_get_register_value (struct amdgpu_device *adev,bool indexed,u32 se_num, -u32 sh_num,u32 reg_offset) +u32 sh_num,u32 reg_offset, +u32 *value) {if (indexed) { -return nv_read_indexed_register (adev, se_num, sh_num, reg_offset); +if (adev->pm.pp_feature &PP_GFXOFF_MASK ) +return -EINVAL ; + *value =nv_read_indexed_register (adev, se_num, sh_num, reg_offset); }else { -if (reg_offset ==SOC15_REG_OFFSET (GC ,0 , mmGB_ADDR_CONFIG)) -return adev->gfx.config.gb_addr_config; -return RREG32 (reg_offset); +if (reg_offset ==SOC15_REG_OFFSET (GC ,0 , mmGB_ADDR_CONFIG)) { + *value = adev->gfx.config.gb_addr_config; + }else { +if (adev->pm.pp_feature &PP_GFXOFF_MASK ) +return -EINVAL ; + *value =RREG32 (reg_offset); + } } +return 0 ; } static int nv_read_register(struct amdgpu_device *adev, u32 se_num,
@@ -227,10 +235,9 @@ static int nv_read_register(struct amdgpu_device *adev, u32 se_num, (adev->reg_offset[en->hwip][en->inst][en->seg] + en->reg_offset)) continue; - *value =nv_get_register_value (adev, - nv_allowed_read_registers[i].grbm_indexed, - se_num, sh_num, reg_offset); -return 0 ; +return nv_get_register_value (adev, + nv_allowed_read_registers[i].grbm_indexed, + se_num, sh_num, reg_offset, value); }return -EINVAL ; }
drivers/gpu/drm/amd/amdgpu/soc15.c +19 -12
@@ -363,19 +363,27 @@ static uint32_t soc15_read_indexed_register(struct amdgpu_device *adev, u32 se_nreturn val; } -static uint32_t soc15_get_register_value (struct amdgpu_device *adev, +static int soc15_get_register_value (struct amdgpu_device *adev,bool indexed,u32 se_num, -u32 sh_num,u32 reg_offset) +u32 sh_num,u32 reg_offset, +u32 *value) {if (indexed) { -return soc15_read_indexed_register (adev, se_num, sh_num, reg_offset); +if (adev->pm.pp_feature &PP_GFXOFF_MASK ) +return -EINVAL ; + *value =soc15_read_indexed_register (adev, se_num, sh_num, reg_offset); }else { -if (reg_offset ==SOC15_REG_OFFSET (GC ,0 , mmGB_ADDR_CONFIG)) -return adev->gfx.config.gb_addr_config; -else if (reg_offset ==SOC15_REG_OFFSET (GC ,0 , mmDB_DEBUG2)) -return adev->gfx.config.db_debug2; -return RREG32 (reg_offset); +if (reg_offset ==SOC15_REG_OFFSET (GC ,0 , mmGB_ADDR_CONFIG)) { + *value = adev->gfx.config.gb_addr_config; + }else if (reg_offset ==SOC15_REG_OFFSET (GC ,0 , mmDB_DEBUG2)) { + *value = adev->gfx.config.db_debug2; + }else { +if (adev->pm.pp_feature &PP_GFXOFF_MASK ) +return -EINVAL ; + *value =RREG32 (reg_offset); + } } +return 0 ; } static int soc15_read_register(struct amdgpu_device *adev, u32 se_num,
@@ -391,10 +399,9 @@ static int soc15_read_register(struct amdgpu_device *adev, u32 se_num, + en->reg_offset))continue ; - *value =soc15_get_register_value (adev, - soc15_allowed_read_registers[i].grbm_indexed, - se_num, sh_num, reg_offset); -return 0 ; +return soc15_get_register_value (adev, + soc15_allowed_read_registers[i].grbm_indexed, + se_num, sh_num, reg_offset, value); }return -EINVAL ; }
Signature · 6 lines
2.23.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quan, Evan
Reviewed-by Evan QuanQuoted 94 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Thursday, November 14, 2019 12:23 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu/powerplay: properly setPP_GFXOFF_MASKSo that the setting reflects what the hw supports. This will be used in a subsequent patch so needs to be correct.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 ++ drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 7 +++++++ 2 files changed, 9 insertions(+)drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +2
-0@@ -719,6 +719,7 @@ static int smu_set_funcs(struct amdgpu_device *adev)switch (adev->asic_type) {case CHIP_VEGA20 : + adev->pm.pp_feature &= ~PP_GFXOFF_MASK ;vega20_set_ppt_funcs (smu);break ;case CHIP_NAVI10 :@@ -727,6 +728,7 @@ static int smu_set_funcs(struct amdgpu_device *adev)navi10_set_ppt_funcs (smu);break ;case CHIP_ARCTURUS : + adev->pm.pp_feature &= ~PP_GFXOFF_MASK ;arcturus_set_ppt_funcs (smu);/* OD is not supported on Arcturus */ smu->od_enabled =false;drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +7
-1@@ -81,6 +81,8 @@ static void hwmgr_init_workload_prority(struct pp_hwmgr *hwmgr)int hwmgr_early_init (struct pp_hwmgr *hwmgr) { +struct amdgpu_device *adev = hwmgr->adev; +if (!hwmgr)return -EINVAL ;@@ -96,6 +98,7 @@ int hwmgr_early_init(struct pp_hwmgr *hwmgr)switch (hwmgr->chip_family) {case AMDGPU_FAMILY_CI : + adev->pm.pp_feature &= ~PP_GFXOFF_MASK ; hwmgr->smumgr_funcs = &ci_smu_funcs;ci_set_asic_special_caps (hwmgr); hwmgr->feature_mask &= ~(PP_VBI_TIME_SUPPORT_MASK |@@ -106,12 +109,14 @@ int hwmgr_early_init(struct pp_hwmgr *hwmgr)smu7_init_function_pointers (hwmgr);break ;case AMDGPU_FAMILY_CZ : + adev->pm.pp_feature &= ~PP_GFXOFF_MASK ; hwmgr->od_enabled = false; hwmgr->smumgr_funcs = &smu8_smu_funcs; hwmgr->feature_mask &= ~PP_GFXOFF_MASK ;smu8_init_function_pointers (hwmgr);break ;case AMDGPU_FAMILY_VI : + adev->pm.pp_feature &= ~PP_GFXOFF_MASK ; hwmgr->feature_mask &= ~PP_GFXOFF_MASK ;switch (hwmgr->chip_id) {case CHIP_TOPAZ :@@ -153,6 +158,7 @@ int hwmgr_early_init(struct pp_hwmgr *hwmgr)case AMDGPU_FAMILY_AI :switch (hwmgr->chip_id) {case CHIP_VEGA10 : + adev->pm.pp_feature &= ~PP_GFXOFF_MASK ; hwmgr->feature_mask &= ~PP_GFXOFF_MASK ; hwmgr->smumgr_funcs = &vega10_smu_funcs;vega10_hwmgr_init (hwmgr);@@ -162,6 +168,7 @@ int hwmgr_early_init(struct pp_hwmgr *hwmgr)vega12_hwmgr_init (hwmgr);break ;case CHIP_VEGA20 : + adev->pm.pp_feature &= ~PP_GFXOFF_MASK ; hwmgr->feature_mask &= ~PP_GFXOFF_MASK ; hwmgr->smumgr_funcs = &vega20_smu_funcs;vega20_hwmgr_init (hwmgr); --2.23.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