* [PATCH] drm/amdgpu: move apu flags initialization to the start of device init
@ 2021-06-22 9:40 Huang Rui
2021-06-22 10:19 ` Liu, Aaron
0 siblings, 1 reply; 2+ messages in thread
From: Huang Rui @ 2021-06-22 9:40 UTC (permalink / raw)
To: amd-gfx
Cc: Chen Gong, Tao Zhou, Aaron Liu, Huang Rui, Alex Deucher, Lang Yu,
Hawking Zhang
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@amd.com>
---
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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH] drm/amdgpu: move apu flags initialization to the start of device init
2021-06-22 9:40 [PATCH] drm/amdgpu: move apu flags initialization to the start of device init Huang Rui
@ 2021-06-22 10:19 ` Liu, Aaron
0 siblings, 0 replies; 2+ messages in thread
From: Liu, Aaron @ 2021-06-22 10:19 UTC (permalink / raw)
To: Huang, Ray, amd-gfx
Cc: Deucher, Alexander, Gong, Curry, Zhou1, Tao, Yu, Lang, Zhang, Hawking
Reviewed-by: Aaron Liu <aaron.liu@amd.com>
--
Best Regards
Aaron Liu
> -----Original Message-----
> From: Huang, Ray <Ray.Huang@amd.com>
> Sent: Tuesday, June 22, 2021 5:41 PM
> To: amd-gfx@lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Zhang, Hawking
> <Hawking.Zhang@amd.com>; Zhou1, Tao <Tao.Zhou1@amd.com>; Yu, Lang
> <Lang.Yu@amd.com>; Gong, Curry <Curry.Gong@amd.com>; Liu, Aaron
> <Aaron.Liu@amd.com>; Huang, Ray <Ray.Huang@amd.com>
> 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@amd.com>
> ---
> 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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-22 10:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22 9:40 [PATCH] drm/amdgpu: move apu flags initialization to the start of device init Huang Rui
2021-06-22 10:19 ` Liu, Aaron
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.