Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/powerplay: tag swSMU code layers

Per designs, the swSMU code is separated into four layers. And the typical
calling flow should be like: amdgpu_smu.c -> ${asic}_ppt.c -> smu_v11/12_0.c
-> smu_cmn.c. Compile errors will come out for any violations. This can
help to prevent cross callings(e.g. amdgpu_smu.c -> ${asic}_ppt.c ->
amdgpu_smu.c -> ${asic}_ppt.c) which were common in our code.

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>

authored by

Evan Quan and committed by
Alex Deucher
d8e0b16d 70475931

+28 -9
+2 -2
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
··· 20 20 * OTHER DEALINGS IN THE SOFTWARE. 21 21 */ 22 22 23 + #define SWSMU_CODE_LAYER_L1 24 + 23 25 #include <linux/firmware.h> 24 26 #include <linux/pci.h> 25 27 26 28 #include "amdgpu.h" 27 29 #include "amdgpu_smu.h" 28 30 #include "smu_internal.h" 29 - #include "smu_v11_0.h" 30 - #include "smu_v12_0.h" 31 31 #include "atom.h" 32 32 #include "arcturus_ppt.h" 33 33 #include "navi10_ppt.h"
+2 -1
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
··· 21 21 * 22 22 */ 23 23 24 + #define SWSMU_CODE_LAYER_L2 25 + 24 26 #include <linux/firmware.h> 25 27 #include "amdgpu.h" 26 28 #include "amdgpu_smu.h" 27 - #include "smu_internal.h" 28 29 #include "atomfirmware.h" 29 30 #include "amdgpu_atomfirmware.h" 30 31 #include "amdgpu_atombios.h"
+2
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
··· 653 653 #define WORKLOAD_MAP(profile, workload) \ 654 654 [profile] = {1, (workload)} 655 655 656 + #if !defined(SWSMU_CODE_LAYER_L2) && !defined(SWSMU_CODE_LAYER_L3) && !defined(SWSMU_CODE_LAYER_L4) 656 657 int smu_load_microcode(struct smu_context *smu); 657 658 658 659 int smu_check_fw_status(struct smu_context *smu); ··· 790 789 791 790 int smu_get_status_gfxoff(struct amdgpu_device *adev, uint32_t *value); 792 791 792 + #endif 793 793 #endif
+3
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h
··· 134 134 BACO_SEQ_COUNT, 135 135 }; 136 136 137 + #if defined(SWSMU_CODE_LAYER_L2) || defined(SWSMU_CODE_LAYER_L3) 138 + 137 139 int smu_v11_0_init_microcode(struct smu_context *smu); 138 140 139 141 void smu_v11_0_fini_microcode(struct smu_context *smu); ··· 264 262 uint32_t *min_value, 265 263 uint32_t *max_value); 266 264 265 + #endif 267 266 #endif
+3
drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h
··· 31 31 #define MP1_Public 0x03b00000 32 32 #define MP1_SRAM 0x03c00004 33 33 34 + #if defined(SWSMU_CODE_LAYER_L2) || defined(SWSMU_CODE_LAYER_L3) 35 + 34 36 int smu_v12_0_check_fw_status(struct smu_context *smu); 35 37 36 38 int smu_v12_0_check_fw_version(struct smu_context *smu); ··· 60 58 61 59 int smu_v12_0_set_driver_table_location(struct smu_context *smu); 62 60 61 + #endif 63 62 #endif
+2 -1
drivers/gpu/drm/amd/powerplay/navi10_ppt.c
··· 21 21 * 22 22 */ 23 23 24 + #define SWSMU_CODE_LAYER_L2 25 + 24 26 #include <linux/firmware.h> 25 27 #include <linux/pci.h> 26 28 #include "amdgpu.h" 27 29 #include "amdgpu_smu.h" 28 - #include "smu_internal.h" 29 30 #include "atomfirmware.h" 30 31 #include "amdgpu_atomfirmware.h" 31 32 #include "amdgpu_atombios.h"
+2 -1
drivers/gpu/drm/amd/powerplay/renoir_ppt.c
··· 21 21 * 22 22 */ 23 23 24 + #define SWSMU_CODE_LAYER_L2 25 + 24 26 #include "amdgpu.h" 25 27 #include "amdgpu_smu.h" 26 - #include "smu_internal.h" 27 28 #include "smu_v12_0_ppsmc.h" 28 29 #include "smu12_driver_if.h" 29 30 #include "smu_v12_0.h"
+2 -1
drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c
··· 21 21 * 22 22 */ 23 23 24 + #define SWSMU_CODE_LAYER_L2 25 + 24 26 #include <linux/firmware.h> 25 27 #include <linux/pci.h> 26 28 #include "amdgpu.h" 27 29 #include "amdgpu_smu.h" 28 - #include "smu_internal.h" 29 30 #include "atomfirmware.h" 30 31 #include "amdgpu_atomfirmware.h" 31 32 #include "amdgpu_atombios.h"
+2 -1
drivers/gpu/drm/amd/powerplay/smu_cmn.c
··· 20 20 * OTHER DEALINGS IN THE SOFTWARE. 21 21 */ 22 22 23 + #define SWSMU_CODE_LAYER_L4 24 + 23 25 #include "amdgpu.h" 24 26 #include "amdgpu_smu.h" 25 27 #include "smu_cmn.h" 26 - #include "smu_internal.h" 27 28 #include "soc15_common.h" 28 29 29 30 /*
+2
drivers/gpu/drm/amd/powerplay/smu_cmn.h
··· 25 25 26 26 #include "amdgpu_smu.h" 27 27 28 + #if defined(SWSMU_CODE_LAYER_L2) || defined(SWSMU_CODE_LAYER_L3) || defined(SWSMU_CODE_LAYER_L4) 28 29 int smu_cmn_send_smc_msg_with_param(struct smu_context *smu, 29 30 enum smu_message_type msg, 30 31 uint32_t param, ··· 79 78 80 79 int smu_cmn_write_pptable(struct smu_context *smu); 81 80 81 + #endif 82 82 #endif
+3
drivers/gpu/drm/amd/powerplay/smu_internal.h
··· 25 25 26 26 #include "amdgpu_smu.h" 27 27 28 + #if defined(SWSMU_CODE_LAYER_L1) 29 + 28 30 #define smu_ppt_funcs(intf, ret, smu, args...) \ 29 31 ((smu)->ppt_funcs ? ((smu)->ppt_funcs->intf ? (smu)->ppt_funcs->intf(smu, ##args) : ret) : -EINVAL) 30 32 ··· 96 94 #define smu_get_pp_feature_mask(smu, buf) smu_ppt_funcs(get_pp_feature_mask, 0, smu, buf) 97 95 #define smu_set_pp_feature_mask(smu, new_mask) smu_ppt_funcs(set_pp_feature_mask, 0, smu, new_mask) 98 96 97 + #endif 99 98 #endif
+1 -1
drivers/gpu/drm/amd/powerplay/smu_v11_0.c
··· 26 26 #include <linux/reboot.h> 27 27 28 28 #define SMU_11_0_PARTIAL_PPTABLE 29 + #define SWSMU_CODE_LAYER_L3 29 30 30 31 #include "amdgpu.h" 31 32 #include "amdgpu_smu.h" 32 - #include "smu_internal.h" 33 33 #include "atomfirmware.h" 34 34 #include "amdgpu_atomfirmware.h" 35 35 #include "amdgpu_atombios.h"
+2 -1
drivers/gpu/drm/amd/powerplay/smu_v12_0.c
··· 20 20 * OTHER DEALINGS IN THE SOFTWARE. 21 21 */ 22 22 23 + #define SWSMU_CODE_LAYER_L3 24 + 23 25 #include <linux/firmware.h> 24 26 #include "amdgpu.h" 25 27 #include "amdgpu_smu.h" 26 - #include "smu_internal.h" 27 28 #include "atomfirmware.h" 28 29 #include "amdgpu_atomfirmware.h" 29 30 #include "smu_v12_0.h"