Skip to contentSkip to conversation

drm/amdgpu: add option param of specify vmhub to set reserved vmid.

PATCH New Chong Li 1 participant 1 message May 17, 2023

Subsystems (2)
lore
Share & tools
lore

Chong Li

author
#0 lore raw

PATCH 1/1 drm/amdgpu: add option param of specify vmhub to set reserved vmid.

Using reserved vmid for the specify vmhub.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 9 +++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c  | 4 ++++
 3 files changed, 14 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index ce196badf42d..062381d542dc 100644
@@ -174,6 +174,7 @@ extern int amdgpu_vm_fragment_size;
 extern int amdgpu_vm_fault_stop;
 extern int amdgpu_vm_debug;
 extern int amdgpu_vm_update_mode;
+extern int amdgpu_vmhub_reserve_vmid;
 extern int amdgpu_exp_hw_support;
 extern int amdgpu_dc;
 extern int amdgpu_sched_jobs;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +9 -0
index 3d91e123f9bd..66f0139b4d33 100644
@@ -973,6 +973,15 @@ MODULE_PARM_DESC(
 						4 = AMDGPU_CPX_PARTITION_MODE)");
 module_param_named(user_partt_mode, amdgpu_user_partt_mode, uint, 0444);
 
+
+/**
+ * DOC: amdgpu_vmhub_reserve_vmid (int)
+ * using reserved vmid for the specify vmhub.
+ */
+int amdgpu_vmhub_reserve_vmid = -1;
+module_param(amdgpu_vmhub_reserve_vmid, int, 0444);
+MODULE_PARM_DESC(amdgpu_vmhub_reserve_vmid, "specify vmhub ((0, AMDGPU_MAX_VMHUBS - 1)) = On, -1 = Off (Default))");
+
 /* These devices are not supported by amdgpu.
  * They are supported by the mach64, r128, radeon drivers
  */
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +4 -0
index ea3d0be152fc..3dcbae201ed2 100644
@@ -2114,6 +2114,10 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)
 	vm->va = RB_ROOT_CACHED;
 	for (i = 0; i < AMDGPU_MAX_VMHUBS; i++)
 		vm->reserved_vmid[i] = NULL;
+
+	if (amdgpu_vmhub_reserve_vmid >= 0 && amdgpu_vmhub_reserve_vmid < AMDGPU_MAX_VMHUBS)
+		amdgpu_vmid_alloc_reserved(adev, vm, amdgpu_vmhub_reserve_vmid);
+
 	INIT_LIST_HEAD(&vm->evicted);
 	INIT_LIST_HEAD(&vm->relocated);
 	INIT_LIST_HEAD(&vm->moved);
Signature · 1 line
2.34.1