When the CPU is XGMI connected, the PCIe links should
not be enumerated for topology purposes. However, PCIe
transfer should still be a valid option for remote
doorbells and MMIO mappings.

Move the XGMI connection check out of the shared helper
function amdgpu_device_is_peer_accessible and into the
topology path.

Signed-off-by: David Francis <david.fran...@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +---
 drivers/gpu/drm/amd/amdkfd/kfd_topology.c  | 6 ++++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 7ec32b44df05..a5c054f8a427 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -5783,9 +5783,7 @@ bool amdgpu_device_is_peer_accessible(struct 
amdgpu_device *adev,
                ~*peer_adev->dev->dma_mask : ~((1ULL << 32) - 1);
        resource_size_t aper_limit =
                adev->gmc.aper_base + adev->gmc.aper_size - 1;
-       bool p2p_access =
-               !adev->gmc.xgmi.connected_to_cpu &&
-               !(pci_p2pdma_distance(adev->pdev, peer_adev->dev, false) < 0);
+       bool p2p_access = !(pci_p2pdma_distance(adev->pdev, peer_adev->dev, 
false) < 0);
 
        return pcie_p2p && p2p_access && (adev->gmc.visible_vram_size &&
                adev->gmc.real_vram_size == adev->gmc.visible_vram_size &&
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
index 4e530791507e..cb64c19482f3 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
@@ -1514,11 +1514,13 @@ static int kfd_dev_create_p2p_links(void)
                        goto next;
 
                /* check if node(s) is/are peer accessible in one direction or 
bi-direction */
-               ret = kfd_add_peer_prop(new_dev, dev, i, k);
+               if (!new_dev->gpu->adev->gmc.xgmi.connected_to_cpu)
+                       ret = kfd_add_peer_prop(new_dev, dev, i, k);
                if (ret < 0)
                        goto out;
 
-               ret = kfd_add_peer_prop(dev, new_dev, k, i);
+               if (!dev->gpu->adev->gmc.xgmi.connected_to_cpu)
+                       ret = kfd_add_peer_prop(dev, new_dev, k, i);
                if (ret < 0)
                        goto out;
 next:
-- 
2.34.1

Reply via email to