[PATCH 1/2] drm/amdgpu: Add pcie usage callback to nbio

Chen, Guchun Guchun.Chen at amd.com
Wed Aug 9 08:44:38 UTC 2023


[Public]

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Asad
> Kamal
> Sent: Wednesday, August 9, 2023 4:30 PM
> To: amd-gfx at lists.freedesktop.org
> Cc: Lazar, Lijo <Lijo.Lazar at amd.com>; Zhang, Morris
> <Shiwu.Zhang at amd.com>; Kamal, Asad <Asad.Kamal at amd.com>; Zhang,
> Hawking <Hawking.Zhang at amd.com>
> Subject: [PATCH 1/2] drm/amdgpu: Add pcie usage callback to nbio
>
> Add a callback in nbio to get pcie usage
>
> Signed-off-by: Asad Kamal <asad.kamal at amd.com>
> Reviewed-by: Lijo Lazar <lijo.lazar at amd.com>
> Reviewed-by: Shiwu Zhang <shiwu.zhang at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c | 8 ++++++++
> drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h | 3 +++
>  2 files changed, 11 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c
> index a3bc00577a7c..f65903a41e6f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c
> @@ -45,6 +45,14 @@ int amdgpu_nbio_ras_sw_init(struct amdgpu_device
> *adev)
>       return 0;
>  }
>
> +void amdgpu_nbio_get_pcie_usage(struct amdgpu_device *adev, uint64_t
> *count0,
> +                             uint64_t *count1)
> +{
> +     if (adev->nbio.funcs->get_pcie_usage)
> +             adev->nbio.funcs->get_pcie_usage(adev, count0, count1);
> +
> +}
> +
>  int amdgpu_nbio_ras_late_init(struct amdgpu_device *adev, struct
> ras_common_if *ras_block)  {
>       int r;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h
> index 8ab8ae01f87c..39bf845c9cc8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h
> @@ -99,6 +99,8 @@ struct amdgpu_nbio_funcs {
>       int (*get_compute_partition_mode)(struct amdgpu_device *adev);
>       u32 (*get_memory_partition_mode)(struct amdgpu_device *adev,
>                                        u32 *supp_modes);
> +     void (*get_pcie_usage)(struct amdgpu_device *adevi, uint64_t

A nit-pick. Use 'adev' instead of 'adevi' for better code consistency.

Regards,
Guchun

> *count0,
> +                                     uint64_t *count1);
>  };
>
>  struct amdgpu_nbio {
> @@ -111,5 +113,6 @@ struct amdgpu_nbio {  };
>
>  int amdgpu_nbio_ras_sw_init(struct amdgpu_device *adev);
> +void amdgpu_nbio_get_pcie_usage(struct amdgpu_device *adev, uint64_t
> +*count0, uint64_t *count1);
>  int amdgpu_nbio_ras_late_init(struct amdgpu_device *adev, struct
> ras_common_if *ras_block);  #endif
> --
> 2.34.1



More information about the amd-gfx mailing list