[PATCH 45/66] drm/amdgpu/pm/smu_v13.0: convert IP version checking

Lazar, Lijo lijo.lazar at amd.com
Wed Sep 22 08:18:17 UTC 2021



On 9/21/2021 11:37 PM, Alex Deucher wrote:
> Use IP versions rather than asic_type to differentiate
> IP version specific features.
> 
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> ---
>   .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c    | 22 +++++++++++--------
>   1 file changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
> index a0e50f23b1dd..08f3cc809fc6 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
> @@ -89,12 +89,13 @@ int smu_v13_0_init_microcode(struct smu_context *smu)
>   	if (amdgpu_sriov_vf(adev))
>   		return 0;
>   
> -	switch (adev->asic_type) {
> -	case CHIP_ALDEBARAN:
> +	switch (adev->ip_versions[MP1_HWIP]) {
> +	case IP_VERSION(13, 0, 2):
>   		chip_name = "aldebaran";
>   		break;
>   	default:
> -		dev_err(adev->dev, "Unsupported ASIC type %d\n", adev->asic_type);
> +		dev_err(adev->dev, "Unsupported IP version 0x%x\n",
> +			adev->ip_versions[MP1_HWIP]);
>   		return -EINVAL;
>   	}
>   
> @@ -210,15 +211,17 @@ int smu_v13_0_check_fw_version(struct smu_context *smu)
>   	smu_minor = (smu_version >> 8) & 0xff;
>   	smu_debug = (smu_version >> 0) & 0xff;
>   
> -	switch (smu->adev->asic_type) {
> -	case CHIP_ALDEBARAN:
> +	switch (smu->adev->ip_versions[MP1_HWIP]) {
> +	case IP_VERSION(13, 0, 2):
>   		smu->smc_driver_if_version = SMU13_DRIVER_IF_VERSION_ALDE;
>   		break;
> -	case CHIP_YELLOW_CARP:
> +	case IP_VERSION(13, 0, 1):
> +	case IP_VERSION(13, 0, 3):
>   		smu->smc_driver_if_version = SMU13_DRIVER_IF_VERSION_YELLOW_CARP;
>   		break;

Ah, there are two versions. Commented about something similar in another 
patch. Please ignore.

Thanks,
Lijo

>   	default:
> -		dev_err(smu->adev->dev, "smu unsupported asic type:%d.\n", smu->adev->asic_type);
> +		dev_err(smu->adev->dev, "smu unsupported IP version: 0x%x.\n",
> +			smu->adev->ip_versions[MP1_HWIP]);
>   		smu->smc_driver_if_version = SMU13_DRIVER_IF_VERSION_INV;
>   		break;
>   	}
> @@ -740,8 +743,9 @@ int smu_v13_0_gfx_off_control(struct smu_context *smu, bool enable)
>   	int ret = 0;
>   	struct amdgpu_device *adev = smu->adev;
>   
> -	switch (adev->asic_type) {
> -	case CHIP_YELLOW_CARP:
> +	switch (adev->ip_versions[MP1_HWIP]) {
> +	case IP_VERSION(13, 0, 1):
> +	case IP_VERSION(13, 0, 3):
>   		if (!(adev->pm.pp_feature & PP_GFXOFF_MASK))
>   			return 0;
>   		if (enable)
> 


More information about the amd-gfx mailing list