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

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
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -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)
{
	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;
	}
}

/**
+0 −2
Original line number Diff line number Diff line
@@ -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);
+0 −4
Original line number Diff line number Diff line
@@ -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);
	}

+0 −4
Original line number Diff line number Diff line
@@ -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);
	}
}
+0 −2
Original line number Diff line number Diff line
@@ -765,8 +765,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);