All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: modify system reference clock source for navi+
@ 2021-05-18  6:26 Aaron Liu
  2021-05-18  8:04 ` Huang Rui
  2021-05-18  9:36 ` Wang, Kevin(Yang)
  0 siblings, 2 replies; 4+ messages in thread
From: Aaron Liu @ 2021-05-18  6:26 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alexander.Deucher, Ray.Huang, Aaron Liu

Starting from Navi+, the rlc reference clock is used for system clock
from vbios gfx_info table. It is incorrect to use core_refclk_10khz of
vbios smu_info table as system clock.

Signed-off-by: Aaron Liu <aaron.liu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
index 8c417014ca89..83ca58426139 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
@@ -546,6 +546,21 @@ int amdgpu_atomfirmware_get_clock_info(struct amdgpu_device *adev)
 		ret = 0;
 	}
 
+	/* if asic is Navi+, the rlc reference clock is used for system clock
+	 * from vbios gfx_info table */
+	if (adev->asic_type >= CHIP_NAVI10) {
+		index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
+						   gfx_info);
+		if (amdgpu_atom_parse_data_header(mode_info->atom_context, index, NULL,
+					  &frev, &crev, &data_offset)) {
+			struct atom_gfx_info_v2_2 *gfx_info = (struct atom_gfx_info_v2_2*)
+				(mode_info->atom_context->bios + data_offset);
+			if ((frev >= 2) && (crev >= 2))
+				spll->reference_freq = le32_to_cpu(gfx_info->rlc_gpu_timer_refclk);
+			ret = 0;
+		}
+	}
+
 	return ret;
 }
 
-- 
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] 4+ messages in thread

* Re: [PATCH] drm/amdgpu: modify system reference clock source for navi+
  2021-05-18  6:26 [PATCH] drm/amdgpu: modify system reference clock source for navi+ Aaron Liu
@ 2021-05-18  8:04 ` Huang Rui
  2021-05-18  9:36 ` Wang, Kevin(Yang)
  1 sibling, 0 replies; 4+ messages in thread
From: Huang Rui @ 2021-05-18  8:04 UTC (permalink / raw)
  To: Liu, Aaron; +Cc: Deucher, Alexander, amd-gfx

On Tue, May 18, 2021 at 02:26:03PM +0800, Liu, Aaron wrote:
> Starting from Navi+, the rlc reference clock is used for system clock
> from vbios gfx_info table. It is incorrect to use core_refclk_10khz of
> vbios smu_info table as system clock.
> 
> Signed-off-by: Aaron Liu <aaron.liu@amd.com>

Acked-by: Huang Rui <ray.huang@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
> index 8c417014ca89..83ca58426139 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
> @@ -546,6 +546,21 @@ int amdgpu_atomfirmware_get_clock_info(struct amdgpu_device *adev)
>  		ret = 0;
>  	}
>  
> +	/* if asic is Navi+, the rlc reference clock is used for system clock
> +	 * from vbios gfx_info table */
> +	if (adev->asic_type >= CHIP_NAVI10) {
> +		index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
> +						   gfx_info);
> +		if (amdgpu_atom_parse_data_header(mode_info->atom_context, index, NULL,
> +					  &frev, &crev, &data_offset)) {
> +			struct atom_gfx_info_v2_2 *gfx_info = (struct atom_gfx_info_v2_2*)
> +				(mode_info->atom_context->bios + data_offset);
> +			if ((frev >= 2) && (crev >= 2))
> +				spll->reference_freq = le32_to_cpu(gfx_info->rlc_gpu_timer_refclk);
> +			ret = 0;
> +		}
> +	}
> +
>  	return ret;
>  }
>  
> -- 
> 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] 4+ messages in thread

* Re: [PATCH] drm/amdgpu: modify system reference clock source for navi+
  2021-05-18  6:26 [PATCH] drm/amdgpu: modify system reference clock source for navi+ Aaron Liu
  2021-05-18  8:04 ` Huang Rui
@ 2021-05-18  9:36 ` Wang, Kevin(Yang)
  2021-05-18 12:55   ` Alex Deucher
  1 sibling, 1 reply; 4+ messages in thread
From: Wang, Kevin(Yang) @ 2021-05-18  9:36 UTC (permalink / raw)
  To: Liu, Aaron, amd-gfx; +Cc: Deucher, Alexander, Huang, Ray


[-- Attachment #1.1: Type: text/plain, Size: 2844 bytes --]

[AMD Official Use Only]



________________________________
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Aaron Liu <aaron.liu@amd.com>
Sent: Tuesday, May 18, 2021 2:26 PM
To: amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Huang, Ray <Ray.Huang@amd.com>; Liu, Aaron <Aaron.Liu@amd.com>
Subject: [PATCH] drm/amdgpu: modify system reference clock source for navi+

Starting from Navi+, the rlc reference clock is used for system clock
from vbios gfx_info table. It is incorrect to use core_refclk_10khz of
vbios smu_info table as system clock.

Signed-off-by: Aaron Liu <aaron.liu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
index 8c417014ca89..83ca58426139 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
@@ -546,6 +546,21 @@ int amdgpu_atomfirmware_get_clock_info(struct amdgpu_device *adev)
                 ret = 0;
         }

+       /* if asic is Navi+, the rlc reference clock is used for system clock
+        * from vbios gfx_info table */
+       if (adev->asic_type >= CHIP_NAVI10) {
+               index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
+                                                  gfx_info);
+               if (amdgpu_atom_parse_data_header(mode_info->atom_context, index, NULL,
+                                         &frev, &crev, &data_offset)) {
+                       struct atom_gfx_info_v2_2 *gfx_info = (struct atom_gfx_info_v2_2*)
+                               (mode_info->atom_context->bios + data_offset);
+                       if ((frev >= 2) && (crev >= 2))
[kevin]:
There is a hidden danger here. We can't assume that the higher version (frev) is compatible with old one.
the code should change to if (frev == 2) && (crev >= 2)) {} ...

+                               spll->reference_freq = le32_to_cpu(gfx_info->rlc_gpu_timer_refclk);
+                       ret = 0;
+               }
+       }
+
         return ret;
 }

--
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CKevin1.Wang%40amd.com%7C28bc3524cc2b430f8ee108d919c6494d%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637569161701557512%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=kD9yMGIWNpeCZc87I%2B4UufLoAssTGQc73DRjOx4ipXM%3D&amp;reserved=0

[-- Attachment #1.2: Type: text/html, Size: 6244 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/amdgpu: modify system reference clock source for navi+
  2021-05-18  9:36 ` Wang, Kevin(Yang)
@ 2021-05-18 12:55   ` Alex Deucher
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2021-05-18 12:55 UTC (permalink / raw)
  To: Wang, Kevin(Yang); +Cc: Deucher, Alexander, Huang, Ray, Liu, Aaron, amd-gfx

WIth Kevin's comments addressed, the patch is:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

On Tue, May 18, 2021 at 5:36 AM Wang, Kevin(Yang) <Kevin1.Wang@amd.com> wrote:
>
> [AMD Official Use Only]
>
>
>
>
> ________________________________
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Aaron Liu <aaron.liu@amd.com>
> Sent: Tuesday, May 18, 2021 2:26 PM
> To: amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>
> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Huang, Ray <Ray.Huang@amd.com>; Liu, Aaron <Aaron.Liu@amd.com>
> Subject: [PATCH] drm/amdgpu: modify system reference clock source for navi+
>
> Starting from Navi+, the rlc reference clock is used for system clock
> from vbios gfx_info table. It is incorrect to use core_refclk_10khz of
> vbios smu_info table as system clock.
>
> Signed-off-by: Aaron Liu <aaron.liu@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
> index 8c417014ca89..83ca58426139 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
> @@ -546,6 +546,21 @@ int amdgpu_atomfirmware_get_clock_info(struct amdgpu_device *adev)
>                  ret = 0;
>          }
>
> +       /* if asic is Navi+, the rlc reference clock is used for system clock
> +        * from vbios gfx_info table */
> +       if (adev->asic_type >= CHIP_NAVI10) {
> +               index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
> +                                                  gfx_info);
> +               if (amdgpu_atom_parse_data_header(mode_info->atom_context, index, NULL,
> +                                         &frev, &crev, &data_offset)) {
> +                       struct atom_gfx_info_v2_2 *gfx_info = (struct atom_gfx_info_v2_2*)
> +                               (mode_info->atom_context->bios + data_offset);
> +                       if ((frev >= 2) && (crev >= 2))
> [kevin]:
> There is a hidden danger here. We can't assume that the higher version (frev) is compatible with old one.
> the code should change to if (frev == 2) && (crev >= 2)) {} ...
>
> +                               spll->reference_freq = le32_to_cpu(gfx_info->rlc_gpu_timer_refclk);
> +                       ret = 0;
> +               }
> +       }
> +
>          return ret;
>  }
>
> --
> 2.25.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CKevin1.Wang%40amd.com%7C28bc3524cc2b430f8ee108d919c6494d%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637569161701557512%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=kD9yMGIWNpeCZc87I%2B4UufLoAssTGQc73DRjOx4ipXM%3D&amp;reserved=0
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-18 12:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18  6:26 [PATCH] drm/amdgpu: modify system reference clock source for navi+ Aaron Liu
2021-05-18  8:04 ` Huang Rui
2021-05-18  9:36 ` Wang, Kevin(Yang)
2021-05-18 12:55   ` Alex Deucher

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.