aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc/kernel
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2014-04-09 13:49:28 -0400
committerHelge Deller <deller@gmx.de>2014-04-13 09:00:53 -0400
commit0ef36bd2b37815719e31a72d2beecc28ca8ecd26 (patch)
tree585481e9ab58d3354977ff611ec21457220b29d8 /arch/parisc/kernel
parent496252f787560df18a65fdc74dc3180f7cd2c723 (diff)
parisc: change value of SHMLBA from 0x00400000 to PAGE_SIZE
On parisc, SHMLBA was defined to 0x00400000 (4MB) to reflect that we need to take care of our caches for shared mappings. But actually, we can map a file at any multiple address of PAGE_SIZE, so let us correct that now with a value of PAGE_SIZE for SHMLBA. Instead we now take care of this cache colouring via the constant SHM_COLOUR while we map shared pages. Signed-off-by: Helge Deller <deller@gmx.de> CC: Jeroen Roovers <jer@gentoo.org> CC: John David Anglin <dave.anglin@bell.net> CC: Carlos O'Donell <carlos@systemhalted.org> Cc: stable@kernel.org [3.13+]
Diffstat (limited to 'arch/parisc/kernel')
-rw-r--r--arch/parisc/kernel/cache.c3
-rw-r--r--arch/parisc/kernel/sys_parisc.c14
2 files changed, 9 insertions, 8 deletions
diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
index a6ffc775a9f8..f6448c7c62b5 100644
--- a/arch/parisc/kernel/cache.c
+++ b/arch/parisc/kernel/cache.c
@@ -323,7 +323,8 @@ void flush_dcache_page(struct page *page)
323 * specifically accesses it, of course) */ 323 * specifically accesses it, of course) */
324 324
325 flush_tlb_page(mpnt, addr); 325 flush_tlb_page(mpnt, addr);
326 if (old_addr == 0 || (old_addr & (SHMLBA - 1)) != (addr & (SHMLBA - 1))) { 326 if (old_addr == 0 || (old_addr & (SHM_COLOUR - 1))
327 != (addr & (SHM_COLOUR - 1))) {
327 __flush_cache_page(mpnt, addr, page_to_phys(page)); 328 __flush_cache_page(mpnt, addr, page_to_phys(page));
328 if (old_addr) 329 if (old_addr)
329 printk(KERN_ERR "INEQUIVALENT ALIASES 0x%lx and 0x%lx in file %s\n", old_addr, addr, mpnt->vm_file ? (char *)mpnt->vm_file->f_path.dentry->d_name.name : "(null)"); 330 printk(KERN_ERR "INEQUIVALENT ALIASES 0x%lx and 0x%lx in file %s\n", old_addr, addr, mpnt->vm_file ? (char *)mpnt->vm_file->f_path.dentry->d_name.name : "(null)");
diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
index b7cadc4a06cd..31ffa9b55322 100644
--- a/arch/parisc/kernel/sys_parisc.c
+++ b/arch/parisc/kernel/sys_parisc.c
@@ -45,7 +45,7 @@
45 45
46static int get_offset(unsigned int last_mmap) 46static int get_offset(unsigned int last_mmap)
47{ 47{
48 return (last_mmap & (SHMLBA-1)) >> PAGE_SHIFT; 48 return (last_mmap & (SHM_COLOUR-1)) >> PAGE_SHIFT;
49} 49}
50 50
51static unsigned long shared_align_offset(unsigned int last_mmap, 51static unsigned long shared_align_offset(unsigned int last_mmap,
@@ -57,8 +57,8 @@ static unsigned long shared_align_offset(unsigned int last_mmap,
57static inline unsigned long COLOR_ALIGN(unsigned long addr, 57static inline unsigned long COLOR_ALIGN(unsigned long addr,
58 unsigned int last_mmap, unsigned long pgoff) 58 unsigned int last_mmap, unsigned long pgoff)
59{ 59{
60 unsigned long base = (addr+SHMLBA-1) & ~(SHMLBA-1); 60 unsigned long base = (addr+SHM_COLOUR-1) & ~(SHM_COLOUR-1);
61 unsigned long off = (SHMLBA-1) & 61 unsigned long off = (SHM_COLOUR-1) &
62 (shared_align_offset(last_mmap, pgoff) << PAGE_SHIFT); 62 (shared_align_offset(last_mmap, pgoff) << PAGE_SHIFT);
63 63
64 return base + off; 64 return base + off;
@@ -101,7 +101,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
101 if (flags & MAP_FIXED) { 101 if (flags & MAP_FIXED) {
102 if ((flags & MAP_SHARED) && last_mmap && 102 if ((flags & MAP_SHARED) && last_mmap &&
103 (addr - shared_align_offset(last_mmap, pgoff)) 103 (addr - shared_align_offset(last_mmap, pgoff))
104 & (SHMLBA - 1)) 104 & (SHM_COLOUR - 1))
105 return -EINVAL; 105 return -EINVAL;
106 goto found_addr; 106 goto found_addr;
107 } 107 }
@@ -122,7 +122,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
122 info.length = len; 122 info.length = len;
123 info.low_limit = mm->mmap_legacy_base; 123 info.low_limit = mm->mmap_legacy_base;
124 info.high_limit = mmap_upper_limit(); 124 info.high_limit = mmap_upper_limit();
125 info.align_mask = last_mmap ? (PAGE_MASK & (SHMLBA - 1)) : 0; 125 info.align_mask = last_mmap ? (PAGE_MASK & (SHM_COLOUR - 1)) : 0;
126 info.align_offset = shared_align_offset(last_mmap, pgoff); 126 info.align_offset = shared_align_offset(last_mmap, pgoff);
127 addr = vm_unmapped_area(&info); 127 addr = vm_unmapped_area(&info);
128 128
@@ -161,7 +161,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
161 if (flags & MAP_FIXED) { 161 if (flags & MAP_FIXED) {
162 if ((flags & MAP_SHARED) && last_mmap && 162 if ((flags & MAP_SHARED) && last_mmap &&
163 (addr - shared_align_offset(last_mmap, pgoff)) 163 (addr - shared_align_offset(last_mmap, pgoff))
164 & (SHMLBA - 1)) 164 & (SHM_COLOUR - 1))
165 return -EINVAL; 165 return -EINVAL;
166 goto found_addr; 166 goto found_addr;
167 } 167 }
@@ -182,7 +182,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
182 info.length = len; 182 info.length = len;
183 info.low_limit = PAGE_SIZE; 183 info.low_limit = PAGE_SIZE;
184 info.high_limit = mm->mmap_base; 184 info.high_limit = mm->mmap_base;
185 info.align_mask = last_mmap ? (PAGE_MASK & (SHMLBA - 1)) : 0; 185 info.align_mask = last_mmap ? (PAGE_MASK & (SHM_COLOUR - 1)) : 0;
186 info.align_offset = shared_align_offset(last_mmap, pgoff); 186 info.align_offset = shared_align_offset(last_mmap, pgoff);
187 addr = vm_unmapped_area(&info); 187 addr = vm_unmapped_area(&info);
188 if (!(addr & ~PAGE_MASK)) 188 if (!(addr & ~PAGE_MASK))