[PATCH 2/2] drm/amd/pm: Fill pcie recov cntr to metrics 1.6

Lazar, Lijo lijo.lazar at amd.com
Wed Oct 9 04:39:54 UTC 2024



On 10/4/2024 8:31 PM, Asad Kamal wrote:
> Fill pcie other end recovery counter to metrics 1.6
> 
> Signed-off-by: Asad Kamal <asad.kamal at amd.com>
> ---
>  .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c    | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
> index 52f3c537bb3f..a85574a46769 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
> @@ -2306,7 +2306,8 @@ static int smu_v13_0_6_get_current_pcie_link_speed(struct smu_context *smu)
>  
>  static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **table)
>  {
> -	bool per_inst, smu_13_0_6_per_inst, smu_13_0_14_per_inst, apu_per_inst;
> +	bool per_inst, smu_13_0_6_per_inst, smu_13_0_14_per_inst, apu_per_inst,
> +	     smu_13_0_6_rec_cnt, smu_13_0_14_rec_cnt;
>  	struct smu_table_context *smu_table = &smu->smu_table;
>  	struct gpu_metrics_v1_6 *gpu_metrics =
>  		(struct gpu_metrics_v1_6 *)smu_table->gpu_metrics_table;
> @@ -2417,6 +2418,16 @@ static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **table
>  				metrics_x->PCIeNAKSentCountAcc;
>  		gpu_metrics->pcie_nak_rcvd_count_acc =
>  				metrics_x->PCIeNAKReceivedCountAcc;
> +		smu_13_0_6_rec_cnt = (amdgpu_ip_version(smu->adev, MP1_HWIP, 0)
> +				== IP_VERSION(13, 0, 6)) &&
> +			(smu->smc_fw_version >= 0x557600);
> +		smu_13_0_14_rec_cnt = (amdgpu_ip_version(smu->adev, MP1_HWIP, 0)
> +				== IP_VERSION(13, 0, 14)) &&
> +			(smu->smc_fw_version >= 0x05550E00);

Better move this to an inline function which checks IP version.

bool smu_v13_0_6_is_other_end_count_available(smu)
{
switch (ip_version)
	case a:
		return fw_version > xyz;
		
}

That may be easier to read and manage for any future updates/IP version
derivatives.

Thanks,
Lijo

> +		if (smu_13_0_6_rec_cnt || smu_13_0_14_rec_cnt)
> +			gpu_metrics->pcie_lc_perf_other_end_recovery =
> +				metrics_x->PCIeOtherEndRecoveryAcc;
> +
>  	}
>  
>  	gpu_metrics->system_clock_counter = ktime_get_boottime_ns();


More information about the amd-gfx mailing list