Skip to content

Commit 7e31a85

Browse files
Evan Quanalexdeucher
authored andcommitted
drm/amdgpu: move smu_debug_mask to a more proper place
As the smu_context will be invisible from outside(of power). Also, the smu_debug_mask can be shared around all power code instead of some specific framework(swSMU) only. Signed-off-by: Evan Quan <[email protected]> Reviewed-by: Lijo Lazar <[email protected]> Reviewed-by: Guchun Chen <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent fa4a427 commit 7e31a85

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1619,7 +1619,7 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
16191619
return 0;
16201620

16211621
debugfs_create_x32("amdgpu_smu_debug", 0600, root,
1622-
&adev->smu.smu_debug_mask);
1622+
&adev->pm.smu_debug_mask);
16231623

16241624
ent = debugfs_create_file("amdgpu_preempt_ib", 0600, root, adev,
16251625
&fops_ib_preempt);

drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,9 @@ enum ip_power_state {
423423
POWER_STATE_OFF,
424424
};
425425

426+
/* Used to mask smu debug modes */
427+
#define SMU_DEBUG_HALT_ON_ERROR 0x1
428+
426429
struct amdgpu_pm {
427430
struct mutex mutex;
428431
u32 current_sclk;
@@ -460,6 +463,11 @@ struct amdgpu_pm {
460463
struct list_head pm_attr_list;
461464

462465
atomic_t pwr_state[AMD_IP_BLOCK_TYPE_NUM];
466+
467+
/*
468+
* 0 = disabled (default), otherwise enable corresponding debug mode
469+
*/
470+
uint32_t smu_debug_mask;
463471
};
464472

465473
#define R600_SSTU_DFLT 0

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,6 @@ struct stb_context {
482482

483483
#define WORKLOAD_POLICY_MAX 7
484484

485-
/* Used to mask smu debug modes */
486-
#define SMU_DEBUG_HALT_ON_ERROR 0x1
487-
488485
struct smu_context
489486
{
490487
struct amdgpu_device *adev;
@@ -573,11 +570,6 @@ struct smu_context
573570
struct smu_user_dpm_profile user_dpm_profile;
574571

575572
struct stb_context stb_context;
576-
577-
/*
578-
* 0 = disabled (default), otherwise enable corresponding debug mode
579-
*/
580-
uint32_t smu_debug_mask;
581573
};
582574

583575
struct i2c_adapter;

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,11 @@ int smu_cmn_send_msg_without_waiting(struct smu_context *smu,
257257
uint16_t msg_index,
258258
uint32_t param)
259259
{
260+
struct amdgpu_device *adev = smu->adev;
260261
u32 reg;
261262
int res;
262263

263-
if (smu->adev->no_hw_access)
264+
if (adev->no_hw_access)
264265
return 0;
265266

266267
reg = __smu_cmn_poll_stat(smu);
@@ -272,9 +273,9 @@ int smu_cmn_send_msg_without_waiting(struct smu_context *smu,
272273
__smu_cmn_send_msg(smu, msg_index, param);
273274
res = 0;
274275
Out:
275-
if (unlikely(smu->smu_debug_mask & SMU_DEBUG_HALT_ON_ERROR) &&
276+
if (unlikely(adev->pm.smu_debug_mask & SMU_DEBUG_HALT_ON_ERROR) &&
276277
res && (res != -ETIME)) {
277-
amdgpu_device_halt(smu->adev);
278+
amdgpu_device_halt(adev);
278279
WARN_ON(1);
279280
}
280281

@@ -299,7 +300,7 @@ int smu_cmn_wait_for_response(struct smu_context *smu)
299300
reg = __smu_cmn_poll_stat(smu);
300301
res = __smu_cmn_reg2errno(smu, reg);
301302

302-
if (unlikely(smu->smu_debug_mask & SMU_DEBUG_HALT_ON_ERROR) &&
303+
if (unlikely(smu->adev->pm.smu_debug_mask & SMU_DEBUG_HALT_ON_ERROR) &&
303304
res && (res != -ETIME)) {
304305
amdgpu_device_halt(smu->adev);
305306
WARN_ON(1);
@@ -343,10 +344,11 @@ int smu_cmn_send_smc_msg_with_param(struct smu_context *smu,
343344
uint32_t param,
344345
uint32_t *read_arg)
345346
{
347+
struct amdgpu_device *adev = smu->adev;
346348
int res, index;
347349
u32 reg;
348350

349-
if (smu->adev->no_hw_access)
351+
if (adev->no_hw_access)
350352
return 0;
351353

352354
index = smu_cmn_to_asic_specific_index(smu,
@@ -372,8 +374,8 @@ int smu_cmn_send_smc_msg_with_param(struct smu_context *smu,
372374
if (read_arg)
373375
smu_cmn_read_arg(smu, read_arg);
374376
Out:
375-
if (unlikely(smu->smu_debug_mask & SMU_DEBUG_HALT_ON_ERROR) && res) {
376-
amdgpu_device_halt(smu->adev);
377+
if (unlikely(adev->pm.smu_debug_mask & SMU_DEBUG_HALT_ON_ERROR) && res) {
378+
amdgpu_device_halt(adev);
377379
WARN_ON(1);
378380
}
379381

0 commit comments

Comments
 (0)