mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-02 12:10:23 -04:00
drm/amd/pm: add message smu to get ecc_table
support ECC TABLE message, this table include umc ras error count and error address V2: Return after smu version check fail V3: Return -EOPNOTSUPP, if fail to get smc ver. V4: ECCTABLE typo corrected and sentence rephrased. Signed-off-by: mziya <Mohammadzafar.ziya@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
#include "mp/mp_11_0_sh_mask.h"
|
||||
|
||||
#include "asic_reg/mp/mp_11_0_sh_mask.h"
|
||||
#include "amdgpu_ras.h"
|
||||
#include "smu_cmn.h"
|
||||
|
||||
/*
|
||||
@@ -83,6 +84,12 @@
|
||||
/* STB FIFO depth is in 64bit units */
|
||||
#define SIENNA_CICHLID_STB_DEPTH_UNIT_BYTES 8
|
||||
|
||||
/*
|
||||
* SMU support ECCTABLE since version 58.70.0,
|
||||
* use this to check whether ECCTABLE feature is supported.
|
||||
*/
|
||||
#define SUPPORT_ECCTABLE_SMU_VERSION 0x003a4600
|
||||
|
||||
static int get_table_size(struct smu_context *smu)
|
||||
{
|
||||
if (smu->adev->ip_versions[MP1_HWIP][0] == IP_VERSION(11, 0, 13))
|
||||
@@ -225,6 +232,7 @@ static struct cmn2asic_mapping sienna_cichlid_table_map[SMU_TABLE_COUNT] = {
|
||||
TAB_MAP(OVERDRIVE),
|
||||
TAB_MAP(I2C_COMMANDS),
|
||||
TAB_MAP(PACE),
|
||||
TAB_MAP(ECCINFO),
|
||||
};
|
||||
|
||||
static struct cmn2asic_mapping sienna_cichlid_pwr_src_map[SMU_POWER_SOURCE_COUNT] = {
|
||||
@@ -466,6 +474,8 @@ static int sienna_cichlid_tables_init(struct smu_context *smu)
|
||||
SMU_TABLE_INIT(tables, SMU_TABLE_ACTIVITY_MONITOR_COEFF,
|
||||
sizeof(DpmActivityMonitorCoeffIntExternal_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(SmuMetricsExternal_t), GFP_KERNEL);
|
||||
if (!smu_table->metrics_table)
|
||||
@@ -481,6 +491,10 @@ static int sienna_cichlid_tables_init(struct smu_context *smu)
|
||||
if (!smu_table->watermarks_table)
|
||||
goto err2_out;
|
||||
|
||||
smu_table->ecc_table = kzalloc(tables[SMU_TABLE_ECCINFO].size, GFP_KERNEL);
|
||||
if (!smu_table->ecc_table)
|
||||
return -ENOMEM;
|
||||
|
||||
return 0;
|
||||
|
||||
err2_out:
|
||||
@@ -3672,6 +3686,60 @@ static ssize_t sienna_cichlid_get_gpu_metrics(struct smu_context *smu,
|
||||
return sizeof(struct gpu_metrics_v1_3);
|
||||
}
|
||||
|
||||
static int sienna_cichlid_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)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (smu_version < SUPPORT_ECCTABLE_SMU_VERSION)
|
||||
ret = -EOPNOTSUPP;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t sienna_cichlid_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;
|
||||
|
||||
ret = sienna_cichlid_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 < SIENNA_CICHLID_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 sienna_cichlid_enable_mgpu_fan_boost(struct smu_context *smu)
|
||||
{
|
||||
struct smu_table_context *table_context = &smu->smu_table;
|
||||
@@ -3923,6 +3991,7 @@ static const struct pptable_funcs sienna_cichlid_ppt_funcs = {
|
||||
.gpo_control = sienna_cichlid_gpo_control,
|
||||
.set_mp1_state = sienna_cichlid_set_mp1_state,
|
||||
.stb_collect_info = sienna_cichlid_stb_get_data_direct,
|
||||
.get_ecc_info = sienna_cichlid_get_ecc_info,
|
||||
};
|
||||
|
||||
void sienna_cichlid_set_ppt_funcs(struct smu_context *smu)
|
||||
|
||||
@@ -473,8 +473,10 @@ int smu_v11_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;
|
||||
|
||||
Reference in New Issue
Block a user