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
285 if (offset_in_page(args->addr | args->size))285 if (offset_in_page(args->addr | args->size))
286 return -EINVAL;286 return -EINVAL;
287 287
288 /* we only support read only mappings for now */
289 if (!(args->flags & RADEON_GEM_USERPTR_READONLY))
290 return -EACCES;
291
292 /* reject unknown flag values */288 /* reject unknown flag values */
293 if (args->flags & ~(RADEON_GEM_USERPTR_READONLY |289 if (args->flags & ~(RADEON_GEM_USERPTR_READONLY |
294 RADEON_GEM_USERPTR_ANONONLY | RADEON_GEM_USERPTR_VALIDATE |290 RADEON_GEM_USERPTR_ANONONLY | RADEON_GEM_USERPTR_VALIDATE |
295 RADEON_GEM_USERPTR_REGISTER))291 RADEON_GEM_USERPTR_REGISTER))
296 return -EINVAL;292 return -EINVAL;
297 293
298 /* readonly pages not tested on older hardware */294 if (args->flags & RADEON_GEM_USERPTR_READONLY) {
299 if (rdev->family < CHIP_R600)295 /* readonly pages not tested on older hardware */
300 return -EINVAL;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 }
301 306
302 down_read(&rdev->exclusive_lock);307 down_read(&rdev->exclusive_lock);
303 308

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