Commit 2847a67d authored by Christian König's avatar Christian König
Browse files

drm/ttm: revert "prevent moving of pinned BOs"

parent fc64adc5
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -466,7 +466,11 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,
			return r;
	}

	/* Can't move a pinned BO */
	abo = ttm_to_amdgpu_bo(bo);
	if (WARN_ON_ONCE(abo->tbo.pin_count > 0))
		return -EINVAL;

	adev = amdgpu_ttm_adev(bo->bdev);

	if (!old_mem || (old_mem->mem_type == TTM_PL_SYSTEM &&
+3 −0
Original line number Diff line number Diff line
@@ -1015,6 +1015,9 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,
	if (ret)
		goto out_ntfy;

	if (nvbo->bo.pin_count)
		NV_WARN(drm, "Moving pinned object %p!\n", nvbo);

	if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA) {
		ret = nouveau_bo_vm_bind(bo, new_reg, &new_tile);
		if (ret)
+4 −0
Original line number Diff line number Diff line
@@ -211,7 +211,11 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict,
	if (r)
		return r;

	/* Can't move a pinned BO */
	rbo = container_of(bo, struct radeon_bo, tbo);
	if (WARN_ON_ONCE(rbo->tbo.pin_count > 0))
		return -EINVAL;

	rdev = radeon_get_rdev(bo->bdev);
	if (old_mem->mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) {
		ttm_bo_move_null(bo, new_mem);
+8 −12
Original line number Diff line number Diff line
@@ -894,18 +894,14 @@ int ttm_bo_validate(struct ttm_buffer_object *bo,
	if (!placement->num_placement && !placement->num_busy_placement)
		return ttm_bo_pipeline_gutting(bo);

	/* Check whether we need to move buffer. */
	if (bo->resource && ttm_resource_compat(bo->resource, placement))
		return 0;

	/* Moving of pinned BOs is forbidden */
	if (bo->pin_count)
		return -EINVAL;

	/*
	 * Check whether we need to move buffer.
	 */
	if (!bo->resource || !ttm_resource_compat(bo->resource, placement)) {
		ret = ttm_bo_move_buffer(bo, placement, ctx);
		if (ret)
			return ret;

	}
	/*
	 * We might need to add a TTM.
	 */
+1 −0
Original line number Diff line number Diff line
@@ -361,6 +361,7 @@ bool ttm_resource_compat(struct ttm_resource *res,

	return false;
}
EXPORT_SYMBOL(ttm_resource_compat);

void ttm_resource_set_bo(struct ttm_resource *res,
			 struct ttm_buffer_object *bo)
Loading