Commit 3680b2a5 authored by Evan Quan's avatar Evan Quan Committed by Alex Deucher

drm/amdgpu: check PSP support before adding the ip block

So that we do not need to check this in every internal function.
Signed-off-by: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent fe96b99d
...@@ -67,9 +67,6 @@ static int psp_sw_init(void *handle) ...@@ -67,9 +67,6 @@ static int psp_sw_init(void *handle)
psp->adev = adev; psp->adev = adev;
if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP)
return 0;
ret = psp_init_microcode(psp); ret = psp_init_microcode(psp);
if (ret) { if (ret) {
DRM_ERROR("Failed to load psp firmware!\n"); DRM_ERROR("Failed to load psp firmware!\n");
...@@ -83,9 +80,6 @@ static int psp_sw_fini(void *handle) ...@@ -83,9 +80,6 @@ static int psp_sw_fini(void *handle)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct amdgpu_device *adev = (struct amdgpu_device *)handle;
if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP)
return 0;
release_firmware(adev->psp.sos_fw); release_firmware(adev->psp.sos_fw);
adev->psp.sos_fw = NULL; adev->psp.sos_fw = NULL;
release_firmware(adev->psp.asd_fw); release_firmware(adev->psp.asd_fw);
...@@ -721,10 +715,6 @@ static int psp_hw_init(void *handle) ...@@ -721,10 +715,6 @@ static int psp_hw_init(void *handle)
int ret; int ret;
struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct amdgpu_device *adev = (struct amdgpu_device *)handle;
if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP)
return 0;
mutex_lock(&adev->firmware.mutex); mutex_lock(&adev->firmware.mutex);
/* /*
* This sequence is just used on hw_init only once, no need on * This sequence is just used on hw_init only once, no need on
...@@ -754,9 +744,6 @@ static int psp_hw_fini(void *handle) ...@@ -754,9 +744,6 @@ static int psp_hw_fini(void *handle)
struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct amdgpu_device *adev = (struct amdgpu_device *)handle;
struct psp_context *psp = &adev->psp; struct psp_context *psp = &adev->psp;
if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP)
return 0;
if (adev->gmc.xgmi.num_physical_nodes > 1 && if (adev->gmc.xgmi.num_physical_nodes > 1 &&
psp->xgmi_context.initialized == 1) psp->xgmi_context.initialized == 1)
psp_xgmi_terminate(psp); psp_xgmi_terminate(psp);
...@@ -785,9 +772,6 @@ static int psp_suspend(void *handle) ...@@ -785,9 +772,6 @@ static int psp_suspend(void *handle)
struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct amdgpu_device *adev = (struct amdgpu_device *)handle;
struct psp_context *psp = &adev->psp; struct psp_context *psp = &adev->psp;
if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP)
return 0;
if (adev->gmc.xgmi.num_physical_nodes > 1 && if (adev->gmc.xgmi.num_physical_nodes > 1 &&
psp->xgmi_context.initialized == 1) { psp->xgmi_context.initialized == 1) {
ret = psp_xgmi_terminate(psp); ret = psp_xgmi_terminate(psp);
...@@ -812,9 +796,6 @@ static int psp_resume(void *handle) ...@@ -812,9 +796,6 @@ static int psp_resume(void *handle)
struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct amdgpu_device *adev = (struct amdgpu_device *)handle;
struct psp_context *psp = &adev->psp; struct psp_context *psp = &adev->psp;
if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP)
return 0;
DRM_INFO("PSP is resuming...\n"); DRM_INFO("PSP is resuming...\n");
mutex_lock(&adev->firmware.mutex); mutex_lock(&adev->firmware.mutex);
...@@ -850,11 +831,6 @@ static bool psp_check_fw_loading_status(struct amdgpu_device *adev, ...@@ -850,11 +831,6 @@ static bool psp_check_fw_loading_status(struct amdgpu_device *adev,
{ {
struct amdgpu_firmware_info *ucode = NULL; struct amdgpu_firmware_info *ucode = NULL;
if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) {
DRM_INFO("firmware is not loaded by PSP\n");
return true;
}
if (!adev->firmware.fw_size) if (!adev->firmware.fw_size)
return false; return false;
......
...@@ -595,10 +595,12 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev) ...@@ -595,10 +595,12 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev)
amdgpu_device_ip_block_add(adev, &vega10_common_ip_block); amdgpu_device_ip_block_add(adev, &vega10_common_ip_block);
amdgpu_device_ip_block_add(adev, &gmc_v9_0_ip_block); amdgpu_device_ip_block_add(adev, &gmc_v9_0_ip_block);
amdgpu_device_ip_block_add(adev, &vega10_ih_ip_block); amdgpu_device_ip_block_add(adev, &vega10_ih_ip_block);
if (adev->asic_type == CHIP_VEGA20) if (likely(adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)) {
amdgpu_device_ip_block_add(adev, &psp_v11_0_ip_block); if (adev->asic_type == CHIP_VEGA20)
else amdgpu_device_ip_block_add(adev, &psp_v11_0_ip_block);
amdgpu_device_ip_block_add(adev, &psp_v3_1_ip_block); else
amdgpu_device_ip_block_add(adev, &psp_v3_1_ip_block);
}
amdgpu_device_ip_block_add(adev, &gfx_v9_0_ip_block); amdgpu_device_ip_block_add(adev, &gfx_v9_0_ip_block);
amdgpu_device_ip_block_add(adev, &sdma_v4_0_ip_block); amdgpu_device_ip_block_add(adev, &sdma_v4_0_ip_block);
if (!amdgpu_sriov_vf(adev)) if (!amdgpu_sriov_vf(adev))
...@@ -620,7 +622,8 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev) ...@@ -620,7 +622,8 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev)
amdgpu_device_ip_block_add(adev, &vega10_common_ip_block); amdgpu_device_ip_block_add(adev, &vega10_common_ip_block);
amdgpu_device_ip_block_add(adev, &gmc_v9_0_ip_block); amdgpu_device_ip_block_add(adev, &gmc_v9_0_ip_block);
amdgpu_device_ip_block_add(adev, &vega10_ih_ip_block); amdgpu_device_ip_block_add(adev, &vega10_ih_ip_block);
amdgpu_device_ip_block_add(adev, &psp_v10_0_ip_block); if (likely(adev->firmware.load_type == AMDGPU_FW_LOAD_PSP))
amdgpu_device_ip_block_add(adev, &psp_v10_0_ip_block);
amdgpu_device_ip_block_add(adev, &gfx_v9_0_ip_block); amdgpu_device_ip_block_add(adev, &gfx_v9_0_ip_block);
amdgpu_device_ip_block_add(adev, &sdma_v4_0_ip_block); amdgpu_device_ip_block_add(adev, &sdma_v4_0_ip_block);
amdgpu_device_ip_block_add(adev, &pp_smu_ip_block); amdgpu_device_ip_block_add(adev, &pp_smu_ip_block);
......
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