From: "Christian König" <deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH 1/6] drm/amdgpu: add support for BO_VAs without BO v2
Date: Wed, 8 Feb 2017 16:04:04 +0100 [thread overview]
Message-ID: <1486566249-3332-2-git-send-email-deathsimple@vodafone.de> (raw)
In-Reply-To: <1486566249-3332-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
From: Christian König <christian.koenig@amd.com>
For PRT support we need mappings which aren't backed by any memory.
v2: fix parameter checking
Signed-off-by: Christian König <christian.koenig@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 8e6030d..64f04c7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1117,7 +1117,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
struct fence *exclusive;
int r;
- if (clear) {
+ if (clear || !bo_va->bo) {
mem = NULL;
nodes = 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);
}
- flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem);
- gtt_flags = (amdgpu_ttm_is_bound(bo_va->bo->tbo.ttm) &&
- adev == amdgpu_ttm_adev(bo_va->bo->tbo.bdev)) ? flags : 0;
+ if (bo_va->bo) {
+ flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem);
+ gtt_flags = (amdgpu_ttm_is_bound(bo_va->bo->tbo.ttm) &&
+ adev == amdgpu_ttm_adev(bo_va->bo->tbo.bdev)) ?
+ flags : 0;
+ } else {
+ flags = 0x0;
+ gtt_flags = ~0x0;
+ }
spin_lock(&vm->status_lock);
if (!list_empty(&bo_va->vm_status))
@@ -1271,7 +1277,8 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev,
INIT_LIST_HEAD(&bo_va->invalids);
INIT_LIST_HEAD(&bo_va->vm_status);
- list_add_tail(&bo_va->bo_list, &bo->va);
+ if (bo)
+ list_add_tail(&bo_va->bo_list, &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 */
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;
last_pfn = eaddr / AMDGPU_GPU_PAGE_SIZE;
--
2.5.0
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2017-02-08 15:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-08 15:04 PRT support for amdgpu v3 Christian König
[not found] ` <1486566249-3332-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-02-08 15:04 ` Christian König [this message]
2017-02-08 15:04 ` [PATCH 2/6] drm/amdgpu: add basic PRT support Christian König
2017-02-08 15:04 ` [PATCH 3/6] drm/amdgpu: IOCTL interface for PRT support v4 Christian König
[not found] ` <1486566249-3332-4-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-02-10 10:12 ` Nicolai Hähnle
2017-02-08 15:04 ` [PATCH 4/6] drm/amdgpu: implement PRT for GFX6 v2 Christian König
2017-02-08 15:04 ` [PATCH 5/6] drm/amdgpu: implement PRT for GFX7 v2 Christian König
2017-02-08 15:04 ` [PATCH 6/6] drm/amdgpu: implement PRT for GFX8 v2 Christian König
2017-02-09 10:11 ` PRT support for amdgpu v3 Nicolai Hähnle
[not found] ` <31495c1d-fb51-981a-aa33-aae22871bfe0-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-09 15:55 ` Christian König
2017-02-09 19:45 ` Bas Nieuwenhuizen
2017-02-12 11:36 ` Nicolai Hähnle
[not found] ` <154d4061-82c0-a662-c361-14beceb5364b-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-13 14:13 ` Christian König
-- strict thread matches above, loose matches on Subject: below --
2017-02-02 10:25 PRT support for amdgpu v2 Christian König
[not found] ` <1486031118-1688-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-02-02 10:25 ` [PATCH 1/6] drm/amdgpu: add support for BO_VAs without BO v2 Christian König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1486566249-3332-2-git-send-email-deathsimple@vodafone.de \
--to=deathsimple-antagkrnahcb1svskn2v4q@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.