diff mbox

drm/amdgpu: fix userptr flags check

Message ID 1448532380-8289-1-git-send-email-deathsimple@vodafone.de (mailing list archive)
State New, archived
Headers show

Commit Message

Christian König Nov. 26, 2015, 10:06 a.m. UTC
From: Christian König <christian.koenig@amd.com>

That got messed up while porting it from Radeon.

Signed-off-by: Christian König <christian.koenig@amd.com>
Cc: stable@vger.kernel.org
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Michel Dänzer Nov. 27, 2015, 2:42 a.m. UTC | #1
On 26.11.2015 19:06, Christian König wrote:
> From: Christian König <christian.koenig@amd.com>
> 
> That got messed up while porting it from Radeon.
> 
> Signed-off-by: Christian König <christian.koenig@amd.com>
> Cc: stable@vger.kernel.org
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> index 00c5b58..af53215 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> @@ -242,8 +242,9 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data,
>  	    AMDGPU_GEM_USERPTR_REGISTER))
>  		return -EINVAL;
>  
> -	if (!(args->flags & AMDGPU_GEM_USERPTR_ANONONLY) ||
> -		   !(args->flags & AMDGPU_GEM_USERPTR_REGISTER)) {
> +	if (!(args->flags & AMDGPU_GEM_USERPTR_READONLY) && (
> +	     !(args->flags & AMDGPU_GEM_USERPTR_ANONONLY) ||
> +	     !(args->flags & AMDGPU_GEM_USERPTR_REGISTER))) {
>  
>  		/* if we want to write to it we must require anonymous
>  		   memory and install a MMU notifier */
> 

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Alex Deucher Nov. 30, 2015, 7:40 p.m. UTC | #2
On Thu, Nov 26, 2015 at 9:42 PM, Michel Dänzer <michel@daenzer.net> wrote:
> On 26.11.2015 19:06, Christian König wrote:
>> From: Christian König <christian.koenig@amd.com>
>>
>> That got messed up while porting it from Radeon.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> Cc: stable@vger.kernel.org
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> index 00c5b58..af53215 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> @@ -242,8 +242,9 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data,
>>           AMDGPU_GEM_USERPTR_REGISTER))
>>               return -EINVAL;
>>
>> -     if (!(args->flags & AMDGPU_GEM_USERPTR_ANONONLY) ||
>> -                !(args->flags & AMDGPU_GEM_USERPTR_REGISTER)) {
>> +     if (!(args->flags & AMDGPU_GEM_USERPTR_READONLY) && (
>> +          !(args->flags & AMDGPU_GEM_USERPTR_ANONONLY) ||
>> +          !(args->flags & AMDGPU_GEM_USERPTR_REGISTER))) {
>>
>>               /* if we want to write to it we must require anonymous
>>                  memory and install a MMU notifier */
>>
>
> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>


Applied.  thanks!

Alex

>
>
> --
> Earthling Michel Dänzer               |               http://www.amd.com
> Libre software enthusiast             |             Mesa and X developer
diff mbox

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 00c5b58..af53215 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -242,8 +242,9 @@  int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data,
 	    AMDGPU_GEM_USERPTR_REGISTER))
 		return -EINVAL;
 
-	if (!(args->flags & AMDGPU_GEM_USERPTR_ANONONLY) ||
-		   !(args->flags & AMDGPU_GEM_USERPTR_REGISTER)) {
+	if (!(args->flags & AMDGPU_GEM_USERPTR_READONLY) && (
+	     !(args->flags & AMDGPU_GEM_USERPTR_ANONONLY) ||
+	     !(args->flags & AMDGPU_GEM_USERPTR_REGISTER))) {
 
 		/* if we want to write to it we must require anonymous
 		   memory and install a MMU notifier */