Skip to contentSkip to conversation

drm/amd/pm: populate the bootup LCLK frequency

PATCH In review Evan Quan 2 participants 6 messages Oct 14, 2020 – Oct 15, 2020

Subsystems (3)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/2 drm/amd/pm: populate the bootup LCLK frequency

As for other clock domains.

Change-Id I0a78c133f00cd11133bc755bf0443505088f024c
---
 drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h        | 1 +
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 5 +++++
 2 files changed, 6 insertions(+)
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +1 -0
index fafa9c57e32f..9fa9473d418f 100644
@@ -226,6 +226,7 @@ struct smu_bios_boot_up_values
 	uint32_t			format_revision;
 	uint32_t			content_revision;
 	uint32_t			fclk;
+	uint32_t			lclk;
 };
 
 enum smu_table_id
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +5 -0
index a057d1d15087..fbf6d3e35173 100644
@@ -603,6 +603,11 @@ int smu_v11_0_get_vbios_bootup_values(struct smu_context *smu)
 						 (uint8_t)SMU11_SYSPLL1_2_ID,
 						 &smu->smu_table.boot_values.fclk);
 
+	smu_v11_0_atom_get_smu_clockinfo(smu->adev,
+					 (uint8_t)SMU11_SYSPLL3_1_LCLK_ID,
+					 (uint8_t)SMU11_SYSPLL3_1_ID,
+					 &smu->smu_table.boot_values.lclk);
+
 	return 0;
 }
 
Signature · 6 lines
2.28.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#1 lore raw

PATCH 2/2 drm/amd/pm: populate Arcturus PCIE link state

Populate current link speed, width and clock domain frequency.

Change-Id Ic342fbd8f5e2495d212eaa4b85b4e146838e0525
---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c             |  3 ---
 .../gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c  | 18 ++++++++++++++++++
 2 files changed, 18 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -3
index 46eea3f8f958..f87411cfa4da 100644
@@ -2124,9 +2124,6 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
 	} else if (DEVICE_ATTR_IS(pp_dpm_fclk)) {
 		if (asic_type < CHIP_VEGA20)
 			*states = ATTR_STATE_UNSUPPORTED;
-	} else if (DEVICE_ATTR_IS(pp_dpm_pcie)) {
-		if (asic_type == CHIP_ARCTURUS)
-			*states = ATTR_STATE_UNSUPPORTED;
 	} else if (DEVICE_ATTR_IS(pp_od_clk_voltage)) {
 		*states = ATTR_STATE_UNSUPPORTED;
 		if ((is_support_sw_smu(adev) && adev->smu.od_enabled) ||
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +18 -0
index f982b9090d7b..46d950757230 100644
@@ -720,6 +720,7 @@ static int arcturus_print_clk_levels(struct smu_context *smu,
 	struct smu_11_0_dpm_table *single_dpm_table;
 	struct smu_dpm_context *smu_dpm = &smu->smu_dpm;
 	struct smu_11_0_dpm_context *dpm_context = NULL;
+	uint32_t gen_speed, lane_width;
 
 	if (amdgpu_ras_intr_triggered())
 		return snprintf(buf, PAGE_SIZE, "unavailable\n");
@@ -823,6 +824,23 @@ static int arcturus_print_clk_levels(struct smu_context *smu,
 				now) ? "*" : ""));
 		break;
 
+	case SMU_PCIE:
+		gen_speed = smu_v11_0_get_current_pcie_link_speed_level(smu);
+		lane_width = smu_v11_0_get_current_pcie_link_width_level(smu);
+		size += sprintf(buf + size, "0: %s %s %dMhz *\n",
+				(gen_speed == 0) ? "2.5GT/s," :
+				(gen_speed == 1) ? "5.0GT/s," :
+				(gen_speed == 2) ? "8.0GT/s," :
+				(gen_speed == 3) ? "16.0GT/s," : "",
+				(lane_width == 1) ? "x1" :
+				(lane_width == 2) ? "x2" :
+				(lane_width == 3) ? "x4" :
+				(lane_width == 4) ? "x8" :
+				(lane_width == 5) ? "x12" :
+				(lane_width == 6) ? "x16" : "",
+				smu->smu_table.boot_values.lclk / 100);
+		break;
+
 	default:
 		break;
 	}
Signature · 6 lines
2.28.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#2 lore raw

Re: [PATCH 2/2] drm/amd/pm: populate Arcturus PCIE link state

Quoted 45 lines · Evan Quan

Populate current link speed, width and clock domain frequency.

Change-Id Ic342fbd8f5e2495d212eaa4b85b4e146838e0525
---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c             |  3 ---
 .../gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c  | 18 ++++++++++++++++++
 2 files changed, 18 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -3
index 46eea3f8f958..f87411cfa4da 100644
@@ -2124,9 +2124,6 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
        } else if (DEVICE_ATTR_IS(pp_dpm_fclk)) {
                if (asic_type < CHIP_VEGA20)
                        *states = ATTR_STATE_UNSUPPORTED;
-       } else if (DEVICE_ATTR_IS(pp_dpm_pcie)) {
-               if (asic_type == CHIP_ARCTURUS)
-                       *states = ATTR_STATE_UNSUPPORTED;
        } else if (DEVICE_ATTR_IS(pp_od_clk_voltage)) {
                *states = ATTR_STATE_UNSUPPORTED;
                if ((is_support_sw_smu(adev) && adev->smu.od_enabled) ||
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +6 -0
index f982b9090d7b..46d950757230 100644
@@ -720,6 +720,7 @@ static int arcturus_print_clk_levels(struct smu_context *smu,
        struct smu_11_0_dpm_table *single_dpm_table;
        struct smu_dpm_context *smu_dpm = &smu->smu_dpm;
        struct smu_11_0_dpm_context *dpm_context = NULL;
+       uint32_t gen_speed, lane_width;
 
        if (amdgpu_ras_intr_triggered())
                return snprintf(buf, PAGE_SIZE, "unavailable\n");
@@ -823,6 +824,23 @@ static int arcturus_print_clk_levels(struct smu_context *smu,
                                now) ? "*" : ""));
                break;
 
+       case SMU_PCIE:
+               gen_speed = smu_v11_0_get_current_pcie_link_speed_level(smu);
+               lane_width = smu_v11_0_get_current_pcie_link_width_level(smu);
+               size += sprintf(buf + size, "0: %s %s %dMhz *\n",
+                               (gen_speed == 0) ? "2.5GT/s," :

drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c static int arcturus_print_clk_levels(struct smu_context *smu, · line 841

Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +10 -0
+                               (gen_speed == 1) ? "5.0GT/s," :
+                               (gen_speed == 2) ? "8.0GT/s," :
+                               (gen_speed == 3) ? "16.0GT/s," : "",
+                               (lane_width == 1) ? "x1" :
+                               (lane_width == 2) ? "x2" :
+                               (lane_width == 3) ? "x4" :
+                               (lane_width == 4) ? "x8" :
+                               (lane_width == 5) ? "x12" :
+                               (lane_width == 6) ? "x16" : "",
+                               smu->smu_table.boot_values.lclk / 100);

We should put a * by the link speed for consistency with other asics.

Alex

Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +2 -1
+               break;
+
        default:
                break;
        }
--

2.28.0

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#3 lore raw

RE: [PATCH 2/2] drm/amd/pm: populate Arcturus PCIE link state

[AMD Official Use Only - Internal Distribution Only]

Hi Alex,

It was intended to align with other ASICs. The output for this on Arcturus is:
0: 8.0GT/s, x16 618Mhz *
Is not that OK?

BR
Evan
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, October 14, 2020 9:18 PM
To: Quan, Evan <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/2] drm/amd/pm: populate Arcturus PCIE link state

Quoted 49 lines · Evan Quan

Populate current link speed, width and clock domain frequency.

Change-Id Ic342fbd8f5e2495d212eaa4b85b4e146838e0525
---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c             |  3 ---
 .../gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c  | 18
++++++++++++++++++
 2 files changed, 18 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -3
index 46eea3f8f958..f87411cfa4da 100644
@@ -2124,9 +2124,6 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
        } else if (DEVICE_ATTR_IS(pp_dpm_fclk)) {
                if (asic_type < CHIP_VEGA20)
                        *states = ATTR_STATE_UNSUPPORTED;
-       } else if (DEVICE_ATTR_IS(pp_dpm_pcie)) {
-               if (asic_type == CHIP_ARCTURUS)
-                       *states = ATTR_STATE_UNSUPPORTED;
        } else if (DEVICE_ATTR_IS(pp_od_clk_voltage)) {
                *states = ATTR_STATE_UNSUPPORTED;
                if ((is_support_sw_smu(adev) && adev->smu.od_enabled)

|| diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c index f982b9090d7b..46d950757230 100644

drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +7 -1
@@ -720,6 +720,7 @@ static int arcturus_print_clk_levels(struct smu_context *smu,
        struct smu_11_0_dpm_table *single_dpm_table;
        struct smu_dpm_context *smu_dpm = &smu->smu_dpm;
        struct smu_11_0_dpm_context *dpm_context = NULL;
+       uint32_t gen_speed, lane_width;
 
        if (amdgpu_ras_intr_triggered())
                return snprintf(buf, PAGE_SIZE, "unavailable\n"); @@
-823,6 +824,23 @@ static int arcturus_print_clk_levels(struct smu_context *smu,
                                now) ? "*" : ""));
                break;
 
+       case SMU_PCIE:
+               gen_speed = smu_v11_0_get_current_pcie_link_speed_level(smu);
+               lane_width = smu_v11_0_get_current_pcie_link_width_level(smu);
+               size += sprintf(buf + size, "0: %s %s %dMhz *\n",
+                               (gen_speed == 0) ? "2.5GT/s," :
+                               (gen_speed == 1) ? "5.0GT/s," :

drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c static int arcturus_print_clk_levels(struct smu_context *smu,

Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +10 -0
+                               (gen_speed == 2) ? "8.0GT/s," :
+                               (gen_speed == 3) ? "16.0GT/s," : "",
+                               (lane_width == 1) ? "x1" :
+                               (lane_width == 2) ? "x2" :
+                               (lane_width == 3) ? "x4" :
+                               (lane_width == 4) ? "x8" :
+                               (lane_width == 5) ? "x12" :
+                               (lane_width == 6) ? "x16" : "",
+                               smu->smu_table.boot_values.lclk /
+ 100);

We should put a * by the link speed for consistency with other asics.

Alex

Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +2 -1
+               break;
+
        default:
                break;
        }
--

2.28.0

Quoted 8 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cev an.quan%40amd.com%7C880ed84a1bc14d8df30108d87043a997%7C3dd8961fe4884e6 08e11a82d994e183d%7C0%7C0%7C637382783197264100&amp;sdata=kz2KbU6Sn00k9 jjihiqBnQEkfgI3dFbApLnqLf1Dw98%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by
#4 lore raw

Re: [PATCH 2/2] drm/amd/pm: populate Arcturus PCIE link state

Quoted 8 lines · Evan

[AMD Official Use Only - Internal Distribution Only]

Hi Alex,

It was intended to align with other ASICs. The output for this on Arcturus is:
0: 8.0GT/s, x16 618Mhz *
Is not that OK?

Nevermind, I missed the *. I got mixed up comparing with the code for other asics.

Quoted 73 lines

BR
Evan
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, October 14, 2020 9:18 PM
To: Quan, Evan <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/2] drm/amd/pm: populate Arcturus PCIE link state

Quoted 49 lines · Evan Quan

Populate current link speed, width and clock domain frequency.

Change-Id Ic342fbd8f5e2495d212eaa4b85b4e146838e0525
---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c             |  3 ---
 .../gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c  | 18
++++++++++++++++++
 2 files changed, 18 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -3
index 46eea3f8f958..f87411cfa4da 100644
@@ -2124,9 +2124,6 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
        } else if (DEVICE_ATTR_IS(pp_dpm_fclk)) {
                if (asic_type < CHIP_VEGA20)
                        *states = ATTR_STATE_UNSUPPORTED;
-       } else if (DEVICE_ATTR_IS(pp_dpm_pcie)) {
-               if (asic_type == CHIP_ARCTURUS)
-                       *states = ATTR_STATE_UNSUPPORTED;
        } else if (DEVICE_ATTR_IS(pp_od_clk_voltage)) {
                *states = ATTR_STATE_UNSUPPORTED;
                if ((is_support_sw_smu(adev) && adev->smu.od_enabled)

|| diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c index f982b9090d7b..46d950757230 100644

drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +7 -1
@@ -720,6 +720,7 @@ static int arcturus_print_clk_levels(struct smu_context *smu,
        struct smu_11_0_dpm_table *single_dpm_table;
        struct smu_dpm_context *smu_dpm = &smu->smu_dpm;
        struct smu_11_0_dpm_context *dpm_context = NULL;
+       uint32_t gen_speed, lane_width;
 
        if (amdgpu_ras_intr_triggered())
                return snprintf(buf, PAGE_SIZE, "unavailable\n"); @@
-823,6 +824,23 @@ static int arcturus_print_clk_levels(struct smu_context *smu,
                                now) ? "*" : ""));
                break;
 
+       case SMU_PCIE:
+               gen_speed = smu_v11_0_get_current_pcie_link_speed_level(smu);
+               lane_width = smu_v11_0_get_current_pcie_link_width_level(smu);
+               size += sprintf(buf + size, "0: %s %s %dMhz *\n",
+                               (gen_speed == 0) ? "2.5GT/s," :
+                               (gen_speed == 1) ? "5.0GT/s," :

drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c static int arcturus_print_clk_levels(struct smu_context *smu,

Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +10 -0
+                               (gen_speed == 2) ? "8.0GT/s," :
+                               (gen_speed == 3) ? "16.0GT/s," : "",
+                               (lane_width == 1) ? "x1" :
+                               (lane_width == 2) ? "x2" :
+                               (lane_width == 3) ? "x4" :
+                               (lane_width == 4) ? "x8" :
+                               (lane_width == 5) ? "x12" :
+                               (lane_width == 6) ? "x16" : "",
+                               smu->smu_table.boot_values.lclk /
+ 100);

We should put a * by the link speed for consistency with other asics.

Quoted 19 lines

Alex

Quoted 16 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +2 -1
+               break;
+
        default:
                break;
        }
--

2.28.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cev an.quan%40amd.com%7C880ed84a1bc14d8df30108d87043a997%7C3dd8961fe4884e6 08e11a82d994e183d%7C0%7C0%7C637382783197264100&amp;sdata=kz2KbU6Sn00k9 jjihiqBnQEkfgI3dFbApLnqLf1Dw98%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by on v1 1/2
#5 lore raw
In reply to Evan Quan
Quoted 5 lines · Evan Quan

As for other clock domains.

Change-Id I0a78c133f00cd11133bc755bf0443505088f024c
Quoted 36 lines
---
 drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h        | 1 +
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 5 +++++
 2 files changed, 6 insertions(+)
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +1 -0
index fafa9c57e32f..9fa9473d418f 100644
@@ -226,6 +226,7 @@ struct smu_bios_boot_up_values
        uint32_t                        format_revision;
        uint32_t                        content_revision;
        uint32_t                        fclk;
+       uint32_t                        lclk;
 };
 
 enum smu_table_id
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +5 -1
index a057d1d15087..fbf6d3e35173 100644
@@ -603,6 +603,11 @@ int smu_v11_0_get_vbios_bootup_values(struct smu_context *smu)
                                                 (uint8_t)SMU11_SYSPLL1_2_ID,
                                                 &smu->smu_table.boot_values.fclk);
 
+       smu_v11_0_atom_get_smu_clockinfo(smu->adev,
+                                        (uint8_t)SMU11_SYSPLL3_1_LCLK_ID,
+                                        (uint8_t)SMU11_SYSPLL3_1_ID,
+                                        &smu->smu_table.boot_values.lclk);
+
        return 0;
 }
 
--

2.28.0

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx