Commit a31e6287 authored by Victor Zhao's avatar Victor Zhao Committed by Alex Deucher
Browse files

drm/amdgpu: Refactor mode2 reset logic for v11.0.7



- refactor mode2 on v11.0.7 to align with aldebaran
- comment out using mode2 reset as default for now, will introduce
another controller to replace previous reset_level_mask

v2: squash in unused variable removal (Alex)

Signed-off-by: default avatarVictor Zhao <Victor.Zhao@amd.com>
Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a340847b
Loading
Loading
Loading
Loading
+17 −8
Original line number Diff line number Diff line
@@ -31,12 +31,23 @@
#include "amdgpu_psp.h"
#include "amdgpu_xgmi.h"

static bool sienna_cichlid_is_mode2_default(struct amdgpu_reset_control *reset_ctl)
{
#if 0
	struct amdgpu_device *adev = (struct amdgpu_device *)reset_ctl->handle;

	if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(11, 0, 7) &&
	    adev->pm.fw_version >= 0x3a5500 && !amdgpu_sriov_vf(adev))
		return true;
#endif
	return false;
}

static struct amdgpu_reset_handler *
sienna_cichlid_get_reset_handler(struct amdgpu_reset_control *reset_ctl,
			    struct amdgpu_reset_context *reset_context)
{
	struct amdgpu_reset_handler *handler;
	struct amdgpu_device *adev = (struct amdgpu_device *)reset_ctl->handle;

	if (reset_context->method != AMD_RESET_METHOD_NONE) {
		list_for_each_entry(handler, &reset_ctl->reset_handlers,
@@ -44,17 +55,15 @@ sienna_cichlid_get_reset_handler(struct amdgpu_reset_control *reset_ctl,
			if (handler->reset_method == reset_context->method)
				return handler;
		}
	} else {
	}

	if (sienna_cichlid_is_mode2_default(reset_ctl)) {
		list_for_each_entry (handler, &reset_ctl->reset_handlers,
				     handler_list) {
			if (handler->reset_method == AMD_RESET_METHOD_MODE2 &&
			    adev->pm.fw_version >= 0x3a5500 &&
			    !amdgpu_sriov_vf(adev)) {
				reset_context->method = AMD_RESET_METHOD_MODE2;
			if (handler->reset_method == AMD_RESET_METHOD_MODE2)
				return handler;
		}
	}
	}

	return NULL;
}