Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5f6b5b1 authored by Christian König's avatar Christian König Committed by Alex Deucher
Browse files

drm/amdgpu: add support for BO_VAs without BO v2



For PRT support we need mappings which aren't backed by any memory.

v2: fix parameter checking

Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarNicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent e4f0fdcc
Loading
Loading
Loading
Loading
+14 −6
Original line number Original line Diff line number Diff line
@@ -1117,7 +1117,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
	struct dma_fence *exclusive;
	struct dma_fence *exclusive;
	int r;
	int r;


	if (clear) {
	if (clear || !bo_va->bo) {
		mem = NULL;
		mem = NULL;
		nodes = NULL;
		nodes = NULL;
		exclusive = NULL;
		exclusive = NULL;
@@ -1134,9 +1134,15 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
		exclusive = reservation_object_get_excl(bo_va->bo->tbo.resv);
		exclusive = reservation_object_get_excl(bo_va->bo->tbo.resv);
	}
	}


	if (bo_va->bo) {
		flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem);
		flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem);
		gtt_flags = (amdgpu_ttm_is_bound(bo_va->bo->tbo.ttm) &&
		gtt_flags = (amdgpu_ttm_is_bound(bo_va->bo->tbo.ttm) &&
		adev == amdgpu_ttm_adev(bo_va->bo->tbo.bdev)) ? flags : 0;
			adev == amdgpu_ttm_adev(bo_va->bo->tbo.bdev)) ?
			flags : 0;
	} else {
		flags = 0x0;
		gtt_flags = ~0x0;
	}


	spin_lock(&vm->status_lock);
	spin_lock(&vm->status_lock);
	if (!list_empty(&bo_va->vm_status))
	if (!list_empty(&bo_va->vm_status))
@@ -1271,6 +1277,7 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev,
	INIT_LIST_HEAD(&bo_va->invalids);
	INIT_LIST_HEAD(&bo_va->invalids);
	INIT_LIST_HEAD(&bo_va->vm_status);
	INIT_LIST_HEAD(&bo_va->vm_status);


	if (bo)
		list_add_tail(&bo_va->bo_list, &bo->va);
		list_add_tail(&bo_va->bo_list, &bo->va);


	return bo_va;
	return bo_va;
@@ -1309,7 +1316,8 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev,


	/* make sure object fit at this offset */
	/* make sure object fit at this offset */
	eaddr = saddr + size - 1;
	eaddr = saddr + size - 1;
	if ((saddr >= eaddr) || (offset + size > amdgpu_bo_size(bo_va->bo)))
	if (saddr >= eaddr ||
	    (bo_va->bo && offset + size > amdgpu_bo_size(bo_va->bo)))
		return -EINVAL;
		return -EINVAL;


	last_pfn = eaddr / AMDGPU_GPU_PAGE_SIZE;
	last_pfn = eaddr / AMDGPU_GPU_PAGE_SIZE;