diff mbox

[02/41] drm: Fix broken use of _PAGE_NO_CACHE on powerpc

Message ID 1467695057-12431-3-git-send-email-benh@kernel.crashing.org (mailing list archive)
State Not Applicable
Headers show

Commit Message

Benjamin Herrenschmidt July 5, 2016, 5:03 a.m. UTC
That constant no longer exist. Use the proper accessor instead

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 drivers/gpu/drm/drm_memory.c  | 2 +-
 drivers/gpu/drm/drm_scatter.c | 2 +-
 drivers/gpu/drm/drm_vm.c      | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

Comments

Michael Ellerman July 7, 2016, 12:38 p.m. UTC | #1
Benjamin Herrenschmidt <benh@kernel.crashing.org> writes:

> That constant no longer exist. Use the proper accessor instead

I still see it?

  arch/powerpc/include/asm/book3s/32/hash.h:#define _PAGE_NO_CACHE	0x020	/* I: cache inhibit */
  arch/powerpc/include/asm/book3s/64/pgtable.h:#define _PAGE_NO_CACHE		_PAGE_TOLERANT
  arch/powerpc/include/asm/nohash/32/pte-44x.h:#define _PAGE_NO_CACHE	0x00000400		/* H: I bit */
  arch/powerpc/include/asm/nohash/32/pte-8xx.h:#define _PAGE_NO_CACHE	0x0002	/* I: cache inhibit */
  arch/powerpc/include/asm/nohash/32/pte-fsl-booke.h:#define _PAGE_NO_CACHE	0x00200	/* H: I bit */
  arch/powerpc/include/asm/nohash/pte-book3e.h:#define _PAGE_NO_CACHE	0x400000 /* I: cache inhibit */

Do you mean it doesn't exist in some cases? Or pgprot_noncached_wc() is
just better?

Also this should probably at least get Cc'ed to the DRM folks.

cheers
Benjamin Herrenschmidt July 7, 2016, 1:04 p.m. UTC | #2
On Thu, 2016-07-07 at 22:38 +1000, Michael Ellerman wrote:
> Benjamin Herrenschmidt <benh@kernel.crashing.org> writes:
> 
> > That constant no longer exist. Use the proper accessor instead
> 
> I still see it?

Hrm, right, it does, I think it's just not always accessible or the
wrong type. That stuff wasn't building anymore. In any case, it
shouldn't be used outside of the arch, the accessors are better.

>   arch/powerpc/include/asm/book3s/32/hash.h:#define _PAGE_NO_CACHE	0x020	/* I: cache inhibit */
>   arch/powerpc/include/asm/book3s/64/pgtable.h:#define _PAGE_NO_CACHE		_PAGE_TOLERANT
>   arch/powerpc/include/asm/nohash/32/pte-44x.h:#define _PAGE_NO_CACHE	0x00000400		/* H: I bit */
>   arch/powerpc/include/asm/nohash/32/pte-8xx.h:#define _PAGE_NO_CACHE	0x0002	/* I: cache inhibit */
>   arch/powerpc/include/asm/nohash/32/pte-fsl-booke.h:#define _PAGE_NO_CACHE	0x00200	/* H: I bit */
>   arch/powerpc/include/asm/nohash/pte-book3e.h:#define _PAGE_NO_CACHE	0x400000 /* I: cache inhibit */
> 
> Do you mean it doesn't exist in some cases? Or pgprot_noncached_wc() is
> just better?
> 
> Also this should probably at least get Cc'ed to the DRM folks.

Ah yes :-)

Cheers,
Ben.
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_memory.c b/drivers/gpu/drm/drm_memory.c
index 87a8cb7..fc0ebd2 100644
--- a/drivers/gpu/drm/drm_memory.c
+++ b/drivers/gpu/drm/drm_memory.c
@@ -44,7 +44,7 @@ 
 # include <asm/agp.h>
 #else
 # ifdef __powerpc__
-#  define PAGE_AGP	__pgprot(_PAGE_KERNEL | _PAGE_NO_CACHE)
+#  define PAGE_AGP	pgprot_noncached_wc(PAGE_KERNEL)
 # else
 #  define PAGE_AGP	PAGE_KERNEL
 # endif
diff --git a/drivers/gpu/drm/drm_scatter.c b/drivers/gpu/drm/drm_scatter.c
index 4f0f3b3..bf70431 100644
--- a/drivers/gpu/drm/drm_scatter.c
+++ b/drivers/gpu/drm/drm_scatter.c
@@ -41,7 +41,7 @@ 
 static inline void *drm_vmalloc_dma(unsigned long size)
 {
 #if defined(__powerpc__) && defined(CONFIG_NOT_COHERENT_CACHE)
-	return __vmalloc(size, GFP_KERNEL, PAGE_KERNEL | _PAGE_NO_CACHE);
+	return __vmalloc(size, GFP_KERNEL, pgprot_noncached_wc(PAGE_KERNEL));
 #else
 	return vmalloc_32(size);
 #endif
diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
index ac9f4b3..7e9f642 100644
--- a/drivers/gpu/drm/drm_vm.c
+++ b/drivers/gpu/drm/drm_vm.c
@@ -80,7 +80,7 @@  static pgprot_t drm_dma_prot(uint32_t map_type, struct vm_area_struct *vma)
 	pgprot_t tmp = vm_get_page_prot(vma->vm_flags);
 
 #if defined(__powerpc__) && defined(CONFIG_NOT_COHERENT_CACHE)
-	tmp |= _PAGE_NO_CACHE;
+	tmp = pgprot_noncached_wc(tmp);
 #endif
 	return tmp;
 }
@@ -593,7 +593,7 @@  static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
 			 * pages and mappings in fault()
 			 */
 #if defined(__powerpc__)
-			pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
+			vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 #endif
 			vma->vm_ops = &drm_vm_ops;
 			break;