Skip to content

Commit 028cfb2

Browse files
Evan Quanalexdeucher
authored andcommitted
drm/amdgpu: fix wrong vram lost counter increment V2
Vram lost counter is wrongly increased by two during baco reset. V2: assumed vram lost for mode1 reset on all ASICs Signed-off-by: Evan Quan <[email protected]> Acked-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 4f7d010 commit 028cfb2

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,8 +2008,24 @@ static void amdgpu_device_fill_reset_magic(struct amdgpu_device *adev)
20082008
*/
20092009
static bool amdgpu_device_check_vram_lost(struct amdgpu_device *adev)
20102010
{
2011-
return !!memcmp(adev->gart.ptr, adev->reset_magic,
2012-
AMDGPU_RESET_MAGIC_NUM);
2011+
if (memcmp(adev->gart.ptr, adev->reset_magic,
2012+
AMDGPU_RESET_MAGIC_NUM))
2013+
return true;
2014+
2015+
if (!adev->in_gpu_reset)
2016+
return false;
2017+
2018+
/*
2019+
* For all ASICs with baco/mode1 reset, the VRAM is
2020+
* always assumed to be lost.
2021+
*/
2022+
switch (amdgpu_asic_reset_method(adev)) {
2023+
case AMD_RESET_METHOD_BACO:
2024+
case AMD_RESET_METHOD_MODE1:
2025+
return true;
2026+
default:
2027+
return false;
2028+
}
20132029
}
20142030

20152031
/**

drivers/gpu/drm/amd/amdgpu/cik.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,8 +1358,6 @@ static int cik_asic_reset(struct amdgpu_device *adev)
13581358
int r;
13591359

13601360
if (cik_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) {
1361-
if (!adev->in_suspend)
1362-
amdgpu_inc_vram_lost(adev);
13631361
r = amdgpu_dpm_baco_reset(adev);
13641362
} else {
13651363
r = cik_asic_pci_config_reset(adev);

drivers/gpu/drm/amd/amdgpu/nv.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,17 +351,13 @@ static int nv_asic_reset(struct amdgpu_device *adev)
351351
struct smu_context *smu = &adev->smu;
352352

353353
if (nv_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) {
354-
if (!adev->in_suspend)
355-
amdgpu_inc_vram_lost(adev);
356354
ret = smu_baco_enter(smu);
357355
if (ret)
358356
return ret;
359357
ret = smu_baco_exit(smu);
360358
if (ret)
361359
return ret;
362360
} else {
363-
if (!adev->in_suspend)
364-
amdgpu_inc_vram_lost(adev);
365361
ret = nv_asic_mode1_reset(adev);
366362
}
367363

drivers/gpu/drm/amd/amdgpu/soc15.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -569,14 +569,10 @@ static int soc15_asic_reset(struct amdgpu_device *adev)
569569

570570
switch (soc15_asic_reset_method(adev)) {
571571
case AMD_RESET_METHOD_BACO:
572-
if (!adev->in_suspend)
573-
amdgpu_inc_vram_lost(adev);
574572
return soc15_asic_baco_reset(adev);
575573
case AMD_RESET_METHOD_MODE2:
576574
return amdgpu_dpm_mode2_reset(adev);
577575
default:
578-
if (!adev->in_suspend)
579-
amdgpu_inc_vram_lost(adev);
580576
return soc15_asic_mode1_reset(adev);
581577
}
582578
}

drivers/gpu/drm/amd/amdgpu/vi.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -765,8 +765,6 @@ static int vi_asic_reset(struct amdgpu_device *adev)
765765
int r;
766766

767767
if (vi_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) {
768-
if (!adev->in_suspend)
769-
amdgpu_inc_vram_lost(adev);
770768
r = amdgpu_dpm_baco_reset(adev);
771769
} else {
772770
r = vi_asic_pci_config_reset(adev);

0 commit comments

Comments
 (0)