[POWERPC] spufs: use correct pg_prot for mapping SPU local store

This hopefully fixes a long-standing bug in the spu file system.
An spu context comes with local memory that can be either saved
in kernel pages or point directly to a physical SPE.

When mapping the physical SPE, that mapping needs to be cache-inhibited.
For simplicity, we used to map the kernel backing memory that way
too, but unfortunately that was not only inefficient, but also incorrect
because the same page could then be accessed simultaneously through
a cacheable and a cache-inhibited mapping, which is not allowed
by the powerpc specification and in our case caused data inconsistency
for which we did a really ugly workaround in user space.

Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>

authored by Arnd Bergmann and committed by Paul Mackerras ac91cb8d 6263203e

+7 -3
+7 -3
arch/powerpc/platforms/cell/spufs/file.c
··· 102 103 spu_acquire(ctx); 104 105 - if (ctx->state == SPU_STATE_SAVED) 106 page = vmalloc_to_page(ctx->csa.lscsa->ls + offset); 107 - else 108 page = pfn_to_page((ctx->spu->local_store_phys + offset) 109 >> PAGE_SHIFT); 110 - 111 spu_release(ctx); 112 113 if (type)
··· 102 103 spu_acquire(ctx); 104 105 + if (ctx->state == SPU_STATE_SAVED) { 106 + vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 107 + & ~(_PAGE_NO_CACHE | _PAGE_GUARDED)); 108 page = vmalloc_to_page(ctx->csa.lscsa->ls + offset); 109 + } else { 110 + vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 111 + | _PAGE_NO_CACHE | _PAGE_GUARDED); 112 page = pfn_to_page((ctx->spu->local_store_phys + offset) 113 >> PAGE_SHIFT); 114 + } 115 spu_release(ctx); 116 117 if (type)