drm/amdgpu: Update smu driver interface for aldebaran
Subsystems (3)
PATCH 1/4 drm/amdgpu: Update smu driver interface for aldebaran
update smu driver if version to 0x08 to avoid mismatch log A version mismatch can still happen with an older FW
--- .../drm/amd/pm/inc/smu13_driver_if_aldebaran.h | 18 +++++++++++++++++- drivers/gpu/drm/amd/pm/inc/smu_v13_0.h | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/inc/smu13_driver_if_aldebaran.h +17 -1
@@ -140,6 +140,8 @@#define MAX_SW_I2C_COMMANDS 24 +#define ALDEBARAN_UMC_CHANNEL_NUM 32 + typedef enum { I2C_CONTROLLER_PORT_0, //CKSVII2C0 I2C_CONTROLLER_PORT_1, //CKSVII2C1
@@ -507,6 +509,19 @@ typedef struct {uint32_t MmHubPadding[8 ];// SMU internal use } AvfsDebugTable_t; +typedef struct { +uint64_t mca_umc_status; +uint64_t mca_umc_addr; +uint16_t ce_count_lo_chip; +uint16_t ce_count_hi_chip; + +uint32_t eccPadding; +}EccInfo_t ; + +typedef struct { +EccInfo_t EccInfo[ALDEBARAN_UMC_CHANNEL_NUM ]; +}EccInfoTable_t ; +// These defines are used with the following messages: // SMC_MSG_TransferTableDram2Smu // SMC_MSG_TransferTableSmu2Dram
@@ -517,6 +532,7 @@ typedef struct {#define TABLE_SMU_METRICS 4#define TABLE_DRIVER_SMU_CONFIG 5#define TABLE_I2C_COMMANDS 6 -#define TABLE_COUNT 7 +#define TABLE_ECCINFO 7 +#define TABLE_COUNT 8#endif
drivers/gpu/drm/amd/pm/inc/smu_v13_0.h +1 -1
@@ -27,7 +27,7 @@#define SMU13_DRIVER_IF_VERSION_INV 0xFFFFFFFF#define SMU13_DRIVER_IF_VERSION_YELLOW_CARP 0x04 -#define SMU13_DRIVER_IF_VERSION_ALDE 0x07 +#define SMU13_DRIVER_IF_VERSION_ALDE 0x08#define SMU13_MODE1_RESET_WAIT_TIME_IN_MS 500 //500ms
Signature · 1 line
2.17.1
PATCH 2/4 drm/amdgpu: add new query interface for umc block v2
add message smu to query error information
v2:
rename message_smu to ecc_info
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 16 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h | 4 + drivers/gpu/drm/amd/amdgpu/umc_v6_7.c | 161 ++++++++++++++++++++++++ 3 files changed, 181 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +16 -0
@@ -320,6 +320,19 @@ struct ras_common_if {char name[32 ]; }; +#define MAX_UMC_CHANNEL_NUM 32 + +struct ecc_info_per_ch { +uint16_t ce_count_lo_chip; +uint16_t ce_count_hi_chip; +uint64_t mca_umc_status; +uint64_t mca_umc_addr; +}; + +struct umc_ecc_info { +struct ecc_info_per_ch ecc[MAX_UMC_CHANNEL_NUM ]; +}; +struct amdgpu_ras {/* ras infrastructure */ /* for ras itself. */
@@ -359,6 +372,9 @@ struct amdgpu_ras {struct delayed_work ras_counte_delay_work;atomic_t ras_ue_count;atomic_t ras_ce_count; + +/* record umc error info queried from smu */ +struct umc_ecc_info umc_ecc; };struct ras_fs_data {
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h +4 -0
@@ -49,6 +49,10 @@ struct amdgpu_umc_ras_funcs {void (*query_ras_error_address)(struct amdgpu_device *adev,void *ras_error_status);bool (*query_ras_poison_mode)(struct amdgpu_device *adev); +void (*ecc_info_query_ras_error_count)(struct amdgpu_device *adev, +void *ras_error_status); +void (*ecc_info_query_ras_error_address)(struct amdgpu_device *adev, +void *ras_error_status); };struct amdgpu_umc_funcs {
drivers/gpu/drm/amd/amdgpu/umc_v6_7.c +161 -0
171 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 3/4 drm/amdgpu: add message smu to get ecc_table v2
In reply to Stanley.Yangsupport ECC TABLE message, this table include umc ras error count and error address
v2:
add smu version check to query whether support ecctable call smu_cmn_update_table to get ecctable directly
--- drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h | 8 +++ drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 14 ++++ .../drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 70 +++++++++++++++++++ .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 2 + 4 files changed, 94 insertions(+)
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +8 -0
@@ -324,6 +324,7 @@ enum smu_table_idSMU_TABLE_OVERDRIVE ,SMU_TABLE_I2C_COMMANDS ,SMU_TABLE_PACE , +SMU_TABLE_ECCINFO , SMU_TABLE_COUNT, };
@@ -340,6 +341,7 @@ struct smu_table_contextvoid *max_sustainable_clocks;struct smu_bios_boot_up_values boot_values;void *driver_pptable; +void *ecc_table;struct smu_table tables[SMU_TABLE_COUNT ];/* * The driver table is just a staging buffer for
@@ -1261,6 +1263,11 @@ struct pptable_funcs {* of SMUBUS table. */ int (*send_hbm_bad_pages_num)(struct smu_context *smu,uint32_t size); + +/** +* @get_ecc_table: message SMU to get ECC INFO table. +*/ +ssize_t (*get_ecc_info)(struct smu_context *smu,void *table); }; typedef enum {
@@ -1397,6 +1404,7 @@ int smu_set_light_sbr(struct smu_context *smu, bool enable);int smu_wait_for_event (struct amdgpu_device *adev,enum smu_event_type event,uint64_t event_arg); +int smu_get_ecc_info (struct smu_context *smu,void *umc_ecc);#endif #endif
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +14 -0
@@ -3072,6 +3072,20 @@ int smu_set_light_sbr(struct smu_context *smu, bool enable)return ret; } +int smu_get_ecc_info (struct smu_context *smu,void *umc_ecc) +{ +int ret = -EOPNOTSUPP ; + +mutex_lock (&smu->mutex); +if (smu->ppt_funcs && + smu->ppt_funcs->get_ecc_info) + ret = smu->ppt_funcs->get_ecc_info (smu, umc_ecc); +mutex_unlock (&smu->mutex); + +return ret; + +} +static int smu_get_prv_buffer_details (void *handle,void **addr,size_t *size) {struct smu_context *smu = handle;
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +70 -0
106 lines not on this page · raw message
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +2 -0
@@ -428,8 +428,10 @@ int smu_v13_0_fini_smc_tables(struct smu_context *smu)kfree (smu_table->hardcode_pptable); smu_table->hardcode_pptable =NULL ; +kfree (smu_table->ecc_table);kfree (smu_table->metrics_table);kfree (smu_table->watermarks_table); + smu_table->ecc_table =NULL ; smu_table->metrics_table =NULL ; smu_table->watermarks_table =NULL ; smu_table->metrics_time =0 ;
Signature · 1 line
2.17.1
Re: [PATCH Review 3/4] drm/amdgpu: add message smu to get ecc_table v2
Quoted 144 lines · Stanley.Yang
support ECC TABLE message, this table include umc ras error count and error address
v2:
add smu version check to query whether support ecctable callsmu_cmn_update_tableto get ecctable directlySigned-off-by Stanley.Yang <[email protected]>--- drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h | 8 +++ drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 14 ++++ .../drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 70 +++++++++++++++++++ .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 2 + 4 files changed, 94 insertions(+)drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +8
-0@@ -324,6 +324,7 @@ enum smu_table_idSMU_TABLE_OVERDRIVE ,SMU_TABLE_I2C_COMMANDS ,SMU_TABLE_PACE , +SMU_TABLE_ECCINFO , SMU_TABLE_COUNT, };@@ -340,6 +341,7 @@ struct smu_table_contextvoid *max_sustainable_clocks;struct smu_bios_boot_up_values boot_values;void *driver_pptable; +void *ecc_table;struct smu_table tables[SMU_TABLE_COUNT ];/* * The driver table is just a staging buffer for @@ -1261,6 +1263,11 @@ struct pptable_funcs {* of SMUBUS table. */ int (*send_hbm_bad_pages_num)(struct smu_context *smu,uint32_t size); + +/** +* @get_ecc_table: message SMU to get ECC INFO table. +*/ +ssize_t (*get_ecc_info)(struct smu_context *smu,void *table); }; typedef enum {@@ -1397,6 +1404,7 @@ int smu_set_light_sbr(struct smu_context *smu, bool enable);int smu_wait_for_event (struct amdgpu_device *adev,enum smu_event_type event,uint64_t event_arg); +int smu_get_ecc_info (struct smu_context *smu,void *umc_ecc);#endif #endif drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +14
-0@@ -3072,6 +3072,20 @@ int smu_set_light_sbr(struct smu_context *smu, bool enable)return ret; } +int smu_get_ecc_info (struct smu_context *smu,void *umc_ecc) +{ +int ret = -EOPNOTSUPP ; + +mutex_lock (&smu->mutex); +if (smu->ppt_funcs && + smu->ppt_funcs->get_ecc_info) + ret = smu->ppt_funcs->get_ecc_info (smu, umc_ecc); +mutex_unlock (&smu->mutex); + +return ret; + +} +static int smu_get_prv_buffer_details (void *handle,void **addr,size_t *size) {struct smu_context *smu = handle;drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +28
-0@@ -78,6 +78,12 @@#define smnPCIE_ESM_CTRL 0x111003D0 +/* +* SMU support ECCTABLE since version 68.42.0, +* use this to check ECCTALE feature whether support +*/ +#define SUPPORT_ECCTABLE_SMU_VERSION 0x00442a00 +static const struct smu_temperature_range smu13_thermal_policy[] = { {-273150 ,99000 ,99000 ,-273150 ,99000 ,99000 ,-273150 ,99000 ,99000 },@@ -190,6 +196,7 @@ static const struct cmn2asic_mapping aldebaran_table_map[SMU_TABLE_COUNT] = {TAB_MAP (SMU_METRICS ),TAB_MAP (DRIVER_SMU_CONFIG ),TAB_MAP (I2C_COMMANDS ), + TAB_MAP(ECCINFO), };static const uint8_t aldebaran_throttler_map[] = {@@ -223,6 +230,9 @@ static int aldebaran_tables_init(struct smu_context *smu)SMU_TABLE_INIT (tables,SMU_TABLE_I2C_COMMANDS ,sizeof (SwI2cRequest_t),PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM ); +SMU_TABLE_INIT (tables,SMU_TABLE_ECCINFO ,sizeof (EccInfoTable_t), +PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM ); + smu_table->metrics_table =kzalloc (sizeof (SmuMetrics_t),GFP_KERNEL );if (!smu_table->metrics_table)return -ENOMEM ;@@ -235,6 +245,10 @@ static int aldebaran_tables_init(struct smu_context *smu)return -ENOMEM ; } + smu_table->ecc_table =kzalloc (tables[SMU_TABLE_ECCINFO ].size,GFP_KERNEL ); +if (!smu_table->ecc_table) +return -ENOMEM ; +return 0 ; }@@ -1765,6 +1779,61 @@ static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu,return sizeof (struct gpu_metrics_v1_3 ); } +static int aldebaran_check_ecc_table_support (struct smu_context *smu) +{ +uint32_t if_version =0xff , smu_version =0xff ; +int ret =0 ; + + ret =smu_cmn_get_smc_version (smu, &if_version, &smu_version); +if (ret) + ret = -EOPNOTSUPP ;// return not support if failed get smu_version + +if (smu_version <SUPPORT_ECCTABLE_SMU_VERSION ) + ret = -EOPNOTSUPP ; + +return ret; +}
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu, · line 1805
Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +10
-0+ +static ssize_t aldebaran_get_ecc_info (struct smu_context *smu, +void *table) +{ +struct smu_table_context *smu_table = &smu->smu_table; +EccInfoTable_t *ecc_table =NULL ; +struct ecc_info_per_ch *ecc_info_per_channel =NULL ; +int i, ret =0 ; +struct umc_ecc_info *eccinfo = (struct umc_ecc_info *)table; +
Missed to ask last time. Since umc_ecc_info is a common struct, do you also want to pass back the number of channels having data?
Now this struct can hold max of 32 channel data. Let's say if the same interface is going to be used on another ASIC X having only 16 channels. Then the callback for ASIC X fills data only for 16 channels. Or, you expect that to be taken care at the caller side?
Thanks,
Lijo
Quoted 58 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +32
-0+ ret =aldebaran_check_ecc_table_support (smu); +if (ret) +return ret; + + ret =smu_cmn_update_table (smu, +SMU_TABLE_ECCINFO , +0 , + smu_table->ecc_table, + false); +if (ret) { +dev_info (smu->adev->dev,"Failed to export SMU ecc table!\n" ); +return ret; + } + + ecc_table = (EccInfoTable_t *)smu_table->ecc_table; + +for (i =0 ; i <ALDEBARAN_UMC_CHANNEL_NUM ; i++) { + ecc_info_per_channel = &(eccinfo->ecc[i]); + ecc_info_per_channel->ce_count_lo_chip = + ecc_table->EccInfo[i].ce_count_lo_chip; + ecc_info_per_channel->ce_count_hi_chip = + ecc_table->EccInfo[i].ce_count_hi_chip; + ecc_info_per_channel->mca_umc_status = + ecc_table->EccInfo[i].mca_umc_status; + ecc_info_per_channel->mca_umc_addr = + ecc_table->EccInfo[i].mca_umc_addr; + } + +return ret; +} +static int aldebaran_mode1_reset (struct smu_context *smu) {u32 smu_version, fatal_err, param;@@ -1967,6 +2036,7 @@ static const struct pptable_funcs aldebaran_ppt_funcs = { .i2c_init = aldebaran_i2c_control_init, .i2c_fini = aldebaran_i2c_control_fini, .send_hbm_bad_pages_num = aldebaran_smu_send_hbm_bad_page_num, + .get_ecc_info = aldebaran_get_ecc_info, };void aldebaran_set_ppt_funcs (struct smu_context *smu)drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +2
-0@@ -428,8 +428,10 @@ int smu_v13_0_fini_smc_tables(struct smu_context *smu)kfree (smu_table->hardcode_pptable); smu_table->hardcode_pptable =NULL ; +kfree (smu_table->ecc_table);kfree (smu_table->metrics_table);kfree (smu_table->watermarks_table); + smu_table->ecc_table =NULL ; smu_table->metrics_table =NULL ; smu_table->watermarks_table =NULL ; smu_table->metrics_time =0 ;
回复: [PATCH Review 3/4] drm/amdgpu: add message smu to get ecc_table v2
[AMD Official Use Only]
Quoted 188 lines
-----邮件原件-----
发件人: Lazar, Lijo <[email protected]>
发送时间: Thursday, November 18, 2021 7:33 PM
收件人: Yang, Stanley <[email protected]>; amd- [email protected]; Zhang, Hawking <[email protected]>; Clements, John <[email protected]>; Quan, Evan <[email protected]>; Wang, Yang(Kevin) <[email protected]> 主题: Re: [PATCH Review 3/4] drm/amdgpu: add message smu to getecc_tablev2Quoted 7 lines · Stanley.Yang
support ECC TABLE message, this table include umc ras error count and error address
v2:
add smu version check to query whether support ecctable callsmu_cmn_update_tableto get ecctable directlyQuoted 5 lines
Signed-off-by Stanley.Yang <[email protected]>--- drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h | 8 +++ drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 14 ++++ .../drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 70+++++++++++++++++++
Quoted 17 lines
.../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 2 + 4 files changed, 94 insertions(+)drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +1
-0@@ -324,6 +324,7 @@ enum smu_table_idSMU_TABLE_OVERDRIVE ,SMU_TABLE_I2C_COMMANDS ,SMU_TABLE_PACE , +SMU_TABLE_ECCINFO , SMU_TABLE_COUNT, };drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h struct smu_table_context
Quoted 9 lines
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +2
-0@@ -340,6 +341,7 @@ struct smu_table_contextvoid *max_sustainable_clocks;struct smu_bios_boot_up_values boot_values;void *driver_pptable; +void *ecc_table;struct smu_table tables[SMU_TABLE_COUNT ];/* * The driver table is just a staging buffer for @@ -1261,6 +1263,11 @@ struct pptable_funcs { * of SMUBUS table.
Quoted 2 lines
*/
int (*send_hbm_bad_pages_num)(structsmu_context*smu,
uint32_tdrivers/gpu/drm/amd/pm/inc/amdgpu_smu.h int smu_set_light_sbr(struct smu_context *smu, · line 1406
Quoted 13 lines
size);
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +5
-0+ +/** +* @get_ecc_table: message SMU to get ECC INFO table. +*/ +ssize_t (*get_ecc_info)(struct smu_context *smu,void *table); }; typedef enum {@@ -1397,6 +1404,7 @@ int smu_set_light_sbr(struct smu_context *smu, bool enable); int smu_wait_for_event(struct amdgpu_device *adev, enum
smu_event_typeevent,drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c int smu_set_light_sbr(struct smu_context *smu,
Quoted 11 lines
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +1
-0uint64_t event_arg); +int smu_get_ecc_info (struct smu_context *smu,void *umc_ecc);#endif #endifdrivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0
-0@@ -3072,6 +3072,20 @@ int smu_set_light_sbr(struct smu_context *smu,bool enable)
Quoted 7 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +4
-0return ret; } +int smu_get_ecc_info (struct smu_context *smu,void *umc_ecc) { +int ret = -EOPNOTSUPP ; + +mutex_lock (&smu->mutex);drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c int smu_set_light_sbr(struct smu_context *smu, bool enable)
Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +9
-0+if (smu->ppt_funcs && + smu->ppt_funcs->get_ecc_info) + ret = smu->ppt_funcs->get_ecc_info (smu, umc_ecc); +mutex_unlock (&smu->mutex); + +return ret; + +} + static int smu_get_prv_buffer_details(void *handle, void **addr, size_t*size)
Quoted 19 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0
-0{struct smu_context *smu = handle;drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +5
-0@@ -78,6 +78,12 @@#define smnPCIE_ESM_CTRL 0x111003D0 +/* +* SMU support ECCTABLE since version 68.42.0, +* use this to check ECCTALE feature whether support */ #define +SUPPORT_ECCTABLE_SMU_VERSION 0x00442a00 +static const struct smu_temperature_range smu13_thermal_policy[] = { {-273150 ,99000 ,99000 ,-273150 ,99000 ,99000 ,-273150 ,99000 ,Quoted 1 line
99000}, @@ -190,6 +196,7 @@ static const struct
cmn2asic_mappingaldebaran_table_map[SMU_TABLE_COUNT] = {
Quoted 9 lines
TAB_MAP(SMU_METRICS),
TAB_MAP(DRIVER_SMU_CONFIG),
TAB_MAP(I2C_COMMANDS),drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +1
-0+ TAB_MAP(ECCINFO), }; static const uint8_t aldebaran_throttler_map[] = { @@ -223,6 +230,9@@ static int
aldebaran_tables_init(struct smu_context *smu)
SMU_TABLE_INIT(tables,SMU_TABLE_I2C_COMMANDS,
sizeof(SwI2cRequest_t),drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
Quoted 3 lines
PAGE_SIZE,AMDGPU_GEM_DOMAIN_VRAM);drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +1
-0+ SMU_TABLE_INIT(tables, SMU_TABLE_ECCINFO,
sizeof(EccInfoTable_t),drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static int aldebaran_tables_init(struct smu_context *smu)
Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +2
-0+ PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM); + smu_table->metrics_table = kzalloc(sizeof(SmuMetrics_t),
GFP_KERNEL);drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static int aldebaran_tables_init(struct smu_context
Quoted 3 lines
if (!smu_table->metrics_table)
return-ENOMEM;drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0
-0@@ -235,6 +245,10 @@ static int aldebaran_tables_init(struct smu_context*smu)
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static int aldebaran_tables_init(struct smu_context *smu)
Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +1
-0return -ENOMEM ; } + smu_table->ecc_table = kzalloc(tables[SMU_TABLE_ECCINFO].size,
GFP_KERNEL);drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static ssize_t aldebaran_get_gpu_metrics(struct
Quoted 7 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +3
-0+if (!smu_table->ecc_table) +return -ENOMEM ; +return 0 ; }@@ -1765,6 +1779,61 @@ static ssize_t aldebaran_get_gpu_metrics(struct
smu_context*smu,drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu,
Quoted 11 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +8
-0return sizeof (struct gpu_metrics_v1_3 ); } +static int aldebaran_check_ecc_table_support (struct smu_context *smu) +{ +uint32_t if_version =0xff , smu_version =0xff ; +int ret =0 ; + + ret =smu_cmn_get_smc_version (smu, &if_version, &smu_version); +if (ret) + ret = -EOPNOTSUPP ;// return not support if failed get
smu_versionQuoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +6
-0+ +if (smu_version <SUPPORT_ECCTABLE_SMU_VERSION ) + ret = -EOPNOTSUPP ; + +return ret; +}drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu, · line 1805
Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +10
-0+ +static ssize_t aldebaran_get_ecc_info (struct smu_context *smu, +void *table) +{ +struct smu_table_context *smu_table = &smu->smu_table; +EccInfoTable_t *ecc_table =NULL ; +struct ecc_info_per_ch *ecc_info_per_channel =NULL ; +int i, ret =0 ; +struct umc_ecc_info *eccinfo = (struct umc_ecc_info *)table; +Missed to ask last time. Since
umc_ecc_infois a common struct, do you also want to pass back the number of channels having data?
Quoted 4 lines
Now this struct can hold max of 32 channel data. Let's say if the same interface is going to be used on another ASIC X having only 16 channels. Then the callback for ASIC X fills data only for 16 channels. Or, you expect that to be taken care at the caller side?
[Yang, Stanley] : If ASIC X have only 16 channels, the callback only fill data for 16 channels, and caller side also need consider its own channel number to handle with umc_ecc_info.
Quoted 67 lines
Thanks,
Lijodrivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu,
Quoted 11 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +11
-0+ ret =aldebaran_check_ecc_table_support (smu); +if (ret) +return ret; + + ret =smu_cmn_update_table (smu, +SMU_TABLE_ECCINFO , +0 , + smu_table->ecc_table, + false); +if (ret) { + dev_info(smu->adev->dev, "Failed to export SMU ecctable!\n");
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static const struct pptable_funcs
Quoted 24 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +20
-0+return ret; + } + + ecc_table = (EccInfoTable_t *)smu_table->ecc_table; + +for (i =0 ; i <ALDEBARAN_UMC_CHANNEL_NUM ; i++) { + ecc_info_per_channel = &(eccinfo->ecc[i]); + ecc_info_per_channel->ce_count_lo_chip = + ecc_table->EccInfo[i].ce_count_lo_chip; + ecc_info_per_channel->ce_count_hi_chip = + ecc_table->EccInfo[i].ce_count_hi_chip; + ecc_info_per_channel->mca_umc_status = + ecc_table->EccInfo[i].mca_umc_status; + ecc_info_per_channel->mca_umc_addr = + ecc_table->EccInfo[i].mca_umc_addr; + } + +return ret; +} +static int aldebaran_mode1_reset (struct smu_context *smu) {u32 smu_version, fatal_err, param;@@ -1967,6 +2036,7 @@ static const struct pptable_funcs
aldebaran_ppt_funcs= {drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static const struct pptable_funcs aldebaran_ppt_funcs = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0
-0.i2c_init = aldebaran_i2c_control_init, .i2c_fini = aldebaran_i2c_control_fini, .send_hbm_bad_pages_num =
aldebaran_smu_send_hbm_bad_page_num,drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c int smu_v13_0_fini_smc_tables(struct
Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +1
-0+ .get_ecc_info = aldebaran_get_ecc_info, }; void aldebaran_set_ppt_funcs(struct smu_context *smu) diff --git
a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.cb/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
index4d96099a9bb1..55421ea622fb100644drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0
-0@@ -428,8 +428,10 @@ int smu_v13_0_fini_smc_tables(struct
smu_context*smu)Quoted 11 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +2
-0kfree (smu_table->hardcode_pptable); smu_table->hardcode_pptable =NULL ; +kfree (smu_table->ecc_table);kfree (smu_table->metrics_table);kfree (smu_table->watermarks_table); + smu_table->ecc_table =NULL ; smu_table->metrics_table =NULL ; smu_table->watermarks_table =NULL ; smu_table->metrics_time =0 ;
Lazar, Lijo
Reviewed-byRe: 回复: [PATCH Review 3/4] drm/amdgpu: add message smu to get ecc_table v2
Quoted 163 lines · Stanley
[AMD Official Use Only]
Quoted 159 lines
-----邮件原件-----
发件人: Lazar, Lijo <[email protected]>
发送时间: Thursday, November 18, 2021 7:33 PM
收件人: Yang, Stanley <[email protected]>; amd- [email protected]; Zhang, Hawking <[email protected]>; Clements, John <[email protected]>; Quan, Evan <[email protected]>; Wang, Yang(Kevin) <[email protected]> 主题: Re: [PATCH Review 3/4] drm/amdgpu: add message smu to getecc_tablev2Quoted 7 lines · Stanley.Yang
support ECC TABLE message, this table include umc ras error count and error address
v2:
add smu version check to query whether support ecctable callsmu_cmn_update_tableto get ecctable directlyQuoted 5 lines
Signed-off-by Stanley.Yang <[email protected]>--- drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h | 8 +++ drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 14 ++++ .../drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 70+++++++++++++++++++
Quoted 17 lines
.../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 2 + 4 files changed, 94 insertions(+)drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +1
-0@@ -324,6 +324,7 @@ enum smu_table_idSMU_TABLE_OVERDRIVE ,SMU_TABLE_I2C_COMMANDS ,SMU_TABLE_PACE , +SMU_TABLE_ECCINFO , SMU_TABLE_COUNT, };drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h struct smu_table_context
Quoted 9 lines
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +2
-0@@ -340,6 +341,7 @@ struct smu_table_contextvoid *max_sustainable_clocks;struct smu_bios_boot_up_values boot_values;void *driver_pptable; +void *ecc_table;struct smu_table tables[SMU_TABLE_COUNT ];/* * The driver table is just a staging buffer for @@ -1261,6 +1263,11 @@ struct pptable_funcs { * of SMUBUS table.
Quoted 2 lines
*/
int (*send_hbm_bad_pages_num)(structsmu_context*smu,
uint32_tdrivers/gpu/drm/amd/pm/inc/amdgpu_smu.h int smu_set_light_sbr(struct smu_context *smu, · line 1406
Quoted 13 lines
size);
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +5
-0+ +/** +* @get_ecc_table: message SMU to get ECC INFO table. +*/ +ssize_t (*get_ecc_info)(struct smu_context *smu,void *table); }; typedef enum {@@ -1397,6 +1404,7 @@ int smu_set_light_sbr(struct smu_context *smu, bool enable); int smu_wait_for_event(struct amdgpu_device *adev, enum
smu_event_typeevent,drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c int smu_set_light_sbr(struct smu_context *smu,
Quoted 11 lines
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +1
-0uint64_t event_arg); +int smu_get_ecc_info (struct smu_context *smu,void *umc_ecc);#endif #endifdrivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0
-0@@ -3072,6 +3072,20 @@ int smu_set_light_sbr(struct smu_context *smu,bool enable)
Quoted 7 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +4
-0return ret; } +int smu_get_ecc_info (struct smu_context *smu,void *umc_ecc) { +int ret = -EOPNOTSUPP ; + +mutex_lock (&smu->mutex);drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c int smu_set_light_sbr(struct smu_context *smu, bool enable)
Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +9
-0+if (smu->ppt_funcs && + smu->ppt_funcs->get_ecc_info) + ret = smu->ppt_funcs->get_ecc_info (smu, umc_ecc); +mutex_unlock (&smu->mutex); + +return ret; + +} + static int smu_get_prv_buffer_details(void *handle, void **addr, size_t*size)
Quoted 19 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0
-0{struct smu_context *smu = handle;drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +5
-0@@ -78,6 +78,12 @@#define smnPCIE_ESM_CTRL 0x111003D0 +/* +* SMU support ECCTABLE since version 68.42.0, +* use this to check ECCTALE feature whether support */ #define +SUPPORT_ECCTABLE_SMU_VERSION 0x00442a00 +static const struct smu_temperature_range smu13_thermal_policy[] = { {-273150 ,99000 ,99000 ,-273150 ,99000 ,99000 ,-273150 ,99000 ,Quoted 1 line
99000}, @@ -190,6 +196,7 @@ static const struct
cmn2asic_mappingaldebaran_table_map[SMU_TABLE_COUNT] = {
Quoted 9 lines
TAB_MAP(SMU_METRICS), TAB_MAP(DRIVER_SMU_CONFIG), TAB_MAP(I2C_COMMANDS),drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +1
-0+ TAB_MAP(ECCINFO), }; static const uint8_t aldebaran_throttler_map[] = { @@ -223,6 +230,9@@ static int
aldebaran_tables_init(struct smu_context *smu)
SMU_TABLE_INIT(tables,SMU_TABLE_I2C_COMMANDS,
sizeof(SwI2cRequest_t),drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
Quoted 3 lines
PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +1
-0+ SMU_TABLE_INIT(tables, SMU_TABLE_ECCINFO,
sizeof(EccInfoTable_t),drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static int aldebaran_tables_init(struct smu_context *smu)
Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +2
-0+ PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM); + smu_table->metrics_table = kzalloc(sizeof(SmuMetrics_t),
GFP_KERNEL);drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static int aldebaran_tables_init(struct smu_context
Quoted 3 lines
if (!smu_table->metrics_table) return -ENOMEM;drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0
-0@@ -235,6 +245,10 @@ static int aldebaran_tables_init(struct smu_context*smu)
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static int aldebaran_tables_init(struct smu_context *smu)
Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +1
-0return -ENOMEM ; } + smu_table->ecc_table = kzalloc(tables[SMU_TABLE_ECCINFO].size,
GFP_KERNEL);drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static ssize_t aldebaran_get_gpu_metrics(struct
Quoted 7 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +3
-0+if (!smu_table->ecc_table) +return -ENOMEM ; +return 0 ; }@@ -1765,6 +1779,61 @@ static ssize_t aldebaran_get_gpu_metrics(struct
smu_context*smu,Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0
-0return sizeof (struct gpu_metrics_v1_3 ); }
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu,
Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +8
-0+static int aldebaran_check_ecc_table_support (struct smu_context *smu) +{ +uint32_t if_version =0xff , smu_version =0xff ; +int ret =0 ; + + ret =smu_cmn_get_smc_version (smu, &if_version, &smu_version); +if (ret) + ret = -EOPNOTSUPP ;// return not support if failed get
Nitpick - comment style
Quoted 21 lines
Quoted 21 lines
smu_versionQuoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +6
-0+ +if (smu_version <SUPPORT_ECCTABLE_SMU_VERSION ) + ret = -EOPNOTSUPP ; + +return ret; +}drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu, · line 1805
Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +10
-0+ +static ssize_t aldebaran_get_ecc_info (struct smu_context *smu, +void *table) +{ +struct smu_table_context *smu_table = &smu->smu_table; +EccInfoTable_t *ecc_table =NULL ; +struct ecc_info_per_ch *ecc_info_per_channel =NULL ; +int i, ret =0 ; +struct umc_ecc_info *eccinfo = (struct umc_ecc_info *)table; +Missed to ask last time. Since
umc_ecc_infois a common struct, do you also want to pass back the number of channels having data?
Quoted 7 lines
Quoted 4 lines
Now this struct can hold max of 32 channel data. Let's say if the same interface is going to be used on another ASIC X having only 16 channels. Then the callback for ASIC X fills data only for 16 channels. Or, you expect that to be taken care at the caller side?
[Yang, Stanley] : If ASIC X have only 16 channels, the callback only fill data for 16 channels, and caller side also need consider its own channel number to handle with
umc_ecc_info.
Thanks for the details. With the nitpick above and Evan's comments on the patch subject addressed, patches 1 and 3 are
2 and 4 look good to me. Hawking or John should a take look though.
Thanks,
Lijo
Quoted 67 lines
Quoted 67 lines
Thanks,
Lijodrivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu,
Quoted 11 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +11
-0+ ret =aldebaran_check_ecc_table_support (smu); +if (ret) +return ret; + + ret =smu_cmn_update_table (smu, +SMU_TABLE_ECCINFO , +0 , + smu_table->ecc_table, + false); +if (ret) { + dev_info(smu->adev->dev, "Failed to export SMU ecctable!\n");
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static const struct pptable_funcs
Quoted 24 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +20
-0+return ret; + } + + ecc_table = (EccInfoTable_t *)smu_table->ecc_table; + +for (i =0 ; i <ALDEBARAN_UMC_CHANNEL_NUM ; i++) { + ecc_info_per_channel = &(eccinfo->ecc[i]); + ecc_info_per_channel->ce_count_lo_chip = + ecc_table->EccInfo[i].ce_count_lo_chip; + ecc_info_per_channel->ce_count_hi_chip = + ecc_table->EccInfo[i].ce_count_hi_chip; + ecc_info_per_channel->mca_umc_status = + ecc_table->EccInfo[i].mca_umc_status; + ecc_info_per_channel->mca_umc_addr = + ecc_table->EccInfo[i].mca_umc_addr; + } + +return ret; +} +static int aldebaran_mode1_reset (struct smu_context *smu) {u32 smu_version, fatal_err, param;@@ -1967,6 +2036,7 @@ static const struct pptable_funcs
aldebaran_ppt_funcs= {drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static const struct pptable_funcs aldebaran_ppt_funcs = {
Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0
-0.i2c_init = aldebaran_i2c_control_init, .i2c_fini = aldebaran_i2c_control_fini, .send_hbm_bad_pages_num =
aldebaran_smu_send_hbm_bad_page_num,drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c int smu_v13_0_fini_smc_tables(struct
Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +1
-0+ .get_ecc_info = aldebaran_get_ecc_info, }; void aldebaran_set_ppt_funcs(struct smu_context *smu) diff --git
a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.cb/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
index4d96099a9bb1..55421ea622fb100644drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0
-0@@ -428,8 +428,10 @@ int smu_v13_0_fini_smc_tables(struct
smu_context*smu)Quoted 11 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +2
-0kfree (smu_table->hardcode_pptable); smu_table->hardcode_pptable =NULL ; +kfree (smu_table->ecc_table);kfree (smu_table->metrics_table);kfree (smu_table->watermarks_table); + smu_table->ecc_table =NULL ; smu_table->metrics_table =NULL ; smu_table->watermarks_table =NULL ; smu_table->metrics_time =0 ;
RE: 回复: [PATCH Review 3/4] drm/amdgpu: add message smu to get ecc_table v2
[AMD Official Use Only]
Series looks good to me.
Regards,
Hawking
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, November 18, 2021 22:41
To: Yang, Stanley <[email protected]>; [email protected]; Zhang, Hawking <[email protected]>; Clements, John <[email protected]>; Quan, Evan <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: Re: 回复: [PATCH Review 3/4] drm/amdgpu: add message smu to get ecc_table v2
Quoted 167 lines · Stanley
[AMD Official Use Only]
Quoted 163 lines
-----邮件原件-----
发件人: Lazar, Lijo <[email protected]>
发送时间: Thursday, November 18, 2021 7:33 PM
收件人: Yang, Stanley <[email protected]>; amd- [email protected]; Zhang, Hawking <[email protected]>; Clements, John <[email protected]>; Quan, Evan <[email protected]>; Wang, Yang(Kevin) <[email protected]> 主题: Re: [PATCH Review 3/4] drm/amdgpu: add message smu to getecc_tablev2Quoted 7 lines · Stanley.Yang
support ECC TABLE message, this table include umc ras error count and error address
v2:
add smu version check to query whether support ecctable callsmu_cmn_update_tableto get ecctable directlyQuoted 5 lines
Signed-off-by Stanley.Yang <[email protected]>--- drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h | 8 +++ drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 14 ++++ .../drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 70+++++++++++++++++++
Quoted 17 lines
.../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 2 + 4 files changed, 94 insertions(+)drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +1
-0@@ -324,6 +324,7 @@ enum smu_table_idSMU_TABLE_OVERDRIVE ,SMU_TABLE_I2C_COMMANDS ,SMU_TABLE_PACE , +SMU_TABLE_ECCINFO , SMU_TABLE_COUNT, };drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h struct smu_table_context
Quoted 9 lines
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +2
-0@@ -340,6 +341,7 @@ struct smu_table_contextvoid *max_sustainable_clocks;struct smu_bios_boot_up_values boot_values;void *driver_pptable; +void *ecc_table;struct smu_table tables[SMU_TABLE_COUNT ];/* * The driver table is just a staging buffer for @@ -1261,6 +1263,11 @@ struct pptable_funcs { * of SMUBUS table.
Quoted 2 lines
*/
int (*send_hbm_bad_pages_num)(structsmu_context*smu,
uint32_tdrivers/gpu/drm/amd/pm/inc/amdgpu_smu.h int smu_set_light_sbr(struct smu_context *smu, · line 1406
Quoted 13 lines
size);
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +5
-0+ +/** +* @get_ecc_table: message SMU to get ECC INFO table. +*/ +ssize_t (*get_ecc_info)(struct smu_context *smu,void *table); }; typedef enum {@@ -1397,6 +1404,7 @@ int smu_set_light_sbr(struct smu_context *smu, bool enable); int smu_wait_for_event(struct amdgpu_device *adev, enum
smu_event_typeevent,drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c int smu_set_light_sbr(struct smu_context · line 3072
Quoted 12 lines
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +1
-0uint64_t event_arg); +int smu_get_ecc_info (struct smu_context *smu,void *umc_ecc);#endif #endifdrivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0
-0@@ -3072,6 +3072,20 @@ int smu_set_light_sbr(struct smu_context *smu,bool enable)
Quoted 17 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +13
-0return ret; } +int smu_get_ecc_info (struct smu_context *smu,void *umc_ecc) { +int ret = -EOPNOTSUPP ; + +mutex_lock (&smu->mutex); +if (smu->ppt_funcs && + smu->ppt_funcs->get_ecc_info) + ret = smu->ppt_funcs->get_ecc_info (smu, umc_ecc); +mutex_unlock (&smu->mutex); + +return ret; + +} + static int smu_get_prv_buffer_details(void *handle, void **addr,Quoted 1 line
size_t*size)
Quoted 19 lines
{ struct smu_context *smu = handle; diff --git
a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.cb/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.cindexf835d86cc2f5..4c21609ccea5100644drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +5
-0@@ -78,6 +78,12 @@#define smnPCIE_ESM_CTRL 0x111003D0 +/* +* SMU support ECCTABLE since version 68.42.0, +* use this to check ECCTALE feature whether support */ #define +SUPPORT_ECCTABLE_SMU_VERSION 0x00442a00 +static const struct smu_temperature_range smu13_thermal_policy[] = { {-273150 ,99000 ,99000 ,-273150 ,99000 ,99000 ,-273150 ,99000 ,Quoted 1 line
99000}, @@ -190,6 +196,7 @@ static const struct
cmn2asic_mappingaldebaran_table_map[SMU_TABLE_COUNT] = {
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static const struct cmn2asic_mapping aldebaran_table_map[SMU_TABLE_COUNT] = {
Quoted 9 lines
TAB_MAP(SMU_METRICS), TAB_MAP(DRIVER_SMU_CONFIG), TAB_MAP(I2C_COMMANDS),drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +2
-0+ TAB_MAP(ECCINFO), }; static const uint8_t aldebaran_throttler_map[] = { @@ -223,6 +230,9 @@ static int aldebaran_tables_init(struct smu_context *smu) SMU_TABLE_INIT(tables, SMU_TABLE_I2C_COMMANDS,
sizeof(SwI2cRequest_t),drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
Quoted 3 lines
PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +1
-0+ SMU_TABLE_INIT(tables, SMU_TABLE_ECCINFO,
sizeof(EccInfoTable_t),drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static int aldebaran_tables_init(struct smu_context *smu)
Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +2
-0+ PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM); + smu_table->metrics_table = kzalloc(sizeof(SmuMetrics_t),
GFP_KERNEL);Quoted 4 lines
if (!smu_table->metrics_table) return -ENOMEM;drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0
-0@@ -235,6 +245,10 @@ static int aldebaran_tables_init(struct
smu_context*smu)
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
Quoted 4 lines
return -ENOMEM; }drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +1
-0+ smu_table->ecc_table = kzalloc(tables[SMU_TABLE_ECCINFO].size,
GFP_KERNEL);Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +3
-0+if (!smu_table->ecc_table) +return -ENOMEM ; +return 0 ; }@@ -1765,6 +1779,61 @@ static ssize_taldebaran_get_gpu_metrics(struct
smu_context*smu,Quoted 3 lines
return sizeof(struct gpu_metrics_v1_3); }
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu,
Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +8
-0+static int aldebaran_check_ecc_table_support (struct smu_context +*smu) { +uint32_t if_version =0xff , smu_version =0xff ; +int ret =0 ; + + ret =smu_cmn_get_smc_version (smu, &if_version, &smu_version); +if (ret) + ret = -EOPNOTSUPP ;// return not support if failed get
Nitpick - comment style
Quoted 21 lines
Quoted 21 lines
smu_versionQuoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +6
-0+ +if (smu_version <SUPPORT_ECCTABLE_SMU_VERSION ) + ret = -EOPNOTSUPP ; + +return ret; +}drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu, · line 1805
Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +10
-0+ +static ssize_t aldebaran_get_ecc_info (struct smu_context *smu, +void *table) +{ +struct smu_table_context *smu_table = &smu->smu_table; +EccInfoTable_t *ecc_table =NULL ; +struct ecc_info_per_ch *ecc_info_per_channel =NULL ; +int i, ret =0 ; +struct umc_ecc_info *eccinfo = (struct umc_ecc_info *)table; +Missed to ask last time. Since
umc_ecc_infois a common struct, do you also want to pass back the number of channels having data?
Quoted 7 lines
Quoted 4 lines
Now this struct can hold max of 32 channel data. Let's say if the same interface is going to be used on another ASIC X having only 16 channels. Then the callback for ASIC X fills data only for 16 channels. Or, you expect that to be taken care at the caller side?
[Yang, Stanley] : If ASIC X have only 16 channels, the callback only fill data for 16 channels, and caller side also need consider its own channel number to handle with
umc_ecc_info.
Thanks for the details. With the nitpick above and Evan's comments on the patch subject addressed, patches 1 and 3 are
2 and 4 look good to me. Hawking or John should a take look though.
Thanks,
Lijo
Quoted 67 lines
Quoted 67 lines
Thanks,
Lijodrivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu,
Quoted 11 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +11
-0+ ret =aldebaran_check_ecc_table_support (smu); +if (ret) +return ret; + + ret =smu_cmn_update_table (smu, +SMU_TABLE_ECCINFO , +0 , + smu_table->ecc_table, + false); +if (ret) { + dev_info(smu->adev->dev, "Failed to export SMU ecctable!\n");
Quoted 23 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +20
-0+return ret; + } + + ecc_table = (EccInfoTable_t *)smu_table->ecc_table; + +for (i =0 ; i <ALDEBARAN_UMC_CHANNEL_NUM ; i++) { + ecc_info_per_channel = &(eccinfo->ecc[i]); + ecc_info_per_channel->ce_count_lo_chip = + ecc_table->EccInfo[i].ce_count_lo_chip; + ecc_info_per_channel->ce_count_hi_chip = + ecc_table->EccInfo[i].ce_count_hi_chip; + ecc_info_per_channel->mca_umc_status = + ecc_table->EccInfo[i].mca_umc_status; + ecc_info_per_channel->mca_umc_addr = + ecc_table->EccInfo[i].mca_umc_addr; + } + +return ret; +} +static int aldebaran_mode1_reset (struct smu_context *smu) { u32 smu_version, fatal_err, param; @@ -1967,6 +2036,7 @@ staticQuoted 1 line
const struct
pptable_funcs
aldebaran_ppt_funcs= {Quoted 3 lines
.i2c_init =
aldebaran_i2c_control_init,
.i2c_fini =aldebaran_i2c_control_fini,
.send_hbm_bad_pages_num =
aldebaran_smu_send_hbm_bad_page_num,drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c int smu_v13_0_fini_smc_tables(struct
Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +1
-0+ .get_ecc_info = aldebaran_get_ecc_info, }; void aldebaran_set_ppt_funcs(struct smu_context *smu) diff --git
a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.cb/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
index4d96099a9bb1..55421ea622fb100644drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0
-0@@ -428,8 +428,10 @@ int smu_v13_0_fini_smc_tables(struct
smu_context*smu)Quoted 11 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +2
-0kfree (smu_table->hardcode_pptable); smu_table->hardcode_pptable =NULL ; +kfree (smu_table->ecc_table);kfree (smu_table->metrics_table);kfree (smu_table->watermarks_table); + smu_table->ecc_table =NULL ; smu_table->metrics_table =NULL ; smu_table->watermarks_table =NULL ; smu_table->metrics_time =0 ;
PATCH 4/4 query umc error info from ecc_table v2
In reply to Stanley.Yangif smu support ECCTABLE, driver can message smu to get ecc_table then query umc error info from ECCTABLE
v2:
optimize source code makes logical more reasonable
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 42 +++++++++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c | 72 +++++++++++++++++-------- 2 files changed, 83 insertions(+), 31 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +33 -9
@@ -888,6 +888,38 @@ void amdgpu_ras_mca_query_error_status(struct amdgpu_device *adev, } } +static void amdgpu_ras_get_ecc_info (struct amdgpu_device *adev,struct ras_err_data *err_data) +{ +struct amdgpu_ras *ras =amdgpu_ras_get_context (adev); +int ret =0 ; + +/* +* choosing right query method according to +* whether smu support query error information +*/ + ret =smu_get_ecc_info (&adev->smu, (void *)&(ras->umc_ecc)); +if (ret == -EOPNOTSUPP ) { +if (adev->umc.ras_funcs && + adev->umc.ras_funcs->query_ras_error_count) + adev->umc.ras_funcs->query_ras_error_count (adev, err_data); + +/* umc query_ras_error_address is also responsible for clearing +* error status +*/ +if (adev->umc.ras_funcs && + adev->umc.ras_funcs->query_ras_error_address) + adev->umc.ras_funcs->query_ras_error_address (adev, err_data); + }else if (!ret) { +if (adev->umc.ras_funcs && + adev->umc.ras_funcs->ecc_info_query_ras_error_count) + adev->umc.ras_funcs->ecc_info_query_ras_error_count (adev, err_data); + +if (adev->umc.ras_funcs && + adev->umc.ras_funcs->ecc_info_query_ras_error_address) + adev->umc.ras_funcs->ecc_info_query_ras_error_address (adev, err_data); + } +} +/* query/inject/cure begin */ int amdgpu_ras_query_error_status (struct amdgpu_device *adev,struct ras_query_if *info)
@@ -901,15 +933,7 @@ int amdgpu_ras_query_error_status(struct amdgpu_device *adev,switch (info->head.block) {case AMDGPU_RAS_BLOCK__UMC : -if (adev->umc.ras_funcs && - adev->umc.ras_funcs->query_ras_error_count) - adev->umc.ras_funcs->query_ras_error_count (adev, &err_data); -/* umc query_ras_error_address is also responsible for clearing -* error status -*/ -if (adev->umc.ras_funcs && - adev->umc.ras_funcs->query_ras_error_address) - adev->umc.ras_funcs->query_ras_error_address (adev, &err_data); +amdgpu_ras_get_ecc_info (adev, &err_data);break ;case AMDGPU_RAS_BLOCK__SDMA :if (adev->sdma.funcs->query_ras_error_count) {
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c +50 -22
80 lines not on this page · raw message
Signature · 1 line
2.17.1
[AMD Official Use Only]
Better to update the patch title as "drm/amd/pm: Update smu driver interface for aldebaran" as all other power related patches. And please update patch3 also.
Other than above, patch 1, 3 are reviewed-by: Evan Quan <[email protected]>
Quoted 81 lines
-----Original Message-----
From: Stanley.Yang <[email protected]>
Sent: Thursday, November 18, 2021 5:34 PM
To: [email protected]; Zhang, Hawking <[email protected]>; Clements, John <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Cc: Yang, Stanley <[email protected]>
Subject: [PATCH Review 1/4] drm/amdgpu: Update smu driver interface for aldebaranupdate smu driver if version to
0x08to avoid mismatch log A version mismatch can still happen with an older FWChange-Id I97f2bc4ed9a9cba313b744e2ff6812c90b244935Signed-off-by Stanley.Yang <[email protected]>--- .../drm/amd/pm/inc/smu13_driver_if_aldebaran.h | 18 +++++++++++++++++- drivers/gpu/drm/amd/pm/inc/smu_v13_0.h | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/pm/inc/smu13_driver_if_aldebaran.h +17
-1@@ -140,6 +140,8 @@#define MAX_SW_I2C_COMMANDS 24 +#define ALDEBARAN_UMC_CHANNEL_NUM 32 + typedef enum { I2C_CONTROLLER_PORT_0, //CKSVII2C0 I2C_CONTROLLER_PORT_1, //CKSVII2C1@@ -507,6 +509,19 @@ typedef struct {uint32_t MmHubPadding[8 ];// SMU internal use } AvfsDebugTable_t; +typedef struct { +uint64_t mca_umc_status; +uint64_t mca_umc_addr; +uint16_t ce_count_lo_chip; +uint16_t ce_count_hi_chip; + +uint32_t eccPadding; +}EccInfo_t ; + +typedef struct { +EccInfo_t EccInfo[ALDEBARAN_UMC_CHANNEL_NUM ]; +}EccInfoTable_t ; +// These defines are used with the following messages: // SMC_MSG_TransferTableDram2Smu // SMC_MSG_TransferTableSmu2Dram @@ -517,6 +532,7 @@ typedef struct {#define TABLE_SMU_METRICS 4#define TABLE_DRIVER_SMU_CONFIG 5#define TABLE_I2C_COMMANDS 6 -#define TABLE_COUNT 7 +#define TABLE_ECCINFO 7 +#define TABLE_COUNT 8#endif drivers/gpu/drm/amd/pm/inc/smu_v13_0.h +1
-2@@ -27,7 +27,7 @@#define SMU13_DRIVER_IF_VERSION_INV 0xFFFFFFFF#define SMU13_DRIVER_IF_VERSION_YELLOW_CARP 0x04 -#define SMU13_DRIVER_IF_VERSION_ALDE 0x07 +#define SMU13_DRIVER_IF_VERSION_ALDE 0x08#define SMU13_MODE1_RESET_WAIT_TIME_IN_MS 500 //500ms --2.17.1
[AMD Official Use Only]
Thanks Evan,
Will update patch 1 and 3 title before submit.
Regards,
Stanley
Quoted 99 lines
-----邮件原件-----
发件人: Quan, Evan <[email protected]>
发送时间: Thursday, November 18, 2021 5:58 PM
收件人: Yang, Stanley <[email protected]>; amd- [email protected]; Zhang, Hawking <[email protected]>; Clements, John <[email protected]>; Lazar, Lijo <[email protected]>; Wang, Yang(Kevin) <[email protected]> 抄送: Yang, Stanley <[email protected]>
主题: RE: [PATCH Review 1/4] drm/amdgpu: Update smu driver interface for aldebaran[AMD Official Use Only]
Better to update the patch title as "drm/amd/pm: Update smu driver interface for aldebaran" as all other power related patches. And please update patch3 also.
Other than above, patch 1, 3 are reviewed-by: Evan Quan <[email protected]>Quoted 5 lines
-----Original Message-----
From: Stanley.Yang <[email protected]>
Sent: Thursday, November 18, 2021 5:34 PM
To: [email protected]; Zhang, Hawking
<[email protected]>; Clements, John<[email protected]>; Quan,
Quoted 75 lines
Evan <[email protected]>; Lazar, Lijo <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Cc: Yang, Stanley <[email protected]>
Subject: [PATCH Review 1/4] drm/amdgpu: Update smu driver interface for aldebaranupdate smu driver if version to
0x08to avoid mismatch log A version mismatch can still happen with an older FWChange-Id I97f2bc4ed9a9cba313b744e2ff6812c90b244935Signed-off-by Stanley.Yang <[email protected]>--- .../drm/amd/pm/inc/smu13_driver_if_aldebaran.h | 18 +++++++++++++++++- drivers/gpu/drm/amd/pm/inc/smu_v13_0.h | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/pm/inc/smu13_driver_if_aldebaran.h +17
-1@@ -140,6 +140,8 @@#define MAX_SW_I2C_COMMANDS 24 +#define ALDEBARAN_UMC_CHANNEL_NUM 32 + typedef enum { I2C_CONTROLLER_PORT_0, //CKSVII2C0 I2C_CONTROLLER_PORT_1, //CKSVII2C1@@ -507,6 +509,19 @@ typedef struct {uint32_t MmHubPadding[8 ];// SMU internal use } AvfsDebugTable_t; +typedef struct { +uint64_t mca_umc_status; +uint64_t mca_umc_addr; +uint16_t ce_count_lo_chip; +uint16_t ce_count_hi_chip; + +uint32_t eccPadding; +}EccInfo_t ; + +typedef struct { +EccInfo_t EccInfo[ALDEBARAN_UMC_CHANNEL_NUM ]; +}EccInfoTable_t ; +// These defines are used with the following messages: // SMC_MSG_TransferTableDram2Smu // SMC_MSG_TransferTableSmu2Dram @@ -517,6 +532,7 @@ typedef struct {#define TABLE_SMU_METRICS 4#define TABLE_DRIVER_SMU_CONFIG 5#define TABLE_I2C_COMMANDS 6 -#define TABLE_COUNT 7 +#define TABLE_ECCINFO 7 +#define TABLE_COUNT 8#endif drivers/gpu/drm/amd/pm/inc/smu_v13_0.h +0
-0@@ -27,7 +27,7 @@#define SMU13_DRIVER_IF_VERSION_INV 0xFFFFFFFF #define
SMU13_DRIVER_IF_VERSION_YELLOW_CARP0x04-#defineSMU13_DRIVER_IF_VERSION_ALDE0x07
+#defineSMU13_DRIVER_IF_VERSION_ALDE0x08#define
SMU13_MODE1_RESET_WAIT_TIME_IN_MS500 //500ms--
2.17.1