RE: [PATCH] drm/amdgpu: move apu flags initialization to the start of device init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reviewed-by: Aaron Liu <aaron.liu@xxxxxxx>

--
Best Regards
Aaron Liu

> -----Original Message-----
> From: Huang, Ray <Ray.Huang@xxxxxxx>
> Sent: Tuesday, June 22, 2021 5:41 PM
> To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx
> Cc: Deucher, Alexander <Alexander.Deucher@xxxxxxx>; Zhang, Hawking
> <Hawking.Zhang@xxxxxxx>; Zhou1, Tao <Tao.Zhou1@xxxxxxx>; Yu, Lang
> <Lang.Yu@xxxxxxx>; Gong, Curry <Curry.Gong@xxxxxxx>; Liu, Aaron
> <Aaron.Liu@xxxxxxx>; Huang, Ray <Ray.Huang@xxxxxxx>
> Subject: [PATCH] drm/amdgpu: move apu flags initialization to the start of
> device init
> 
> In some asics, we need to adjust the behavior according to the apu flags at
> very early stage.
> 
> Signed-off-by: Huang Rui <ray.huang@xxxxxxx>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 36
> ++++++++++++++++++++++
>  drivers/gpu/drm/amd/amdgpu/nv.c            |  1 -
>  drivers/gpu/drm/amd/amdgpu/soc15.c         | 10 +-----
>  3 files changed, 37 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 3f51b142fc83..e6702d136a6d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1359,6 +1359,38 @@ static void
> amdgpu_device_check_smu_prv_buffer_size(struct amdgpu_device *adev)
>  	adev->pm.smu_prv_buffer_size = 0;
>  }
> 
> +static int amdgpu_device_init_apu_flags(struct amdgpu_device *adev) {
> +	if (!(adev->flags & AMD_IS_APU) ||
> +	    adev->asic_type < CHIP_RAVEN)
> +		return 0;
> +
> +	switch (adev->asic_type) {
> +	case CHIP_RAVEN:
> +		if (adev->pdev->device == 0x15dd)
> +			adev->apu_flags |= AMD_APU_IS_RAVEN;
> +		if (adev->pdev->device == 0x15d8)
> +			adev->apu_flags |= AMD_APU_IS_PICASSO;
> +		break;
> +	case CHIP_RENOIR:
> +		if ((adev->pdev->device == 0x1636) ||
> +		    (adev->pdev->device == 0x164c))
> +			adev->apu_flags |= AMD_APU_IS_RENOIR;
> +		else
> +			adev->apu_flags |= AMD_APU_IS_GREEN_SARDINE;
> +		break;
> +	case CHIP_VANGOGH:
> +		adev->apu_flags |= AMD_APU_IS_VANGOGH;
> +		break;
> +	case CHIP_YELLOW_CARP:
> +		break;
> +	default:
> +		return -EINVAL;
> +	}
> +
> +	return 0;
> +}
> +
>  /**
>   * amdgpu_device_check_arguments - validate module params
>   *
> @@ -3358,6 +3390,10 @@ int amdgpu_device_init(struct amdgpu_device
> *adev,
>  	mutex_init(&adev->psp.mutex);
>  	mutex_init(&adev->notifier_lock);
> 
> +	r = amdgpu_device_init_apu_flags(adev);
> +	if (r)
> +		return r;
> +
>  	r = amdgpu_device_check_arguments(adev);
>  	if (r)
>  		return r;
> diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c
> b/drivers/gpu/drm/amd/amdgpu/nv.c index 455d0425787c..1470488a18e3
> 100644
> --- a/drivers/gpu/drm/amd/amdgpu/nv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/nv.c
> @@ -1275,7 +1275,6 @@ static int nv_common_early_init(void *handle)
>  		break;
> 
>  	case CHIP_VANGOGH:
> -		adev->apu_flags |= AMD_APU_IS_VANGOGH;
>  		adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
>  			AMD_CG_SUPPORT_GFX_MGLS |
>  			AMD_CG_SUPPORT_GFX_CP_LS |
> diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c
> b/drivers/gpu/drm/amd/amdgpu/soc15.c
> index de85577c9cfd..b02436401d46 100644
> --- a/drivers/gpu/drm/amd/amdgpu/soc15.c
> +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
> @@ -1360,10 +1360,7 @@ static int soc15_common_early_init(void *handle)
>  		break;
>  	case CHIP_RAVEN:
>  		adev->asic_funcs = &soc15_asic_funcs;
> -		if (adev->pdev->device == 0x15dd)
> -			adev->apu_flags |= AMD_APU_IS_RAVEN;
> -		if (adev->pdev->device == 0x15d8)
> -			adev->apu_flags |= AMD_APU_IS_PICASSO;
> +
>  		if (adev->rev_id >= 0x8)
>  			adev->apu_flags |= AMD_APU_IS_RAVEN2;
> 
> @@ -1455,11 +1452,6 @@ static int soc15_common_early_init(void *handle)
>  		break;
>  	case CHIP_RENOIR:
>  		adev->asic_funcs = &soc15_asic_funcs;
> -		if ((adev->pdev->device == 0x1636) ||
> -		    (adev->pdev->device == 0x164c))
> -			adev->apu_flags |= AMD_APU_IS_RENOIR;
> -		else
> -			adev->apu_flags |= AMD_APU_IS_GREEN_SARDINE;
> 
>  		if (adev->apu_flags & AMD_APU_IS_RENOIR)
>  			adev->external_rev_id = adev->rev_id + 0x91;
> --
> 2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux