[Public] This patch is, Reviewed-by: Tim Huang <tim.huang@xxxxxxx> > -----Original Message----- > From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of Yifan > Zhang > Sent: Tuesday, July 30, 2024 12:37 PM > To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx > Cc: Deucher, Alexander <Alexander.Deucher@xxxxxxx>; Zhang, Jesse(Jie) > <Jesse.Zhang@xxxxxxx>; Zhang, Yifan <Yifan1.Zhang@xxxxxxx> > Subject: [PATCH] drm/amdgpu: use CPU for page table update if SDMA is > unavailable > > avoid using SDMA if it is unavailable. > > Signed-off-by: Yifan Zhang <yifan1.zhang@xxxxxxx> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c > index a060c28f0877..bcb729094521 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c > @@ -2397,6 +2397,7 @@ void amdgpu_vm_set_task_info(struct amdgpu_vm > *vm) int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm > *vm, > int32_t xcp_id) > { > + struct amdgpu_ip_block *ip_block; > struct amdgpu_bo *root_bo; > struct amdgpu_bo_vm *root; > int r, i; > @@ -2426,6 +2427,11 @@ int amdgpu_vm_init(struct amdgpu_device *adev, > struct amdgpu_vm *vm, > vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode & > AMDGPU_VM_USE_CPU_FOR_GFX); > > + /* use CPU for page table update if SDMA is unavailable */ > + ip_block = amdgpu_device_ip_get_ip_block(adev, > AMD_IP_BLOCK_TYPE_SDMA); > + if (!ip_block || ip_block->status.valid == false) > + vm->use_cpu_for_update = true; > + > DRM_DEBUG_DRIVER("VM update mode is %s\n", > vm->use_cpu_for_update ? "CPU" : "SDMA"); > WARN_ONCE((vm->use_cpu_for_update && > -- > 2.37.3