aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/mm')
-rw-r--r--arch/mips/mm/c-octeon.c14
-rw-r--r--arch/mips/mm/dma-default.c18
-rw-r--r--arch/mips/mm/gup.c3
-rw-r--r--arch/mips/mm/init.c1
-rw-r--r--arch/mips/mm/tlb-funcs.S2
-rw-r--r--arch/mips/mm/tlbex.c2
6 files changed, 32 insertions, 8 deletions
diff --git a/arch/mips/mm/c-octeon.c b/arch/mips/mm/c-octeon.c
index a0bcdbb81d41..729e7702b1de 100644
--- a/arch/mips/mm/c-octeon.c
+++ b/arch/mips/mm/c-octeon.c
@@ -224,6 +224,20 @@ static void probe_octeon(void)
224 c->options |= MIPS_CPU_PREFETCH; 224 c->options |= MIPS_CPU_PREFETCH;
225 break; 225 break;
226 226
227 case CPU_CAVIUM_OCTEON3:
228 c->icache.linesz = 128;
229 c->icache.sets = 16;
230 c->icache.ways = 39;
231 c->icache.flags |= MIPS_CACHE_VTAG;
232 icache_size = c->icache.sets * c->icache.ways * c->icache.linesz;
233
234 c->dcache.linesz = 128;
235 c->dcache.ways = 32;
236 c->dcache.sets = 8;
237 dcache_size = c->dcache.sets * c->dcache.ways * c->dcache.linesz;
238 c->options |= MIPS_CPU_PREFETCH;
239 break;
240
227 default: 241 default:
228 panic("Unsupported Cavium Networks CPU type"); 242 panic("Unsupported Cavium Networks CPU type");
229 break; 243 break;
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index aaccf1c10699..664e523653d0 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -50,16 +50,20 @@ static inline struct page *dma_addr_to_page(struct device *dev,
50} 50}
51 51
52/* 52/*
53 * The affected CPUs below in 'cpu_needs_post_dma_flush()' can
54 * speculatively fill random cachelines with stale data at any time,
55 * requiring an extra flush post-DMA.
56 *
53 * Warning on the terminology - Linux calls an uncached area coherent; 57 * Warning on the terminology - Linux calls an uncached area coherent;
54 * MIPS terminology calls memory areas with hardware maintained coherency 58 * MIPS terminology calls memory areas with hardware maintained coherency
55 * coherent. 59 * coherent.
56 */ 60 */
57 61static inline int cpu_needs_post_dma_flush(struct device *dev)
58static inline int cpu_is_noncoherent_r10000(struct device *dev)
59{ 62{
60 return !plat_device_is_coherent(dev) && 63 return !plat_device_is_coherent(dev) &&
61 (current_cpu_type() == CPU_R10000 || 64 (boot_cpu_type() == CPU_R10000 ||
62 current_cpu_type() == CPU_R12000); 65 boot_cpu_type() == CPU_R12000 ||
66 boot_cpu_type() == CPU_BMIPS5000);
63} 67}
64 68
65static gfp_t massage_gfp_flags(const struct device *dev, gfp_t gfp) 69static gfp_t massage_gfp_flags(const struct device *dev, gfp_t gfp)
@@ -230,7 +234,7 @@ static inline void __dma_sync(struct page *page,
230static void mips_dma_unmap_page(struct device *dev, dma_addr_t dma_addr, 234static void mips_dma_unmap_page(struct device *dev, dma_addr_t dma_addr,
231 size_t size, enum dma_data_direction direction, struct dma_attrs *attrs) 235 size_t size, enum dma_data_direction direction, struct dma_attrs *attrs)
232{ 236{
233 if (cpu_is_noncoherent_r10000(dev)) 237 if (cpu_needs_post_dma_flush(dev))
234 __dma_sync(dma_addr_to_page(dev, dma_addr), 238 __dma_sync(dma_addr_to_page(dev, dma_addr),
235 dma_addr & ~PAGE_MASK, size, direction); 239 dma_addr & ~PAGE_MASK, size, direction);
236 240
@@ -284,7 +288,7 @@ static void mips_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
284static void mips_dma_sync_single_for_cpu(struct device *dev, 288static void mips_dma_sync_single_for_cpu(struct device *dev,
285 dma_addr_t dma_handle, size_t size, enum dma_data_direction direction) 289 dma_addr_t dma_handle, size_t size, enum dma_data_direction direction)
286{ 290{
287 if (cpu_is_noncoherent_r10000(dev)) 291 if (cpu_needs_post_dma_flush(dev))
288 __dma_sync(dma_addr_to_page(dev, dma_handle), 292 __dma_sync(dma_addr_to_page(dev, dma_handle),
289 dma_handle & ~PAGE_MASK, size, direction); 293 dma_handle & ~PAGE_MASK, size, direction);
290} 294}
@@ -305,7 +309,7 @@ static void mips_dma_sync_sg_for_cpu(struct device *dev,
305 309
306 /* Make sure that gcc doesn't leave the empty loop body. */ 310 /* Make sure that gcc doesn't leave the empty loop body. */
307 for (i = 0; i < nelems; i++, sg++) { 311 for (i = 0; i < nelems; i++, sg++) {
308 if (cpu_is_noncoherent_r10000(dev)) 312 if (cpu_needs_post_dma_flush(dev))
309 __dma_sync(sg_page(sg), sg->offset, sg->length, 313 __dma_sync(sg_page(sg), sg->offset, sg->length,
310 direction); 314 direction);
311 } 315 }
diff --git a/arch/mips/mm/gup.c b/arch/mips/mm/gup.c
index d4ea5c9c4a93..06ce17c2a905 100644
--- a/arch/mips/mm/gup.c
+++ b/arch/mips/mm/gup.c
@@ -12,6 +12,7 @@
12#include <linux/swap.h> 12#include <linux/swap.h>
13#include <linux/hugetlb.h> 13#include <linux/hugetlb.h>
14 14
15#include <asm/cpu-features.h>
15#include <asm/pgtable.h> 16#include <asm/pgtable.h>
16 17
17static inline pte_t gup_get_pte(pte_t *ptep) 18static inline pte_t gup_get_pte(pte_t *ptep)
@@ -273,7 +274,7 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
273 len = (unsigned long) nr_pages << PAGE_SHIFT; 274 len = (unsigned long) nr_pages << PAGE_SHIFT;
274 275
275 end = start + len; 276 end = start + len;
276 if (end < start) 277 if (end < start || cpu_has_dc_aliases)
277 goto slow_irqon; 278 goto slow_irqon;
278 279
279 /* XXX: batch / limit 'nr' */ 280 /* XXX: batch / limit 'nr' */
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 4e73f10a7519..e205ef598e97 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -254,6 +254,7 @@ void copy_from_user_page(struct vm_area_struct *vma,
254 SetPageDcacheDirty(page); 254 SetPageDcacheDirty(page);
255 } 255 }
256} 256}
257EXPORT_SYMBOL_GPL(copy_from_user_page);
257 258
258void __init fixrange_init(unsigned long start, unsigned long end, 259void __init fixrange_init(unsigned long start, unsigned long end,
259 pgd_t *pgd_base) 260 pgd_t *pgd_base)
diff --git a/arch/mips/mm/tlb-funcs.S b/arch/mips/mm/tlb-funcs.S
index 30a494db99c2..79bca3130bd1 100644
--- a/arch/mips/mm/tlb-funcs.S
+++ b/arch/mips/mm/tlb-funcs.S
@@ -16,10 +16,12 @@
16 16
17#define FASTPATH_SIZE 128 17#define FASTPATH_SIZE 128
18 18
19#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
19LEAF(tlbmiss_handler_setup_pgd) 20LEAF(tlbmiss_handler_setup_pgd)
20 .space 16 * 4 21 .space 16 * 4
21END(tlbmiss_handler_setup_pgd) 22END(tlbmiss_handler_setup_pgd)
22EXPORT(tlbmiss_handler_setup_pgd_end) 23EXPORT(tlbmiss_handler_setup_pgd_end)
24#endif
23 25
24LEAF(handle_tlbm) 26LEAF(handle_tlbm)
25 .space FASTPATH_SIZE * 4 27 .space FASTPATH_SIZE * 4
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 556cb4815770..821b45175dc1 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -85,6 +85,7 @@ static int use_bbit_insns(void)
85 case CPU_CAVIUM_OCTEON: 85 case CPU_CAVIUM_OCTEON:
86 case CPU_CAVIUM_OCTEON_PLUS: 86 case CPU_CAVIUM_OCTEON_PLUS:
87 case CPU_CAVIUM_OCTEON2: 87 case CPU_CAVIUM_OCTEON2:
88 case CPU_CAVIUM_OCTEON3:
88 return 1; 89 return 1;
89 default: 90 default:
90 return 0; 91 return 0;
@@ -95,6 +96,7 @@ static int use_lwx_insns(void)
95{ 96{
96 switch (current_cpu_type()) { 97 switch (current_cpu_type()) {
97 case CPU_CAVIUM_OCTEON2: 98 case CPU_CAVIUM_OCTEON2:
99 case CPU_CAVIUM_OCTEON3:
98 return 1; 100 return 1;
99 default: 101 default:
100 return 0; 102 return 0;