drm/amdgpu/pm: Add default case for smu IH process func
Subsystems (3)
PATCH v2 1/2 drm/amdgpu/pm: Add default case for smu IH process func
Add default case for smu IH process func.
--- drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 4 ++++ drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 4 ++++ drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +4 -0
@@ -1462,6 +1462,10 @@ static int smu_v11_0_irq_process(struct amdgpu_device *adev,schedule_work (&smu->throttling_logging_work);break ; +default : +dev_dbg (adev->dev,"Unhandled context id %d from client:%d!\n" , + ctxid, client_id); +break ; } } }
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +4 -0
@@ -1428,6 +1428,10 @@ static int smu_v13_0_irq_process(struct amdgpu_device *adev, data = data & (~THM_THERMAL_INT_CTRL__THERM_TRIGGER_MASK_MASK );WREG32_SOC15 (THM ,0 , regTHM_THERMAL_INT_CTRL, data);break ; +default : +dev_dbg (adev->dev,"Unhandled context id %d from client:%d!\n" , + ctxid, client_id); +break ; } } }
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +4 -1
@@ -1439,7 +1439,10 @@ static int smu_v13_0_6_irq_process(struct amdgpu_device *adev, entry->src_data[1]);schedule_work (&smu->throttling_logging_work); } - +break ; +default : +dev_dbg (adev->dev,"Unhandled context id %d from client:%d!\n" , + ctxid, client_id);break ; } }
Signature · 1 line
2.34.1
PATCH v2 2/2 drm/amdgpu/pm: Use macro definitions in the smu IH process function
Replace the hard-coded numbers with macro definition
--- .../pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0.h | 11 ----------- .../pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_6.h | 4 ---- .../pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_7.h | 11 ----------- drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 10 +++++----- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 14 +++++++------- drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c | 2 +- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h | 10 ++++++++++ 7 files changed, 23 insertions(+), 39 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0.h +0 -11
@@ -1618,15 +1618,4 @@ typedef struct {#define TABLE_WIFIBAND 12#define TABLE_COUNT 13 -//IH Interupt ID -#define IH_INTERRUPT_ID_TO_DRIVER 0xFE -#define IH_INTERRUPT_CONTEXT_ID_BACO 0x2 -#define IH_INTERRUPT_CONTEXT_ID_AC 0x3 -#define IH_INTERRUPT_CONTEXT_ID_DC 0x4 -#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D0 0x5 -#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D3 0x6 -#define IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING 0x7 -#define IH_INTERRUPT_CONTEXT_ID_FAN_ABNORMAL 0x8 -#define IH_INTERRUPT_CONTEXT_ID_FAN_RECOVERY 0x9 -#endif
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_6.h +0 -4
@@ -209,10 +209,6 @@ typedef struct {float minPsmVoltage[30 ]; } AvfsDebugTableXcd_t; -// Defines used for IH-based thermal interrupts to GFX driver - A/X only -#define IH_INTERRUPT_ID_TO_DRIVER 0xFE -#define IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING 0x7 -//thermal over-temp mask defines for IH interrupt to host #define THROTTLER_PROCHOT_BIT 0#define THROTTLER_PPT_BIT 1
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_7.h +0 -11
@@ -1608,15 +1608,4 @@ typedef struct {#define TABLE_WIFIBAND 12#define TABLE_COUNT 13 -//IH Interupt ID -#define IH_INTERRUPT_ID_TO_DRIVER 0xFE -#define IH_INTERRUPT_CONTEXT_ID_BACO 0x2 -#define IH_INTERRUPT_CONTEXT_ID_AC 0x3 -#define IH_INTERRUPT_CONTEXT_ID_DC 0x4 -#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D0 0x5 -#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D3 0x6 -#define IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING 0x7 -#define IH_INTERRUPT_CONTEXT_ID_FAN_ABNORMAL 0x8 -#define IH_INTERRUPT_CONTEXT_ID_FAN_RECOVERY 0x9 -#endif
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +5 -5
@@ -1432,24 +1432,24 @@ static int smu_v11_0_irq_process(struct amdgpu_device *adev,dev_emerg (adev->dev,"ERROR: System is going to shutdown due to GPU HW CTF!\n" );orderly_poweroff (true); }else if (client_id ==SOC15_IH_CLIENTID_MP1 ) { -if (src_id ==0xfe ) { +if (src_id ==IH_INTERRUPT_ID_TO_DRIVER ) {/* ACK SMUToHost interrupt */ data =RREG32_SOC15 (MP1 ,0 , mmMP1_SMN_IH_SW_INT_CTRL); data =REG_SET_FIELD (data,MP1_SMN_IH_SW_INT_CTRL ,INT_ACK ,1 );WREG32_SOC15 (MP1 ,0 , mmMP1_SMN_IH_SW_INT_CTRL, data);switch (ctxid) { -case 0x3 : +case IH_INTERRUPT_CONTEXT_ID_AC :dev_dbg (adev->dev,"Switched to AC mode!\n" );schedule_work (&smu->interrupt_work); adev->pm.ac_power = true;break ; -case 0x4 : +case IH_INTERRUPT_CONTEXT_ID_DC :dev_dbg (adev->dev,"Switched to DC mode!\n" );schedule_work (&smu->interrupt_work); adev->pm.ac_power = false;break ; -case 0x7 : +case IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING :/* * Increment the throttle interrupt counter */
@@ -1508,7 +1508,7 @@ int smu_v11_0_register_irq_handler(struct smu_context *smu)return ret; ret =amdgpu_irq_add_id (adev,SOC15_IH_CLIENTID_MP1 , -0xfe , +IH_INTERRUPT_ID_TO_DRIVER , irq_src);if (ret)return ret;
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +7 -7
@@ -1368,24 +1368,24 @@ static int smu_v13_0_irq_process(struct amdgpu_device *adev,dev_emerg (adev->dev,"ERROR: System is going to shutdown due to GPU HW CTF!\n" );orderly_poweroff (true); }else if (client_id ==SOC15_IH_CLIENTID_MP1 ) { -if (src_id ==0xfe ) { +if (src_id ==IH_INTERRUPT_ID_TO_DRIVER ) {/* ACK SMUToHost interrupt */ data =RREG32_SOC15 (MP1 ,0 , regMP1_SMN_IH_SW_INT_CTRL); data =REG_SET_FIELD (data,MP1_SMN_IH_SW_INT_CTRL ,INT_ACK ,1 );WREG32_SOC15 (MP1 ,0 , regMP1_SMN_IH_SW_INT_CTRL, data);switch (ctxid) { -case 0x3 : +case IH_INTERRUPT_CONTEXT_ID_AC :dev_dbg (adev->dev,"Switched to AC mode!\n" );smu_v13_0_ack_ac_dc_interrupt (smu); adev->pm.ac_power = true;break ; -case 0x4 : +case IH_INTERRUPT_CONTEXT_ID_DC :dev_dbg (adev->dev,"Switched to DC mode!\n" );smu_v13_0_ack_ac_dc_interrupt (smu); adev->pm.ac_power = false;break ; -case 0x7 : +case IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING :/* * Increment the throttle interrupt counter */
@@ -1398,7 +1398,7 @@ static int smu_v13_0_irq_process(struct amdgpu_device *adev,schedule_work (&smu->throttling_logging_work);break ; -case 0x8 : +case IH_INTERRUPT_CONTEXT_ID_FAN_ABNORMAL : high = smu->thermal_range.software_shutdown_temp + smu->thermal_range.software_shutdown_temp_offset; high = min_t(typeof(high),
@@ -1415,7 +1415,7 @@ static int smu_v13_0_irq_process(struct amdgpu_device *adev, data = data & (~THM_THERMAL_INT_CTRL__THERM_TRIGGER_MASK_MASK );WREG32_SOC15 (THM ,0 , regTHM_THERMAL_INT_CTRL, data);break ; -case 0x9 : +case IH_INTERRUPT_CONTEXT_ID_FAN_RECOVERY : high =min_t (typeof (high),SMU_THERMAL_MAXIMUM_ALERT_TEMP , smu->thermal_range.software_shutdown_temp);
@@ -1476,7 +1476,7 @@ int smu_v13_0_register_irq_handler(struct smu_context *smu)return ret; ret =amdgpu_irq_add_id (adev,SOC15_IH_CLIENTID_MP1 , -0xfe , +IH_INTERRUPT_ID_TO_DRIVER , irq_src);if (ret)return ret;
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c +1 -1
@@ -892,7 +892,7 @@ int smu_v14_0_register_irq_handler(struct smu_context *smu)// TODO: THM related ret =amdgpu_irq_add_id (adev,SOC15_IH_CLIENTID_MP1 , -0xfe , +IH_INTERRUPT_ID_TO_DRIVER , irq_src);if (ret)return ret;
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +10 -0
@@ -30,6 +30,16 @@#define FDO_PWM_MODE_STATIC 1#define FDO_PWM_MODE_STATIC_RPM 5 +#define IH_INTERRUPT_ID_TO_DRIVER 0xFE +#define IH_INTERRUPT_CONTEXT_ID_BACO 0x2 +#define IH_INTERRUPT_CONTEXT_ID_AC 0x3 +#define IH_INTERRUPT_CONTEXT_ID_DC 0x4 +#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D0 0x5 +#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D3 0x6 +#define IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING 0x7 +#define IH_INTERRUPT_CONTEXT_ID_FAN_ABNORMAL 0x8 +#define IH_INTERRUPT_CONTEXT_ID_FAN_RECOVERY 0x9 +extern const int link_speed[];/* Helper to Convert from PCIE Gen 1/2/3/4/5/6 to 0.1 GT/s speed units */
Signature · 1 line
2.34.1
Re: [PATCH v2 2/2] drm/amdgpu/pm: Use macro definitions in the smu IH process function
Quoted 3 lines · Ma Jun
Replace the hard-coded numbers with macro definition
Signed-off-by Ma Jun <[email protected]>
Series is
Thanks,
Lijo
Quoted 201 lines
--- .../pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0.h | 11 ----------- .../pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_6.h | 4 ---- .../pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_7.h | 11 ----------- drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 10 +++++----- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 14 +++++++------- drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c | 2 +- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h | 10 ++++++++++ 7 files changed, 23 insertions(+), 39 deletions(-)drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0.h +0
-11@@ -1618,15 +1618,4 @@ typedef struct {#define TABLE_WIFIBAND 12#define TABLE_COUNT 13 -//IH Interupt ID -#define IH_INTERRUPT_ID_TO_DRIVER 0xFE -#define IH_INTERRUPT_CONTEXT_ID_BACO 0x2 -#define IH_INTERRUPT_CONTEXT_ID_AC 0x3 -#define IH_INTERRUPT_CONTEXT_ID_DC 0x4 -#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D0 0x5 -#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D3 0x6 -#define IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING 0x7 -#define IH_INTERRUPT_CONTEXT_ID_FAN_ABNORMAL 0x8 -#define IH_INTERRUPT_CONTEXT_ID_FAN_RECOVERY 0x9 -#endif drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_6.h +0
-4@@ -209,10 +209,6 @@ typedef struct {float minPsmVoltage[30 ]; } AvfsDebugTableXcd_t; -// Defines used for IH-based thermal interrupts to GFX driver - A/X only -#define IH_INTERRUPT_ID_TO_DRIVER 0xFE -#define IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING 0x7 -//thermal over-temp mask defines for IH interrupt to host #define THROTTLER_PROCHOT_BIT 0#define THROTTLER_PPT_BIT 1drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_7.h +0
-11@@ -1608,15 +1608,4 @@ typedef struct {#define TABLE_WIFIBAND 12#define TABLE_COUNT 13 -//IH Interupt ID -#define IH_INTERRUPT_ID_TO_DRIVER 0xFE -#define IH_INTERRUPT_CONTEXT_ID_BACO 0x2 -#define IH_INTERRUPT_CONTEXT_ID_AC 0x3 -#define IH_INTERRUPT_CONTEXT_ID_DC 0x4 -#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D0 0x5 -#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D3 0x6 -#define IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING 0x7 -#define IH_INTERRUPT_CONTEXT_ID_FAN_ABNORMAL 0x8 -#define IH_INTERRUPT_CONTEXT_ID_FAN_RECOVERY 0x9 -#endif drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +5
-5@@ -1432,24 +1432,24 @@ static int smu_v11_0_irq_process(struct amdgpu_device *adev,dev_emerg (adev->dev,"ERROR: System is going to shutdown due to GPU HW CTF!\n" );orderly_poweroff (true); }else if (client_id ==SOC15_IH_CLIENTID_MP1 ) { -if (src_id ==0xfe ) { +if (src_id ==IH_INTERRUPT_ID_TO_DRIVER ) {/* ACK SMUToHost interrupt */ data =RREG32_SOC15 (MP1 ,0 , mmMP1_SMN_IH_SW_INT_CTRL); data =REG_SET_FIELD (data,MP1_SMN_IH_SW_INT_CTRL ,INT_ACK ,1 );WREG32_SOC15 (MP1 ,0 , mmMP1_SMN_IH_SW_INT_CTRL, data);switch (ctxid) { -case 0x3 : +case IH_INTERRUPT_CONTEXT_ID_AC :dev_dbg (adev->dev,"Switched to AC mode!\n" );schedule_work (&smu->interrupt_work); adev->pm.ac_power = true;break ; -case 0x4 : +case IH_INTERRUPT_CONTEXT_ID_DC :dev_dbg (adev->dev,"Switched to DC mode!\n" );schedule_work (&smu->interrupt_work); adev->pm.ac_power = false;break ; -case 0x7 : +case IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING :/* * Increment the throttle interrupt counter */ @@ -1508,7 +1508,7 @@ int smu_v11_0_register_irq_handler(struct smu_context *smu)return ret; ret =amdgpu_irq_add_id (adev,SOC15_IH_CLIENTID_MP1 , -0xfe , +IH_INTERRUPT_ID_TO_DRIVER , irq_src);if (ret)return ret;drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +7
-7@@ -1368,24 +1368,24 @@ static int smu_v13_0_irq_process(struct amdgpu_device *adev,dev_emerg (adev->dev,"ERROR: System is going to shutdown due to GPU HW CTF!\n" );orderly_poweroff (true); }else if (client_id ==SOC15_IH_CLIENTID_MP1 ) { -if (src_id ==0xfe ) { +if (src_id ==IH_INTERRUPT_ID_TO_DRIVER ) {/* ACK SMUToHost interrupt */ data =RREG32_SOC15 (MP1 ,0 , regMP1_SMN_IH_SW_INT_CTRL); data =REG_SET_FIELD (data,MP1_SMN_IH_SW_INT_CTRL ,INT_ACK ,1 );WREG32_SOC15 (MP1 ,0 , regMP1_SMN_IH_SW_INT_CTRL, data);switch (ctxid) { -case 0x3 : +case IH_INTERRUPT_CONTEXT_ID_AC :dev_dbg (adev->dev,"Switched to AC mode!\n" );smu_v13_0_ack_ac_dc_interrupt (smu); adev->pm.ac_power = true;break ; -case 0x4 : +case IH_INTERRUPT_CONTEXT_ID_DC :dev_dbg (adev->dev,"Switched to DC mode!\n" );smu_v13_0_ack_ac_dc_interrupt (smu); adev->pm.ac_power = false;break ; -case 0x7 : +case IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING :/* * Increment the throttle interrupt counter */ @@ -1398,7 +1398,7 @@ static int smu_v13_0_irq_process(struct amdgpu_device *adev,schedule_work (&smu->throttling_logging_work);break ; -case 0x8 : +case IH_INTERRUPT_CONTEXT_ID_FAN_ABNORMAL : high = smu->thermal_range.software_shutdown_temp + smu->thermal_range.software_shutdown_temp_offset; high = min_t(typeof(high),@@ -1415,7 +1415,7 @@ static int smu_v13_0_irq_process(struct amdgpu_device *adev, data = data & (~THM_THERMAL_INT_CTRL__THERM_TRIGGER_MASK_MASK );WREG32_SOC15 (THM ,0 , regTHM_THERMAL_INT_CTRL, data);break ; -case 0x9 : +case IH_INTERRUPT_CONTEXT_ID_FAN_RECOVERY : high =min_t (typeof (high),SMU_THERMAL_MAXIMUM_ALERT_TEMP , smu->thermal_range.software_shutdown_temp);@@ -1476,7 +1476,7 @@ int smu_v13_0_register_irq_handler(struct smu_context *smu)return ret; ret =amdgpu_irq_add_id (adev,SOC15_IH_CLIENTID_MP1 , -0xfe , +IH_INTERRUPT_ID_TO_DRIVER , irq_src);if (ret)return ret;drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c +1
-1@@ -892,7 +892,7 @@ int smu_v14_0_register_irq_handler(struct smu_context *smu)// TODO: THM related ret =amdgpu_irq_add_id (adev,SOC15_IH_CLIENTID_MP1 , -0xfe , +IH_INTERRUPT_ID_TO_DRIVER , irq_src);if (ret)return ret;drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +10
-0@@ -30,6 +30,16 @@#define FDO_PWM_MODE_STATIC 1#define FDO_PWM_MODE_STATIC_RPM 5 +#define IH_INTERRUPT_ID_TO_DRIVER 0xFE +#define IH_INTERRUPT_CONTEXT_ID_BACO 0x2 +#define IH_INTERRUPT_CONTEXT_ID_AC 0x3 +#define IH_INTERRUPT_CONTEXT_ID_DC 0x4 +#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D0 0x5 +#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D3 0x6 +#define IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING 0x7 +#define IH_INTERRUPT_CONTEXT_ID_FAN_ABNORMAL 0x8 +#define IH_INTERRUPT_CONTEXT_ID_FAN_RECOVERY 0x9 +extern const int link_speed[];/* Helper to Convert from PCIE Gen 1/2/3/4/5/6 to 0.1 GT/s speed units */
RE: [PATCH v2 2/2] drm/amdgpu/pm: Use macro definitions in the smu IH process function
In reply to Ma Jun[AMD Official Use Only - General]
HI Jun,
I don't think it's necessary to delete these definitions in smu driver_if.h.
Adding a prefix can be used to distinguish definitions in the driver and can also make it easier for us to track problems. E.g: SMU_IH_INTERRUPT_ID_TO_DRIVER And definitions in the smu_cmn.h file will cause definition conflicts in all subsequent driver if files, we try to avoid modifying the driver_if file and have kept synchronization with pmfw.
Best Regards,
Kevin
-----Original Message-----
From: Ma, Jun <[email protected]>
Sent: Tuesday, January 23, 2024 4:13 PM
To: [email protected]
Cc: Lazar, Lijo <[email protected]>; Feng, Kenneth <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Ma, Jun <[email protected]>
Subject: [PATCH v2 2/2] drm/amdgpu/pm: Use macro definitions in the smu IH process function
Replace the hard-coded numbers with macro definition
--- .../pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0.h | 11 ----------- .../pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_6.h | 4 ---- .../pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_7.h | 11 ----------- drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 10 +++++----- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 14 +++++++------- drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c | 2 +- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h | 10 ++++++++++ 7 files changed, 23 insertions(+), 39 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0.h +0 -11
@@ -1618,15 +1618,4 @@ typedef struct {#define TABLE_WIFIBAND 12#define TABLE_COUNT 13 -//IH Interupt ID -#define IH_INTERRUPT_ID_TO_DRIVER 0xFE -#define IH_INTERRUPT_CONTEXT_ID_BACO 0x2 -#define IH_INTERRUPT_CONTEXT_ID_AC 0x3 -#define IH_INTERRUPT_CONTEXT_ID_DC 0x4 -#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D0 0x5 -#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D3 0x6 -#define IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING 0x7 -#define IH_INTERRUPT_CONTEXT_ID_FAN_ABNORMAL 0x8 -#define IH_INTERRUPT_CONTEXT_ID_FAN_RECOVERY 0x9 -#endif
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_6.h +0 -4
@@ -209,10 +209,6 @@ typedef struct {float minPsmVoltage[30 ]; } AvfsDebugTableXcd_t; -// Defines used for IH-based thermal interrupts to GFX driver - A/X only -#define IH_INTERRUPT_ID_TO_DRIVER 0xFE -#define IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING 0x7 -//thermal over-temp mask defines for IH interrupt to host #define THROTTLER_PROCHOT_BIT 0#define THROTTLER_PPT_BIT 1
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_7.h +0 -11
@@ -1608,15 +1608,4 @@ typedef struct {#define TABLE_WIFIBAND 12#define TABLE_COUNT 13 -//IH Interupt ID -#define IH_INTERRUPT_ID_TO_DRIVER 0xFE -#define IH_INTERRUPT_CONTEXT_ID_BACO 0x2 -#define IH_INTERRUPT_CONTEXT_ID_AC 0x3 -#define IH_INTERRUPT_CONTEXT_ID_DC 0x4 -#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D0 0x5 -#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D3 0x6 -#define IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING 0x7 -#define IH_INTERRUPT_CONTEXT_ID_FAN_ABNORMAL 0x8 -#define IH_INTERRUPT_CONTEXT_ID_FAN_RECOVERY 0x9 -#endif
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +5 -5
@@ -1432,24 +1432,24 @@ static int smu_v11_0_irq_process(struct amdgpu_device *adev,dev_emerg (adev->dev,"ERROR: System is going to shutdown due to GPU HW CTF!\n" );orderly_poweroff (true); }else if (client_id ==SOC15_IH_CLIENTID_MP1 ) { -if (src_id ==0xfe ) { +if (src_id ==IH_INTERRUPT_ID_TO_DRIVER ) {/* ACK SMUToHost interrupt */ data =RREG32_SOC15 (MP1 ,0 , mmMP1_SMN_IH_SW_INT_CTRL); data =REG_SET_FIELD (data,MP1_SMN_IH_SW_INT_CTRL ,INT_ACK ,1 );WREG32_SOC15 (MP1 ,0 , mmMP1_SMN_IH_SW_INT_CTRL, data);switch (ctxid) { -case 0x3 : +case IH_INTERRUPT_CONTEXT_ID_AC :dev_dbg (adev->dev,"Switched to AC mode!\n" );schedule_work (&smu->interrupt_work); adev->pm.ac_power = true;break ; -case 0x4 : +case IH_INTERRUPT_CONTEXT_ID_DC :dev_dbg (adev->dev,"Switched to DC mode!\n" );schedule_work (&smu->interrupt_work); adev->pm.ac_power = false;break ; -case 0x7 : +case IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING :/* * Increment the throttle interrupt counter */
@@ -1508,7 +1508,7 @@ int smu_v11_0_register_irq_handler(struct smu_context *smu)return ret; ret =amdgpu_irq_add_id (adev,SOC15_IH_CLIENTID_MP1 , -0xfe , +IH_INTERRUPT_ID_TO_DRIVER , irq_src);if (ret)return ret;
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +7 -7
@@ -1368,24 +1368,24 @@ static int smu_v13_0_irq_process(struct amdgpu_device *adev,dev_emerg (adev->dev,"ERROR: System is going to shutdown due to GPU HW CTF!\n" );orderly_poweroff (true); }else if (client_id ==SOC15_IH_CLIENTID_MP1 ) { -if (src_id ==0xfe ) { +if (src_id ==IH_INTERRUPT_ID_TO_DRIVER ) {/* ACK SMUToHost interrupt */ data =RREG32_SOC15 (MP1 ,0 , regMP1_SMN_IH_SW_INT_CTRL); data =REG_SET_FIELD (data,MP1_SMN_IH_SW_INT_CTRL ,INT_ACK ,1 );WREG32_SOC15 (MP1 ,0 , regMP1_SMN_IH_SW_INT_CTRL, data);switch (ctxid) { -case 0x3 : +case IH_INTERRUPT_CONTEXT_ID_AC :dev_dbg (adev->dev,"Switched to AC mode!\n" );smu_v13_0_ack_ac_dc_interrupt (smu); adev->pm.ac_power = true;break ; -case 0x4 : +case IH_INTERRUPT_CONTEXT_ID_DC :dev_dbg (adev->dev,"Switched to DC mode!\n" );smu_v13_0_ack_ac_dc_interrupt (smu); adev->pm.ac_power = false;break ; -case 0x7 : +case IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING :/* * Increment the throttle interrupt counter */
@@ -1398,7 +1398,7 @@ static int smu_v13_0_irq_process(struct amdgpu_device *adev,schedule_work (&smu->throttling_logging_work);break ; -case 0x8 : +case IH_INTERRUPT_CONTEXT_ID_FAN_ABNORMAL : high = smu->thermal_range.software_shutdown_temp + smu->thermal_range.software_shutdown_temp_offset; high = min_t(typeof(high),
@@ -1415,7 +1415,7 @@ static int smu_v13_0_irq_process(struct amdgpu_device *adev, data = data & (~THM_THERMAL_INT_CTRL__THERM_TRIGGER_MASK_MASK );WREG32_SOC15 (THM ,0 , regTHM_THERMAL_INT_CTRL, data);break ; -case 0x9 : +case IH_INTERRUPT_CONTEXT_ID_FAN_RECOVERY : high =min_t (typeof (high),SMU_THERMAL_MAXIMUM_ALERT_TEMP , smu->thermal_range.software_shutdown_temp);
@@ -1476,7 +1476,7 @@ int smu_v13_0_register_irq_handler(struct smu_context *smu)return ret; ret =amdgpu_irq_add_id (adev,SOC15_IH_CLIENTID_MP1 , -0xfe , +IH_INTERRUPT_ID_TO_DRIVER , irq_src);if (ret)return ret;
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c +1 -1
@@ -892,7 +892,7 @@ int smu_v14_0_register_irq_handler(struct smu_context *smu)// TODO: THM related ret =amdgpu_irq_add_id (adev,SOC15_IH_CLIENTID_MP1 , -0xfe , +IH_INTERRUPT_ID_TO_DRIVER , irq_src);if (ret)return ret;
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +10 -0
@@ -30,6 +30,16 @@#define FDO_PWM_MODE_STATIC 1#define FDO_PWM_MODE_STATIC_RPM 5 +#define IH_INTERRUPT_ID_TO_DRIVER 0xFE +#define IH_INTERRUPT_CONTEXT_ID_BACO 0x2 +#define IH_INTERRUPT_CONTEXT_ID_AC 0x3 +#define IH_INTERRUPT_CONTEXT_ID_DC 0x4 +#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D0 0x5 +#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D3 0x6 +#define IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING 0x7 +#define IH_INTERRUPT_CONTEXT_ID_FAN_ABNORMAL 0x8 +#define IH_INTERRUPT_CONTEXT_ID_FAN_RECOVERY 0x9 +extern const int link_speed[];/* Helper to Convert from PCIE Gen 1/2/3/4/5/6 to 0.1 GT/s speed units */
--
2.34.1
Re: [PATCH v2 2/2] drm/amdgpu/pm: Use macro definitions in the smu IH process function
Hi Kevin,
Quoted 8 lines · Yang(Kevin)
[AMD Official Use Only - General]
HI Jun,
I don't think it's necessary to delete these definitions in smu
driver_if.h.
Adding a prefix can be used to distinguish definitions in the driver and can also make it easier for us to track problems. E.g:SMU_IH_INTERRUPT_ID_TO_DRIVERAnd definitions in thesmu_cmn.hfile will cause definition conflicts in all subsequent driver if files, we try to avoid modifying thedriver_iffile and have kept synchronization with pmfw.
In general, we do need to follow the above rules.
But smu_v13_0_irq_process() is a common function used by other asics. Defining these macros in the corresponding smu driver_if.h will cause the compile error.
Regards,
Ma Jun
Quoted 215 lines
Best Regards,
Kevin-----Original Message-----
From: Ma, Jun <[email protected]>
Sent: Tuesday, January 23, 2024 4:13 PM
To: [email protected]
Cc: Lazar, Lijo <[email protected]>; Feng, Kenneth <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Ma, Jun <[email protected]>
Subject: [PATCH v2 2/2] drm/amdgpu/pm: Use macro definitions in the smu IH process functionReplace the hard-coded numbers with macro definition
Signed-off-by Ma Jun <[email protected]>--- .../pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0.h | 11 ----------- .../pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_6.h | 4 ---- .../pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_7.h | 11 ----------- drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 10 +++++----- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 14 +++++++------- drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c | 2 +- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h | 10 ++++++++++ 7 files changed, 23 insertions(+), 39 deletions(-)drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0.h +0
-11@@ -1618,15 +1618,4 @@ typedef struct {#define TABLE_WIFIBAND 12#define TABLE_COUNT 13 -//IH Interupt ID -#define IH_INTERRUPT_ID_TO_DRIVER 0xFE -#define IH_INTERRUPT_CONTEXT_ID_BACO 0x2 -#define IH_INTERRUPT_CONTEXT_ID_AC 0x3 -#define IH_INTERRUPT_CONTEXT_ID_DC 0x4 -#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D0 0x5 -#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D3 0x6 -#define IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING 0x7 -#define IH_INTERRUPT_CONTEXT_ID_FAN_ABNORMAL 0x8 -#define IH_INTERRUPT_CONTEXT_ID_FAN_RECOVERY 0x9 -#endif drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_6.h +0
-4@@ -209,10 +209,6 @@ typedef struct {float minPsmVoltage[30 ]; } AvfsDebugTableXcd_t; -// Defines used for IH-based thermal interrupts to GFX driver - A/X only -#define IH_INTERRUPT_ID_TO_DRIVER 0xFE -#define IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING 0x7 -//thermal over-temp mask defines for IH interrupt to host #define THROTTLER_PROCHOT_BIT 0#define THROTTLER_PPT_BIT 1drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_7.h +0
-11@@ -1608,15 +1608,4 @@ typedef struct {#define TABLE_WIFIBAND 12#define TABLE_COUNT 13 -//IH Interupt ID -#define IH_INTERRUPT_ID_TO_DRIVER 0xFE -#define IH_INTERRUPT_CONTEXT_ID_BACO 0x2 -#define IH_INTERRUPT_CONTEXT_ID_AC 0x3 -#define IH_INTERRUPT_CONTEXT_ID_DC 0x4 -#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D0 0x5 -#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D3 0x6 -#define IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING 0x7 -#define IH_INTERRUPT_CONTEXT_ID_FAN_ABNORMAL 0x8 -#define IH_INTERRUPT_CONTEXT_ID_FAN_RECOVERY 0x9 -#endif drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +5
-5@@ -1432,24 +1432,24 @@ static int smu_v11_0_irq_process(struct amdgpu_device *adev,dev_emerg (adev->dev,"ERROR: System is going to shutdown due to GPU HW CTF!\n" );orderly_poweroff (true); }else if (client_id ==SOC15_IH_CLIENTID_MP1 ) { -if (src_id ==0xfe ) { +if (src_id ==IH_INTERRUPT_ID_TO_DRIVER ) {/* ACK SMUToHost interrupt */ data =RREG32_SOC15 (MP1 ,0 , mmMP1_SMN_IH_SW_INT_CTRL); data =REG_SET_FIELD (data,MP1_SMN_IH_SW_INT_CTRL ,INT_ACK ,1 );WREG32_SOC15 (MP1 ,0 , mmMP1_SMN_IH_SW_INT_CTRL, data);switch (ctxid) { -case 0x3 : +case IH_INTERRUPT_CONTEXT_ID_AC :dev_dbg (adev->dev,"Switched to AC mode!\n" );schedule_work (&smu->interrupt_work); adev->pm.ac_power = true;break ; -case 0x4 : +case IH_INTERRUPT_CONTEXT_ID_DC :dev_dbg (adev->dev,"Switched to DC mode!\n" );schedule_work (&smu->interrupt_work); adev->pm.ac_power = false;break ; -case 0x7 : +case IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING :/* * Increment the throttle interrupt counter */ @@ -1508,7 +1508,7 @@ int smu_v11_0_register_irq_handler(struct smu_context *smu)return ret; ret =amdgpu_irq_add_id (adev,SOC15_IH_CLIENTID_MP1 , -0xfe , +IH_INTERRUPT_ID_TO_DRIVER , irq_src);if (ret)return ret;drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +7
-7@@ -1368,24 +1368,24 @@ static int smu_v13_0_irq_process(struct amdgpu_device *adev,dev_emerg (adev->dev,"ERROR: System is going to shutdown due to GPU HW CTF!\n" );orderly_poweroff (true); }else if (client_id ==SOC15_IH_CLIENTID_MP1 ) { -if (src_id ==0xfe ) { +if (src_id ==IH_INTERRUPT_ID_TO_DRIVER ) {/* ACK SMUToHost interrupt */ data =RREG32_SOC15 (MP1 ,0 , regMP1_SMN_IH_SW_INT_CTRL); data =REG_SET_FIELD (data,MP1_SMN_IH_SW_INT_CTRL ,INT_ACK ,1 );WREG32_SOC15 (MP1 ,0 , regMP1_SMN_IH_SW_INT_CTRL, data);switch (ctxid) { -case 0x3 : +case IH_INTERRUPT_CONTEXT_ID_AC :dev_dbg (adev->dev,"Switched to AC mode!\n" );smu_v13_0_ack_ac_dc_interrupt (smu); adev->pm.ac_power = true;break ; -case 0x4 : +case IH_INTERRUPT_CONTEXT_ID_DC :dev_dbg (adev->dev,"Switched to DC mode!\n" );smu_v13_0_ack_ac_dc_interrupt (smu); adev->pm.ac_power = false;break ; -case 0x7 : +case IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING :/* * Increment the throttle interrupt counter */ @@ -1398,7 +1398,7 @@ static int smu_v13_0_irq_process(struct amdgpu_device *adev,schedule_work (&smu->throttling_logging_work);break ; -case 0x8 : +case IH_INTERRUPT_CONTEXT_ID_FAN_ABNORMAL : high = smu->thermal_range.software_shutdown_temp + smu->thermal_range.software_shutdown_temp_offset; high = min_t(typeof(high),@@ -1415,7 +1415,7 @@ static int smu_v13_0_irq_process(struct amdgpu_device *adev, data = data & (~THM_THERMAL_INT_CTRL__THERM_TRIGGER_MASK_MASK );WREG32_SOC15 (THM ,0 , regTHM_THERMAL_INT_CTRL, data);break ; -case 0x9 : +case IH_INTERRUPT_CONTEXT_ID_FAN_RECOVERY : high =min_t (typeof (high),SMU_THERMAL_MAXIMUM_ALERT_TEMP , smu->thermal_range.software_shutdown_temp);@@ -1476,7 +1476,7 @@ int smu_v13_0_register_irq_handler(struct smu_context *smu)return ret; ret =amdgpu_irq_add_id (adev,SOC15_IH_CLIENTID_MP1 , -0xfe , +IH_INTERRUPT_ID_TO_DRIVER , irq_src);if (ret)return ret;drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c +1
-1@@ -892,7 +892,7 @@ int smu_v14_0_register_irq_handler(struct smu_context *smu)// TODO: THM related ret =amdgpu_irq_add_id (adev,SOC15_IH_CLIENTID_MP1 , -0xfe , +IH_INTERRUPT_ID_TO_DRIVER , irq_src);if (ret)return ret;drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +10
-1@@ -30,6 +30,16 @@#define FDO_PWM_MODE_STATIC 1#define FDO_PWM_MODE_STATIC_RPM 5 +#define IH_INTERRUPT_ID_TO_DRIVER 0xFE +#define IH_INTERRUPT_CONTEXT_ID_BACO 0x2 +#define IH_INTERRUPT_CONTEXT_ID_AC 0x3 +#define IH_INTERRUPT_CONTEXT_ID_DC 0x4 +#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D0 0x5 +#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D3 0x6 +#define IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING 0x7 +#define IH_INTERRUPT_CONTEXT_ID_FAN_ABNORMAL 0x8 +#define IH_INTERRUPT_CONTEXT_ID_FAN_RECOVERY 0x9 +extern const int link_speed[];/* Helper to Convert from PCIE Gen 1/2/3/4/5/6 to 0.1 GT/s speed units */ --2.34.1
RE: [PATCH v2 2/2] drm/amdgpu/pm: Use macro definitions in the smu IH process function
-----Original Message-----
From: Ma, Jun <[email protected]>
Sent: Thursday, January 25, 2024 3:45 PM
To: Wang, Yang(Kevin) <[email protected]>; Ma, Jun <[email protected]>; [email protected]
Cc: Ma, Jun <[email protected]>; Lazar, Lijo <[email protected]>; Feng, Kenneth <[email protected]>; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH v2 2/2] drm/amdgpu/pm: Use macro definitions in the smu IH process function
Hi Kevin,
Quoted 8 lines · Yang(Kevin)
[AMD Official Use Only - General]
HI Jun,
I don't think it's necessary to delete these definitions in smu
driver_if.h.
Adding a prefix can be used to distinguish definitions in the driver
and can also make it easier for us to track problems. E.g:SMU_IH_INTERRUPT_ID_TO_DRIVERAnd definitions in thesmu_cmn.hfile will cause definition conflicts in all subsequent driver if files, we try to avoid modifying thedriver_iffile and have kept synchronization with pmfw.
In general, we do need to follow the above rules.
But smu_v13_0_irq_process() is a common function used by other asics. Defining these macros in the corresponding smu driver_if.h will cause the compile error. [kevin]:
It is precisely for this reason that the prefix SMU_ needs to be added to distinguish these macro definitions. e.g:IH_INTERRUPT_ID_TO_DRIVER to SMU_ IH_INTERRUPT_ID_TO_DRIVER
Best Regards,
Kevin
Regards,
Ma Jun
Quoted 240 lines
Best Regards,
Kevin-----Original Message-----
From: Ma, Jun <[email protected]>
Sent: Tuesday, January 23, 2024 4:13 PM
To: [email protected]
Cc: Lazar, Lijo <[email protected]>; Feng, Kenneth <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Ma, Jun <[email protected]>
Subject: [PATCH v2 2/2] drm/amdgpu/pm: Use macro definitions in the smu IH process functionReplace the hard-coded numbers with macro definition
Signed-off-by Ma Jun <[email protected]>--- .../pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0.h | 11 ----------- .../pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_6.h | 4 ---- .../pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_7.h | 11 ----------- drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 10 +++++----- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 14 +++++++------- drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c | 2 +- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h | 10 ++++++++++ 7 files changed, 23 insertions(+), 39 deletions(-)(quoted diff) +0
-0
a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0.hb/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0.hindexb114d14fc053..91229b2dadb5100644
---a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0.h+++ b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0 +++ .hdrivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0.h +0
-11@@ -1618,15 +1618,4 @@ typedef struct {#define TABLE_WIFIBAND 12#define TABLE_COUNT 13 -//IH Interupt ID -#define IH_INTERRUPT_ID_TO_DRIVER 0xFE -#define IH_INTERRUPT_CONTEXT_ID_BACO 0x2 -#define IH_INTERRUPT_CONTEXT_ID_AC 0x3 -#define IH_INTERRUPT_CONTEXT_ID_DC 0x4 -#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D0 0x5 -#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D3 0x6 -#define IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING 0x7 -#define IH_INTERRUPT_CONTEXT_ID_FAN_ABNORMAL 0x8 -#define IH_INTERRUPT_CONTEXT_ID_FAN_RECOVERY 0x9 -#endif (quoted diff) +0
-0
a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_6.hb/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_6.hindexced348d2e8bb..957b177414a9100644
---a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_6.h+++ b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_6 +++ .hdrivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_6.h +0
-4@@ -209,10 +209,6 @@ typedef struct {float minPsmVoltage[30 ]; } AvfsDebugTableXcd_t; -// Defines used for IH-based thermal interrupts to GFX driver - A/X only -#define IH_INTERRUPT_ID_TO_DRIVER 0xFE -#define IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING 0x7 -//thermal over-temp mask defines for IH interrupt to host #define THROTTLER_PROCHOT_BIT 0#define THROTTLER_PPT_BIT 1(quoted diff) +0
-0
a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_7.hb/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_7.hindex8b1496f8ce58..33937c1d984f100644
---a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_7.h+++ b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_7 +++ .hdrivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0.h +0
-11@@ -1608,15 +1608,4 @@ typedef struct {#define TABLE_WIFIBAND 12#define TABLE_COUNT 13 -//IH Interupt ID -#define IH_INTERRUPT_ID_TO_DRIVER 0xFE -#define IH_INTERRUPT_CONTEXT_ID_BACO 0x2 -#define IH_INTERRUPT_CONTEXT_ID_AC 0x3 -#define IH_INTERRUPT_CONTEXT_ID_DC 0x4 -#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D0 0x5 -#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D3 0x6 -#define IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING 0x7 -#define IH_INTERRUPT_CONTEXT_ID_FAN_ABNORMAL 0x8 -#define IH_INTERRUPT_CONTEXT_ID_FAN_RECOVERY 0x9 -#endif drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +4
-4@@ -1432,24 +1432,24 @@ static int smu_v11_0_irq_process(struct amdgpu_device *adev,dev_emerg (adev->dev,"ERROR: System is going to shutdown due to GPU HW CTF!\n" );orderly_poweroff (true); }else if (client_id ==SOC15_IH_CLIENTID_MP1 ) { -if (src_id ==0xfe ) { +if (src_id ==IH_INTERRUPT_ID_TO_DRIVER ) {/* ACK SMUToHost interrupt */ data =RREG32_SOC15 (MP1 ,0 , mmMP1_SMN_IH_SW_INT_CTRL); data =REG_SET_FIELD (data,MP1_SMN_IH_SW_INT_CTRL ,INT_ACK ,1 );WREG32_SOC15 (MP1 ,0 , mmMP1_SMN_IH_SW_INT_CTRL, data);switch (ctxid) { -case 0x3 : +case IH_INTERRUPT_CONTEXT_ID_AC :dev_dbg (adev->dev,"Switched to AC mode!\n" );schedule_work (&smu->interrupt_work); adev->pm.ac_power = true;break ; -case 0x4 : +case IH_INTERRUPT_CONTEXT_ID_DC :dev_dbg (adev->dev,"Switched to DC mode!\n" );schedule_work (&smu->interrupt_work); adev->pm.ac_power = false;break ; -case 0x7 : +case IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING :/* * Increment the throttle interrupt counter */drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1
-1@@ -1508,7 +1508,7 @@ int smu_v11_0_register_irq_handler(struct smu_context *smu)return ret; ret =amdgpu_irq_add_id (adev,SOC15_IH_CLIENTID_MP1 , -0xfe , +IH_INTERRUPT_ID_TO_DRIVER , irq_src);if (ret)return ret;drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +4
-4@@ -1368,24 +1368,24 @@ static int smu_v13_0_irq_process(struct amdgpu_device *adev,dev_emerg (adev->dev,"ERROR: System is going to shutdown due to GPU HW CTF!\n" );orderly_poweroff (true); }else if (client_id ==SOC15_IH_CLIENTID_MP1 ) { -if (src_id ==0xfe ) { +if (src_id ==IH_INTERRUPT_ID_TO_DRIVER ) {/* ACK SMUToHost interrupt */ data =RREG32_SOC15 (MP1 ,0 , regMP1_SMN_IH_SW_INT_CTRL); data =REG_SET_FIELD (data,MP1_SMN_IH_SW_INT_CTRL ,INT_ACK ,1 );WREG32_SOC15 (MP1 ,0 , regMP1_SMN_IH_SW_INT_CTRL, data);switch (ctxid) { -case 0x3 : +case IH_INTERRUPT_CONTEXT_ID_AC :dev_dbg (adev->dev,"Switched to AC mode!\n" );smu_v13_0_ack_ac_dc_interrupt (smu); adev->pm.ac_power = true;break ; -case 0x4 : +case IH_INTERRUPT_CONTEXT_ID_DC :dev_dbg (adev->dev,"Switched to DC mode!\n" );smu_v13_0_ack_ac_dc_interrupt (smu); adev->pm.ac_power = false;break ; -case 0x7 : +case IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING :/* * Increment the throttle interrupt counter */drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1
-1@@ -1398,7 +1398,7 @@ static int smu_v13_0_irq_process(struct amdgpu_device *adev,schedule_work (&smu->throttling_logging_work);break ; -case 0x8 : +case IH_INTERRUPT_CONTEXT_ID_FAN_ABNORMAL : high = smu->thermal_range.software_shutdown_temp + smu->thermal_range.software_shutdown_temp_offset;high = min_t(typeof(high), @@ -1415,7 +1415,7 @@ static int smu_v13_0_irq_process(struct amdgpu_device *adev, data = data & (~THM_THERMAL_INT_CTRL__THERM_TRIGGER_MASK_MASK); WREG32_SOC15(THM, 0, regTHM_THERMAL_INT_CTRL, data); break;drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1
-1-case 0x9 : +case IH_INTERRUPT_CONTEXT_ID_FAN_RECOVERY : high = min_t(typeof(high), SMU_THERMAL_MAXIMUM_ALERT_TEMP,
smu->thermal_range.software_shutdown_temp);drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1
-1@@ -1476,7 +1476,7 @@ int smu_v13_0_register_irq_handler(struct smu_context *smu)return ret; ret =amdgpu_irq_add_id (adev,SOC15_IH_CLIENTID_MP1 , -0xfe , +IH_INTERRUPT_ID_TO_DRIVER , irq_src);if (ret)return ret;drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c +1
-1@@ -892,7 +892,7 @@ int smu_v14_0_register_irq_handler(struct smu_context *smu)// TODO: THM related ret =amdgpu_irq_add_id (adev,SOC15_IH_CLIENTID_MP1 , -0xfe , +IH_INTERRUPT_ID_TO_DRIVER , irq_src);if (ret)return ret;drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +10
-0@@ -30,6 +30,16 @@#define FDO_PWM_MODE_STATIC 1#define FDO_PWM_MODE_STATIC_RPM 5 +#define IH_INTERRUPT_ID_TO_DRIVER 0xFE +#define IH_INTERRUPT_CONTEXT_ID_BACO 0x2 +#define IH_INTERRUPT_CONTEXT_ID_AC 0x3 +#define IH_INTERRUPT_CONTEXT_ID_DC 0x4 +#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D0 0x5 +#define IH_INTERRUPT_CONTEXT_ID_AUDIO_D3 0x6 +#define IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING 0x7 +#define IH_INTERRUPT_CONTEXT_ID_FAN_ABNORMAL 0x8 +#define IH_INTERRUPT_CONTEXT_ID_FAN_RECOVERY 0x9 +extern const int link_speed[];/* Helper to Convert from PCIE Gen 1/2/3/4/5/6 to 0.1 GT/s speed units */
--
2.34.1