Commit 028cfb24 authored by Evan Quan's avatar Evan Quan Committed by Alex Deucher

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: default avatarEvan Quan <evan.quan@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 4f7d010f
...@@ -2008,8 +2008,24 @@ static void amdgpu_device_fill_reset_magic(struct amdgpu_device *adev) ...@@ -2008,8 +2008,24 @@ static void amdgpu_device_fill_reset_magic(struct amdgpu_device *adev)
*/ */
static bool amdgpu_device_check_vram_lost(struct amdgpu_device *adev) static bool amdgpu_device_check_vram_lost(struct amdgpu_device *adev)
{ {
return !!memcmp(adev->gart.ptr, adev->reset_magic, if (memcmp(adev->gart.ptr, adev->reset_magic,
AMDGPU_RESET_MAGIC_NUM); AMDGPU_RESET_MAGIC_NUM))
return true;
if (!adev->in_gpu_reset)
return false;
/*
* For all ASICs with baco/mode1 reset, the VRAM is
* always assumed to be lost.
*/
switch (amdgpu_asic_reset_method(adev)) {
case AMD_RESET_METHOD_BACO:
case AMD_RESET_METHOD_MODE1:
return true;
default:
return false;
}
} }
/** /**
......
...@@ -1358,8 +1358,6 @@ static int cik_asic_reset(struct amdgpu_device *adev) ...@@ -1358,8 +1358,6 @@ static int cik_asic_reset(struct amdgpu_device *adev)
int r; int r;
if (cik_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) { if (cik_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) {
if (!adev->in_suspend)
amdgpu_inc_vram_lost(adev);
r = amdgpu_dpm_baco_reset(adev); r = amdgpu_dpm_baco_reset(adev);
} else { } else {
r = cik_asic_pci_config_reset(adev); r = cik_asic_pci_config_reset(adev);
......
...@@ -351,8 +351,6 @@ static int nv_asic_reset(struct amdgpu_device *adev) ...@@ -351,8 +351,6 @@ static int nv_asic_reset(struct amdgpu_device *adev)
struct smu_context *smu = &adev->smu; struct smu_context *smu = &adev->smu;
if (nv_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) { if (nv_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) {
if (!adev->in_suspend)
amdgpu_inc_vram_lost(adev);
ret = smu_baco_enter(smu); ret = smu_baco_enter(smu);
if (ret) if (ret)
return ret; return ret;
...@@ -360,8 +358,6 @@ static int nv_asic_reset(struct amdgpu_device *adev) ...@@ -360,8 +358,6 @@ static int nv_asic_reset(struct amdgpu_device *adev)
if (ret) if (ret)
return ret; return ret;
} else { } else {
if (!adev->in_suspend)
amdgpu_inc_vram_lost(adev);
ret = nv_asic_mode1_reset(adev); ret = nv_asic_mode1_reset(adev);
} }
......
...@@ -569,14 +569,10 @@ static int soc15_asic_reset(struct amdgpu_device *adev) ...@@ -569,14 +569,10 @@ static int soc15_asic_reset(struct amdgpu_device *adev)
switch (soc15_asic_reset_method(adev)) { switch (soc15_asic_reset_method(adev)) {
case AMD_RESET_METHOD_BACO: case AMD_RESET_METHOD_BACO:
if (!adev->in_suspend)
amdgpu_inc_vram_lost(adev);
return soc15_asic_baco_reset(adev); return soc15_asic_baco_reset(adev);
case AMD_RESET_METHOD_MODE2: case AMD_RESET_METHOD_MODE2:
return amdgpu_dpm_mode2_reset(adev); return amdgpu_dpm_mode2_reset(adev);
default: default:
if (!adev->in_suspend)
amdgpu_inc_vram_lost(adev);
return soc15_asic_mode1_reset(adev); return soc15_asic_mode1_reset(adev);
} }
} }
......
...@@ -765,8 +765,6 @@ static int vi_asic_reset(struct amdgpu_device *adev) ...@@ -765,8 +765,6 @@ static int vi_asic_reset(struct amdgpu_device *adev)
int r; int r;
if (vi_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) { if (vi_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) {
if (!adev->in_suspend)
amdgpu_inc_vram_lost(adev);
r = amdgpu_dpm_baco_reset(adev); r = amdgpu_dpm_baco_reset(adev);
} else { } else {
r = vi_asic_pci_config_reset(adev); r = vi_asic_pci_config_reset(adev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment