diff options
| author | Will Aitken <will.aitken@amd.com> | 2026-07-08 09:09:30 -0400 |
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2026-07-16 18:27:08 -0400 |
| commit | cd353ecafd69a12b7fa693a7f2dfa450613cc78a (patch) | |
| tree | 8e51a997a13cbb321f4f66cc6903e6be4cfb7241 | |
| parent | c53d678cad30450e39534751f94ab9bcb89f714e (diff) | |
| download | linux-stable-cd353ecafd69a12b7fa693a7f2dfa450613cc78a.tar.gz linux-stable-cd353ecafd69a12b7fa693a7f2dfa450613cc78a.zip | |
drm/amdgpu: Use just sriov capability bit for xgmi ext peer link support
The legacy xgmi ta without EXTEND_PEER_LINKS support in sriov still
reports it as enabled. It then fails when the command is called. Rely on
the host capability bit instead.
v2: Replace other instances of supports_ext_link_info with this method.
Including sysfs emission for xgmi_port_num. Now amd-smi xgmi --metric
will output N/A for all cells when port_nums cannot be mapped in sriov
Signed-off-by: Will Aitken <will.aitken@amd.com>
Signed-off-by: Victor Skvortsov <victor.skvortsov@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 14 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 6 |
3 files changed, 13 insertions, 8 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index ca80b6194cac..fdcba94ec0d1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -1888,6 +1888,12 @@ invoke: /* note down the capbility flag for XGMI TA */ psp->xgmi_context.xgmi_ta_caps = xgmi_cmd->caps_flag; + if (!amdgpu_sriov_vf(psp->adev)) + psp->xgmi_context.supports_ext_link_info = psp->xgmi_context.xgmi_ta_caps & + EXTEND_PEER_LINK_INFO_CMD_FLAG; + else + psp->xgmi_context.supports_ext_link_info = amdgpu_sriov_xgmi_ta_ext_peer_link_en(psp->adev); + return ret; } @@ -2065,15 +2071,13 @@ int psp_xgmi_get_topology_info(struct psp_context *psp, amdgpu_ip_version(psp->adev, MP0_HWIP, 0) == IP_VERSION(13, 0, 14) || amdgpu_sriov_vf(psp->adev); - bool ta_port_num_support = psp->xgmi_context.xgmi_ta_caps & EXTEND_PEER_LINK_INFO_CMD_FLAG || - amdgpu_sriov_xgmi_ta_ext_peer_link_en(psp->adev); /* popluate the shared output buffer rather than the cmd input buffer * with node_ids as the input for GET_PEER_LINKS command execution. * This is required for GET_PEER_LINKS per xgmi ta implementation. * The same requirement for GET_EXTEND_PEER_LINKS command. */ - if (ta_port_num_support) { + if (psp->xgmi_context.supports_ext_link_info) { link_extend_info_output = &xgmi_cmd->xgmi_out_message.get_extend_link_info; for (i = 0; i < topology->num_nodes; i++) @@ -2096,7 +2100,7 @@ int psp_xgmi_get_topology_info(struct psp_context *psp, return ret; for (i = 0; i < topology->num_nodes; i++) { - uint8_t node_num_links = ta_port_num_support ? + uint8_t node_num_links = psp->xgmi_context.supports_ext_link_info ? link_extend_info_output->nodes[i].num_links : link_info_output->nodes[i].num_links; /* accumulate num_links on extended data */ if (get_extended_data) { @@ -2106,7 +2110,7 @@ int psp_xgmi_get_topology_info(struct psp_context *psp, topology->nodes[i].num_links : node_num_links; } /* popluate the connected port num info if supported and available */ - if (ta_port_num_support && topology->nodes[i].num_links) { + if (psp->xgmi_context.supports_ext_link_info && topology->nodes[i].num_links) { memcpy(topology->nodes[i].port_num, link_extend_info_output->nodes[i].port_num, sizeof(struct xgmi_connected_port_num) * TA_XGMI__MAX_PORT_NUM); } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h index 3d7744d60fac..d80c85793e3b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h @@ -232,6 +232,7 @@ struct psp_xgmi_context { struct ta_context context; struct psp_xgmi_topology_info top_info; bool supports_extended_data; + bool supports_ext_link_info; uint8_t xgmi_ta_caps; }; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c index c0f581e416f9..2725230aa5e3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c @@ -559,7 +559,7 @@ static int amdgpu_xgmi_sysfs_add_dev_info(struct amdgpu_device *adev, pr_err("failed to create xgmi_num_links\n"); /* Create xgmi port num file if supported */ - if (adev->psp.xgmi_context.xgmi_ta_caps & EXTEND_PEER_LINK_INFO_CMD_FLAG) { + if (adev->psp.xgmi_context.supports_ext_link_info) { ret = device_create_file(adev->dev, &dev_attr_xgmi_port_num); if (ret) dev_err(adev->dev, "failed to create xgmi_port_num\n"); @@ -595,7 +595,7 @@ remove_file: device_remove_file(adev->dev, &dev_attr_xgmi_error); device_remove_file(adev->dev, &dev_attr_xgmi_num_hops); device_remove_file(adev->dev, &dev_attr_xgmi_num_links); - if (adev->psp.xgmi_context.xgmi_ta_caps & EXTEND_PEER_LINK_INFO_CMD_FLAG) + if (adev->psp.xgmi_context.supports_ext_link_info) device_remove_file(adev->dev, &dev_attr_xgmi_port_num); success: @@ -613,7 +613,7 @@ static void amdgpu_xgmi_sysfs_rem_dev_info(struct amdgpu_device *adev, device_remove_file(adev->dev, &dev_attr_xgmi_error); device_remove_file(adev->dev, &dev_attr_xgmi_num_hops); device_remove_file(adev->dev, &dev_attr_xgmi_num_links); - if (adev->psp.xgmi_context.xgmi_ta_caps & EXTEND_PEER_LINK_INFO_CMD_FLAG) + if (adev->psp.xgmi_context.supports_ext_link_info) device_remove_file(adev->dev, &dev_attr_xgmi_port_num); if (hive->kobj.parent != (&adev->dev->kobj)) |
