Skip to content

Commit d8e0b16

Browse files
Evan Quanalexdeucher
authored andcommitted
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 <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 7047593 commit d8e0b16

File tree

13 files changed

+28
-9
lines changed

13 files changed

+28
-9
lines changed

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
* OTHER DEALINGS IN THE SOFTWARE.
2121
*/
2222

23+
#define SWSMU_CODE_LAYER_L1
24+
2325
#include <linux/firmware.h>
2426
#include <linux/pci.h>
2527

2628
#include "amdgpu.h"
2729
#include "amdgpu_smu.h"
2830
#include "smu_internal.h"
29-
#include "smu_v11_0.h"
30-
#include "smu_v12_0.h"
3131
#include "atom.h"
3232
#include "arcturus_ppt.h"
3333
#include "navi10_ppt.h"

drivers/gpu/drm/amd/powerplay/arcturus_ppt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
*
2222
*/
2323

24+
#define SWSMU_CODE_LAYER_L2
25+
2426
#include <linux/firmware.h>
2527
#include "amdgpu.h"
2628
#include "amdgpu_smu.h"
27-
#include "smu_internal.h"
2829
#include "atomfirmware.h"
2930
#include "amdgpu_atomfirmware.h"
3031
#include "amdgpu_atombios.h"

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@ enum smu_cmn2asic_mapping_type {
653653
#define WORKLOAD_MAP(profile, workload) \
654654
[profile] = {1, (workload)}
655655

656+
#if !defined(SWSMU_CODE_LAYER_L2) && !defined(SWSMU_CODE_LAYER_L3) && !defined(SWSMU_CODE_LAYER_L4)
656657
int smu_load_microcode(struct smu_context *smu);
657658

658659
int smu_check_fw_status(struct smu_context *smu);
@@ -790,3 +791,4 @@ int smu_get_dpm_clock_table(struct smu_context *smu,
790791
int smu_get_status_gfxoff(struct amdgpu_device *adev, uint32_t *value);
791792

792793
#endif
794+
#endif

drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ enum smu_v11_0_baco_seq {
134134
BACO_SEQ_COUNT,
135135
};
136136

137+
#if defined(SWSMU_CODE_LAYER_L2) || defined(SWSMU_CODE_LAYER_L3)
138+
137139
int smu_v11_0_init_microcode(struct smu_context *smu);
138140

139141
void smu_v11_0_fini_microcode(struct smu_context *smu);
@@ -263,3 +265,4 @@ int smu_v11_0_get_dpm_level_range(struct smu_context *smu,
263265
uint32_t *max_value);
264266

265267
#endif
268+
#endif

drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#define MP1_Public 0x03b00000
3232
#define MP1_SRAM 0x03c00004
3333

34+
#if defined(SWSMU_CODE_LAYER_L2) || defined(SWSMU_CODE_LAYER_L3)
35+
3436
int smu_v12_0_check_fw_status(struct smu_context *smu);
3537

3638
int smu_v12_0_check_fw_version(struct smu_context *smu);
@@ -59,3 +61,4 @@ int smu_v12_0_set_soft_freq_limited_range(struct smu_context *smu, enum smu_clk_
5961
int smu_v12_0_set_driver_table_location(struct smu_context *smu);
6062

6163
#endif
64+
#endif

drivers/gpu/drm/amd/powerplay/navi10_ppt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@
2121
*
2222
*/
2323

24+
#define SWSMU_CODE_LAYER_L2
25+
2426
#include <linux/firmware.h>
2527
#include <linux/pci.h>
2628
#include "amdgpu.h"
2729
#include "amdgpu_smu.h"
28-
#include "smu_internal.h"
2930
#include "atomfirmware.h"
3031
#include "amdgpu_atomfirmware.h"
3132
#include "amdgpu_atombios.h"

drivers/gpu/drm/amd/powerplay/renoir_ppt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
*
2222
*/
2323

24+
#define SWSMU_CODE_LAYER_L2
25+
2426
#include "amdgpu.h"
2527
#include "amdgpu_smu.h"
26-
#include "smu_internal.h"
2728
#include "smu_v12_0_ppsmc.h"
2829
#include "smu12_driver_if.h"
2930
#include "smu_v12_0.h"

drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@
2121
*
2222
*/
2323

24+
#define SWSMU_CODE_LAYER_L2
25+
2426
#include <linux/firmware.h>
2527
#include <linux/pci.h>
2628
#include "amdgpu.h"
2729
#include "amdgpu_smu.h"
28-
#include "smu_internal.h"
2930
#include "atomfirmware.h"
3031
#include "amdgpu_atomfirmware.h"
3132
#include "amdgpu_atombios.h"

drivers/gpu/drm/amd/powerplay/smu_cmn.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020
* OTHER DEALINGS IN THE SOFTWARE.
2121
*/
2222

23+
#define SWSMU_CODE_LAYER_L4
24+
2325
#include "amdgpu.h"
2426
#include "amdgpu_smu.h"
2527
#include "smu_cmn.h"
26-
#include "smu_internal.h"
2728
#include "soc15_common.h"
2829

2930
/*

drivers/gpu/drm/amd/powerplay/smu_cmn.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include "amdgpu_smu.h"
2727

28+
#if defined(SWSMU_CODE_LAYER_L2) || defined(SWSMU_CODE_LAYER_L3) || defined(SWSMU_CODE_LAYER_L4)
2829
int smu_cmn_send_smc_msg_with_param(struct smu_context *smu,
2930
enum smu_message_type msg,
3031
uint32_t param,
@@ -79,3 +80,4 @@ int smu_cmn_write_watermarks_table(struct smu_context *smu);
7980
int smu_cmn_write_pptable(struct smu_context *smu);
8081

8182
#endif
83+
#endif

0 commit comments

Comments
 (0)