amdgpu: add AMDGPU_VM_PAGE_PRT
PATCH 1/2 amdgpu: add AMDGPU_VM_PAGE_PRT
From: Nicolai Hähnle <[email protected]>
This is a new kernel interface.
--- include/drm/amdgpu_drm.h | 2 ++ 1 file changed, 2 insertions(+)
include/drm/amdgpu_drm.h +2 -0
@@ -329,6 +329,8 @@ struct drm_amdgpu_gem_op {#define AMDGPU_VM_PAGE_WRITEABLE (1 << 2)/* executable mapping, new for VI */ #define AMDGPU_VM_PAGE_EXECUTABLE (1 << 3) +/* partially resident texture */ +#define AMDGPU_VM_PAGE_PRT (1 << 4)struct drm_amdgpu_gem_va {/** GEM object handle */
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20170208123430.8853-1-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH 2/2 amdgpu: add amdgpu_bo_va_op_raw
From: Nicolai Hähnle <[email protected]>
This variant allows the caller full control over flags and size, and allows passing a NULL bo (for PRT support).
--- amdgpu/amdgpu.h | 28 ++++++++++++++++++++++++++++ amdgpu/amdgpu_bo.c | 25 ++++++++++++++++++++----- 2 files changed, 48 insertions(+), 5 deletions(-)
amdgpu/amdgpu.h +28 -0
@@ -1186,6 +1186,34 @@ int amdgpu_bo_va_op(amdgpu_bo_handle bo, uint32_t ops);/** +* VA mapping/unmapping for a buffer object or PRT region. +* +* This is not a simple drop-in extension for amdgpu_bo_va_op; instead, all +* parameters are treated "raw", i.e. size is not automatically aligned, and +* all flags must be specified explicitly. +* +* \param dev - \c [in] device handle +* \param bo - \c [in] BO handle (may be NULL) +* \param offset - \c [in] Start offset to map +* \param size - \c [in] Size to map +* \param addr - \c [in] Start virtual address. +* \param flags - \c [in] Supported flags for mapping/unmapping +* \param ops - \c [in] AMDGPU_VA_OP_MAP or AMDGPU_VA_OP_UNMAP +* +* \return 0 on success\n +* <0 - Negative POSIX Error code +* +*/ + +int amdgpu_bo_va_op_raw (amdgpu_device_handle dev, +amdgpu_bo_handle bo, +uint64_t offset, +uint64_t size, +uint64_t addr, +uint64_t flags, +uint32_t ops); + +/** * create semaphore * * \param sem - \c [out] semaphore handle
amdgpu/amdgpu_bo.c +20 -5
@@ -683,6 +683,23 @@ int amdgpu_bo_va_op(amdgpu_bo_handle bo, uint32_t ops) {amdgpu_device_handle dev = bo->dev; + + size =ALIGN (size,getpagesize ()); + +return amdgpu_bo_va_op_raw (dev, bo, offset, size, addr, +AMDGPU_VM_PAGE_READABLE | +AMDGPU_VM_PAGE_WRITEABLE | +AMDGPU_VM_PAGE_EXECUTABLE , ops); +} + +int amdgpu_bo_va_op_raw (amdgpu_device_handle dev, +amdgpu_bo_handle bo, +uint64_t offset, +uint64_t size, +uint64_t addr, +uint64_t flags, +uint32_t ops) +{struct drm_amdgpu_gem_va va;int r;
@@ -690,14 +707,12 @@ int amdgpu_bo_va_op(amdgpu_bo_handle bo,return -EINVAL ;memset (&va,0 ,sizeof (va)); - va.handle = bo->handle; + va.handle = bo ? bo->handle :0 ; va.operation = ops; - va.flags =AMDGPU_VM_PAGE_READABLE | -AMDGPU_VM_PAGE_WRITEABLE | -AMDGPU_VM_PAGE_EXECUTABLE ; + va.flags = flags; va.va_address = addr; va.offset_in_bo = offset; - va.map_size =ALIGN (size,getpagesize ()); + va.map_size = size; r =drmCommandWriteRead (dev->fd,DRM_AMDGPU_GEM_VA , &va,sizeof (va));
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20170208123430.8853-2-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Christian König
Reviewed-byRe: [PATCH libdrm 2/2] amdgpu: add amdgpu_bo_va_op_raw
Am 08.02.2017 um 13:34 schrieb Nicolai Hähnle:
Quoted 9 lines
From: Nicolai Hähnle <[email protected]>
This variant allows the caller full control over flags and size, and allows passing a NULL bo (for PRT support).
Cc Christian König <[email protected]>Cc Bas Nieuwenhuizen <[email protected]>Cc Jerry Zhang <[email protected]>Signed-off-by Nicolai Hähnle <[email protected]>
You have a perfect timing, just wanted to ask if anybody has already done the unit test or if I should tackle it?
Regards,
Christian.
Quoted 80 lines
--- amdgpu/amdgpu.h | 28 ++++++++++++++++++++++++++++ amdgpu/amdgpu_bo.c | 25 ++++++++++++++++++++----- 2 files changed, 48 insertions(+), 5 deletions(-)amdgpu/amdgpu.h +28
-0@@ -1186,6 +1186,34 @@ int amdgpu_bo_va_op(amdgpu_bo_handle bo, uint32_t ops);/** +* VA mapping/unmapping for a buffer object or PRT region. +* +* This is not a simple drop-in extension for amdgpu_bo_va_op; instead, all +* parameters are treated "raw", i.e. size is not automatically aligned, and +* all flags must be specified explicitly. +* +* \param dev - \c [in] device handle +* \param bo - \c [in] BO handle (may be NULL) +* \param offset - \c [in] Start offset to map +* \param size - \c [in] Size to map +* \param addr - \c [in] Start virtual address. +* \param flags - \c [in] Supported flags for mapping/unmapping +* \param ops - \c [in] AMDGPU_VA_OP_MAP or AMDGPU_VA_OP_UNMAP +* +* \return 0 on success\n +* <0 - Negative POSIX Error code +* +*/ + +int amdgpu_bo_va_op_raw (amdgpu_device_handle dev, +amdgpu_bo_handle bo, +uint64_t offset, +uint64_t size, +uint64_t addr, +uint64_t flags, +uint32_t ops); + +/** * create semaphore * * \param sem - \c [out] semaphore handle amdgpu/amdgpu_bo.c +18
-2@@ -683,6 +683,23 @@ int amdgpu_bo_va_op(amdgpu_bo_handle bo, uint32_t ops) {amdgpu_device_handle dev = bo->dev; + + size =ALIGN (size,getpagesize ()); + +return amdgpu_bo_va_op_raw (dev, bo, offset, size, addr, +AMDGPU_VM_PAGE_READABLE | +AMDGPU_VM_PAGE_WRITEABLE | +AMDGPU_VM_PAGE_EXECUTABLE , ops); +} + +int amdgpu_bo_va_op_raw (amdgpu_device_handle dev, +amdgpu_bo_handle bo, +uint64_t offset, +uint64_t size, +uint64_t addr, +uint64_t flags, +uint32_t ops) +{struct drm_amdgpu_gem_va va;int r;@@ -690,14 +707,12 @@ int amdgpu_bo_va_op(amdgpu_bo_handle bo,return -EINVAL ;memset (&va,0 ,sizeof (va)); - va.handle = bo->handle; + va.handle = bo ? bo->handle :0 ; va.operation = ops; - va.flags = AMDGPU_VM_PAGE_READABLE |
amdgpu/amdgpu_bo.c int amdgpu_bo_va_op(amdgpu_bo_handle bo, · line 718
Quoted 10 lines
amdgpu/amdgpu_bo.c +2
-3-AMDGPU_VM_PAGE_WRITEABLE | -AMDGPU_VM_PAGE_EXECUTABLE ; + va.flags = flags; va.va_address = addr; va.offset_in_bo = offset; - va.map_size =ALIGN (size,getpagesize ()); + va.map_size = size; r =drmCommandWriteRead (dev->fd,DRM_AMDGPU_GEM_VA , &va,sizeof (va));
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 650eb732-6876-f0c6-462e-546f39469ce4-5C7GfCeVMHo@public.gmane.org
Re: [PATCH libdrm 2/2] amdgpu: add amdgpu_bo_va_op_raw
Quoted 11 lines · Christian König
Am 08.02.2017 um 13:34 schrieb Nicolai Hähnle:
Quoted 9 lines
From: Nicolai Hähnle <[email protected]>
This variant allows the caller full control over flags and size, and allows passing a NULL bo (for PRT support).
Cc Christian König <[email protected]>Cc Bas Nieuwenhuizen <[email protected]>Cc Jerry Zhang <[email protected]>Signed-off-by Nicolai Hähnle <[email protected]>
Quoted 4 lines
Reviewed-by Christian König <[email protected]>.You have a perfect timing, just wanted to ask if anybody has already done the unit test or if I should tackle it?
I actually started hacking on radeonsi support while traveling and decided to push that towards a somewhat usable state, so a series for Mesa is going out now :)
A unit test in libdrm is still a good idea, but I haven't done that.
Cheers,
Nicolai
Quoted 85 lines
Regards,
Christian.Quoted 81 lines
--- amdgpu/amdgpu.h | 28 ++++++++++++++++++++++++++++ amdgpu/amdgpu_bo.c | 25 ++++++++++++++++++++----- 2 files changed, 48 insertions(+), 5 deletions(-)amdgpu/amdgpu.h +3
-0@@ -1186,6 +1186,34 @@ int amdgpu_bo_va_op(amdgpu_bo_handle bo, uint32_t ops);/** +* VA mapping/unmapping for a buffer object or PRT region. +* +* This is not a simple drop-in extension for amdgpu_bo_va_op; instead, all
+ * parameters are treated "raw", i.e. size is not automatically aligned, and
+ * all flags must be specified explicitly.
+ *+ * \param dev - \c [in] device handle + * \param bo - \c [in] BO handle (may be NULL) + * \param offset - \c [in] Start offset to map + * \param size - \c [in] Size to map + * \param addr - \c [in] Start virtual address. + * \param flags - \c [in] Supported flags for mapping/unmapping + * \param ops - \c [in] AMDGPU_VA_OP_MAP or AMDGPU_VA_OP_UNMAP+ *
+ * \return 0 on success\n
+ * <0 - Negative POSIX Error code
+ *amdgpu/amdgpu.h +11
-0+*/ + +int amdgpu_bo_va_op_raw (amdgpu_device_handle dev, +amdgpu_bo_handle bo, +uint64_t offset, +uint64_t size, +uint64_t addr, +uint64_t flags, +uint32_t ops); + +/** * create semaphore * * \param sem - \c [out] semaphore handle amdgpu/amdgpu_bo.c +17
-0@@ -683,6 +683,23 @@ int amdgpu_bo_va_op(amdgpu_bo_handle bo, uint32_t ops) {amdgpu_device_handle dev = bo->dev; + + size =ALIGN (size,getpagesize ()); + +return amdgpu_bo_va_op_raw (dev, bo, offset, size, addr, +AMDGPU_VM_PAGE_READABLE | +AMDGPU_VM_PAGE_WRITEABLE | +AMDGPU_VM_PAGE_EXECUTABLE , ops); +} + +int amdgpu_bo_va_op_raw (amdgpu_device_handle dev, +amdgpu_bo_handle bo, +uint64_t offset, +uint64_t size, +uint64_t addr, +uint64_t flags, +uint32_t ops) +{struct drm_amdgpu_gem_va va;int r; @@ -690,14 +707,12 @@ int amdgpu_bo_va_op(amdgpu_bo_handle bo,return -EINVAL; memset(&va, 0, sizeof(va));amdgpu/amdgpu_bo.c +1
-4- va.handle = bo->handle; + va.handle = bo ? bo->handle :0 ; va.operation = ops; - va.flags =AMDGPU_VM_PAGE_READABLE | -AMDGPU_VM_PAGE_WRITEABLE | -AMDGPU_VM_PAGE_EXECUTABLE ;
Quoted 10 lines
Quoted 8 lines
amdgpu/amdgpu_bo.c +2
-1+ va.flags = flags; va.va_address = addr; va.offset_in_bo = offset; - va.map_size =ALIGN (size,getpagesize ()); + va.map_size = size; r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_GEM_VA, &va,sizeof(va));
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 10ad8d45-6c53-0552-e702-ec9e10af73e7-5C7GfCeVMHo@public.gmane.org
Re: [PATCH libdrm 2/2] amdgpu: add amdgpu_bo_va_op_raw
Quoted 14 lines · Nicolai Hähnle
Quoted 13 lines · Christian König
Am 08.02.2017 um 13:34 schrieb Nicolai Hähnle:
Quoted 9 lines
From: Nicolai Hähnle <[email protected]>
This variant allows the caller full control over flags and size, and allows passing a NULL bo (for PRT support).
Cc Christian König <[email protected]>Cc Bas Nieuwenhuizen <[email protected]>Cc Jerry Zhang <[email protected]>Signed-off-by Nicolai Hähnle <[email protected]>Reviewed-by Christian König <[email protected]>.
Quoted 8 lines
Quoted 2 lines
You have a perfect timing, just wanted to ask if anybody has already done the unit test or if I should tackle it?
I actually started hacking on radeonsi support while traveling and decided to push that towards a somewhat usable state, so a series for Mesa is going out now :)
A unit test in libdrm is still a good idea, but I haven't done that.
FWIW, I don't plan to write such a unit test, but I did send out a basic piglit test as well that works for me with the Mesa series -- minus the fact I still get GPU VM faults when I change the test to not commit pages.
Nicolai
Quoted 100 lines
Cheers,
NicolaiQuoted 95 lines
Regards,
Christian.Quoted 89 lines
--- amdgpu/amdgpu.h | 28 ++++++++++++++++++++++++++++ amdgpu/amdgpu_bo.c | 25 ++++++++++++++++++++----- 2 files changed, 48 insertions(+), 5 deletions(-)amdgpu/amdgpu.h +3
-0@@ -1186,6 +1186,34 @@ int amdgpu_bo_va_op(amdgpu_bo_handle bo, uint32_t ops);/** +* VA mapping/unmapping for a buffer object or PRT region. +* +* This is not a simple drop-in extension for amdgpu_bo_va_op; instead, all
+ * parameters are treated "raw", i.e. size is not automatically aligned, and
+ * all flags must be specified explicitly.
+ *+ * \param dev - \c [in] device handle + * \param bo - \c [in] BO handle (may be NULL) + * \param offset - \c [in] Start offset to map + * \param size - \c [in] Size to map + * \param addr - \c [in] Start virtual address. + * \param flags - \c [in] Supported flags for mapping/unmapping + * \param ops - \c [in] AMDGPU_VA_OP_MAP or AMDGPU_VA_OP_UNMAP+ *
+ * \return 0 on success\n
+ * <0 - Negative POSIX Error code
+ *amdgpu/amdgpu.h +11
-0+*/ + +int amdgpu_bo_va_op_raw (amdgpu_device_handle dev, +amdgpu_bo_handle bo, +uint64_t offset, +uint64_t size, +uint64_t addr, +uint64_t flags, +uint32_t ops); + +/** * create semaphore * * \param sem - \c [out] semaphore handle amdgpu/amdgpu_bo.c +17
-0@@ -683,6 +683,23 @@ int amdgpu_bo_va_op(amdgpu_bo_handle bo, uint32_t ops) {amdgpu_device_handle dev = bo->dev; + + size =ALIGN (size,getpagesize ()); + +return amdgpu_bo_va_op_raw (dev, bo, offset, size, addr, +AMDGPU_VM_PAGE_READABLE | +AMDGPU_VM_PAGE_WRITEABLE | +AMDGPU_VM_PAGE_EXECUTABLE , ops); +} + +int amdgpu_bo_va_op_raw (amdgpu_device_handle dev, +amdgpu_bo_handle bo, +uint64_t offset, +uint64_t size, +uint64_t addr, +uint64_t flags, +uint32_t ops) +{struct drm_amdgpu_gem_va va;int r; @@ -690,14 +707,12 @@ int amdgpu_bo_va_op(amdgpu_bo_handle bo,return -EINVAL; memset(&va, 0, sizeof(va));amdgpu/amdgpu_bo.c +3
-5- va.handle = bo->handle; + va.handle = bo ? bo->handle :0 ; va.operation = ops; - va.flags =AMDGPU_VM_PAGE_READABLE | -AMDGPU_VM_PAGE_WRITEABLE | -AMDGPU_VM_PAGE_EXECUTABLE ; + va.flags = flags; va.va_address = addr; va.offset_in_bo = offset; - va.map_size =ALIGN (size,getpagesize ()); + va.map_size = size; r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_GEM_VA, &va,sizeof(va));
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 60f383c8-fc70-0bad-5bbc-a813077c0e3a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH libdrm 2/2] amdgpu: add amdgpu_bo_va_op_raw
Am 08.02.2017 um 13:55 schrieb Nicolai Hähnle:
Quoted 18 lines · Nicolai Hähnle
Quoted 17 lines · Christian König
Quoted 15 lines
Am 08.02.2017 um 13:34 schrieb Nicolai Hähnle:
Quoted 9 lines
From: Nicolai Hähnle <[email protected]>
This variant allows the caller full control over flags and size, and allows passing a NULL bo (for PRT support).
Cc Christian König <[email protected]>Cc Bas Nieuwenhuizen <[email protected]>Cc Jerry Zhang <[email protected]>Signed-off-by Nicolai Hähnle <[email protected]>Reviewed-by Christian König <[email protected]>.You have a perfect timing, just wanted to ask if anybody has already done the unit test or if I should tackle it?
Quoted 7 lines
Quoted 5 lines
I actually started hacking on radeonsi support while traveling and decided to push that towards a somewhat usable state, so a series for Mesa is going out now :)
A unit test in libdrm is still a good idea, but I haven't done that.
FWIW, I don't plan to write such a unit test, but I did send out a basic piglit test as well that works for me with the Mesa series -- minus the fact I still get GPU VM faults when I change the test to not commit pages.
Ok, I've hacked together a quick unit test to write a few dw to a PRT mapping using the SDMA.
Seems to cause a VM fault as well without a message that we turned PRT handling on.
Going to investigate, looks like another issue with the kernel patches to me.
Regards,
Christian.
Quoted 106 lines
Nicolai
Quoted 101 lines
Cheers,
NicolaiQuoted 96 lines
Regards,
Christian.Quoted 90 lines
--- amdgpu/amdgpu.h | 28 ++++++++++++++++++++++++++++ amdgpu/amdgpu_bo.c | 25 ++++++++++++++++++++----- 2 files changed, 48 insertions(+), 5 deletions(-)amdgpu/amdgpu.h +3
-0@@ -1186,6 +1186,34 @@ int amdgpu_bo_va_op(amdgpu_bo_handle bo, uint32_t ops);/** +* VA mapping/unmapping for a buffer object or PRT region. +* +* This is not a simple drop-in extension for amdgpu_bo_va_op; instead, all
+ * parameters are treated "raw", i.e. size is not automatically aligned, and
+ * all flags must be specified explicitly.
+ *+ * \param dev - \c [in] device handle + * \param bo - \c [in] BO handle (may be NULL) + * \param offset - \c [in] Start offset to map + * \param size - \c [in] Size to map + * \param addr - \c [in] Start virtual address. + * \param flags - \c [in] Supported flags for mapping/unmapping + * \param ops - \c [in] AMDGPU_VA_OP_MAP or
AMDGPU_VA_OP_UNMAP
+ *
+ * \return 0 on success\n
+ * <0 - Negative POSIX Error code
+ *amdgpu/amdgpu.h +11
-0+*/ + +int amdgpu_bo_va_op_raw (amdgpu_device_handle dev, +amdgpu_bo_handle bo, +uint64_t offset, +uint64_t size, +uint64_t addr, +uint64_t flags, +uint32_t ops); + +/** * create semaphore * * \param sem - \c [out] semaphore handle amdgpu/amdgpu_bo.c +17
-0@@ -683,6 +683,23 @@ int amdgpu_bo_va_op(amdgpu_bo_handle bo, uint32_t ops) {amdgpu_device_handle dev = bo->dev; + + size =ALIGN (size,getpagesize ()); + +return amdgpu_bo_va_op_raw (dev, bo, offset, size, addr, +AMDGPU_VM_PAGE_READABLE | +AMDGPU_VM_PAGE_WRITEABLE | +AMDGPU_VM_PAGE_EXECUTABLE , ops); +} + +int amdgpu_bo_va_op_raw (amdgpu_device_handle dev, +amdgpu_bo_handle bo, +uint64_t offset, +uint64_t size, +uint64_t addr, +uint64_t flags, +uint32_t ops) +{struct drm_amdgpu_gem_va va;int r; @@ -690,14 +707,12 @@ int amdgpu_bo_va_op(amdgpu_bo_handle bo,return -EINVAL; memset(&va, 0, sizeof(va));amdgpu/amdgpu_bo.c +3
-5- va.handle = bo->handle; + va.handle = bo ? bo->handle :0 ; va.operation = ops; - va.flags =AMDGPU_VM_PAGE_READABLE | -AMDGPU_VM_PAGE_WRITEABLE | -AMDGPU_VM_PAGE_EXECUTABLE ; + va.flags = flags; va.va_address = addr; va.offset_in_bo = offset; - va.map_size =ALIGN (size,getpagesize ()); + va.map_size = size; r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_GEM_VA, &va,sizeof(va));
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 7 lines · Nicolai Hähnle
From: Nicolai Hähnle <[email protected]>
This is a new kernel interface.
Signed-off-by Nicolai Hähnle <[email protected]>--- include/drm/amdgpu_drm.h | 2 ++
Hi Nicolai,
Please see the "When and how to update these files" section in the README
-Emil
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): CACvgo52qWjJm2W5HfzfbfMtGzqAjas3bFJ978dTv-AVp=Sz1jA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 11 lines · Emil Velikov
Quoted 7 lines · Nicolai Hähnle
From: Nicolai Hähnle <[email protected]>
This is a new kernel interface.
Signed-off-by Nicolai Hähnle <[email protected]>--- include/drm/amdgpu_drm.h | 2 ++Hi Nicolai,
Please see the "When and how to update these files" section in the README
Sure, I'll update this once Christian's patches land in the kernel.
Nicolai
Quoted 3 lines
-Emil
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx