Skip to content

Commit c191515

Browse files
committed
drm/amdgpu: Query P2PDMA distance only if CONFIG_HSA_AMD_P2P is defined
CONFIG_HSA_AMD_P2P indicates the requirements that are needed for P2P DMA Mappings. It is important to note that enabling CONFIG_HSA_AMD_P2P is a necessary but insufficient condition. It is possible to encounter runtime errors - e.g. CPU's do not support Inter-CPU transport of PCIe transaction packets i.e. P2PDMA distance API may return error Signed-off-by: Ramesh Errabolu <Ramesh.Errabolu@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
1 parent 437f02c commit c191515

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5577,6 +5577,12 @@ static void amdgpu_device_get_pcie_info(struct amdgpu_device *adev)
55775577
* Return true if @peer_adev can access (DMA) @adev through the PCIe
55785578
* BAR, i.e. @adev is "large BAR" and the BAR matches the DMA mask of
55795579
* @peer_adev.
5580+
*
5581+
* @note: CONFIG_HSA_AMD_P2P indicates support for P2P DMA mappings. Query
5582+
* P2PDMA distance only if the kernel has all the prerequisites for P2P DMA
5583+
* support. Otherwise fall back to the less reliable legacy P2P support to
5584+
* avoid regressions.
5585+
*
55805586
*/
55815587
bool amdgpu_device_is_peer_accessible(struct amdgpu_device *adev,
55825588
struct amdgpu_device *peer_adev)
@@ -5587,7 +5593,7 @@ bool amdgpu_device_is_peer_accessible(struct amdgpu_device *adev,
55875593
resource_size_t aper_limit =
55885594
adev->gmc.aper_base + adev->gmc.aper_size - 1;
55895595

5590-
#ifdef CONFIG_PCI_P2PDMA
5596+
#ifdef CONFIG_HSA_AMD_P2P
55915597
p2p_access = !adev->gmc.xgmi.connected_to_cpu &&
55925598
!(pci_p2pdma_distance_many(adev->pdev,
55935599
&peer_adev->dev, 1, true) < 0);

0 commit comments

Comments
 (0)