From 25b003e170d3f47d2947cbe36a82798a8a8906b0 Mon Sep 17 00:00:00 2001 From: Huang Rui Date: Tue, 4 Dec 2018 18:41:58 +0800 Subject: [PATCH 1339/2940] drm/amd/powerplay: add interface to check pptable (v2) This patch adds interface to check pptable function for smu. It's to check if the format_revision in vbios is up to pptable header version, and the structure size is not 0. v2: add detailed info to describe this function Signed-off-by: Huang Rui Acked-by: Alex Deucher --- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 8 ++++++++ drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c index d022388f3993..d7d40bfba7b0 100644 --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c @@ -145,6 +145,14 @@ static int smu_smc_table_hw_init(struct smu_context *smu) if (ret) return ret; + /* + * check if the format_revision in vbios is up to pptable header + * version, and the structure size is not 0. + */ + ret = smu_check_pptable(smu); + if (ret) + return ret; + return 0; } diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h index 10888c6956aa..40159636845a 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h @@ -41,6 +41,7 @@ struct smu_funcs int (*check_fw_status)(struct smu_context *smu); int (*read_pptable_from_vbios)(struct smu_context *smu); int (*get_vbios_bootup_values)(struct smu_context *smu); + int (*check_pptable)(struct smu_context *smu); }; #define smu_init_microcode(smu) \ @@ -57,6 +58,8 @@ struct smu_funcs ((smu)->funcs->read_pptable_from_vbios ? (smu)->funcs->read_pptable_from_vbios((smu)) : 0) #define smu_get_vbios_bootup_values(smu) \ ((smu)->funcs->get_vbios_bootup_values ? (smu)->funcs->get_vbios_bootup_values((smu)) : 0) +#define smu_check_pptable(smu) \ + ((smu)->funcs->check_pptable ? (smu)->funcs->check_pptable((smu)) : 0) extern const struct amd_ip_funcs smu_ip_funcs; -- 2.17.1