Commit 0ff38226 authored by Lijo Lazar's avatar Lijo Lazar Committed by Alex Deucher
Browse files

drm/amdgpu: Add interface for TOS reload cases



Add interface to check if a different TOS needs to be loaded than the
one which is which is already active on the SOC. Presently the interface
is restricted to specific variants of PSPv13.0.

Signed-off-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Reviewed-by: default avatarFeifei Xu <Feifei.Xu@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Acked-by: default avatarRajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Tested-by: default avatarRajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent c4f00312
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -2266,6 +2266,19 @@ bool amdgpu_psp_get_ras_capability(struct psp_context *psp)
	}
}

bool amdgpu_psp_tos_reload_needed(struct amdgpu_device *adev)
{
	struct psp_context *psp = &adev->psp;

	if (amdgpu_sriov_vf(adev))
		return false;

	if (psp->funcs && psp->funcs->is_reload_needed)
		return psp->funcs->is_reload_needed(psp);

	return false;
}

static int psp_hw_start(struct psp_context *psp)
{
	struct amdgpu_device *adev = psp->adev;
+2 −0
Original line number Diff line number Diff line
@@ -139,6 +139,7 @@ struct psp_funcs {
	int (*fatal_error_recovery_quirk)(struct psp_context *psp);
	bool (*get_ras_capability)(struct psp_context *psp);
	bool (*is_aux_sos_load_required)(struct psp_context *psp);
	bool (*is_reload_needed)(struct psp_context *psp);
};

struct ta_funcs {
@@ -560,5 +561,6 @@ bool amdgpu_psp_get_ras_capability(struct psp_context *psp);

int psp_config_sq_perfmon(struct psp_context *psp, uint32_t xcp_id,
	bool core_override_enable, bool reg_override_enable, bool perfmon_override_enable);
bool amdgpu_psp_tos_reload_needed(struct amdgpu_device *adev);

#endif
+25 −0
Original line number Diff line number Diff line
@@ -823,6 +823,30 @@ static bool psp_v13_0_is_aux_sos_load_required(struct psp_context *psp)
	return (pmfw_ver < 0x557300);
}

static bool psp_v13_0_is_reload_needed(struct psp_context *psp)
{
	uint32_t ucode_ver;

	if (!psp_v13_0_is_sos_alive(psp))
		return false;

	/* Restrict reload support only to specific IP versions */
	switch (amdgpu_ip_version(psp->adev, MP0_HWIP, 0)) {
	case IP_VERSION(13, 0, 2):
	case IP_VERSION(13, 0, 6):
	case IP_VERSION(13, 0, 14):
		/* TOS version read from microcode header */
		ucode_ver = psp->sos.fw_version;
		/* Read TOS version from hardware */
		psp_v13_0_init_sos_version(psp);
		return (ucode_ver != psp->sos.fw_version);
	default:
		return false;
	}

	return false;
}

static const struct psp_funcs psp_v13_0_funcs = {
	.init_microcode = psp_v13_0_init_microcode,
	.wait_for_bootloader = psp_v13_0_wait_for_bootloader_steady_state,
@@ -847,6 +871,7 @@ static const struct psp_funcs psp_v13_0_funcs = {
	.fatal_error_recovery_quirk = psp_v13_0_fatal_error_recovery_quirk,
	.get_ras_capability = psp_v13_0_get_ras_capability,
	.is_aux_sos_load_required = psp_v13_0_is_aux_sos_load_required,
	.is_reload_needed = psp_v13_0_is_reload_needed,
};

void psp_v13_0_set_psp_funcs(struct psp_context *psp)