[PATCH 2/5] drm/amdgpu: initialize vm->is_compute_context properly

Nirmoy Das nirmoy.das at amd.com
Thu Apr 22 12:35:42 UTC 2021


Fix vm->is_compute_context initialization in amdgpu_vm_init().

Signed-off-by: Nirmoy Das <nirmoy.das at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index f95bcda8463f..6f0a6011cb3d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -2815,9 +2815,9 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 		goto error_free_immediate;
 
 	vm->pte_support_ats = false;
-	vm->is_compute_context = false;
+	vm->is_compute_context = vm_context == AMDGPU_VM_CONTEXT_COMPUTE;
 
-	if (vm_context == AMDGPU_VM_CONTEXT_COMPUTE) {
+	if (vm->is_compute_context) {
 		vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode &
 						AMDGPU_VM_USE_CPU_FOR_COMPUTE);
 
@@ -2844,7 +2844,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 	vm->evicting = false;
 
 	amdgpu_vm_bo_param(adev, vm, adev->vm_manager.root_level, false, &bp);
-	if (vm_context == AMDGPU_VM_CONTEXT_COMPUTE)
+	if (vm->is_compute_context)
 		bp.flags &= ~AMDGPU_GEM_CREATE_SHADOW;
 	r = amdgpu_bo_create(adev, &bp, &root);
 	if (r)
-- 
2.31.1



More information about the amd-gfx mailing list