diff options
| author | Maxime Ripard <maxime@cerno.tech> | 2022-04-05 11:06:58 +0200 | 
|---|---|---|
| committer | Maxime Ripard <maxime@cerno.tech> | 2022-04-05 11:06:58 +0200 | 
| commit | 9cbbd694a58bdf24def2462276514c90cab7cf80 (patch) | |
| tree | 98a504890134d34631a6a0ecbce94d3f1ecc21fc /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |
| parent | 71d637823cac7748079a912e0373476c7cf6f985 (diff) | |
| parent | 3123109284176b1532874591f7c81f3837bbdc17 (diff) | |
Merge drm/drm-next into drm-misc-next
Let's start the 5.19 development cycle.
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 22 | 
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 28f5e8b21a99..5d11978c162e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -375,6 +375,8 @@ static void amdgpu_vm_bo_base_init(struct amdgpu_vm_bo_base *base,  	if (bo->tbo.base.resv != vm->root.bo->tbo.base.resv)  		return; +	dma_resv_assert_held(vm->root.bo->tbo.base.resv); +  	ttm_bo_set_bulk_move(&bo->tbo, &vm->lru_bulk_move);  	if (bo->tbo.type == ttm_bo_type_kernel && bo->parent)  		amdgpu_vm_bo_relocated(base); @@ -710,11 +712,17 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm,   * Check if all VM PDs/PTs are ready for updates   *   * Returns: - * True if eviction list is empty. + * True if VM is not evicting.   */  bool amdgpu_vm_ready(struct amdgpu_vm *vm)  { -	return list_empty(&vm->evicted); +	bool ret; + +	amdgpu_vm_eviction_lock(vm); +	ret = !vm->evicting; +	amdgpu_vm_eviction_unlock(vm); + +	return ret && list_empty(&vm->evicted);  }  /** @@ -1580,7 +1588,7 @@ static int amdgpu_vm_update_ptes(struct amdgpu_vm_update_params *params,  			nptes = max(nptes, 1u);  			trace_amdgpu_vm_update_ptes(params, frag_start, upd_end, -						    nptes, dst, incr, upd_flags, +						    min(nptes, 32u), dst, incr, upd_flags,  						    vm->task_info.pid,  						    vm->immediate.fence_context);  			amdgpu_vm_update_flags(params, to_amdgpu_bo_vm(pt), @@ -2203,6 +2211,7 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev,  	if (!bo)  		return bo_va; +	dma_resv_assert_held(bo->tbo.base.resv);  	if (amdgpu_dmabuf_is_xgmi_accessible(adev, bo)) {  		bo_va->is_xgmi = true;  		/* Power up XGMI if it can be potentially used */ @@ -2580,7 +2589,7 @@ void amdgpu_vm_bo_trace_cs(struct amdgpu_vm *vm, struct ww_acquire_ctx *ticket)  }  /** - * amdgpu_vm_bo_rmv - remove a bo to a specific vm + * amdgpu_vm_bo_del - remove a bo from a specific vm   *   * @adev: amdgpu_device pointer   * @bo_va: requested bo_va @@ -2589,7 +2598,7 @@ void amdgpu_vm_bo_trace_cs(struct amdgpu_vm *vm, struct ww_acquire_ctx *ticket)   *   * Object have to be reserved!   */ -void amdgpu_vm_bo_rmv(struct amdgpu_device *adev, +void amdgpu_vm_bo_del(struct amdgpu_device *adev,  		      struct amdgpu_bo_va *bo_va)  {  	struct amdgpu_bo_va_mapping *mapping, *next; @@ -2597,7 +2606,10 @@ void amdgpu_vm_bo_rmv(struct amdgpu_device *adev,  	struct amdgpu_vm *vm = bo_va->base.vm;  	struct amdgpu_vm_bo_base **base; +	dma_resv_assert_held(vm->root.bo->tbo.base.resv); +  	if (bo) { +		dma_resv_assert_held(bo->tbo.base.resv);  		if (bo->tbo.base.resv == vm->root.bo->tbo.base.resv)  			ttm_bo_set_bulk_move(&bo->tbo, NULL);  | 
