All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH libdrm 1/2] amdgpu: add AMDGPU_VM_PAGE_PRT
@ 2017-02-08 12:34 Nicolai Hähnle
       [not found] ` <20170208123430.8853-1-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolai Hähnle @ 2017-02-08 12:34 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Nicolai Hähnle

From: Nicolai Hähnle <nicolai.haehnle@amd.com>

This is a new kernel interface.

Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
---
 include/drm/amdgpu_drm.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/drm/amdgpu_drm.h b/include/drm/amdgpu_drm.h
index d8f2497..7012515 100644
--- a/include/drm/amdgpu_drm.h
+++ b/include/drm/amdgpu_drm.h
@@ -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 */
-- 
2.9.3

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH libdrm 2/2] amdgpu: add amdgpu_bo_va_op_raw
       [not found] ` <20170208123430.8853-1-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-02-08 12:34   ` Nicolai Hähnle
       [not found]     ` <20170208123430.8853-2-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-02-09 16:24   ` [PATCH libdrm 1/2] amdgpu: add AMDGPU_VM_PAGE_PRT Emil Velikov
  1 sibling, 1 reply; 8+ messages in thread
From: Nicolai Hähnle @ 2017-02-08 12:34 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Jerry Zhang, Christian König, Nicolai Hähnle,
	Bas Nieuwenhuizen

From: Nicolai Hähnle <nicolai.haehnle@amd.com>

This variant allows the caller full control over flags and size, and
allows passing a NULL bo (for PRT support).

Cc: Christian König <christian.koenig@amd.com>
Cc: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: Jerry Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
---
 amdgpu/amdgpu.h    | 28 ++++++++++++++++++++++++++++
 amdgpu/amdgpu_bo.c | 25 ++++++++++++++++++++-----
 2 files changed, 48 insertions(+), 5 deletions(-)

diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
index 7b26a04..6b2ded8 100644
--- a/amdgpu/amdgpu.h
+++ b/amdgpu/amdgpu.h
@@ -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
diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
index d30fd1e..f725bfd 100644
--- a/amdgpu/amdgpu_bo.c
+++ b/amdgpu/amdgpu_bo.c
@@ -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));
 
-- 
2.9.3

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH libdrm 2/2] amdgpu: add amdgpu_bo_va_op_raw
       [not found]     ` <20170208123430.8853-2-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-02-08 12:39       ` Christian König
       [not found]         ` <650eb732-6876-f0c6-462e-546f39469ce4-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Christian König @ 2017-02-08 12:39 UTC (permalink / raw)
  To: Nicolai Hähnle, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Jerry Zhang, Nicolai Hähnle, Bas Nieuwenhuizen

Am 08.02.2017 um 13:34 schrieb Nicolai Hähnle:
> From: Nicolai Hähnle <nicolai.haehnle@amd.com>
>
> This variant allows the caller full control over flags and size, and
> allows passing a NULL bo (for PRT support).
>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
> Cc: Jerry Zhang <Jerry.Zhang@amd.com>
> Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com>.

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.

> ---
>   amdgpu/amdgpu.h    | 28 ++++++++++++++++++++++++++++
>   amdgpu/amdgpu_bo.c | 25 ++++++++++++++++++++-----
>   2 files changed, 48 insertions(+), 5 deletions(-)
>
> diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
> index 7b26a04..6b2ded8 100644
> --- a/amdgpu/amdgpu.h
> +++ b/amdgpu/amdgpu.h
> @@ -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
> diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
> index d30fd1e..f725bfd 100644
> --- a/amdgpu/amdgpu_bo.c
> +++ b/amdgpu/amdgpu_bo.c
> @@ -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));
>   


_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH libdrm 2/2] amdgpu: add amdgpu_bo_va_op_raw
       [not found]         ` <650eb732-6876-f0c6-462e-546f39469ce4-5C7GfCeVMHo@public.gmane.org>
@ 2017-02-08 12:44           ` Nicolai Hähnle
       [not found]             ` <10ad8d45-6c53-0552-e702-ec9e10af73e7-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolai Hähnle @ 2017-02-08 12:44 UTC (permalink / raw)
  To: Christian König, Nicolai Hähnle,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Jerry Zhang, Bas Nieuwenhuizen

On 08.02.2017 13:39, Christian König wrote:
> Am 08.02.2017 um 13:34 schrieb Nicolai Hähnle:
>> From: Nicolai Hähnle <nicolai.haehnle@amd.com>
>>
>> This variant allows the caller full control over flags and size, and
>> allows passing a NULL bo (for PRT support).
>>
>> Cc: Christian König <christian.koenig@amd.com>
>> Cc: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
>> Cc: Jerry Zhang <Jerry.Zhang@amd.com>
>> Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
>
> Reviewed-by: Christian König <christian.koenig@amd.com>.
>
> 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

>
> Regards,
> Christian.
>
>> ---
>>   amdgpu/amdgpu.h    | 28 ++++++++++++++++++++++++++++
>>   amdgpu/amdgpu_bo.c | 25 ++++++++++++++++++++-----
>>   2 files changed, 48 insertions(+), 5 deletions(-)
>>
>> diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
>> index 7b26a04..6b2ded8 100644
>> --- a/amdgpu/amdgpu.h
>> +++ b/amdgpu/amdgpu.h
>> @@ -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
>> diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
>> index d30fd1e..f725bfd 100644
>> --- a/amdgpu/amdgpu_bo.c
>> +++ b/amdgpu/amdgpu_bo.c
>> @@ -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));
>>
>
>

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH libdrm 2/2] amdgpu: add amdgpu_bo_va_op_raw
       [not found]             ` <10ad8d45-6c53-0552-e702-ec9e10af73e7-5C7GfCeVMHo@public.gmane.org>
@ 2017-02-08 12:55               ` Nicolai Hähnle
       [not found]                 ` <60f383c8-fc70-0bad-5bbc-a813077c0e3a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolai Hähnle @ 2017-02-08 12:55 UTC (permalink / raw)
  To: Nicolai Hähnle, Christian König,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Jerry Zhang, Bas Nieuwenhuizen

On 08.02.2017 13:44, Nicolai Hähnle wrote:
> On 08.02.2017 13:39, Christian König wrote:
>> Am 08.02.2017 um 13:34 schrieb Nicolai Hähnle:
>>> From: Nicolai Hähnle <nicolai.haehnle@amd.com>
>>>
>>> This variant allows the caller full control over flags and size, and
>>> allows passing a NULL bo (for PRT support).
>>>
>>> Cc: Christian König <christian.koenig@amd.com>
>>> Cc: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
>>> Cc: Jerry Zhang <Jerry.Zhang@amd.com>
>>> Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
>>
>> Reviewed-by: Christian König <christian.koenig@amd.com>.
>>
>> 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


>
> Cheers,
> Nicolai
>
>>
>> Regards,
>> Christian.
>>
>>> ---
>>>   amdgpu/amdgpu.h    | 28 ++++++++++++++++++++++++++++
>>>   amdgpu/amdgpu_bo.c | 25 ++++++++++++++++++++-----
>>>   2 files changed, 48 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
>>> index 7b26a04..6b2ded8 100644
>>> --- a/amdgpu/amdgpu.h
>>> +++ b/amdgpu/amdgpu.h
>>> @@ -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
>>> diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
>>> index d30fd1e..f725bfd 100644
>>> --- a/amdgpu/amdgpu_bo.c
>>> +++ b/amdgpu/amdgpu_bo.c
>>> @@ -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));
>>>
>>
>>
>

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH libdrm 2/2] amdgpu: add amdgpu_bo_va_op_raw
       [not found]                 ` <60f383c8-fc70-0bad-5bbc-a813077c0e3a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-02-08 13:12                   ` Christian König
  0 siblings, 0 replies; 8+ messages in thread
From: Christian König @ 2017-02-08 13:12 UTC (permalink / raw)
  To: Nicolai Hähnle, Nicolai Hähnle,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Jerry Zhang, Bas Nieuwenhuizen

Am 08.02.2017 um 13:55 schrieb Nicolai Hähnle:
> On 08.02.2017 13:44, Nicolai Hähnle wrote:
>> On 08.02.2017 13:39, Christian König wrote:
>>> Am 08.02.2017 um 13:34 schrieb Nicolai Hähnle:
>>>> From: Nicolai Hähnle <nicolai.haehnle@amd.com>
>>>>
>>>> This variant allows the caller full control over flags and size, and
>>>> allows passing a NULL bo (for PRT support).
>>>>
>>>> Cc: Christian König <christian.koenig@amd.com>
>>>> Cc: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
>>>> Cc: Jerry Zhang <Jerry.Zhang@amd.com>
>>>> Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
>>>
>>> Reviewed-by: Christian König <christian.koenig@amd.com>.
>>>
>>> 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.

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.

>
> Nicolai
>
>
>>
>> Cheers,
>> Nicolai
>>
>>>
>>> Regards,
>>> Christian.
>>>
>>>> ---
>>>>   amdgpu/amdgpu.h    | 28 ++++++++++++++++++++++++++++
>>>>   amdgpu/amdgpu_bo.c | 25 ++++++++++++++++++++-----
>>>>   2 files changed, 48 insertions(+), 5 deletions(-)
>>>>
>>>> diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
>>>> index 7b26a04..6b2ded8 100644
>>>> --- a/amdgpu/amdgpu.h
>>>> +++ b/amdgpu/amdgpu.h
>>>> @@ -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
>>>> diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
>>>> index d30fd1e..f725bfd 100644
>>>> --- a/amdgpu/amdgpu_bo.c
>>>> +++ b/amdgpu/amdgpu_bo.c
>>>> @@ -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));
>>>>
>>>
>>>
>>
>

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH libdrm 1/2] amdgpu: add AMDGPU_VM_PAGE_PRT
       [not found] ` <20170208123430.8853-1-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-02-08 12:34   ` [PATCH libdrm 2/2] amdgpu: add amdgpu_bo_va_op_raw Nicolai Hähnle
@ 2017-02-09 16:24   ` Emil Velikov
       [not found]     ` <CACvgo52qWjJm2W5HfzfbfMtGzqAjas3bFJ978dTv-AVp=Sz1jA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  1 sibling, 1 reply; 8+ messages in thread
From: Emil Velikov @ 2017-02-09 16:24 UTC (permalink / raw)
  To: Nicolai Hähnle; +Cc: Nicolai Hähnle, amd-gfx mailing list

On 8 February 2017 at 12:34, Nicolai Hähnle <nhaehnle@gmail.com> wrote:
> From: Nicolai Hähnle <nicolai.haehnle@amd.com>
>
> This is a new kernel interface.
>
> Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
> ---
>  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
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH libdrm 1/2] amdgpu: add AMDGPU_VM_PAGE_PRT
       [not found]     ` <CACvgo52qWjJm2W5HfzfbfMtGzqAjas3bFJ978dTv-AVp=Sz1jA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-02-10 10:05       ` Nicolai Hähnle
  0 siblings, 0 replies; 8+ messages in thread
From: Nicolai Hähnle @ 2017-02-10 10:05 UTC (permalink / raw)
  To: Emil Velikov, Nicolai Hähnle; +Cc: amd-gfx mailing list

On 09.02.2017 17:24, Emil Velikov wrote:
> On 8 February 2017 at 12:34, Nicolai Hähnle <nhaehnle@gmail.com> wrote:
>> From: Nicolai Hähnle <nicolai.haehnle@amd.com>
>>
>> This is a new kernel interface.
>>
>> Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
>> ---
>>  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

>
> -Emil
>

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-02-10 10:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-08 12:34 [PATCH libdrm 1/2] amdgpu: add AMDGPU_VM_PAGE_PRT Nicolai Hähnle
     [not found] ` <20170208123430.8853-1-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-08 12:34   ` [PATCH libdrm 2/2] amdgpu: add amdgpu_bo_va_op_raw Nicolai Hähnle
     [not found]     ` <20170208123430.8853-2-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-08 12:39       ` Christian König
     [not found]         ` <650eb732-6876-f0c6-462e-546f39469ce4-5C7GfCeVMHo@public.gmane.org>
2017-02-08 12:44           ` Nicolai Hähnle
     [not found]             ` <10ad8d45-6c53-0552-e702-ec9e10af73e7-5C7GfCeVMHo@public.gmane.org>
2017-02-08 12:55               ` Nicolai Hähnle
     [not found]                 ` <60f383c8-fc70-0bad-5bbc-a813077c0e3a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-08 13:12                   ` Christian König
2017-02-09 16:24   ` [PATCH libdrm 1/2] amdgpu: add AMDGPU_VM_PAGE_PRT Emil Velikov
     [not found]     ` <CACvgo52qWjJm2W5HfzfbfMtGzqAjas3bFJ978dTv-AVp=Sz1jA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-10 10:05       ` Nicolai Hähnle

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.