All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <deathsimple@vodafone.de>
To: Jerome Glisse <j.glisse@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/5] drm/radeon: add userptr flag to limit it to anonymous memory
Date: Tue, 05 Aug 2014 16:32:02 +0200	[thread overview]
Message-ID: <53E0EAE2.1010308@vodafone.de> (raw)
In-Reply-To: <20140805142436.GA1958@gmail.com>

Am 05.08.2014 um 16:24 schrieb Jerome Glisse:
> On Tue, Aug 05, 2014 at 04:11:04PM +0200, Christian König wrote:
>> From: Christian König <christian.koenig@amd.com>
> Why do you want that ?
To avoid any problems with writeback (which as far as I understand 
should only happen on mmaped files).

> NACK until proper explanation and motive.
Going to update the commit message and add a code comment.

Christian.

>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> ---
>>   drivers/gpu/drm/radeon/radeon_gem.c | 3 ++-
>>   drivers/gpu/drm/radeon/radeon_ttm.c | 8 ++++++++
>>   include/uapi/drm/radeon_drm.h       | 3 ++-
>>   3 files changed, 12 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
>> index 993ab22..032736b 100644
>> --- a/drivers/gpu/drm/radeon/radeon_gem.c
>> +++ b/drivers/gpu/drm/radeon/radeon_gem.c
>> @@ -290,7 +290,8 @@ int radeon_gem_userptr_ioctl(struct drm_device *dev, void *data,
>>   		return -EACCES;
>>   
>>   	/* reject unknown flag values */
>> -	if (args->flags & ~RADEON_GEM_USERPTR_READONLY)
>> +	if (args->flags & ~(RADEON_GEM_USERPTR_READONLY |
>> +	    RADEON_GEM_USERPTR_ANONONLY))
>>   		return -EINVAL;
>>   
>>   	/* readonly pages not tested on older hardware */
>> diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
>> index 0109090..d63e698 100644
>> --- a/drivers/gpu/drm/radeon/radeon_ttm.c
>> +++ b/drivers/gpu/drm/radeon/radeon_ttm.c
>> @@ -542,6 +542,14 @@ static int radeon_ttm_tt_pin_userptr(struct ttm_tt *ttm)
>>   		       ttm->num_pages * PAGE_SIZE))
>>   		return -EFAULT;
>>   
>> +	if (gtt->userflags & RADEON_GEM_USERPTR_ANONONLY) {
>> +		unsigned long end = gtt->userptr + ttm->num_pages * PAGE_SIZE;
>> +		struct vm_area_struct *vma;
>> +		vma = find_vma(gtt->usermm, gtt->userptr);
>> +		if (!vma || vma->vm_file || vma->vm_end < end)
>> +			return -EPERM;
>> +	}
>> +
>>   	do {
>>   		unsigned num_pages = ttm->num_pages - pinned;
>>   		uint64_t userptr = gtt->userptr + pinned * PAGE_SIZE;
>> diff --git a/include/uapi/drm/radeon_drm.h b/include/uapi/drm/radeon_drm.h
>> index a18ec54..4080ad3 100644
>> --- a/include/uapi/drm/radeon_drm.h
>> +++ b/include/uapi/drm/radeon_drm.h
>> @@ -810,7 +810,8 @@ struct drm_radeon_gem_create {
>>   	uint32_t	flags;
>>   };
>>   
>> -#define RADEON_GEM_USERPTR_READONLY	0x1
>> +#define RADEON_GEM_USERPTR_READONLY	(1 << 0)
>> +#define RADEON_GEM_USERPTR_ANONONLY	(1 << 1)
>>   
>>   struct drm_radeon_gem_userptr {
>>   	uint64_t		addr;
>> -- 
>> 1.9.1
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2014-08-05 14:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-05 14:11 [PATCH 1/5] drm/radeon: add userptr support v6 Christian König
2014-08-05 14:11 ` [PATCH 2/5] drm/radeon: add userptr flag to limit it to anonymous memory Christian König
2014-08-05 14:24   ` Jerome Glisse
2014-08-05 14:32     ` Christian König [this message]
2014-08-05 14:11 ` [PATCH 3/5] drm/radeon: add userptr flag to directly validate the BO to GTT Christian König
2014-08-05 14:11 ` [PATCH 4/5] drm/radeon: add userptr flag to register MMU notifier v2 Christian König
2014-08-05 14:11 ` [PATCH 5/5] drm/radeon: allow userptr write access under certain conditions Christian König
2014-08-05 14:30 ` [PATCH 1/5] drm/radeon: add userptr support v6 Jerome Glisse
2014-08-05 15:19   ` Christian König
  -- strict thread matches above, loose matches on Subject: below --
2014-07-28 11:30 [PATCH 1/5] drm/radeon: add userptr support v5 Christian König
2014-07-28 11:30 ` [PATCH 2/5] drm/radeon: add userptr flag to limit it to anonymous memory 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=53E0EAE2.1010308@vodafone.de \
    --to=deathsimple@vodafone.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=j.glisse@gmail.com \
    /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.