drm/amdgpu: fix wrong vram lost counter increment V2
Subsystems (2)
PATCH 1/1 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
Change-Id I8b9959a5d1632abc774ba07d56cf295bdd8288eb
Signed-off-by Evan Quan <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 20 ++++++++++++++++++-- drivers/gpu/drm/amd/amdgpu/cik.c | 2 -- drivers/gpu/drm/amd/amdgpu/nv.c | 4 ---- drivers/gpu/drm/amd/amdgpu/soc15.c | 4 ---- drivers/gpu/drm/amd/amdgpu/vi.c | 2 -- 5 files changed, 18 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +18 -2
@@ -2087,8 +2087,24 @@ static void amdgpu_device_fill_reset_magic(struct amdgpu_device *adev)*/ static bool amdgpu_device_check_vram_lost (struct amdgpu_device *adev) { -return !!memcmp (adev->gart.ptr, adev->reset_magic, -AMDGPU_RESET_MAGIC_NUM ); +if (memcmp (adev->gart.ptr, adev->reset_magic, +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; + } }/**
drivers/gpu/drm/amd/amdgpu/cik.c +0 -2
@@ -1358,8 +1358,6 @@ static int cik_asic_reset(struct amdgpu_device *adev)int r;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); }else { r =cik_asic_pci_config_reset (adev);
drivers/gpu/drm/amd/amdgpu/nv.c +0 -4
@@ -351,8 +351,6 @@ static int nv_asic_reset(struct amdgpu_device *adev)struct smu_context *smu = &adev->smu;if (nv_asic_reset_method (adev) ==AMD_RESET_METHOD_BACO ) { -if (!adev->in_suspend) -amdgpu_inc_vram_lost (adev); ret =smu_baco_enter (smu);if (ret)return ret;
@@ -360,8 +358,6 @@ static int nv_asic_reset(struct amdgpu_device *adev)if (ret)return ret; }else { -if (!adev->in_suspend) -amdgpu_inc_vram_lost (adev); ret =nv_asic_mode1_reset (adev); }
drivers/gpu/drm/amd/amdgpu/soc15.c +0 -4
@@ -569,14 +569,10 @@ static int soc15_asic_reset(struct amdgpu_device *adev)switch (soc15_asic_reset_method (adev)) {case AMD_RESET_METHOD_BACO : -if (!adev->in_suspend) -amdgpu_inc_vram_lost (adev);return soc15_asic_baco_reset (adev);case AMD_RESET_METHOD_MODE2 :return amdgpu_dpm_mode2_reset (adev);default : -if (!adev->in_suspend) -amdgpu_inc_vram_lost (adev);return soc15_asic_mode1_reset (adev); } }
drivers/gpu/drm/amd/amdgpu/vi.c +0 -2
@@ -744,8 +744,6 @@ static int vi_asic_reset(struct amdgpu_device *adev)int r;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); }else { r =vi_asic_pci_config_reset (adev);
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 7 lines · Evan Quan
Vram lost counter is wrongly increased by two during baco reset.
V2: assumed vram lost for mode1 reset on all ASICs
Change-Id I8b9959a5d1632abc774ba07d56cf295bdd8288ebSigned-off-by Evan Quan <[email protected]>
Acked-by Alex Deucher <[email protected]>
Quoted 109 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 20 ++++++++++++++++++-- drivers/gpu/drm/amd/amdgpu/cik.c | 2 -- drivers/gpu/drm/amd/amdgpu/nv.c | 4 ---- drivers/gpu/drm/amd/amdgpu/soc15.c | 4 ---- drivers/gpu/drm/amd/amdgpu/vi.c | 2 -- 5 files changed, 18 insertions(+), 14 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +18
-2@@ -2087,8 +2087,24 @@ static void amdgpu_device_fill_reset_magic(struct amdgpu_device *adev)*/ static bool amdgpu_device_check_vram_lost (struct amdgpu_device *adev) { -return !!memcmp (adev->gart.ptr, adev->reset_magic, -AMDGPU_RESET_MAGIC_NUM ); +if (memcmp (adev->gart.ptr, adev->reset_magic, +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; + } }/** drivers/gpu/drm/amd/amdgpu/cik.c +0
-2@@ -1358,8 +1358,6 @@ static int cik_asic_reset(struct amdgpu_device *adev)int r;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); }else { r =cik_asic_pci_config_reset (adev);drivers/gpu/drm/amd/amdgpu/nv.c +0
-4@@ -351,8 +351,6 @@ static int nv_asic_reset(struct amdgpu_device *adev)struct smu_context *smu = &adev->smu;if (nv_asic_reset_method (adev) ==AMD_RESET_METHOD_BACO ) { -if (!adev->in_suspend) -amdgpu_inc_vram_lost (adev); ret =smu_baco_enter (smu);if (ret)return ret;@@ -360,8 +358,6 @@ static int nv_asic_reset(struct amdgpu_device *adev)if (ret)return ret; }else { -if (!adev->in_suspend) -amdgpu_inc_vram_lost (adev); ret =nv_asic_mode1_reset (adev); }drivers/gpu/drm/amd/amdgpu/soc15.c +0
-4@@ -569,14 +569,10 @@ static int soc15_asic_reset(struct amdgpu_device *adev)switch (soc15_asic_reset_method (adev)) {case AMD_RESET_METHOD_BACO : -if (!adev->in_suspend) -amdgpu_inc_vram_lost (adev);return soc15_asic_baco_reset (adev);case AMD_RESET_METHOD_MODE2 :return amdgpu_dpm_mode2_reset (adev);default : -if (!adev->in_suspend) -amdgpu_inc_vram_lost (adev);return soc15_asic_mode1_reset (adev); } }drivers/gpu/drm/amd/amdgpu/vi.c +0
-3@@ -744,8 +744,6 @@ static int vi_asic_reset(struct amdgpu_device *adev)int r;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); }else { r =vi_asic_pci_config_reset (adev); --2.26.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