From: "Nicolai Hähnle" <nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: "Christian König"
<deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>,
bas-dldO88ZXqoXqqjsSq9zF6IRWq/SkRNHw@public.gmane.org,
airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 1/6] drm/amdgpu: add support for BO_VAs without BO
Date: Mon, 30 Jan 2017 15:43:21 +0100 [thread overview]
Message-ID: <51ab062e-733b-bde8-ed41-c14fda72519a@gmail.com> (raw)
In-Reply-To: <1485781060-1910-2-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
On 30.01.2017 13:57, Christian König wrote:
> From: Christian König <christian.koenig@amd.com>
>
> For PRT support we need mappings which aren't backed by any memory.
>
> 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..87eae9b 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 (bo_va->bo && (saddr >= eaddr ||
> + (offset + size > amdgpu_bo_size(bo_va->bo))))
> return -EINVAL;
At least the saddr >= eaddr check should probably apply apply.
Come to think of it, what if offset + size wraps around? There should
probably be an explicit check for that.
Cheers,
Nicolai
>
> last_pfn = eaddr / AMDGPU_GPU_PAGE_SIZE;
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2017-01-30 14:43 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-30 12:57 PRT support for amdgpu Christian König
[not found] ` <1485781060-1910-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-01-30 12:57 ` [PATCH 1/6] drm/amdgpu: add support for BO_VAs without BO Christian König
[not found] ` <1485781060-1910-2-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-01-30 14:43 ` Nicolai Hähnle [this message]
[not found] ` <51ab062e-733b-bde8-ed41-c14fda72519a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-02 10:26 ` Christian König
[not found] ` <f3cd0c09-3d57-84e8-b7e4-6fc3dded5974-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-02-02 12:27 ` Nicolai Hähnle
2017-01-30 12:57 ` [PATCH 2/6] drm/amdgpu: add basic PRT support Christian König
2017-01-30 12:57 ` [PATCH 3/6] drm/amdgpu: IOCTL interface for PRT support v3 Christian König
2017-01-30 12:57 ` [PATCH 4/6] drm/amdgpu: implement PRT for GFX6 Christian König
[not found] ` <1485781060-1910-5-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-01-30 13:59 ` StDenis, Tom
[not found] ` <CY4PR12MB1768231152C68AFABF76535AF74B0-rpdhrqHFk06yjjPBNVDk/QdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-01-30 14:14 ` Christian König
[not found] ` <fc54cc73-6b75-59b3-f67a-9a395d749e23-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-01-30 14:15 ` StDenis, Tom
[not found] ` <CY4PR12MB1768D597CD5AA969E892F02FF74B0-rpdhrqHFk06yjjPBNVDk/QdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-01-30 14:26 ` Christian König
2017-01-30 12:57 ` [PATCH 5/6] drm/amdgpu: implement PRT for GFX7 Christian König
2017-01-30 12:57 ` [PATCH 6/6] drm/amdgpu: implement PRT for GFX8 Christian König
2017-01-30 14:55 ` PRT support for amdgpu Nicolai Hähnle
2017-01-31 13:06 ` Bas Nieuwenhuizen
[not found] ` <1485867969.839629.865389344.09B29312-2RFepEojUI2N1INw9kWLP6GC3tUn3ZHUQQ4Iyu8u01E@public.gmane.org>
2017-01-31 16:28 ` Christian König
[not found] ` <ba418c16-e2ca-ddff-4147-387e5b7a2d14-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-02-01 12:19 ` Nicolai Hähnle
2017-02-02 1:49 ` Dave Airlie
[not found] ` <CAPM=9tzUNgK5MHVBaMzVsn-z=Pn-nSBFTswUcGc+zttbYLE7FA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-02 9:18 ` Nicolai Hähnle
[not found] ` <720067e3-c786-0af0-aec6-dfd1f41db378-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-02 9:29 ` Bas Nieuwenhuizen
[not found] ` <1486027743.694234.867769672.09921E90-2RFepEojUI2N1INw9kWLP6GC3tUn3ZHUQQ4Iyu8u01E@public.gmane.org>
2017-02-02 9:33 ` Nicolai Hähnle
[not found] ` <0ace8731-3737-a88d-807c-f30d7be9070e-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-02 9:41 ` Christian König
2017-01-31 16:09 ` Alex Deucher
[not found] ` <CADnq5_P1qAznmzCaYahL0ud=HhCR+8BD3RUVEpm32nZx-STVmA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-31 16:42 ` 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=51ab062e-733b-bde8-ed41-c14fda72519a@gmail.com \
--to=nhaehnle-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=bas-dldO88ZXqoXqqjsSq9zF6IRWq/SkRNHw@public.gmane.org \
--cc=deathsimple-ANTagKRnAhcb1SvskN2V4Q@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.