summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
diff options
context:
space:
mode:
authorLijo Lazar <lijo.lazar@amd.com>2024-09-20 14:17:30 +0530
committerAlex Deucher <alexander.deucher@amd.com>2024-10-15 11:16:32 -0400
commited3dac4bf9588b5a68e1a85ac45cbbe180df6d4b (patch)
tree8d1a1e3a28faa3ce62c0aeb969ad62adea8e74ef /drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
parentee52489d1210dbb894fda71957e1e9832126efda (diff)
downloadlwn-ed3dac4bf9588b5a68e1a85ac45cbbe180df6d4b.tar.gz
lwn-ed3dac4bf9588b5a68e1a85ac45cbbe180df6d4b.zip
drm/amdgpu: Check gmc requirement for reset on init
Add a callback to check if there is any condition detected by GMC block for reset on init. One case is if a pending NPS change request is detected. If reset is done because of NPS switch, refresh NPS info from discovery table. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Feifei Xu <Feifei.Xu@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
index 4b70123957df..3a71028e4193 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
@@ -1249,12 +1249,15 @@ int amdgpu_gmc_get_nps_memranges(struct amdgpu_device *adev,
struct amdgpu_gmc_memrange *ranges;
int range_cnt, ret, i, j;
uint32_t nps_type;
+ bool refresh;
if (!mem_ranges)
return -EINVAL;
+ refresh = (adev->init_lvl->level != AMDGPU_INIT_LEVEL_MINIMAL_XGMI) &&
+ (adev->gmc.reset_flags & AMDGPU_GMC_INIT_RESET_NPS);
ret = amdgpu_discovery_get_nps_info(adev, &nps_type, &ranges,
- &range_cnt, false);
+ &range_cnt, refresh);
if (ret)
return ret;
@@ -1380,3 +1383,11 @@ out:
adev->dev,
"NPS mode change request done, reload driver to complete the change\n");
}
+
+bool amdgpu_gmc_need_reset_on_init(struct amdgpu_device *adev)
+{
+ if (adev->gmc.gmc_funcs->need_reset_on_init)
+ return adev->gmc.gmc_funcs->need_reset_on_init(adev);
+
+ return false;
+}