From f40f201a13497d83e05b8f2fef2c569de8dfe5d0 Mon Sep 17 00:00:00 2001 From: Alex Sierra Date: Thu, 25 Aug 2022 15:42:08 -0500 Subject: [PATCH] drm/amdgpu: ensure no PCIe peer access for CPU XGMI iolinks [Why] Devices with CPU XGMI iolink do not support PCIe peer access. Signed-off-by: Alex Sierra Acked-by: Alex Deucher Reviewed-by: Felix Kuehling (cherry picked from commit b6116052456e26480af9aff29e9d016aeed539d0) Change-Id: I76c0090638f12adbe05b0b3d29d57fd05cdb626e --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 880a3b41f9704..32b202e55fa92 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -5588,7 +5588,8 @@ bool amdgpu_device_is_peer_accessible(struct amdgpu_device *adev, adev->gmc.aper_base + adev->gmc.aper_size - 1; #ifdef CONFIG_PCI_P2PDMA - p2p_access = !(pci_p2pdma_distance_many(adev->pdev, + bool p2p_access = !adev->gmc.xgmi.connected_to_cpu && + !(pci_p2pdma_distance_many(adev->pdev, &peer_adev->dev, 1, true) < 0); #endif return pcie_p2p && p2p_access && (adev->gmc.visible_vram_size &&