Commit 5e3f50fd authored by Hawking Zhang's avatar Hawking Zhang Committed by Alex Deucher
Browse files

drm/amdgpu: Extend psp_skip_tmr for bare-metal and sriov



In SRIOV, guest drivers no longer setup/destory
VMR starting from mp0 v11_0_7.

In bare-metal, if boot-time TMR is enabled, some
generation (e.g., mp0 v13_0_x) don’t need runtime
TMR allocation but still require SETUP_TMR command
with tmr address 0 for backward compatibility.
some newer generations require neither SETUP_TMR nor
DESTROY_TMR and will return errors if they are sent.
Driver relies on boot_time_tmr and autoload_supported
to handle these cases correctly.

Signed-off-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: default avatarLikun Gao <Likun.Gao@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 698fa62f
Loading
Loading
Loading
Loading
+12 −28
Original line number Diff line number Diff line
@@ -902,20 +902,12 @@ static int psp_tmr_init(struct psp_context *psp)

static bool psp_skip_tmr(struct psp_context *psp)
{
	switch (amdgpu_ip_version(psp->adev, MP0_HWIP, 0)) {
	case IP_VERSION(11, 0, 9):
	case IP_VERSION(11, 0, 7):
	case IP_VERSION(13, 0, 2):
	case IP_VERSION(13, 0, 6):
	case IP_VERSION(13, 0, 10):
	case IP_VERSION(13, 0, 12):
	case IP_VERSION(13, 0, 14):
	case IP_VERSION(15, 0, 0):
	case IP_VERSION(15, 0, 8):
		return true;
	default:
		return false;
	}
	u32 ip_version = amdgpu_ip_version(psp->adev, MP0_HWIP, 0);

	if (amdgpu_sriov_vf(psp->adev))
		return (ip_version >= IP_VERSION(11, 0, 7)) ? true : false;
	else
		return (!psp->boot_time_tmr || !psp->autoload_supported) ? false : true;
}

static int psp_tmr_load(struct psp_context *psp)
@@ -923,10 +915,7 @@ static int psp_tmr_load(struct psp_context *psp)
	int ret;
	struct psp_gfx_cmd_resp *cmd;

	/* For Navi12 and CHIP_SIENNA_CICHLID SRIOV, do not set up TMR.
	 * Already set up by host driver.
	 */
	if (amdgpu_sriov_vf(psp->adev) && psp_skip_tmr(psp))
	if (psp_skip_tmr(psp))
		return 0;

	cmd = acquire_psp_cmd_buf(psp);
@@ -958,10 +947,7 @@ static int psp_tmr_unload(struct psp_context *psp)
	int ret;
	struct psp_gfx_cmd_resp *cmd;

	/* skip TMR unload for Navi12 and CHIP_SIENNA_CICHLID SRIOV,
	 * as TMR is not loaded at all
	 */
	if (amdgpu_sriov_vf(psp->adev) && psp_skip_tmr(psp))
	if (psp_skip_tmr(psp))
		return 0;

	cmd = acquire_psp_cmd_buf(psp);
@@ -2632,13 +2618,11 @@ static int psp_hw_start(struct psp_context *psp)
			return ret;
	}

	if (!psp->boot_time_tmr || !psp->autoload_supported) {
	ret = psp_tmr_load(psp);
	if (ret) {
		dev_err(adev->dev, "PSP load tmr failed!\n");
		return ret;
	}
	}

	return 0;
}