[Public] > -----Original Message----- > From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of Asad > Kamal > Sent: Wednesday, August 9, 2023 4:30 PM > To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx > Cc: Lazar, Lijo <Lijo.Lazar@xxxxxxx>; Zhang, Morris > <Shiwu.Zhang@xxxxxxx>; Kamal, Asad <Asad.Kamal@xxxxxxx>; Zhang, > Hawking <Hawking.Zhang@xxxxxxx> > 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@xxxxxxx> > Reviewed-by: Lijo Lazar <lijo.lazar@xxxxxxx> > Reviewed-by: Shiwu Zhang <shiwu.zhang@xxxxxxx> > --- > 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