History

drm/radeon: allow userptr write access under certain conditions

It needs to be anonymous memory (no file mappings) and we are requried to install an MMU notifier.

Christian König committed 12 years ago

Commit bd645e41 parent 341cb9e1 file · +12 −7Browse files

Unified · Split

drivers/gpu/drm/radeon/radeon_gem.c+12−7
@@ -285,19 +285,24 @@ int radeon_gem_userptr_ioctl(struct drm_device *dev, void *data, · 284 unmodified lines
285285 if (offset_in_page(args->addr | args->size))
286286 return -EINVAL;
287287
288− /* we only support read only mappings for now */
289− if (!(args->flags & RADEON_GEM_USERPTR_READONLY))
290− return -EACCES;
291−
292288 /* reject unknown flag values */
293289 if (args->flags & ~(RADEON_GEM_USERPTR_READONLY |
294290 RADEON_GEM_USERPTR_ANONONLY | RADEON_GEM_USERPTR_VALIDATE |
295291 RADEON_GEM_USERPTR_REGISTER))
296292 return -EINVAL;
297293
298− /* readonly pages not tested on older hardware */
299− if (rdev->family < CHIP_R600)
300− return -EINVAL;
294+ if (args->flags & RADEON_GEM_USERPTR_READONLY) {
295+ /* readonly pages not tested on older hardware */
296+ if (rdev->family < CHIP_R600)
297+ return -EINVAL;
298+
299+ } else if (!(args->flags & RADEON_GEM_USERPTR_ANONONLY) ||
300+ !(args->flags & RADEON_GEM_USERPTR_REGISTER)) {
301+
302+ /* if we want to write to it we must require anonymous
303+ memory and install a MMU notifier */
304+ return -EACCES;
305+ }
301306
302307 down_read(&rdev->exclusive_lock);
303308

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t