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

Nirmoy nirmodas at amd.com
Thu Apr 22 14:17:04 UTC 2021


On 4/22/21 3:56 PM, Felix Kuehling wrote:
> Am 2021-04-22 um 8:35 a.m. schrieb Nirmoy Das:
>> 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) {
> A weak ago or so, I submitted a patch that removed the last call to
> amdgpu_vm_init with vm_context == AMDGPU_VM_CONTEXT_COMPUTE. We could
> probably clean this up now and remove the vm_context parameter and the
> AMDGPU_VM_CONTEXT* definitions. The only way to get a compute VM now is
> through amdgpu_vm_make_compute.


I was wondering about that. I will remove vm_context.


Thanks,

Nirmoy


> Regards,
>    Felix
>
>
>>   		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)


More information about the amd-gfx mailing list