mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-13 17:24:28 +08:00
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. Signed-off-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
341cb9e426
commit
bd645e4314
@ -285,19 +285,24 @@ int radeon_gem_userptr_ioctl(struct drm_device *dev, void *data,
|
|||||||
if (offset_in_page(args->addr | args->size))
|
if (offset_in_page(args->addr | args->size))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* we only support read only mappings for now */
|
|
||||||
if (!(args->flags & RADEON_GEM_USERPTR_READONLY))
|
|
||||||
return -EACCES;
|
|
||||||
|
|
||||||
/* reject unknown flag values */
|
/* reject unknown flag values */
|
||||||
if (args->flags & ~(RADEON_GEM_USERPTR_READONLY |
|
if (args->flags & ~(RADEON_GEM_USERPTR_READONLY |
|
||||||
RADEON_GEM_USERPTR_ANONONLY | RADEON_GEM_USERPTR_VALIDATE |
|
RADEON_GEM_USERPTR_ANONONLY | RADEON_GEM_USERPTR_VALIDATE |
|
||||||
RADEON_GEM_USERPTR_REGISTER))
|
RADEON_GEM_USERPTR_REGISTER))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* readonly pages not tested on older hardware */
|
if (args->flags & RADEON_GEM_USERPTR_READONLY) {
|
||||||
if (rdev->family < CHIP_R600)
|
/* readonly pages not tested on older hardware */
|
||||||
return -EINVAL;
|
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);
|
down_read(&rdev->exclusive_lock);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user