Skip to contentSkip to conversation

drm/amdgpu: Add use_xgmi_p2p module parameter

PATCH In review Alex Sierra 3 participants 7 messages Feb 18, 2022 – Feb 24, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Add use_xgmi_p2p module parameter

This parameter controls xGMI p2p communication, which is enabled by default. However, it can be disabled by setting it to 0. In case xGMI p2p is disabled in a dGPU, PCIe p2p interface will be used instead. This parameter is ignored in GPUs that do not support xGMI p2p configuration.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 ++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c  | 4 ++--
 3 files changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index f97848a0ed14..7e95d8bd2338 100644
@@ -217,6 +217,7 @@ extern int amdgpu_mes;
 extern int amdgpu_noretry;
 extern int amdgpu_force_asic_type;
 extern int amdgpu_smartshift_bias;
+extern int amdgpu_use_xgmi_p2p;
 #ifdef CONFIG_HSA_AMD
 extern int sched_policy;
 extern bool debug_evictions;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +8 -0
index 2f8eafb6cf22..6156265f3178 100644
@@ -181,6 +181,7 @@ int amdgpu_tmz = -1; /* auto */
 int amdgpu_reset_method = -1; /* auto */
 int amdgpu_num_kcq = -1;
 int amdgpu_smartshift_bias;
+int amdgpu_use_xgmi_p2p = -1;
 
 static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work);
 
@@ -677,6 +678,13 @@ MODULE_PARM_DESC(force_asic_type,
 	"A non negative value used to specify the asic type for all supported GPUs");
 module_param_named(force_asic_type, amdgpu_force_asic_type, int, 0444);
 
+/**
+ * DOC: use_xgmi_p2p (int)
+ * Enables/disables XGMI P2P interface (0 = disable, 1 = enable). The Default is -1 (enabled).
+ */
+MODULE_PARM_DESC(use_xgmi_p2p,
+	"Disable XGMI P2P interface (0 = disable; 1 = enable; -1 default, enabled)");
+module_param_named(use_xgmi_p2p, amdgpu_use_xgmi_p2p, int, 0444);
 
 
 #ifdef CONFIG_HSA_AMD
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -2
index 207cd01435b5..bbe1bac61f15 100644
@@ -2330,8 +2330,8 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev,
 #else
 	dma_resv_assert_held(amdkcl_ttm_resvp(&vm->root.bo->tbo));
 #endif
-
-	if (amdgpu_dmabuf_is_xgmi_accessible(adev, bo)) {
+	if (amdgpu_use_xgmi_p2p &&
+	    amdgpu_dmabuf_is_xgmi_accessible(adev, bo)) {
 		bo_va->is_xgmi = true;
 		/* Power up XGMI if it can be potentially used */
 		amdgpu_xgmi_set_pstate(adev, AMDGPU_XGMI_PSTATE_MAX_VEGA20);
Signature · 1 line
2.32.0
#1 lore raw

Am 2022-02-18 um 11:53 schrieb Alex Sierra:

Quoted 58 lines

This parameter controls xGMI p2p communication, which is enabled by default. However, it can be disabled by setting it to 0. In case xGMI p2p is disabled in a dGPU, PCIe p2p interface will be used instead. This parameter is ignored in GPUs that do not support xGMI p2p configuration.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 1 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 ++++++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c  | 4 ++--
  3 files changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index f97848a0ed14..7e95d8bd2338 100644
@@ -217,6 +217,7 @@ extern int amdgpu_mes;
  extern int amdgpu_noretry;
  extern int amdgpu_force_asic_type;
  extern int amdgpu_smartshift_bias;
+extern int amdgpu_use_xgmi_p2p;
  #ifdef CONFIG_HSA_AMD
  extern int sched_policy;
  extern bool debug_evictions;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +8 -0
index 2f8eafb6cf22..6156265f3178 100644
@@ -181,6 +181,7 @@ int amdgpu_tmz = -1; /* auto */
  int amdgpu_reset_method = -1; /* auto */
  int amdgpu_num_kcq = -1;
  int amdgpu_smartshift_bias;
+int amdgpu_use_xgmi_p2p = -1;
 
  static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work);
 
@@ -677,6 +678,13 @@ MODULE_PARM_DESC(force_asic_type,
  	"A non negative value used to specify the asic type for all supported GPUs");
  module_param_named(force_asic_type, amdgpu_force_asic_type, int, 0444);
 
+/**
+ * DOC: use_xgmi_p2p (int)
+ * Enables/disables XGMI P2P interface (0 = disable, 1 = enable). The Default is -1 (enabled).
+ */
+MODULE_PARM_DESC(use_xgmi_p2p,
+	"Disable XGMI P2P interface (0 = disable; 1 = enable; -1 default, enabled)");
+module_param_named(use_xgmi_p2p, amdgpu_use_xgmi_p2p, int, 0444);
 
 
  #ifdef CONFIG_HSA_AMD
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index 207cd01435b5..bbe1bac61f15 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev, · line 2334

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -2
@@ -2330,8 +2330,8 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev,
  #else
  	dma_resv_assert_held(amdkcl_ttm_resvp(&vm->root.bo->tbo));
  #endif
-
-	if (amdgpu_dmabuf_is_xgmi_accessible(adev, bo)) {
+	if (amdgpu_use_xgmi_p2p &&
+	    amdgpu_dmabuf_is_xgmi_accessible(adev, bo)) {

This does nothing to tell user mode that XGMI is not available. We need to update the topology information as well. For that, this check needs to be applied at a lower level. I think amdgpu_xgmi_same_hive would be the right place. If amdgpu_use_xgmi_p2p is set, amdgpu_xgmi_same_hive should return false.

Regards,
  Felix

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
  		bo_va->is_xgmi = true;
  		/* Power up XGMI if it can be potentially used */
  		amdgpu_xgmi_set_pstate(adev, AMDGPU_XGMI_PSTATE_MAX_VEGA20);
#2 lore raw

PATCH 1/1 drm/amdgpu: Add use_xgmi_p2p module parameter

In reply to Alex Sierra

This parameter controls xGMI p2p communication, which is enabled by default. However, it can be disabled by setting it to 0. In case xGMI p2p is disabled in a dGPU, PCIe p2p interface will be used instead. This parameter is ignored in GPUs that do not support xGMI p2p configuration.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h      | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  | 8 ++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h | 3 ++-
 3 files changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index f97848a0ed14..7e95d8bd2338 100644
@@ -217,6 +217,7 @@ extern int amdgpu_mes;
 extern int amdgpu_noretry;
 extern int amdgpu_force_asic_type;
 extern int amdgpu_smartshift_bias;
+extern int amdgpu_use_xgmi_p2p;
 #ifdef CONFIG_HSA_AMD
 extern int sched_policy;
 extern bool debug_evictions;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +8 -0
index 2f8eafb6cf22..6156265f3178 100644
@@ -181,6 +181,7 @@ int amdgpu_tmz = -1; /* auto */
 int amdgpu_reset_method = -1; /* auto */
 int amdgpu_num_kcq = -1;
 int amdgpu_smartshift_bias;
+int amdgpu_use_xgmi_p2p = -1;
 
 static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work);
 
@@ -677,6 +678,13 @@ MODULE_PARM_DESC(force_asic_type,
 	"A non negative value used to specify the asic type for all supported GPUs");
 module_param_named(force_asic_type, amdgpu_force_asic_type, int, 0444);
 
+/**
+ * DOC: use_xgmi_p2p (int)
+ * Enables/disables XGMI P2P interface (0 = disable, 1 = enable). The Default is -1 (enabled).
+ */
+MODULE_PARM_DESC(use_xgmi_p2p,
+	"Disable XGMI P2P interface (0 = disable; 1 = enable; -1 default, enabled)");
+module_param_named(use_xgmi_p2p, amdgpu_use_xgmi_p2p, int, 0444);
 
 
 #ifdef CONFIG_HSA_AMD
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +2 -1
index 0afca51c3c0c..095921851fb5 100644
@@ -66,7 +66,8 @@ uint64_t amdgpu_xgmi_get_relative_phy_addr(struct amdgpu_device *adev,
 static inline bool amdgpu_xgmi_same_hive(struct amdgpu_device *adev,
 		struct amdgpu_device *bo_adev)
 {
-	return (adev != bo_adev &&
+	return (amdgpu_use_xgmi_p2p &&
+		adev != bo_adev &&
 		adev->gmc.xgmi.hive_id &&
 		adev->gmc.xgmi.hive_id == bo_adev->gmc.xgmi.hive_id);
 }
Signature · 1 line
2.32.0
Reviewed-by on v1 1/1
#3 lore raw
Quoted 32 lines · Alex Sierra

This parameter controls xGMI p2p communication, which is enabled by default. However, it can be disabled by setting it to 0. In case xGMI p2p is disabled in a dGPU, PCIe p2p interface will be used instead. This parameter is ignored in GPUs that do not support xGMI p2p configuration.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h      | 1 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  | 8 ++++++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h | 3 ++-
  3 files changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index f97848a0ed14..7e95d8bd2338 100644
@@ -217,6 +217,7 @@ extern int amdgpu_mes;
  extern int amdgpu_noretry;
  extern int amdgpu_force_asic_type;
  extern int amdgpu_smartshift_bias;
+extern int amdgpu_use_xgmi_p2p;
  #ifdef CONFIG_HSA_AMD
  extern int sched_policy;
  extern bool debug_evictions;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
index 2f8eafb6cf22..6156265f3178 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c int amdgpu_tmz = -1; /* auto */ · line 184

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -0
@@ -181,6 +181,7 @@ int amdgpu_tmz = -1; /* auto */
  int amdgpu_reset_method = -1; /* auto */
  int amdgpu_num_kcq = -1;
  int amdgpu_smartshift_bias;
+int amdgpu_use_xgmi_p2p = -1;

We usually use 1- as default if some logic is needed to figure out the actual default value. I don't think that's applicable for this option. Why not make the default 1?

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c MODULE_PARM_DESC(force_asic_type, · line 683

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -0
  static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work);
 
@@ -677,6 +678,13 @@ MODULE_PARM_DESC(force_asic_type,
  	"A non negative value used to specify the asic type for all supported GPUs");
  module_param_named(force_asic_type, amdgpu_force_asic_type, int, 0444);
 
+/**
+ * DOC: use_xgmi_p2p (int)
+ * Enables/disables XGMI P2P interface (0 = disable, 1 = enable). The Default is -1 (enabled).

Same as above.

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c MODULE_PARM_DESC(force_asic_type, · line 686

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -0
+ */
+MODULE_PARM_DESC(use_xgmi_p2p,
+	"Disable XGMI P2P interface (0 = disable; 1 = enable; -1 default, enabled)");

Same as above.

With that fixed, the patch is

Quoted 18 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -0
+module_param_named(use_xgmi_p2p, amdgpu_use_xgmi_p2p, int, 0444);
 
 
  #ifdef CONFIG_HSA_AMD
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +2 -1
index 0afca51c3c0c..095921851fb5 100644
@@ -66,7 +66,8 @@ uint64_t amdgpu_xgmi_get_relative_phy_addr(struct amdgpu_device *adev,
  static inline bool amdgpu_xgmi_same_hive(struct amdgpu_device *adev,
  		struct amdgpu_device *bo_adev)
  {
-	return (adev != bo_adev &&
+	return (amdgpu_use_xgmi_p2p &&
+		adev != bo_adev &&
  		adev->gmc.xgmi.hive_id &&
  		adev->gmc.xgmi.hive_id == bo_adev->gmc.xgmi.hive_id);
  }
#4 lore raw
Quoted 34 lines · Felix Kuehling
Quoted 32 lines · Alex Sierra

This parameter controls xGMI p2p communication, which is enabled by default. However, it can be disabled by setting it to 0. In case xGMI p2p is disabled in a dGPU, PCIe p2p interface will be used instead. This parameter is ignored in GPUs that do not support xGMI p2p configuration.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h      | 1 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  | 8 ++++++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h | 3 ++-
  3 files changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index f97848a0ed14..7e95d8bd2338 100644
@@ -217,6 +217,7 @@ extern int amdgpu_mes;
  extern int amdgpu_noretry;
  extern int amdgpu_force_asic_type;
  extern int amdgpu_smartshift_bias;
+extern int amdgpu_use_xgmi_p2p;
  #ifdef CONFIG_HSA_AMD
  extern int sched_policy;
  extern bool debug_evictions;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
index 2f8eafb6cf22..6156265f3178 100644
@@ -181,6 +181,7 @@ int amdgpu_tmz = -1; /* auto */
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c int amdgpu_tmz = -1; /* auto */ · line 184

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -0
  int amdgpu_reset_method = -1; /* auto */
  int amdgpu_num_kcq = -1;
  int amdgpu_smartshift_bias;
+int amdgpu_use_xgmi_p2p = -1;

We usually use 1- as default if some logic is needed to figure out the actual default value. I don't think that's applicable for this option. Why not make the default 1?

If we want to make -1 the default we should document it as "auto" so we can allow for different configurations in different situations. That said, I don't really see a case where we would want to disable xgmi by default unless there was some hardware limitation, and at that point, we could just change the default to -1.

Alex

Quoted 45 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c MODULE_PARM_DESC(force_asic_type, · line 683

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -0
  static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work);
 
@@ -677,6 +678,13 @@ MODULE_PARM_DESC(force_asic_type,
      "A non negative value used to specify the asic type for all supported GPUs");
  module_param_named(force_asic_type, amdgpu_force_asic_type, int, 0444);
 
+/**
+ * DOC: use_xgmi_p2p (int)
+ * Enables/disables XGMI P2P interface (0 = disable, 1 = enable). The Default is -1 (enabled).

Same as above.

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c MODULE_PARM_DESC(force_asic_type, · line 686

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -0
+ */
+MODULE_PARM_DESC(use_xgmi_p2p,
+     "Disable XGMI P2P interface (0 = disable; 1 = enable; -1 default, enabled)");

Same as above.

With that fixed, the patch is

Quoted 18 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -0
+module_param_named(use_xgmi_p2p, amdgpu_use_xgmi_p2p, int, 0444);
 
 
  #ifdef CONFIG_HSA_AMD
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +2 -1
index 0afca51c3c0c..095921851fb5 100644
@@ -66,7 +66,8 @@ uint64_t amdgpu_xgmi_get_relative_phy_addr(struct amdgpu_device *adev,
  static inline bool amdgpu_xgmi_same_hive(struct amdgpu_device *adev,
              struct amdgpu_device *bo_adev)
  {
-     return (adev != bo_adev &&
+     return (amdgpu_use_xgmi_p2p &&
+             adev != bo_adev &&
              adev->gmc.xgmi.hive_id &&
              adev->gmc.xgmi.hive_id == bo_adev->gmc.xgmi.hive_id);
  }
#5 lore raw

PATCH 1/1 drm/amdgpu: Add use_xgmi_p2p module parameter

In reply to Felix Kuehling

This parameter controls xGMI p2p communication, which is enabled by default. However, it can be disabled by setting it to 0. In case xGMI p2p is disabled in a dGPU, PCIe p2p interface will be used instead. This parameter is ignored in GPUs that do not support xGMI p2p configuration.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h      | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  | 8 ++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h | 3 ++-
 3 files changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index f97848a0ed14..7e95d8bd2338 100644
@@ -217,6 +217,7 @@ extern int amdgpu_mes;
 extern int amdgpu_noretry;
 extern int amdgpu_force_asic_type;
 extern int amdgpu_smartshift_bias;
+extern int amdgpu_use_xgmi_p2p;
 #ifdef CONFIG_HSA_AMD
 extern int sched_policy;
 extern bool debug_evictions;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +8 -0
index 2f8eafb6cf22..2849972fd910 100644
@@ -181,6 +181,7 @@ int amdgpu_tmz = -1; /* auto */
 int amdgpu_reset_method = -1; /* auto */
 int amdgpu_num_kcq = -1;
 int amdgpu_smartshift_bias;
+int amdgpu_use_xgmi_p2p = 1;
 
 static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work);
 
@@ -677,6 +678,13 @@ MODULE_PARM_DESC(force_asic_type,
 	"A non negative value used to specify the asic type for all supported GPUs");
 module_param_named(force_asic_type, amdgpu_force_asic_type, int, 0444);
 
+/**
+ * DOC: use_xgmi_p2p (int)
+ * Enables/disables XGMI P2P interface (0 = disable, 1 = enable). The Default is 1 (enabled).
+ */
+MODULE_PARM_DESC(use_xgmi_p2p,
+	"Disable XGMI P2P interface (0 = disable; 1 = enable)");
+module_param_named(use_xgmi_p2p, amdgpu_use_xgmi_p2p, int, 0444);
 
 
 #ifdef CONFIG_HSA_AMD
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +2 -1
index 0afca51c3c0c..095921851fb5 100644
@@ -66,7 +66,8 @@ uint64_t amdgpu_xgmi_get_relative_phy_addr(struct amdgpu_device *adev,
 static inline bool amdgpu_xgmi_same_hive(struct amdgpu_device *adev,
 		struct amdgpu_device *bo_adev)
 {
-	return (adev != bo_adev &&
+	return (amdgpu_use_xgmi_p2p &&
+		adev != bo_adev &&
 		adev->gmc.xgmi.hive_id &&
 		adev->gmc.xgmi.hive_id == bo_adev->gmc.xgmi.hive_id);
 }
Signature · 1 line
2.32.0
Reviewed-by on v1 1/1
#6 lore raw

Am 2022-02-23 um 19:54 schrieb Alex Sierra:

Quoted 40 lines

This parameter controls xGMI p2p communication, which is enabled by default. However, it can be disabled by setting it to 0. In case xGMI p2p is disabled in a dGPU, PCIe p2p interface will be used instead. This parameter is ignored in GPUs that do not support xGMI p2p configuration.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h      | 1 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  | 8 ++++++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h | 3 ++-
  3 files changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index f97848a0ed14..7e95d8bd2338 100644
@@ -217,6 +217,7 @@ extern int amdgpu_mes;
  extern int amdgpu_noretry;
  extern int amdgpu_force_asic_type;
  extern int amdgpu_smartshift_bias;
+extern int amdgpu_use_xgmi_p2p;
  #ifdef CONFIG_HSA_AMD
  extern int sched_policy;
  extern bool debug_evictions;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -0
index 2f8eafb6cf22..2849972fd910 100644
@@ -181,6 +181,7 @@ int amdgpu_tmz = -1; /* auto */
  int amdgpu_reset_method = -1; /* auto */
  int amdgpu_num_kcq = -1;
  int amdgpu_smartshift_bias;
+int amdgpu_use_xgmi_p2p = 1;
 
  static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work);
 

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c MODULE_PARM_DESC(force_asic_type, · line 686

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +6 -0
@@ -677,6 +678,13 @@ MODULE_PARM_DESC(force_asic_type,
  	"A non negative value used to specify the asic type for all supported GPUs");
  module_param_named(force_asic_type, amdgpu_force_asic_type, int, 0444);
 
+/**
+ * DOC: use_xgmi_p2p (int)
+ * Enables/disables XGMI P2P interface (0 = disable, 1 = enable). The Default is 1 (enabled).
+ */
+MODULE_PARM_DESC(use_xgmi_p2p,
+	"Disable XGMI P2P interface (0 = disable; 1 = enable)");

The documentation of the option is misleading ("Disable XGMI ...") because the option actually ENables XGMI P2P. Also document the default here as well. Usually I see it like this in other options:

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c MODULE_PARM_DESC(force_asic_type, · line 687

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -0
+    "Enable XGMI P2P interface (0 = disable; 1 = enable (default))");

With that fixed, the patch is

Quoted 18 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -0
+module_param_named(use_xgmi_p2p, amdgpu_use_xgmi_p2p, int, 0444);
 
 
  #ifdef CONFIG_HSA_AMD
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +2 -1
index 0afca51c3c0c..095921851fb5 100644
@@ -66,7 +66,8 @@ uint64_t amdgpu_xgmi_get_relative_phy_addr(struct amdgpu_device *adev,
  static inline bool amdgpu_xgmi_same_hive(struct amdgpu_device *adev,
  		struct amdgpu_device *bo_adev)
  {
-	return (adev != bo_adev &&
+	return (amdgpu_use_xgmi_p2p &&
+		adev != bo_adev &&
  		adev->gmc.xgmi.hive_id &&
  		adev->gmc.xgmi.hive_id == bo_adev->gmc.xgmi.hive_id);
  }