diff options
author | Evan Quan <evan.quan@amd.com> | 2019-01-08 00:57:29 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-01-25 16:15:35 -0500 |
commit | 3680b2a5b6d92747b3293ccc6783da29574147f1 (patch) | |
tree | 3b16bcb698e978e34fe1bf605c3cd142540246f4 | |
parent | fe96b99dc72b16e3c8406ab17fe9e73e0aef1bd9 (diff) |
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: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 24 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/soc15.c | 13 |
2 files changed, 8 insertions, 29 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index f26d8faa7507..d87f165e3a23 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | |||
@@ -67,9 +67,6 @@ static int psp_sw_init(void *handle) | |||
67 | 67 | ||
68 | psp->adev = adev; | 68 | psp->adev = adev; |
69 | 69 | ||
70 | if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) | ||
71 | return 0; | ||
72 | |||
73 | ret = psp_init_microcode(psp); | 70 | ret = psp_init_microcode(psp); |
74 | if (ret) { | 71 | if (ret) { |
75 | DRM_ERROR("Failed to load psp firmware!\n"); | 72 | DRM_ERROR("Failed to load psp firmware!\n"); |
@@ -83,9 +80,6 @@ static int psp_sw_fini(void *handle) | |||
83 | { | 80 | { |
84 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 81 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
85 | 82 | ||
86 | if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) | ||
87 | return 0; | ||
88 | |||
89 | release_firmware(adev->psp.sos_fw); | 83 | release_firmware(adev->psp.sos_fw); |
90 | adev->psp.sos_fw = NULL; | 84 | adev->psp.sos_fw = NULL; |
91 | release_firmware(adev->psp.asd_fw); | 85 | release_firmware(adev->psp.asd_fw); |
@@ -721,10 +715,6 @@ static int psp_hw_init(void *handle) | |||
721 | int ret; | 715 | int ret; |
722 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 716 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
723 | 717 | ||
724 | |||
725 | if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) | ||
726 | return 0; | ||
727 | |||
728 | mutex_lock(&adev->firmware.mutex); | 718 | mutex_lock(&adev->firmware.mutex); |
729 | /* | 719 | /* |
730 | * This sequence is just used on hw_init only once, no need on | 720 | * 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 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 744 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
755 | struct psp_context *psp = &adev->psp; | 745 | struct psp_context *psp = &adev->psp; |
756 | 746 | ||
757 | if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) | ||
758 | return 0; | ||
759 | |||
760 | if (adev->gmc.xgmi.num_physical_nodes > 1 && | 747 | if (adev->gmc.xgmi.num_physical_nodes > 1 && |
761 | psp->xgmi_context.initialized == 1) | 748 | psp->xgmi_context.initialized == 1) |
762 | psp_xgmi_terminate(psp); | 749 | psp_xgmi_terminate(psp); |
@@ -785,9 +772,6 @@ static int psp_suspend(void *handle) | |||
785 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 772 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
786 | struct psp_context *psp = &adev->psp; | 773 | struct psp_context *psp = &adev->psp; |
787 | 774 | ||
788 | if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) | ||
789 | return 0; | ||
790 | |||
791 | if (adev->gmc.xgmi.num_physical_nodes > 1 && | 775 | if (adev->gmc.xgmi.num_physical_nodes > 1 && |
792 | psp->xgmi_context.initialized == 1) { | 776 | psp->xgmi_context.initialized == 1) { |
793 | ret = psp_xgmi_terminate(psp); | 777 | ret = psp_xgmi_terminate(psp); |
@@ -812,9 +796,6 @@ static int psp_resume(void *handle) | |||
812 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 796 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
813 | struct psp_context *psp = &adev->psp; | 797 | struct psp_context *psp = &adev->psp; |
814 | 798 | ||
815 | if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) | ||
816 | return 0; | ||
817 | |||
818 | DRM_INFO("PSP is resuming...\n"); | 799 | DRM_INFO("PSP is resuming...\n"); |
819 | 800 | ||
820 | mutex_lock(&adev->firmware.mutex); | 801 | mutex_lock(&adev->firmware.mutex); |
@@ -850,11 +831,6 @@ static bool psp_check_fw_loading_status(struct amdgpu_device *adev, | |||
850 | { | 831 | { |
851 | struct amdgpu_firmware_info *ucode = NULL; | 832 | struct amdgpu_firmware_info *ucode = NULL; |
852 | 833 | ||
853 | if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) { | ||
854 | DRM_INFO("firmware is not loaded by PSP\n"); | ||
855 | return true; | ||
856 | } | ||
857 | |||
858 | if (!adev->firmware.fw_size) | 834 | if (!adev->firmware.fw_size) |
859 | return false; | 835 | return false; |
860 | 836 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c index 671f78124cb0..62d272b4be19 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc15.c +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c | |||
@@ -595,10 +595,12 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev) | |||
595 | amdgpu_device_ip_block_add(adev, &vega10_common_ip_block); | 595 | amdgpu_device_ip_block_add(adev, &vega10_common_ip_block); |
596 | amdgpu_device_ip_block_add(adev, &gmc_v9_0_ip_block); | 596 | amdgpu_device_ip_block_add(adev, &gmc_v9_0_ip_block); |
597 | amdgpu_device_ip_block_add(adev, &vega10_ih_ip_block); | 597 | amdgpu_device_ip_block_add(adev, &vega10_ih_ip_block); |
598 | if (adev->asic_type == CHIP_VEGA20) | 598 | if (likely(adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)) { |
599 | amdgpu_device_ip_block_add(adev, &psp_v11_0_ip_block); | 599 | if (adev->asic_type == CHIP_VEGA20) |
600 | else | 600 | amdgpu_device_ip_block_add(adev, &psp_v11_0_ip_block); |
601 | amdgpu_device_ip_block_add(adev, &psp_v3_1_ip_block); | 601 | else |
602 | amdgpu_device_ip_block_add(adev, &psp_v3_1_ip_block); | ||
603 | } | ||
602 | amdgpu_device_ip_block_add(adev, &gfx_v9_0_ip_block); | 604 | amdgpu_device_ip_block_add(adev, &gfx_v9_0_ip_block); |
603 | amdgpu_device_ip_block_add(adev, &sdma_v4_0_ip_block); | 605 | amdgpu_device_ip_block_add(adev, &sdma_v4_0_ip_block); |
604 | if (!amdgpu_sriov_vf(adev)) | 606 | if (!amdgpu_sriov_vf(adev)) |
@@ -620,7 +622,8 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev) | |||
620 | amdgpu_device_ip_block_add(adev, &vega10_common_ip_block); | 622 | amdgpu_device_ip_block_add(adev, &vega10_common_ip_block); |
621 | amdgpu_device_ip_block_add(adev, &gmc_v9_0_ip_block); | 623 | amdgpu_device_ip_block_add(adev, &gmc_v9_0_ip_block); |
622 | amdgpu_device_ip_block_add(adev, &vega10_ih_ip_block); | 624 | amdgpu_device_ip_block_add(adev, &vega10_ih_ip_block); |
623 | amdgpu_device_ip_block_add(adev, &psp_v10_0_ip_block); | 625 | if (likely(adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)) |
626 | amdgpu_device_ip_block_add(adev, &psp_v10_0_ip_block); | ||
624 | amdgpu_device_ip_block_add(adev, &gfx_v9_0_ip_block); | 627 | amdgpu_device_ip_block_add(adev, &gfx_v9_0_ip_block); |
625 | amdgpu_device_ip_block_add(adev, &sdma_v4_0_ip_block); | 628 | amdgpu_device_ip_block_add(adev, &sdma_v4_0_ip_block); |
626 | amdgpu_device_ip_block_add(adev, &pp_smu_ip_block); | 629 | amdgpu_device_ip_block_add(adev, &pp_smu_ip_block); |