From 579191ae3bd4a782fb47f477a891e461483bf3b1 Mon Sep 17 00:00:00 2001 From: Daniel Sanfte Date: Sun, 29 Mar 2026 13:51:15 +0100 Subject: [PATCH] dkms: remove CONFIG_DMABUF_MOVENOTIFY gate for P2P enablement The CONFIG_DMABUF_MOVENOTIFY kernel config option was an AMD out-of-tree config that existed in older patched kernels. Since mainline kernel ~5.12, the DMA-buf move_notify callback is built-in unconditionally (part of struct dma_buf_ops) with no separate Kconfig gate. On mainline kernels (tested on 6.14), CONFIG_DMABUF_MOVENOTIFY is never defined, which causes CONFIG_HSA_AMD_P2P to be disabled even when CONFIG_PCI_P2PDMA=y. This prevents GPU-to-GPU P2P access through PCIe switches (e.g., Broadcom PEX88096) because the IOMMU remap check in amdgpu_device_is_peer_accessible() is compiled out entirely. Without CONFIG_HSA_AMD_P2P, the driver falls back to raw DMA mask address checking which fails for GPUs behind PCIe switches where BAR addresses (e.g., 62 TiB) exceed the GPU's 44-bit DMA mask, even though IOMMU remapping would make P2P work correctly. The fix removes the CONFIG_DMABUF_MOVENOTIFY inner check, keeping only the CONFIG_PCI_P2PDMA gate which is the actual functional requirement for PCIe peer-to-peer DMA support. Tested on: - 2x AMD Instinct MI50 32GB behind Broadcom PEX88096 Gen4 switch - Kernel 6.14.0-37-generic (Ubuntu mainline) - ROCm 6.4.2 with amdgpu DKMS 6.12.12 - Verified: KFD p2p_links, hipDeviceCanAccessPeer, P2P memcpy, rocm-bandwidth-test bidirectional P2P all functional after fix Signed-off-by: Daniel Sanfte --- drivers/gpu/drm/amd/dkms/dkms-config.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/dkms/dkms-config.sh b/drivers/gpu/drm/amd/dkms/dkms-config.sh index efe7089df9c36..c60e20695b462 100755 --- a/drivers/gpu/drm/amd/dkms/dkms-config.sh +++ b/drivers/gpu/drm/amd/dkms/dkms-config.sh @@ -108,9 +108,7 @@ append_mk "subdir-ccflags-y += -DDRM_VER=${DRM_VER} -DDRM_PATCH=${DRM_PATCH} -DD # Check for P2PDMA configuration _enable=0 if [[ "$(get_config CONFIG_PCI_P2PDMA)" == "y" ]]; then - if [[ "$(get_config CONFIG_DMABUF_MOVENOTIFY)" == "y" ]]; then - _enable=1 - fi + _enable=1 fi export_macro_mk CONFIG_HSA_AMD_P2P ${_enable}