Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: Check pcie replays reporting support

Check if pcie replay count reporting is supported before creating sysfs
attribute.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Acked-by: Mangesh Gadre <Mangesh.Gadre@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Lijo Lazar and committed by
Alex Deucher
196aefea c09910b5

+13 -2
+2 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 232 232 { 233 233 int ret = 0; 234 234 235 - if (!amdgpu_sriov_vf(adev)) 235 + if (amdgpu_nbio_is_replay_cnt_supported(adev)) 236 236 ret = sysfs_create_file(&adev->dev->kobj, 237 237 &dev_attr_pcie_replay_count.attr); 238 238 ··· 241 241 242 242 static void amdgpu_device_attr_sysfs_fini(struct amdgpu_device *adev) 243 243 { 244 - if (!amdgpu_sriov_vf(adev)) 244 + if (amdgpu_nbio_is_replay_cnt_supported(adev)) 245 245 sysfs_remove_file(&adev->dev->kobj, 246 246 &dev_attr_pcie_replay_count.attr); 247 247 }
+9
drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c
··· 53 53 return 0; 54 54 } 55 55 56 + bool amdgpu_nbio_is_replay_cnt_supported(struct amdgpu_device *adev) 57 + { 58 + if (amdgpu_sriov_vf(adev) || !adev->asic_funcs->get_pcie_replay_count || 59 + (!adev->nbio.funcs || !adev->nbio.funcs->get_pcie_replay_count)) 60 + return false; 61 + 62 + return true; 63 + } 64 + 56 65 int amdgpu_nbio_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *ras_block) 57 66 { 58 67 int r;
+2
drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h
··· 119 119 int amdgpu_nbio_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *ras_block); 120 120 u64 amdgpu_nbio_get_pcie_replay_count(struct amdgpu_device *adev); 121 121 122 + bool amdgpu_nbio_is_replay_cnt_supported(struct amdgpu_device *adev); 123 + 122 124 #endif