drm/amd/pm: Update SMUv13.0.6 PMFW headers
Subsystems (3)
PATCH 1/2 drm/amd/pm: Update SMUv13.0.6 PMFW headers
Update PMFW interface headers for updated metrics table with pcie link speed and pcie link width
--- drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_6_pmfw.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_6_pmfw.h +4 -1
@@ -123,7 +123,7 @@ typedef enum {VOLTAGE_GUARDBAND_COUNT } GFX_GUARDBAND_e; -#define SMU_METRICS_TABLE_VERSION 0xB +#define SMU_METRICS_TABLE_VERSION 0xC typedef struct __attribute__((packed, aligned(4))) { uint32_t AccumulationCounter;
@@ -223,6 +223,9 @@ typedef struct __attribute__((packed, aligned(4))) {// VCN/JPEG ACTIVITY uint32_t VcnBusy[4 ];uint32_t JpegBusy[32 ]; + +uint32_t PCIeLinkSpeed; +uint32_t PCIeLinkWidth; } MetricsTableX_t; typedef struct __attribute__((packed, aligned(4))) {
Signature · 1 line
2.42.0
PATCH 2/2 drm/amd/pm: Use metric table for pcie speed/width
Report pcie link speed/width using metric table in case of one vf & if pmfw support is available, else report directly from registers in case of pf. Skip reporting it for other cases.
--- .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +13 -1
@@ -2167,6 +2167,7 @@ static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **table (struct gpu_metrics_v1_5 *)smu_table->gpu_metrics_table;struct amdgpu_device *adev = smu->adev;int ret =0 , xcc_id, inst, i, j; +enum amdgpu_sriov_vf_mode mode;MetricsTableX_t *metrics_x;MetricsTableA_t *metrics_a;u16 link_width_level;
@@ -2229,7 +2230,17 @@ static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **table gpu_metrics->gfxclk_lock_status =GET_METRIC_FIELD (GfxLockXCDMak) >>GET_INST (GC ,0 );if (!(adev->flags &AMD_IS_APU )) { -if (!amdgpu_sriov_vf (adev)) { +/*Check smu version, PCIE link speed and width will be reported from pmfw metric +* table for both pf & one vf for smu version 85.99.0 or higher else report only +* for pf from registers +*/ + mode =amdgpu_virt_get_sriov_vf_mode (adev); +if (smu->smc_fw_version >=0x556300 && + mode !=SRIOV_VF_MODE_MULTI_VF ) { + gpu_metrics->pcie_link_width = metrics_x->PCIeLinkWidth; + gpu_metrics->pcie_link_speed = +pcie_gen_to_speed (metrics_x->PCIeLinkSpeed); + }else if (!amdgpu_sriov_vf (adev)) { link_width_level =smu_v13_0_6_get_current_pcie_link_width_level (smu);if (link_width_level >MAX_LINK_WIDTH ) link_width_level =0 ;
@@ -2239,6 +2250,7 @@ static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **table gpu_metrics->pcie_link_speed =smu_v13_0_6_get_current_pcie_link_speed (smu); } + gpu_metrics->pcie_bandwidth_acc =SMUQ10_ROUND (metrics_x->PcieBandwidthAcc[0 ]); gpu_metrics->pcie_bandwidth_inst =
Signature · 1 line
2.42.0
Re: [PATCH 2/2] drm/amd/pm: Use metric table for pcie speed/width
Quoted 23 lines · Asad Kamal
Report pcie link speed/width using metric table in case of one vf & if pmfw support is available, else report directly from registers in case of pf. Skip reporting it for other cases.
Signed-off-by Asad Kamal <[email protected]>--- .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +1
-0@@ -2167,6 +2167,7 @@ static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **table (struct gpu_metrics_v1_5 *)smu_table->gpu_metrics_table;struct amdgpu_device *adev = smu->adev;int ret =0 , xcc_id, inst, i, j; +enum amdgpu_sriov_vf_mode mode;MetricsTableX_t *metrics_x;MetricsTableA_t *metrics_a;u16 link_width_level;@@ -2229,7 +2230,17 @@ static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **table gpu_metrics->gfxclk_lock_status =GET_METRIC_FIELD (GfxLockXCDMak) >>GET_INST (GC ,0 );
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **table · line 2239
Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +7
-1if (!(adev->flags &AMD_IS_APU )) { -if (!amdgpu_sriov_vf (adev)) { +/*Check smu version, PCIE link speed and width will be reported from pmfw metric +* table for both pf & one vf for smu version 85.99.0 or higher else report only +* for pf from registers +*/ + mode =amdgpu_virt_get_sriov_vf_mode (adev); +if (smu->smc_fw_version >=0x556300 && + mode !=SRIOV_VF_MODE_MULTI_VF ) {
gpu_metrics is only available in one-VF mode, so there is no need to do this extra check there.
Thanks,
Lijo
Quoted 15 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +5
-0+ gpu_metrics->pcie_link_width = metrics_x->PCIeLinkWidth; + gpu_metrics->pcie_link_speed = +pcie_gen_to_speed (metrics_x->PCIeLinkSpeed); + }else if (!amdgpu_sriov_vf (adev)) { link_width_level =smu_v13_0_6_get_current_pcie_link_width_level (smu);if (link_width_level >MAX_LINK_WIDTH ) link_width_level =0 ;@@ -2239,6 +2250,7 @@ static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **table gpu_metrics->pcie_link_speed =smu_v13_0_6_get_current_pcie_link_speed (smu); } + gpu_metrics->pcie_bandwidth_acc =SMUQ10_ROUND (metrics_x->PcieBandwidthAcc[0 ]); gpu_metrics->pcie_bandwidth_inst =
RE: [PATCH 2/2] drm/amd/pm: Use metric table for pcie speed/width
[AMD Official Use Only - General]
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, March 15, 2024 12:25 PM
To: Kamal, Asad <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Ma, Le <[email protected]>; Zhang, Morris <[email protected]>; Cheung, Donald <[email protected]>; Khatir, Sepehr <[email protected]>; Oliveira, Daniel <[email protected]>; Poag, Charis <[email protected]>
Subject: Re: [PATCH 2/2] drm/amd/pm: Use metric table for pcie speed/width
Quoted 25 lines · Asad Kamal
Report pcie link speed/width using metric table in case of one vf & if pmfw support is available, else report directly from registers in case of pf. Skip reporting it for other cases.
Signed-off-by Asad Kamal <[email protected]>--- .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +1
-0@@ -2167,6 +2167,7 @@ static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **table (struct gpu_metrics_v1_5 *)smu_table->gpu_metrics_table;struct amdgpu_device *adev = smu->adev;int ret =0 , xcc_id, inst, i, j; +enum amdgpu_sriov_vf_mode mode;MetricsTableX_t *metrics_x;MetricsTableA_t *metrics_a;u16 link_width_level;@@ -2229,7 +2230,17 @@ static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **table gpu_metrics->gfxclk_lock_status =GET_METRIC_FIELD (GfxLockXCDMak) >>GET_INST (GC ,0 );
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **table · line 2240
Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +7
-1if (!(adev->flags &AMD_IS_APU )) { -if (!amdgpu_sriov_vf (adev)) { +/*Check smu version, PCIE link speed and width will be reported from pmfw metric +* table for both pf & one vf for smu version 85.99.0 or higher else report only +* for pf from registers +*/ + mode =amdgpu_virt_get_sriov_vf_mode (adev); +if (smu->smc_fw_version >=0x556300 && + mode !=SRIOV_VF_MODE_MULTI_VF ) {
gpu_metrics is only available in one-VF mode, so there is no need to do this extra check there.
Thanks,
Lijo
[Kamal, Asad] Thank you, will send a v2 with changes
Quoted 15 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +4
-0+ gpu_metrics->pcie_link_width = metrics_x->PCIeLinkWidth; + gpu_metrics->pcie_link_speed = +pcie_gen_to_speed (metrics_x->PCIeLinkSpeed); + }else if (!amdgpu_sriov_vf (adev)) { link_width_level =smu_v13_0_6_get_current_pcie_link_width_level (smu);if (link_width_level >MAX_LINK_WIDTH )link_width_level = 0;drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +1
-0@@ -2239,6 +2250,7 @@ static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **table gpu_metrics->pcie_link_speed =smu_v13_0_6_get_current_pcie_link_speed (smu); } + gpu_metrics->pcie_bandwidth_acc =SMUQ10_ROUND (metrics_x->PcieBandwidthAcc[0 ]); gpu_metrics->pcie_bandwidth_inst =