Skip to content

Commit 64314e3

Browse files
committed
drm/amdgpu: fix the PCIe lanes reporting in the INFO IOCTL
Combine the platform and GPU caps like we do for PCIe Gen. This aligns properly with expectations and documentation for the interface. Link: https://gitlab.freedesktop.org/drm/amd/-/issues/3820 Reviewed-by: Yang Wang <kevinyang.wang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 757e8b9 commit 64314e3

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
846846
case AMDGPU_INFO_DEV_INFO: {
847847
struct drm_amdgpu_info_device *dev_info;
848848
uint64_t vm_size;
849-
uint32_t pcie_gen_mask;
849+
uint32_t pcie_gen_mask, pcie_width_mask;
850850

851851
dev_info = kzalloc(sizeof(*dev_info), GFP_KERNEL);
852852
if (!dev_info)
@@ -934,15 +934,18 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
934934
dev_info->tcc_disabled_mask = adev->gfx.config.tcc_disabled_mask;
935935

936936
/* Combine the chip gen mask with the platform (CPU/mobo) mask. */
937-
pcie_gen_mask = adev->pm.pcie_gen_mask & (adev->pm.pcie_gen_mask >> 16);
937+
pcie_gen_mask = adev->pm.pcie_gen_mask &
938+
(adev->pm.pcie_gen_mask >> CAIL_PCIE_LINK_SPEED_SUPPORT_SHIFT);
939+
pcie_width_mask = adev->pm.pcie_mlw_mask &
940+
(adev->pm.pcie_mlw_mask >> CAIL_PCIE_LINK_WIDTH_SUPPORT_SHIFT);
938941
dev_info->pcie_gen = fls(pcie_gen_mask);
939942
dev_info->pcie_num_lanes =
940-
adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X32 ? 32 :
941-
adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X16 ? 16 :
942-
adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X12 ? 12 :
943-
adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X8 ? 8 :
944-
adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X4 ? 4 :
945-
adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X2 ? 2 : 1;
943+
pcie_width_mask & CAIL_ASIC_PCIE_LINK_WIDTH_SUPPORT_X32 ? 32 :
944+
pcie_width_mask & CAIL_ASIC_PCIE_LINK_WIDTH_SUPPORT_X16 ? 16 :
945+
pcie_width_mask & CAIL_ASIC_PCIE_LINK_WIDTH_SUPPORT_X12 ? 12 :
946+
pcie_width_mask & CAIL_ASIC_PCIE_LINK_WIDTH_SUPPORT_X8 ? 8 :
947+
pcie_width_mask & CAIL_ASIC_PCIE_LINK_WIDTH_SUPPORT_X4 ? 4 :
948+
pcie_width_mask & CAIL_ASIC_PCIE_LINK_WIDTH_SUPPORT_X2 ? 2 : 1;
946949

947950
dev_info->tcp_cache_size = adev->gfx.config.gc_tcp_l1_size;
948951
dev_info->num_sqc_per_wgp = adev->gfx.config.gc_num_sqc_per_wgp;

0 commit comments

Comments
 (0)