Subject: Re: Kernel 4.7: PAGE_GUARDED and _PAGE_NO_CACHE

From: Michael Ellerman <[email-masked]>
Date: Mon, 06 Jun 2016 12:00:06 +1000

On Sun, 2016-06-05 at 21:23 -0400, Julian Margetson wrote:
> > > 
> > > drivers/gpu/drm/drm_vm.c: In function ‘drm_dma_prot’:
> > > drivers/gpu/drm/drm_vm.c:83:6: error: invalid operands to binary | 
> > > (have ‘pgprot_t {aka struct <anonymous>}’ and ‘int’)
> > >     tmp |= _PAGE_NO_CACHE;
> > >         ^
> > > 
> > That is because that usage is wrong based on type. _PAGE_NO_CACHE is not
> > of type pgprot_t. What you really need there is
> > 
> > tmp = __pgprot(pgprot_val(tmp) | _PAGE_NO_CACHE);
> > 
> > or a better option would be
> > 
> > tmp = pgprot_noncached_wc(tmp);
> > 
> > -aneesh
> 
> tmp = pgprot_noncached_wc(tmp);
> 
> compiles but  I then run in to the following
> 
>   CC      drivers/gpu/drm/drm_scatter.o
> drivers/gpu/drm/drm_scatter.c: In function ‘drm_vmalloc_dma’:
> drivers/gpu/drm/drm_scatter.c:44:49: error: invalid operands to binary | 
> (have ‘pgprot_t {aka struct <anonymous>}’ and ‘int’)
>    return __vmalloc(size, GFP_KERNEL, PAGE_KERNEL | _PAGE_NO_CACHE);
>                                                   ^
> drivers/gpu/drm/drm_scatter.c:48:1: warning: control reaches end of 
> non-void function [-Wreturn-type]
>   }
>   ^

Aneesh showed you how to fix that in his reply above.

    return __vmalloc(size, GFP_KERNEL, pgprot_noncached_wc(PAGE_KERNEL));

cheers