drm/amdgpu: move apu flags initialization to the start of device init
Subsystems (2)
PATCH 1/1 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.
--- 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(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +36 -0
@@ -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;
drivers/gpu/drm/amd/amdgpu/nv.c +0 -1
@@ -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 |
drivers/gpu/drm/amd/amdgpu/soc15.c +1 -9
@@ -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 ;
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
--
Best Regards
Aaron Liu
Quoted 121 lines
-----Original Message-----
From: Huang, Ray <[email protected]>
Sent: Tuesday, June 22, 2021 5:41 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Yu, Lang <[email protected]>; Gong, Curry <[email protected]>; Liu, Aaron <[email protected]>; Huang, Ray <[email protected]>
Subject: [PATCH] drm/amdgpu: move apu flags initialization to the start of device initIn some asics, we need to adjust the behavior according to the apu flags at very early stage.
Signed-off-by Huang Rui <[email protected]>--- 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(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +35
-0@@ -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)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0return r;(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/nv.cindex455d0425787c..1470488a18e3100644drivers/gpu/drm/amd/amdgpu/nv.c +0
-1@@ -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 |drivers/gpu/drm/amd/amdgpu/soc15.c +1
-10@@ -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 ; --
Quoted 1 line
2.25.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx