drm/amd/pm: Update pmfw header files for SMU v13.0.6
Subsystems (3)
Alex Deucher
maintainerPATCH 1/12 drm/amd/pm: Update pmfw header files for SMU v13.0.6
From: Asad kamal <[email protected]>
Update driver metrics table for SMU v13.0.6 to be compatible with PMFW v85.47 version
--- .../drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_6.h | 4 ++-- drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_6_pmfw.h | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_6.h +2 -2
@@ -26,7 +26,7 @@// *** IMPORTANT *** // PMFW TEAM: Always increment the interface version if // anything is changed in this file -#define SMU13_0_6_DRIVER_IF_VERSION 0x08042022 +#define SMU13_0_6_DRIVER_IF_VERSION 0x08042023//I2C Interface #define NUM_I2C_CONTROLLERS 8
@@ -106,7 +106,7 @@ typedef enum { } UCLK_DPM_MODE_e; typedef struct { - //0-26 SOC, 27-29 SOCIO + //0-23 SOC, 24-26 SOCIO, 27-29 SOC uint16_t avgPsmCount[30]; uint16_t minPsmCount[30]; float avgPsmVoltage[30];
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_6_pmfw.h +5 -1
@@ -123,7 +123,7 @@ typedef enum {VOLTAGE_GUARDBAND_COUNT } GFX_GUARDBAND_e; -#define SMU_METRICS_TABLE_VERSION 0x1 +#define SMU_METRICS_TABLE_VERSION 0x3 typedef struct { uint32_t AccumulationCounter;
@@ -198,6 +198,10 @@ typedef struct {uint32_t SocketThmResidencyAcc;uint32_t VrThmResidencyAcc;uint32_t HbmThmResidencyAcc; +uint32_t spare; + +// New Items at end to maintain driver compatibility +uint32_t GfxclkFrequency[8 ]; } MetricsTable_t;#define SMU_VF_METRICS_TABLE_VERSION 0x1
Signature · 1 line
2.40.1
Alex Deucher
maintainerPATCH 2/12 drm/amd/pm: Update gfx clock frequency for SMU v13.0.6
From: Asad kamal <[email protected]>
Update gfx clock frequency from metric table for SMU v13.0.6
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +10 -1
@@ -660,7 +660,10 @@ static int smu_v13_0_6_get_smu_metrics_data(struct smu_context *smu, {struct smu_table_context *smu_table = &smu->smu_table;MetricsTable_t *metrics = (MetricsTable_t *)smu_table->metrics_table; +struct amdgpu_device *adev = smu->adev; +uint32_t smu_version;int ret =0 ; +int xcc_id; ret =smu_v13_0_6_get_metrics_table (smu,NULL , false);if (ret)
@@ -670,7 +673,13 @@ static int smu_v13_0_6_get_smu_metrics_data(struct smu_context *smu,switch (member) {case METRICS_CURR_GFXCLK :case METRICS_AVERAGE_GFXCLK : - *value =0 ; +smu_cmn_get_smc_version (smu,NULL , &smu_version); +if (smu_version >=0x552F00 ) { + xcc_id =GET_INST (GC ,0 ); + *value =SMUQ10_TO_UINT (metrics->GfxclkFrequency[xcc_id]); + }else { + *value =0 ; + }break ;case METRICS_CURR_SOCCLK :case METRICS_AVERAGE_SOCCLK :
Signature · 1 line
2.40.1
Alex Deucher
maintainerPATCH 3/12 drm/amd/pm: Update pmfw header files for SMU v13.0.6
In reply to Alex DeucherFrom: Asad kamal <[email protected]>
Update driver interface for SMU v13.0.6 to be compatible with PMFW v85.48 version
--- .../pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_6.h | 12 ++++++++++++ drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 1 - 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_6.h +12 -0
@@ -121,6 +121,18 @@ 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 +#define THROTTLER_TEMP_CCD_BIT 5 +#define THROTTLER_TEMP_XCD_BIT 6 +#define THROTTLER_TEMP_HBM_BIT 7 +#define THROTTLER_TEMP_AID_BIT 8 +#define THROTTLER_VRHOT_BIT 9 + +// These defines are used with the following messages: // SMC_MSG_TransferTableDram2Smu // SMC_MSG_TransferTableSmu2Dram
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +0 -1
@@ -175,7 +175,6 @@ static const struct cmn2asic_mapping smu_v13_0_6_table_map[SMU_TABLE_COUNT] = {#define THROTTLER_PPT_BIT 1#define THROTTLER_TEMP_SOC_BIT 2#define THROTTLER_TEMP_VR_GFX_BIT 3 -#define THROTTLER_TEMP_HBM_BIT 4static const uint8_t smu_v13_0_6_throttler_map[] = { [THROTTLER_PPT_BIT ] = (SMU_THROTTLER_PPT0_BIT ),
Signature · 1 line
2.40.1
Alex Deucher
maintainerPATCH 4/12 drm/amd/pm: Add ih for SMU v13.0.6 thermal throttling
In reply to Alex DeucherFrom: Asad kamal <[email protected]>
Add interrupt handler for thermal throttler events from PMFW on SMUv13.0.6
--- .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 107 +++++++++++++++++- 1 file changed, 104 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +104 -3
@@ -1297,6 +1297,109 @@ static int smu_v13_0_6_set_power_limit(struct smu_context *smu,return smu_v13_0_set_power_limit (smu, limit_type, limit); } +static int smu_v13_0_6_irq_process (struct amdgpu_device *adev, +struct amdgpu_irq_src *source, +struct amdgpu_iv_entry *entry) +{ +struct smu_context *smu = adev->powerplay.pp_handle; +uint32_t client_id = entry->client_id; +uint32_t src_id = entry->src_id; +/* +* ctxid is used to distinguish different +* events for SMCToHost interrupt +*/ +uint32_t ctxid = entry->src_data[0 ]; +uint32_t data; + +if (client_id ==SOC15_IH_CLIENTID_MP1 ) { +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 IH_INTERRUPT_CONTEXT_ID_THERMAL_THROTTLING : +/* +* Increment the throttle interrupt counter +*/ +atomic64_inc (&smu->throttle_int_counter); + +if (!atomic_read (&adev->throttling_logging_enabled)) +return 0 ; + +if (__ratelimit (&adev->throttling_logging_rs)) +schedule_work (&smu->throttling_logging_work); + +break ; + } + } + } + +return 0 ; +} + +int smu_v13_0_6_set_irq_state (struct amdgpu_device *adev, +struct amdgpu_irq_src *source, +unsigned tyep, +enum amdgpu_interrupt_state state) +{ +uint32_t val =0 ; + +switch (state) { +case AMDGPU_IRQ_STATE_DISABLE : +/* For MP1 SW irqs */ + val =RREG32_SOC15 (MP1 ,0 , regMP1_SMN_IH_SW_INT_CTRL); + val =REG_SET_FIELD (val,MP1_SMN_IH_SW_INT_CTRL ,INT_MASK ,1 ); +WREG32_SOC15 (MP1 ,0 , regMP1_SMN_IH_SW_INT_CTRL, val); + +break ; +case AMDGPU_IRQ_STATE_ENABLE : +/* For MP1 SW irqs */ + val =RREG32_SOC15 (MP1 ,0 , regMP1_SMN_IH_SW_INT); + val =REG_SET_FIELD (val,MP1_SMN_IH_SW_INT ,ID ,0xFE ); + val =REG_SET_FIELD (val,MP1_SMN_IH_SW_INT ,VALID ,0 ); +WREG32_SOC15 (MP1 ,0 , regMP1_SMN_IH_SW_INT, val); + + val =RREG32_SOC15 (MP1 ,0 , regMP1_SMN_IH_SW_INT_CTRL); + val =REG_SET_FIELD (val,MP1_SMN_IH_SW_INT_CTRL ,INT_MASK ,0 ); +WREG32_SOC15 (MP1 ,0 , regMP1_SMN_IH_SW_INT_CTRL, val); + +break ; +default : +break ; + } + +return 0 ; +} + +static const struct amdgpu_irq_src_funcs smu_v13_0_6_irq_funcs = +{ + .set = smu_v13_0_6_set_irq_state, + .process = smu_v13_0_6_irq_process, +}; + +int smu_v13_0_6_register_irq_handler (struct smu_context *smu) +{ +struct amdgpu_device *adev = smu->adev; +struct amdgpu_irq_src *irq_src = &smu->irq_source; +int ret =0 ; + +if (amdgpu_sriov_vf (adev)) +return 0 ; + + irq_src->num_types =1 ; + irq_src->funcs = &smu_v13_0_6_irq_funcs; + + ret =amdgpu_irq_add_id (adev,SOC15_IH_CLIENTID_MP1 , +IH_INTERRUPT_ID_TO_DRIVER , + irq_src); +if (ret) +return ret; + +return ret; +} +static int smu_v13_0_6_system_features_control (struct smu_context *smu,bool enable) {
@@ -2042,11 +2145,9 @@ static const struct pptable_funcs smu_v13_0_6_ppt_funcs = { .feature_is_enabled = smu_cmn_feature_is_enabled, .set_power_limit = smu_v13_0_6_set_power_limit, .set_xgmi_pstate = smu_v13_0_set_xgmi_pstate, -/* TODO: Thermal limits unknown, skip these for now -.register_irq_handler = smu_v13_0_register_irq_handler, + .register_irq_handler = smu_v13_0_6_register_irq_handler, .enable_thermal_alert = smu_v13_0_enable_thermal_alert, .disable_thermal_alert = smu_v13_0_disable_thermal_alert, -*/ .setup_pptable = smu_v13_0_6_setup_pptable, .baco_is_support = smu_v13_0_6_is_baco_supported, .get_dpm_ultimate_freq = smu_v13_0_6_get_dpm_ultimate_freq,
Signature · 1 line
2.40.1
Alex Deucher
maintainerPATCH 5/12 drm/amd/pm: Keep interface version in PMFW header
In reply to Alex DeucherFrom: Lijo Lazar <[email protected]>
Use the interface version directly from PMFW interface header file rather than keeping another definition in common smu13 file.
--- .../inc/pmfw_if/smu13_driver_if_aldebaran.h | 2 + .../inc/pmfw_if/smu13_driver_if_v13_0_0.h | 2 + .../inc/pmfw_if/smu13_driver_if_v13_0_4.h | 2 +- .../inc/pmfw_if/smu13_driver_if_v13_0_5.h | 2 +- .../inc/pmfw_if/smu13_driver_if_v13_0_7.h | 2 +- .../inc/pmfw_if/smu13_driver_if_yellow_carp.h | 2 +- drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h | 11 ------ .../drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 1 + .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 39 +------------------ .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 1 + .../drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c | 1 + .../drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c | 1 + .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 1 + .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 1 + .../drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c | 1 + 15 files changed, 17 insertions(+), 52 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_aldebaran.h +2 -0
@@ -24,6 +24,8 @@#ifndef SMU13_DRIVER_IF_ALDEBARAN_H #define SMU13_DRIVER_IF_ALDEBARAN_H +#define SMU13_DRIVER_IF_VERSION_ALDE 0x08 +#define NUM_VCLK_DPM_LEVELS 8#define NUM_DCLK_DPM_LEVELS 8#define NUM_SOCCLK_DPM_LEVELS 8
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0.h +2 -0
@@ -24,6 +24,8 @@#ifndef SMU13_DRIVER_IF_V13_0_0_H #define SMU13_DRIVER_IF_V13_0_0_H +#define SMU13_0_0_DRIVER_IF_VERSION 0x32 +//Increment this version if SkuTable_t or BoardTable_t change #define PPTABLE_VERSION 0x26
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_4.h +1 -1
@@ -27,7 +27,7 @@// *** IMPORTANT *** // SMU TEAM: Always increment the interface version if // any structure is changed in this file -#define PMFW_DRIVER_IF_VERSION 8 +#define SMU13_0_4_DRIVER_IF_VERSION 8 typedef struct { int32_t value;
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_5.h +1 -1
@@ -23,7 +23,7 @@#ifndef __SMU13_DRIVER_IF_V13_0_5_H__#define __SMU13_DRIVER_IF_V13_0_5_H__ -#define PMFW_DRIVER_IF_VERSION 4 +#define SMU13_0_5_DRIVER_IF_VERSION 4// Throttler Status Bitmask #define THROTTLER_STATUS_BIT_SPL 0
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_7.h +1 -1
@@ -25,7 +25,7 @@// *** IMPORTANT *** // PMFW TEAM: Always increment the interface version on any change to this file -#define SMU13_DRIVER_IF_VERSION 0x35 +#define SMU13_0_7_DRIVER_IF_VERSION 0x35//Increment this version if SkuTable_t or BoardTable_t change #define PPTABLE_VERSION 0x27
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_yellow_carp.h +1 -1
@@ -26,7 +26,7 @@// *** IMPORTANT *** // SMU TEAM: Always increment the interface version if // any structure is changed in this file -#define SMU13_DRIVER_IF_VERSION 4 +#define SMU13_YELLOW_CARP_DRIVER_IF_VERSION 4 typedef struct { int32_t value;
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h +0 -11
@@ -25,17 +25,6 @@#include "amdgpu_smu.h" -#define SMU13_DRIVER_IF_VERSION_INV 0xFFFFFFFF -#define SMU13_DRIVER_IF_VERSION_YELLOW_CARP 0x04 -#define SMU13_DRIVER_IF_VERSION_ALDE 0x08 -#define SMU13_DRIVER_IF_VERSION_SMU_V13_0_0_0 0x37 -#define SMU13_DRIVER_IF_VERSION_SMU_V13_0_4 0x08 -#define SMU13_DRIVER_IF_VERSION_SMU_V13_0_5 0x04 -#define SMU13_DRIVER_IF_VERSION_SMU_V13_0_0_10 0x32 -#define SMU13_DRIVER_IF_VERSION_SMU_V13_0_7 0x37 -#define SMU13_DRIVER_IF_VERSION_SMU_V13_0_10 0x1D -#define SMU13_DRIVER_IF_VERSION_SMU_V13_0_6 0x0 -#define SMU13_MODE1_RESET_WAIT_TIME_IN_MS 500 //500ms/* MP Apertures */
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +1 -0
@@ -2147,5 +2147,6 @@ void aldebaran_set_ppt_funcs(struct smu_context *smu) smu->clock_map = aldebaran_clk_map; smu->feature_map = aldebaran_feature_mask_map; smu->table_map = aldebaran_table_map; + smu->smc_driver_if_version =SMU13_DRIVER_IF_VERSION_ALDE ;smu_v13_0_set_smu_mailbox_registers (smu); }
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +2 -37
@@ -269,45 +269,10 @@ int smu_v13_0_check_fw_version(struct smu_context *smu) smu_major = (smu_version >>16 ) &0xff ; smu_minor = (smu_version >>8 ) &0xff ; smu_debug = (smu_version >>0 ) &0xff ; -if (smu->is_apu) +if (smu->is_apu || + adev->ip_versions[MP1_HWIP ][0 ] ==IP_VERSION (13 ,0 ,6 )) adev->pm.fw_version = smu_version; -switch (adev->ip_versions[MP1_HWIP ][0 ]) { -case IP_VERSION (13 ,0 ,2 ): - smu->smc_driver_if_version =SMU13_DRIVER_IF_VERSION_ALDE ; -break ; -case IP_VERSION (13 ,0 ,0 ): - smu->smc_driver_if_version =SMU13_DRIVER_IF_VERSION_SMU_V13_0_0_0 ; -break ; -case IP_VERSION (13 ,0 ,10 ): - smu->smc_driver_if_version =SMU13_DRIVER_IF_VERSION_SMU_V13_0_0_10 ; -break ; -case IP_VERSION (13 ,0 ,7 ): - smu->smc_driver_if_version =SMU13_DRIVER_IF_VERSION_SMU_V13_0_7 ; -break ; -case IP_VERSION (13 ,0 ,1 ): -case IP_VERSION (13 ,0 ,3 ): -case IP_VERSION (13 ,0 ,8 ): - smu->smc_driver_if_version =SMU13_DRIVER_IF_VERSION_YELLOW_CARP ; -break ; -case IP_VERSION (13 ,0 ,4 ): -case IP_VERSION (13 ,0 ,11 ): - smu->smc_driver_if_version =SMU13_DRIVER_IF_VERSION_SMU_V13_0_4 ; -break ; -case IP_VERSION (13 ,0 ,5 ): - smu->smc_driver_if_version =SMU13_DRIVER_IF_VERSION_SMU_V13_0_5 ; -break ; -case IP_VERSION (13 ,0 ,6 ): - smu->smc_driver_if_version =SMU13_DRIVER_IF_VERSION_SMU_V13_0_6 ; - adev->pm.fw_version = smu_version; -break ; -default : -dev_err (adev->dev,"smu unsupported IP version: 0x%x.\n" , - adev->ip_versions[MP1_HWIP ][0 ]); - smu->smc_driver_if_version =SMU13_DRIVER_IF_VERSION_INV ; -break ; - } -/* only for dGPU w/ SMU13*/ if (adev->pm.fw) dev_dbg(smu->adev->dev, "smu fw reported program %d, version = 0x%08x (%d.%d.%d)\n",
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +1 -0
@@ -2199,5 +2199,6 @@ void smu_v13_0_0_set_ppt_funcs(struct smu_context *smu) smu->table_map = smu_v13_0_0_table_map; smu->pwr_src_map = smu_v13_0_0_pwr_src_map; smu->workload_map = smu_v13_0_0_workload_map; + smu->smc_driver_if_version =SMU13_0_0_DRIVER_IF_VERSION ;smu_v13_0_0_set_smu_mailbox_registers (smu); }
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c +1 -0
@@ -1043,6 +1043,7 @@ void smu_v13_0_4_set_ppt_funcs(struct smu_context *smu) smu->message_map = smu_v13_0_4_message_map; smu->feature_map = smu_v13_0_4_feature_mask_map; smu->table_map = smu_v13_0_4_table_map; + smu->smc_driver_if_version =SMU13_0_4_DRIVER_IF_VERSION ; smu->is_apu = true;if (adev->ip_versions[MP1_HWIP ][0 ] ==IP_VERSION (13 ,0 ,4 ))
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c +1 -0
@@ -1068,6 +1068,7 @@ void smu_v13_0_5_set_ppt_funcs(struct smu_context *smu) smu->feature_map = smu_v13_0_5_feature_mask_map; smu->table_map = smu_v13_0_5_table_map; smu->is_apu = true; + smu->smc_driver_if_version =SMU13_0_5_DRIVER_IF_VERSION ; smu->param_reg =SOC15_REG_OFFSET (MP1 ,0 , mmMP1_C2PMSG_34); smu->msg_reg =SOC15_REG_OFFSET (MP1 ,0 , mmMP1_C2PMSG_2); smu->resp_reg =SOC15_REG_OFFSET (MP1 ,0 , mmMP1_C2PMSG_33);
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +1 -0
@@ -2176,5 +2176,6 @@ void smu_v13_0_6_set_ppt_funcs(struct smu_context *smu) smu->clock_map = smu_v13_0_6_clk_map; smu->feature_map = smu_v13_0_6_feature_mask_map; smu->table_map = smu_v13_0_6_table_map; + smu->smc_driver_if_version =SMU13_0_6_DRIVER_IF_VERSION ;smu_v13_0_set_smu_mailbox_registers (smu); }
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +1 -0
@@ -1796,5 +1796,6 @@ void smu_v13_0_7_set_ppt_funcs(struct smu_context *smu) smu->table_map = smu_v13_0_7_table_map; smu->pwr_src_map = smu_v13_0_7_pwr_src_map; smu->workload_map = smu_v13_0_7_workload_map; + smu->smc_driver_if_version =SMU13_0_7_DRIVER_IF_VERSION ;smu_v13_0_set_smu_mailbox_registers (smu); }
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +1 -0
@@ -1234,5 +1234,6 @@ void yellow_carp_set_ppt_funcs(struct smu_context *smu) smu->feature_map = yellow_carp_feature_mask_map; smu->table_map = yellow_carp_table_map; smu->is_apu = true; + smu->smc_driver_if_version =SMU13_YELLOW_CARP_DRIVER_IF_VERSION ;smu_v13_0_set_smu_mailbox_registers (smu); }
Signature · 1 line
2.40.1
Alex Deucher
maintainerPATCH 6/12 drm/amd/pm: Initialize power limit for SMU v13.0.6
In reply to Alex DeucherFrom: Lijo Lazar <[email protected]>
PMFW will initialize the power limit values even if PPT throttler feature is disabled. Fetch the limit value from FW.
--- .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 15 --------------- 1 file changed, 15 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +0 -15
@@ -1256,21 +1256,6 @@ static int smu_v13_0_6_get_power_limit(struct smu_context *smu,uint32_t power_limit =0 ;int ret; -if (!smu_cmn_feature_is_enabled (smu,SMU_FEATURE_PPT_BIT )) { -if (current_power_limit) - *current_power_limit =0 ; -if (default_power_limit) - *default_power_limit =0 ; -if (max_power_limit) - *max_power_limit =0 ; - -dev_warn ( - smu->adev->dev, -"PPT feature is not enabled, power values can't be fetched." ); - -return 0 ; - } - ret =smu_cmn_send_smc_msg (smu, SMU_MSG_GetPptLimit, &power_limit);if (ret) {
Signature · 1 line
2.40.1
Alex Deucher
maintainerPATCH 7/12 drm/amd/pm: Update hw mon attributes for GC version 9.4.3
In reply to Alex DeucherFrom: Asad Kamal <[email protected]>
Update hw mon attributes for GC Version 9.4.3 to valid ones on APU and Non APU systems
v2: Group checks along existing one
Added power limit & mclock for gc version 9.4.3
--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 36 +++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +25 -11
@@ -3362,7 +3362,8 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,return 0 ;/* Skip crit temp on APU */ -if ((adev->flags &AMD_IS_APU ) && (adev->family >=AMDGPU_FAMILY_CZ ) && +if ((((adev->flags &AMD_IS_APU ) && (adev->family >=AMDGPU_FAMILY_CZ )) || + (gc_ver ==IP_VERSION (9 ,4 ,3 ))) && (attr == &sensor_dev_attr_temp1_crit.dev_attr.attr || attr == &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr))return 0 ;
@@ -3395,9 +3396,10 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj, attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr)) /* can't manage state */ effective_mode &= ~S_IWUSR ; -/* In the case of APUs, this is only implemented on Vangogh */ +/* not implemented yet for APUs other than GC 10.3.1 (vangogh) and 9.4.3 */ if (((adev->family == AMDGPU_FAMILY_SI) || - ((adev->flags & AMD_IS_APU) && (gc_ver != IP_VERSION(10, 3, 1)))) && + ((adev->flags & AMD_IS_APU) && (gc_ver != IP_VERSION(10, 3, 1)) && + (gc_ver != IP_VERSION(9, 4, 3)))) && (attr == &sensor_dev_attr_power1_cap_max.dev_attr.attr || attr == &sensor_dev_attr_power1_cap_min.dev_attr.attr || attr == &sensor_dev_attr_power1_cap.dev_attr.attr ||
@@ -3426,25 +3428,39 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,return 0 ;if ((adev->family ==AMDGPU_FAMILY_SI ||/* not implemented yet */ - adev->family ==AMDGPU_FAMILY_KV ) &&/* not implemented yet */ + adev->family ==AMDGPU_FAMILY_KV ||/* not implemented yet */ + (gc_ver ==IP_VERSION (9 ,4 ,3 ))) && (attr == &sensor_dev_attr_in0_input.dev_attr.attr || attr == &sensor_dev_attr_in0_label.dev_attr.attr))return 0 ; -/* only APUs have vddnb */ -if (!(adev->flags &AMD_IS_APU ) && +/* only APUs other than gc 9,4,3 have vddnb */ +if ((!(adev->flags &AMD_IS_APU ) || (gc_ver ==IP_VERSION (9 ,4 ,3 ))) && (attr == &sensor_dev_attr_in1_input.dev_attr.attr || attr == &sensor_dev_attr_in1_label.dev_attr.attr))return 0 ; -/* no mclk on APUs */ -if ((adev->flags &AMD_IS_APU ) && +/* no mclk on APUs other than gc 9,4,3*/ +if (((adev->flags &AMD_IS_APU ) && (gc_ver !=IP_VERSION (9 ,4 ,3 ))) && (attr == &sensor_dev_attr_freq2_input.dev_attr.attr || attr == &sensor_dev_attr_freq2_label.dev_attr.attr))return 0 ; -/* only SOC15 dGPUs support hotspot and mem temperatures */ if (((adev->flags &AMD_IS_APU ) || gc_ver <IP_VERSION (9 ,0 ,0 )) && + (gc_ver !=IP_VERSION (9 ,4 ,3 )) && + (attr == &sensor_dev_attr_temp2_input.dev_attr.attr || + attr == &sensor_dev_attr_temp2_label.dev_attr.attr)) +return 0 ; + +/* Only hotspot temperature for gc 9,4,3*/ +if ((gc_ver ==IP_VERSION (9 ,4 ,3 )) && + (attr == &sensor_dev_attr_temp1_input.dev_attr.attr || + attr == &sensor_dev_attr_temp1_label.dev_attr.attr)) +return 0 ; + +/* only SOC15 dGPUs support hotspot and mem temperatures */ + if (((adev->flags & AMD_IS_APU) || gc_ver < IP_VERSION(9, 0, 0) || + (gc_ver == IP_VERSION(9, 4, 3))) && (attr == &sensor_dev_attr_temp2_crit.dev_attr.attr || attr == &sensor_dev_attr_temp2_crit_hyst.dev_attr.attr || attr == &sensor_dev_attr_temp3_crit.dev_attr.attr ||
@@ -3452,9 +3468,7 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj, attr == &sensor_dev_attr_temp1_emergency.dev_attr.attr || attr == &sensor_dev_attr_temp2_emergency.dev_attr.attr || attr == &sensor_dev_attr_temp3_emergency.dev_attr.attr || - attr == &sensor_dev_attr_temp2_input.dev_attr.attr || attr == &sensor_dev_attr_temp3_input.dev_attr.attr || - attr == &sensor_dev_attr_temp2_label.dev_attr.attr || attr == &sensor_dev_attr_temp3_label.dev_attr.attr)) return 0;
Signature · 1 line
2.40.1
Alex Deucher
maintainerPATCH 8/12 drm/amd/pm: Expose mem temperature for GC version 9.4.3
In reply to Alex DeucherFrom: Asad Kamal <[email protected]>
Add mem temperature as part of hw mon attributes for GC version 9.4.3
--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +5 -5
@@ -3449,10 +3449,12 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,if (((adev->flags &AMD_IS_APU ) || gc_ver <IP_VERSION (9 ,0 ,0 )) && (gc_ver !=IP_VERSION (9 ,4 ,3 )) && (attr == &sensor_dev_attr_temp2_input.dev_attr.attr || - attr == &sensor_dev_attr_temp2_label.dev_attr.attr)) + attr == &sensor_dev_attr_temp2_label.dev_attr.attr || + attr == &sensor_dev_attr_temp3_input.dev_attr.attr || + attr == &sensor_dev_attr_temp3_label.dev_attr.attr))return 0 ; -/* Only hotspot temperature for gc 9,4,3*/ +/* hotspot temperature for gc 9,4,3*/ if ((gc_ver ==IP_VERSION (9 ,4 ,3 )) && (attr == &sensor_dev_attr_temp1_input.dev_attr.attr || attr == &sensor_dev_attr_temp1_label.dev_attr.attr))
@@ -3467,9 +3469,7 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj, attr == &sensor_dev_attr_temp3_crit_hyst.dev_attr.attr || attr == &sensor_dev_attr_temp1_emergency.dev_attr.attr || attr == &sensor_dev_attr_temp2_emergency.dev_attr.attr || - attr == &sensor_dev_attr_temp3_emergency.dev_attr.attr || - attr == &sensor_dev_attr_temp3_input.dev_attr.attr || - attr == &sensor_dev_attr_temp3_label.dev_attr.attr)) + attr == &sensor_dev_attr_temp3_emergency.dev_attr.attr)) return 0;/* only Vangogh has fast PPT limit and power labels */
Signature · 1 line
2.40.1
Alex Deucher
maintainerPATCH 9/12 drm/amd/pm: Update PMFW headers for version 85.54
In reply to Alex DeucherFrom: Lijo Lazar <[email protected]>
It adds message support for FW notification on driver unload.
--- .../inc/pmfw_if/smu13_driver_if_v13_0_6.h | 18 ------------------ .../pm/swsmu/inc/pmfw_if/smu_v13_0_6_ppsmc.h | 3 ++- 2 files changed, 2 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_6.h +0 -18
@@ -132,22 +132,4 @@ typedef struct {#define THROTTLER_TEMP_AID_BIT 8#define THROTTLER_VRHOT_BIT 9 - -// These defines are used with the following messages: -// SMC_MSG_TransferTableDram2Smu -// SMC_MSG_TransferTableSmu2Dram -// #define TABLE_PPTABLE 0 -// #define TABLE_AVFS_PSM_DEBUG 1 -// #define TABLE_AVFS_FUSE_OVERRIDE 2 -// #define TABLE_PMSTATUSLOG 3 -// #define TABLE_SMU_METRICS 4 -// #define TABLE_DRIVER_SMU_CONFIG 5 -// #define TABLE_I2C_COMMANDS 6 -// #define TABLE_COUNT 7 - -// // Table transfer status -// #define TABLE_TRANSFER_OK 0x0 -// #define TABLE_TRANSFER_FAILED 0xFF -// #define TABLE_TRANSFER_PENDING 0xAB -#endif
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_6_ppsmc.h +2 -1
@@ -82,7 +82,8 @@#define PPSMC_MSG_SetSoftMaxGfxClk 0x31#define PPSMC_MSG_GetMinGfxDpmFreq 0x32#define PPSMC_MSG_GetMaxGfxDpmFreq 0x33 -#define PPSMC_Message_Count 0x34 +#define PPSMC_MSG_PrepareForDriverUnload 0x34 +#define PPSMC_Message_Count 0x35//PPSMC Reset Types for driver msg argument #define PPSMC_RESET_TYPE_DRIVER_MODE_1_RESET 0x1
Signature · 1 line
2.40.1
Alex Deucher
maintainerPATCH 10/12 drm/amd/pm: Notify PMFW about driver unload cases
In reply to Alex DeucherFrom: Lijo Lazar <[email protected]>
On SMU v13.0.6 APUs, FW will need to take some actions if driver is going to halt RLC. Notify PMFW that driver is not going to manage device so that FW takes care of the required actions.
--- .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +23 -2
@@ -122,6 +122,7 @@ static const struct cmn2asic_msg_mapping smu_v13_0_6_message_map[SMU_MSG_MAX_COUMSG_MAP (GetMaxGfxclkFrequency, PPSMC_MSG_GetMaxGfxDpmFreq,0 ),MSG_MAP (SetSoftMinGfxclk, PPSMC_MSG_SetSoftMinGfxClk,0 ),MSG_MAP (SetSoftMaxGfxClk, PPSMC_MSG_SetSoftMaxGfxClk,0 ), + MSG_MAP(PrepareMp1ForUnload, PPSMC_MSG_PrepareForDriverUnload, 0), }; static const struct cmn2asic_mapping smu_v13_0_6_clk_map[SMU_CLK_COUNT] = {
@@ -1385,14 +1386,34 @@ int smu_v13_0_6_register_irq_handler(struct smu_context *smu)return ret; } +static int smu_v13_0_6_notify_unload (struct smu_context *smu) +{ +uint32_t smu_version; + +smu_cmn_get_smc_version (smu,NULL , &smu_version); +if (smu_version <=0x553500 ) +return 0 ; + +dev_dbg (smu->adev->dev,"Notify PMFW about driver unload" ); +/* Ignore return, just intimate FW that driver is not going to be there */ +smu_cmn_send_smc_msg (smu, SMU_MSG_PrepareMp1ForUnload,NULL ); + +return 0 ; +} +static int smu_v13_0_6_system_features_control (struct smu_context *smu,bool enable) { +struct amdgpu_device *adev = smu->adev;int ret; -/* Nothing to be done for APU */ -if (smu->adev->flags &AMD_IS_APU ) +/* On APUs, notify FW that the device is no longer driver managed */ +if (adev->flags &AMD_IS_APU ) { +if (!enable) +smu_v13_0_6_notify_unload (smu); +return 0 ; + } ret =smu_v13_0_system_features_control (smu, enable);
Signature · 1 line
2.40.1
Alex Deucher
maintainerPATCH 11/12 drm/amdgpu: Add mode-2 reset in SMU v13.0.6
In reply to Alex DeucherFrom: Lijo Lazar <[email protected]>
Modifications to mode-2 reset flow for SMU v13.0.6 ASICs.
--- drivers/gpu/drm/amd/amdgpu/soc15.c | 9 +++++++++ .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 16 +++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/soc15.c +9 -0
@@ -556,6 +556,15 @@ soc15_asic_reset_method(struct amdgpu_device *adev)if (connected_to_cpu)return AMD_RESET_METHOD_MODE2 ;break ; +case IP_VERSION (13 ,0 ,6 ): +/* Use gpu_recovery param to target a reset method. +* Enable triggering of GPU reset only if specified +* by module parameter. +*/ +if (amdgpu_gpu_recovery ==4 || amdgpu_gpu_recovery ==5 ) +return AMD_RESET_METHOD_MODE2 ; +else +return AMD_RESET_METHOD_NONE ;default :break ; }
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +7 -9
@@ -2024,27 +2024,27 @@ static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **tablestatic int smu_v13_0_6_mode2_reset (struct smu_context *smu) { -u32 smu_version;int ret =0 , index;struct amdgpu_device *adev = smu->adev;int timeout =10 ; -smu_cmn_get_smc_version (smu,NULL , &smu_version); - index =smu_cmn_to_asic_specific_index (smu,CMN2ASIC_MAPPING_MSG , SMU_MSG_GfxDeviceDriverReset);mutex_lock (&smu->message_lock); + ret =smu_cmn_send_msg_without_waiting (smu, (uint16_t )index,SMU_RESET_MODE_2 ); +/* This is similar to FLR, wait till max FLR timeout */ msleep (100 ); +dev_dbg (smu->adev->dev,"restore config space...\n" );/* Restore the config space saved during init */ amdgpu_device_load_pci_state (adev->pdev);dev_dbg (smu->adev->dev,"wait for reset ack\n" ); -while (ret == -ETIME && timeout) { + do { ret = smu_cmn_wait_for_response(smu); /* Wait a bit more time for getting ACK */ if (ret == -ETIME) {
@@ -2053,16 +2053,14 @@ static int smu_v13_0_6_mode2_reset(struct smu_context *smu)continue ; } -if (ret !=1 ) { +if (ret) {dev_err (adev->dev, -"failed to send mode2 message \tparam: 0x%08x response %#x\n" , +"failed to send mode2 message \tparam: 0x%08x error code %d\n" ,SMU_RESET_MODE_2 , ret); goto out; } - } + }while (ret == -ETIME && timeout); -if (ret ==1 ) - ret =0 ; out:mutex_unlock (&smu->message_lock);
Signature · 1 line
2.40.1
Alex Deucher
maintainerPATCH 12/12 drm/amd/pm: fix wrong smu socclk value
In reply to Alex DeucherFrom: Yang Wang <[email protected]>
fix typo about smu socclk value.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +1 -1
@@ -387,7 +387,7 @@ static int smu_v13_0_6_get_dpm_ultimate_freq(struct smu_context *smu,break ;case SMU_SOCCLK :if (pptable->Init) - clock_limit = pptable->UclkFrequencyTable[0 ]; + clock_limit = pptable->SocclkFrequencyTable[0 ];break ;case SMU_FCLK :if (pptable->Init)
Signature · 1 line
2.40.1