From: "Christian König" <deathsimple@vodafone.de>
To: alexdeucher@gmail.com
Cc: dri-devel@lists.freedesktop.org
Subject: [PATCH 5/5] drm/radeon: allow userptr write access under certain conditions
Date: Tue, 5 Aug 2014 16:11:07 +0200 [thread overview]
Message-ID: <1407247867-7093-5-git-send-email-deathsimple@vodafone.de> (raw)
In-Reply-To: <1407247867-7093-1-git-send-email-deathsimple@vodafone.de>
From: Christian König <christian.koenig@amd.com>
It needs to be anonymous memory (no file mappings)
and we are requried to install an MMU notifier.
Signed-off-by: Christian König <christian.koenig@amd.com>
---
drivers/gpu/drm/radeon/radeon_gem.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
index 2a6fbf1..01b5894 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -285,19 +285,24 @@ int radeon_gem_userptr_ioctl(struct drm_device *dev, void *data,
if (offset_in_page(args->addr | args->size))
return -EINVAL;
- /* we only support read only mappings for now */
- if (!(args->flags & RADEON_GEM_USERPTR_READONLY))
- return -EACCES;
-
/* reject unknown flag values */
if (args->flags & ~(RADEON_GEM_USERPTR_READONLY |
RADEON_GEM_USERPTR_ANONONLY | RADEON_GEM_USERPTR_VALIDATE |
RADEON_GEM_USERPTR_REGISTER))
return -EINVAL;
- /* readonly pages not tested on older hardware */
- if (rdev->family < CHIP_R600)
- return -EINVAL;
+ if (args->flags & RADEON_GEM_USERPTR_READONLY) {
+ /* readonly pages not tested on older hardware */
+ if (rdev->family < CHIP_R600)
+ return -EINVAL;
+
+ } else if (!(args->flags & RADEON_GEM_USERPTR_ANONONLY) ||
+ !(args->flags & RADEON_GEM_USERPTR_REGISTER)) {
+
+ /* if we want to write to it we must require anonymous
+ memory and install a MMU notifier */
+ return -EACCES;
+ }
down_read(&rdev->exclusive_lock);
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2014-08-05 14:25 UTC|newest]
Thread overview: 12+ 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
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 ` Christian König [this message]
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-08-07 7:36 [PATCH 1/5] drm/radeon: add userptr support v8 Christian König
2014-08-07 7:36 ` [PATCH 5/5] drm/radeon: allow userptr write access under certain conditions Christian König
2014-08-05 16:05 [PATCH 1/5] drm/radeon: add userptr support v7 Christian König
2014-08-05 16:05 ` [PATCH 5/5] drm/radeon: allow userptr write access under certain conditions Christian König
2014-07-28 11:30 [PATCH 1/5] drm/radeon: add userptr support v5 Christian König
2014-07-28 11:30 ` [PATCH 5/5] drm/radeon: allow userptr write access under certain conditions 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=1407247867-7093-5-git-send-email-deathsimple@vodafone.de \
--to=deathsimple@vodafone.de \
--cc=alexdeucher@gmail.com \
--cc=dri-devel@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox