[AMD Official Use Only - AMD Internal Distribution Only]

Reviewed-by: Asad Kamal <[email protected]>

Thanks & Regards
Asad

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 6, 2026 7:26 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander 
<[email protected]>; Kamal, Asad <[email protected]>; Skvortsov, 
Victor <[email protected]>; Aitken, Will <[email protected]>; Louis, 
Simon <[email protected]>; Louis, Simon <[email protected]>; Louis, Simon 
<[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: Add xgmi link status for VFs

From: Simon Louis <[email protected]>

Xgmi link status is unavailable in guest. This patch returns 
AMDGPU_XGMI_LINK_NA for VFs.

Signed-off-by: Simon Louis <[email protected]>
Signed-off-by: Lijo Lazar <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c       | 3 +++
 drivers/gpu/drm/amd/include/kgd_pp_interface.h | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
index 0ca6fa40a87c..08731d4be177 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
@@ -347,6 +347,9 @@ int amdgpu_get_xgmi_link_status(struct amdgpu_device *adev, 
int global_link_num)  {
        u32 xgmi_state_reg_val;

+       if (amdgpu_sriov_vf(adev))
+               return AMDGPU_XGMI_LINK_NA;
+
        if (adev->gmc.xgmi.num_physical_nodes <= 1)
                return -EINVAL;

diff --git a/drivers/gpu/drm/amd/include/kgd_pp_interface.h 
b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
index 6683ffd6aa68..bdf8e6ff556c 100644
--- a/drivers/gpu/drm/amd/include/kgd_pp_interface.h
+++ b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
@@ -1832,6 +1832,8 @@ struct amdgpu_partition_metrics_v1_1 {  enum 
amdgpu_xgmi_link_status {
        AMDGPU_XGMI_LINK_INACTIVE = 0,
        AMDGPU_XGMI_LINK_ACTIVE = 1,
+       /* Status not available */
+       AMDGPU_XGMI_LINK_NA = 2,
 };

 #endif
--
2.49.0

Reply via email to