]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
sh: Fix up more 64-bit pgprot truncation on SH-X2 TLB.
authorPaul Mundt <lethal@linux-sh.org>
Wed, 17 Feb 2010 04:23:00 +0000 (13:23 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Wed, 17 Feb 2010 04:23:00 +0000 (13:23 +0900)
Both the store queue API and the PMB remapping take unsigned long for
their pgprot flags, which cuts off the extended protection bits. In the
case of the PMB this isn't really a problem since the cache attribute
bits that we care about are all in the lower 32-bits, but we do it just
to be safe. The store queue remapping on the other hand depends on the
extended prot bits for enabling userspace access to the mappings.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/include/asm/mmu.h
arch/sh/include/cpu-sh4/cpu/sq.h
arch/sh/kernel/cpu/sh4/sq.c
arch/sh/mm/ioremap.c
arch/sh/mm/pmb.c
drivers/video/pvr2fb.c

index 2fcbedb550027e3da6de01f9e9eae6a51805c054..151bc922701bb47d5a8f5d97cb13357c303203cf 100644 (file)
@@ -33,6 +33,7 @@
 #ifndef __ASSEMBLY__
 #include <linux/errno.h>
 #include <linux/threads.h>
+#include <asm/page.h>
 
 /* Default "unsigned long" context */
 typedef unsigned long mm_context_id_t[NR_CPUS];
@@ -71,13 +72,13 @@ struct pmb_entry {
 #ifdef CONFIG_PMB
 /* arch/sh/mm/pmb.c */
 long pmb_remap(unsigned long virt, unsigned long phys,
-              unsigned long size, unsigned long flags);
+              unsigned long size, pgprot_t prot);
 void pmb_unmap(unsigned long addr);
 int pmb_init(void);
 bool __in_29bit_mode(void);
 #else
 static inline long pmb_remap(unsigned long virt, unsigned long phys,
-                            unsigned long size, unsigned long flags)
+                            unsigned long size, pgprot_t prot)
 {
        return -EINVAL;
 }
index 586d6491816aed1fa0741eeaffeab31fb4eb0586..74716ba2dc3cd3fb1cb3135c25689401e6dcf3ca 100644 (file)
@@ -12,6 +12,7 @@
 #define __ASM_CPU_SH4_SQ_H
 
 #include <asm/addrspace.h>
+#include <asm/page.h>
 
 /*
  * Store queues range from e0000000-e3fffffc, allowing approx. 64MB to be
@@ -28,7 +29,7 @@
 
 /* arch/sh/kernel/cpu/sh4/sq.c */
 unsigned long sq_remap(unsigned long phys, unsigned int size,
-                      const char *name, unsigned long flags);
+                      const char *name, pgprot_t prot);
 void sq_unmap(unsigned long vaddr);
 void sq_flush_range(unsigned long start, unsigned int len);
 
index 97aea9d69b00bf2ebf2b47b53e5301124fbac9b7..fc065f9da6e557cd66376535497cf071f2df4148 100644 (file)
@@ -100,7 +100,7 @@ static inline void sq_mapping_list_del(struct sq_mapping *map)
        spin_unlock_irq(&sq_mapping_lock);
 }
 
-static int __sq_remap(struct sq_mapping *map, unsigned long flags)
+static int __sq_remap(struct sq_mapping *map, pgprot_t prot)
 {
 #if defined(CONFIG_MMU)
        struct vm_struct *vma;
@@ -113,7 +113,7 @@ static int __sq_remap(struct sq_mapping *map, unsigned long flags)
 
        if (ioremap_page_range((unsigned long)vma->addr,
                               (unsigned long)vma->addr + map->size,
-                              vma->phys_addr, __pgprot(flags))) {
+                              vma->phys_addr, prot)) {
                vunmap(vma->addr);
                return -EAGAIN;
        }
@@ -135,14 +135,14 @@ static int __sq_remap(struct sq_mapping *map, unsigned long flags)
  * @phys: Physical address of mapping.
  * @size: Length of mapping.
  * @name: User invoking mapping.
- * @flags: Protection flags.
+ * @prot: Protection bits.
  *
  * Remaps the physical address @phys through the next available store queue
  * address of @size length. @name is logged at boot time as well as through
  * the sysfs interface.
  */
 unsigned long sq_remap(unsigned long phys, unsigned int size,
-                      const char *name, unsigned long flags)
+                      const char *name, pgprot_t prot)
 {
        struct sq_mapping *map;
        unsigned long end;
@@ -177,7 +177,7 @@ unsigned long sq_remap(unsigned long phys, unsigned int size,
 
        map->sq_addr = P4SEG_STORE_QUE + (page << PAGE_SHIFT);
 
-       ret = __sq_remap(map, pgprot_val(PAGE_KERNEL_NOCACHE) | flags);
+       ret = __sq_remap(map, prot);
        if (unlikely(ret != 0))
                goto out;
 
@@ -309,8 +309,7 @@ static ssize_t mapping_store(const char *buf, size_t count)
                return -EIO;
 
        if (likely(len)) {
-               int ret = sq_remap(base, len, "Userspace",
-                                  pgprot_val(PAGE_SHARED));
+               int ret = sq_remap(base, len, "Userspace", PAGE_SHARED);
                if (ret < 0)
                        return ret;
        } else
index 94583c5da85553a328f33e747d0605fcf90a188b..c68d2d7d00a96343e7ab9efee4c7287e02af03f4 100644 (file)
@@ -80,7 +80,7 @@ __ioremap_caller(unsigned long phys_addr, unsigned long size,
        if (unlikely(phys_addr >= P1SEG)) {
                unsigned long mapped;
 
-               mapped = pmb_remap(addr, phys_addr, size, pgprot_val(pgprot));
+               mapped = pmb_remap(addr, phys_addr, size, pgprot);
                if (likely(mapped)) {
                        addr            += mapped;
                        phys_addr       += mapped;
index f822f83418e40723327f87dd9a70d14e0cda06df..509a444a30ab11365d64d8629ceb1ddda754a35f 100644 (file)
@@ -24,6 +24,7 @@
 #include <asm/system.h>
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
+#include <asm/page.h>
 #include <asm/mmu.h>
 #include <asm/io.h>
 #include <asm/mmu_context.h>
@@ -166,12 +167,15 @@ static struct {
 };
 
 long pmb_remap(unsigned long vaddr, unsigned long phys,
-              unsigned long size, unsigned long flags)
+              unsigned long size, pgprot_t prot)
 {
        struct pmb_entry *pmbp, *pmbe;
        unsigned long wanted;
        int pmb_flags, i;
        long err;
+       u64 flags;
+
+       flags = pgprot_val(prot);
 
        /* Convert typical pgprot value to the PMB equivalent */
        if (flags & _PAGE_CACHABLE) {
index 53f8f1100e81c671cc63c10814467dcb1e0275d9..f9975100d56d3f311e812c71ad4cd8219e0a797f 100644 (file)
@@ -831,7 +831,7 @@ static int __devinit pvr2fb_common_init(void)
        printk(KERN_NOTICE "fb%d: registering with SQ API\n", fb_info->node);
 
        pvr2fb_map = sq_remap(fb_info->fix.smem_start, fb_info->fix.smem_len,
-                             fb_info->fix.id, pgprot_val(PAGE_SHARED));
+                             fb_info->fix.id, PAGE_SHARED);
 
        printk(KERN_NOTICE "fb%d: Mapped video memory to SQ addr 0x%lx\n",
               fb_info->node, pvr2fb_map);