Commit 995da6cc authored by Evan Quan's avatar Evan Quan Committed by Alex Deucher

drm/amdgpu: update psp firmwares loading sequence V2

For those ASICs with DF Cstate management centralized to PMFW,
TMR setup should be performed between pmfw loading and other
non-psp firmwares loading.

V2: skip possible SMU firmware reloading
Signed-off-by: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent f4a3c42b
...@@ -38,6 +38,39 @@ ...@@ -38,6 +38,39 @@
static void psp_set_funcs(struct amdgpu_device *adev); static void psp_set_funcs(struct amdgpu_device *adev);
/*
* Due to DF Cstate management centralized to PMFW, the firmware
* loading sequence will be updated as below:
* - Load KDB
* - Load SYS_DRV
* - Load tOS
* - Load PMFW
* - Setup TMR
* - Load other non-psp fw
* - Load ASD
* - Load XGMI/RAS/HDCP/DTM TA if any
*
* This new sequence is required for
* - Arcturus
* - Navi12 and onwards
*/
static void psp_check_pmfw_centralized_cstate_management(struct psp_context *psp)
{
struct amdgpu_device *adev = psp->adev;
psp->pmfw_centralized_cstate_management = false;
if (amdgpu_sriov_vf(adev))
return;
if (adev->flags & AMD_IS_APU)
return;
if ((adev->asic_type == CHIP_ARCTURUS) ||
(adev->asic_type >= CHIP_NAVI12))
psp->pmfw_centralized_cstate_management = true;
}
static int psp_early_init(void *handle) static int psp_early_init(void *handle)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct amdgpu_device *adev = (struct amdgpu_device *)handle;
...@@ -75,6 +108,8 @@ static int psp_early_init(void *handle) ...@@ -75,6 +108,8 @@ static int psp_early_init(void *handle)
psp->adev = adev; psp->adev = adev;
psp_check_pmfw_centralized_cstate_management(psp);
return 0; return 0;
} }
...@@ -1116,11 +1151,18 @@ static int psp_hw_start(struct psp_context *psp) ...@@ -1116,11 +1151,18 @@ static int psp_hw_start(struct psp_context *psp)
return ret; return ret;
} }
/*
* For those ASICs with DF Cstate management centralized
* to PMFW, TMR setup should be performed after PMFW
* loaded and before other non-psp firmware loaded.
*/
if (!psp->pmfw_centralized_cstate_management) {
ret = psp_tmr_load(psp); ret = psp_tmr_load(psp);
if (ret) { if (ret) {
DRM_ERROR("PSP load tmr failed!\n"); DRM_ERROR("PSP load tmr failed!\n");
return ret; return ret;
} }
}
return 0; return 0;
} }
...@@ -1316,7 +1358,8 @@ static int psp_np_fw_load(struct psp_context *psp) ...@@ -1316,7 +1358,8 @@ static int psp_np_fw_load(struct psp_context *psp)
struct amdgpu_firmware_info *ucode; struct amdgpu_firmware_info *ucode;
struct amdgpu_device* adev = psp->adev; struct amdgpu_device* adev = psp->adev;
if (psp->autoload_supported) { if (psp->autoload_supported ||
psp->pmfw_centralized_cstate_management) {
ucode = &adev->firmware.ucode[AMDGPU_UCODE_ID_SMC]; ucode = &adev->firmware.ucode[AMDGPU_UCODE_ID_SMC];
if (!ucode->fw || amdgpu_sriov_vf(adev)) if (!ucode->fw || amdgpu_sriov_vf(adev))
goto out; goto out;
...@@ -1326,6 +1369,14 @@ static int psp_np_fw_load(struct psp_context *psp) ...@@ -1326,6 +1369,14 @@ static int psp_np_fw_load(struct psp_context *psp)
return ret; return ret;
} }
if (psp->pmfw_centralized_cstate_management) {
ret = psp_tmr_load(psp);
if (ret) {
DRM_ERROR("PSP load tmr failed!\n");
return ret;
}
}
out: out:
for (i = 0; i < adev->firmware.max_ucodes; i++) { for (i = 0; i < adev->firmware.max_ucodes; i++) {
ucode = &adev->firmware.ucode[i]; ucode = &adev->firmware.ucode[i];
...@@ -1333,7 +1384,9 @@ static int psp_np_fw_load(struct psp_context *psp) ...@@ -1333,7 +1384,9 @@ static int psp_np_fw_load(struct psp_context *psp)
continue; continue;
if (ucode->ucode_id == AMDGPU_UCODE_ID_SMC && if (ucode->ucode_id == AMDGPU_UCODE_ID_SMC &&
(psp_smu_reload_quirk(psp) || psp->autoload_supported)) (psp_smu_reload_quirk(psp) ||
psp->autoload_supported ||
psp->pmfw_centralized_cstate_management))
continue; continue;
if (amdgpu_sriov_vf(adev) && if (amdgpu_sriov_vf(adev) &&
......
...@@ -264,6 +264,8 @@ struct psp_context ...@@ -264,6 +264,8 @@ struct psp_context
atomic_t fence_value; atomic_t fence_value;
/* flag to mark whether gfx fw autoload is supported or not */ /* flag to mark whether gfx fw autoload is supported or not */
bool autoload_supported; bool autoload_supported;
/* flag to mark whether df cstate management centralized to PMFW */
bool pmfw_centralized_cstate_management;
/* xgmi ta firmware and buffer */ /* xgmi ta firmware and buffer */
const struct firmware *ta_fw; const struct firmware *ta_fw;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment