aboutsummaryrefslogtreecommitdiff
path: root/arch/mips/mm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/mm')
-rw-r--r--arch/mips/mm/c-r4k.c21
-rw-r--r--arch/mips/mm/init.c65
-rw-r--r--arch/mips/mm/pgtable.c2
-rw-r--r--arch/mips/mm/tlbex.c159
4 files changed, 124 insertions, 123 deletions
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 857b726f4d4..069803f58f3 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -578,7 +578,7 @@ static inline void local_r4k_flush_icache_page(void *args)
* secondary cache will result in any entries in the primary caches
* also getting invalidated which hopefully is a bit more economical.
*/
- if (cpu_has_subset_pcaches) {
+ if (cpu_has_inclusive_pcaches) {
unsigned long addr = (unsigned long) page_address(page);
r4k_blast_scache_page(addr);
@@ -634,7 +634,7 @@ static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
/* Catch bad driver code */
BUG_ON(size == 0);
- if (cpu_has_subset_pcaches) {
+ if (cpu_has_inclusive_pcaches) {
if (size >= scache_size)
r4k_blast_scache();
else
@@ -662,7 +662,7 @@ static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
/* Catch bad driver code */
BUG_ON(size == 0);
- if (cpu_has_subset_pcaches) {
+ if (cpu_has_inclusive_pcaches) {
if (size >= scache_size)
r4k_blast_scache();
else
@@ -862,15 +862,18 @@ static void __init probe_pcache(void)
break;
case CPU_VR4133:
- write_c0_config(config & ~CONF_EB);
+ write_c0_config(config & ~VR41_CONF_P4K);
case CPU_VR4131:
/* Workaround for cache instruction bug of VR4131 */
if (c->processor_id == 0x0c80U || c->processor_id == 0x0c81U ||
c->processor_id == 0x0c82U) {
- config &= ~0x00000030U;
- config |= 0x00410000U;
+ config |= 0x00400000U;
+ if (c->processor_id == 0x0c80U)
+ config |= VR41_CONF_BP;
write_c0_config(config);
- }
+ } else
+ c->options |= MIPS_CPU_CACHE_CDEX_P;
+
icache_size = 1 << (10 + ((config & CONF_IC) >> 9));
c->icache.linesz = 16 << ((config & CONF_IB) >> 5);
c->icache.ways = 2;
@@ -880,8 +883,6 @@ static void __init probe_pcache(void)
c->dcache.linesz = 16 << ((config & CONF_DB) >> 4);
c->dcache.ways = 2;
c->dcache.waybit = __ffs(dcache_size/2);
-
- c->options |= MIPS_CPU_CACHE_CDEX_P;
break;
case CPU_VR41XX:
@@ -1192,7 +1193,7 @@ static void __init setup_scache(void)
printk("Unified secondary cache %ldkB %s, linesize %d bytes.\n",
scache_size >> 10, way_string[c->scache.ways], c->scache.linesz);
- c->options |= MIPS_CPU_SUBSET_CACHES;
+ c->options |= MIPS_CPU_INCLUSIVE_CACHES;
}
void au1x00_fixup_config_od(void)
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 802bdd32aa2..c52497bb102 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -139,10 +139,36 @@ void __init fixrange_init(unsigned long start, unsigned long end,
#ifndef CONFIG_NEED_MULTIPLE_NODES
extern void pagetable_init(void);
+static int __init page_is_ram(unsigned long pagenr)
+{
+ int i;
+
+ for (i = 0; i < boot_mem_map.nr_map; i++) {
+ unsigned long addr, end;
+
+ if (boot_mem_map.map[i].type != BOOT_MEM_RAM)
+ /* not usable memory */
+ continue;
+
+ addr = PFN_UP(boot_mem_map.map[i].addr);
+ end = PFN_DOWN(boot_mem_map.map[i].addr +
+ boot_mem_map.map[i].size);
+
+ if (pagenr >= addr && pagenr < end)
+ return 1;
+ }
+
+ return 0;
+}
+
void __init paging_init(void)
{
- unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+ unsigned long zones_size[] = { [0 ... MAX_NR_ZONES - 1] = 0 };
unsigned long max_dma, high, low;
+#ifndef CONFIG_FLATMEM
+ unsigned long zholes_size[] = { [0 ... MAX_NR_ZONES - 1] = 0 };
+ unsigned long i, j, pfn;
+#endif
pagetable_init();
@@ -174,29 +200,16 @@ void __init paging_init(void)
zones_size[ZONE_HIGHMEM] = high - low;
#endif
+#ifdef CONFIG_FLATMEM
free_area_init(zones_size);
-}
-
-static inline int page_is_ram(unsigned long pagenr)
-{
- int i;
-
- for (i = 0; i < boot_mem_map.nr_map; i++) {
- unsigned long addr, end;
-
- if (boot_mem_map.map[i].type != BOOT_MEM_RAM)
- /* not usable memory */
- continue;
-
- addr = PFN_UP(boot_mem_map.map[i].addr);
- end = PFN_DOWN(boot_mem_map.map[i].addr +
- boot_mem_map.map[i].size);
-
- if (pagenr >= addr && pagenr < end)
- return 1;
- }
-
- return 0;
+#else
+ pfn = 0;
+ for (i = 0; i < MAX_NR_ZONES; i++)
+ for (j = 0; j < zones_size[i]; j++, pfn++)
+ if (!page_is_ram(pfn))
+ zholes_size[i]++;
+ free_area_init_node(0, NODE_DATA(0), zones_size, 0, zholes_size);
+#endif
}
static struct kcore_list kcore_mem, kcore_vmalloc;
@@ -213,9 +226,9 @@ void __init mem_init(void)
#ifdef CONFIG_DISCONTIGMEM
#error "CONFIG_HIGHMEM and CONFIG_DISCONTIGMEM dont work together yet"
#endif
- max_mapnr = num_physpages = highend_pfn;
+ max_mapnr = highend_pfn;
#else
- max_mapnr = num_physpages = max_low_pfn;
+ max_mapnr = max_low_pfn;
#endif
high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
@@ -229,6 +242,7 @@ void __init mem_init(void)
if (PageReserved(pfn_to_page(tmp)))
reservedpages++;
}
+ num_physpages = ram;
#ifdef CONFIG_HIGHMEM
for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) {
@@ -247,6 +261,7 @@ void __init mem_init(void)
totalhigh_pages++;
}
totalram_pages += totalhigh_pages;
+ num_physpages += totalhigh_pages;
#endif
codesize = (unsigned long) &_etext - (unsigned long) &_text;
diff --git a/arch/mips/mm/pgtable.c b/arch/mips/mm/pgtable.c
index 792c6eb4423..c93aa6cbcac 100644
--- a/arch/mips/mm/pgtable.c
+++ b/arch/mips/mm/pgtable.c
@@ -15,6 +15,8 @@ void show_mem(void)
printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
pfn = max_mapnr;
while (pfn-- > 0) {
+ if (!pfn_valid(pfn))
+ continue;
page = pfn_to_page(pfn);
total++;
if (PageHighMem(page))
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index e1a8139fc8f..375e0991505 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -5,7 +5,7 @@
*
* Synthesize TLB refill handlers at runtime.
*
- * Copyright (C) 2004,2005 by Thiemo Seufer
+ * Copyright (C) 2004,2005,2006 by Thiemo Seufer
* Copyright (C) 2005 Maciej W. Rozycki
* Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org)
*
@@ -35,8 +35,6 @@
#include <asm/smp.h>
#include <asm/war.h>
-/* #define DEBUG_TLB */
-
static __init int __attribute__((unused)) r45k_bvahwbug(void)
{
/* XXX: We should probe for the presence of this bug, but we don't. */
@@ -728,6 +726,7 @@ static void __init build_r3000_tlb_refill_handler(void)
{
long pgdc = (long)pgd_current;
u32 *p;
+ int i;
memset(tlb_handler, 0, sizeof(tlb_handler));
p = tlb_handler;
@@ -753,16 +752,14 @@ static void __init build_r3000_tlb_refill_handler(void)
if (p > tlb_handler + 32)
panic("TLB refill handler space exceeded");
- printk("Synthesized TLB refill handler (%u instructions).\n",
- (unsigned int)(p - tlb_handler));
-#ifdef DEBUG_TLB
- {
- int i;
+ pr_info("Synthesized TLB refill handler (%u instructions).\n",
+ (unsigned int)(p - tlb_handler));
- for (i = 0; i < (p - tlb_handler); i++)
- printk("%08x\n", tlb_handler[i]);
- }
-#endif
+ pr_debug("\t.set push\n");
+ pr_debug("\t.set noreorder\n");
+ for (i = 0; i < (p - tlb_handler); i++)
+ pr_debug("\t.word 0x%08x\n", tlb_handler[i]);
+ pr_debug("\t.set pop\n");
memcpy((void *)ebase, tlb_handler, 0x80);
}
@@ -1175,6 +1172,7 @@ static void __init build_r4000_tlb_refill_handler(void)
struct reloc *r = relocs;
u32 *f;
unsigned int final_len;
+ int i;
memset(tlb_handler, 0, sizeof(tlb_handler));
memset(labels, 0, sizeof(labels));
@@ -1272,24 +1270,21 @@ static void __init build_r4000_tlb_refill_handler(void)
#endif /* CONFIG_64BIT */
resolve_relocs(relocs, labels);
- printk("Synthesized TLB refill handler (%u instructions).\n",
- final_len);
-
-#ifdef DEBUG_TLB
- {
- int i;
+ pr_info("Synthesized TLB refill handler (%u instructions).\n",
+ final_len);
- f = final_handler;
+ f = final_handler;
#ifdef CONFIG_64BIT
- if (final_len > 32)
- final_len = 64;
- else
- f = final_handler + 32;
+ if (final_len > 32)
+ final_len = 64;
+ else
+ f = final_handler + 32;
#endif /* CONFIG_64BIT */
- for (i = 0; i < final_len; i++)
- printk("%08x\n", f[i]);
- }
-#endif
+ pr_debug("\t.set push\n");
+ pr_debug("\t.set noreorder\n");
+ for (i = 0; i < final_len; i++)
+ pr_debug("\t.word 0x%08x\n", f[i]);
+ pr_debug("\t.set pop\n");
memcpy((void *)ebase, final_handler, 0x100);
}
@@ -1522,6 +1517,7 @@ static void __init build_r3000_tlb_load_handler(void)
u32 *p = handle_tlbl;
struct label *l = labels;
struct reloc *r = relocs;
+ int i;
memset(handle_tlbl, 0, sizeof(handle_tlbl));
memset(labels, 0, sizeof(labels));
@@ -1541,17 +1537,14 @@ static void __init build_r3000_tlb_load_handler(void)
panic("TLB load handler fastpath space exceeded");
resolve_relocs(relocs, labels);
- printk("Synthesized TLB load handler fastpath (%u instructions).\n",
- (unsigned int)(p - handle_tlbl));
-
-#ifdef DEBUG_TLB
- {
- int i;
+ pr_info("Synthesized TLB load handler fastpath (%u instructions).\n",
+ (unsigned int)(p - handle_tlbl));
- for (i = 0; i < (p - handle_tlbl); i++)
- printk("%08x\n", handle_tlbl[i]);
- }
-#endif
+ pr_debug("\t.set push\n");
+ pr_debug("\t.set noreorder\n");
+ for (i = 0; i < (p - handle_tlbl); i++)
+ pr_debug("\t.word 0x%08x\n", handle_tlbl[i]);
+ pr_debug("\t.set pop\n");
}
static void __init build_r3000_tlb_store_handler(void)
@@ -1559,6 +1552,7 @@ static void __init build_r3000_tlb_store_handler(void)
u32 *p = handle_tlbs;
struct label *l = labels;
struct reloc *r = relocs;
+ int i;
memset(handle_tlbs, 0, sizeof(handle_tlbs));
memset(labels, 0, sizeof(labels));
@@ -1578,17 +1572,14 @@ static void __init build_r3000_tlb_store_handler(void)
panic("TLB store handler fastpath space exceeded");
resolve_relocs(relocs, labels);
- printk("Synthesized TLB store handler fastpath (%u instructions).\n",
- (unsigned int)(p - handle_tlbs));
+ pr_info("Synthesized TLB store handler fastpath (%u instructions).\n",
+ (unsigned int)(p - handle_tlbs));
-#ifdef DEBUG_TLB
- {
- int i;
-
- for (i = 0; i < (p - handle_tlbs); i++)
- printk("%08x\n", handle_tlbs[i]);
- }
-#endif
+ pr_debug("\t.set push\n");
+ pr_debug("\t.set noreorder\n");
+ for (i = 0; i < (p - handle_tlbs); i++)
+ pr_debug("\t.word 0x%08x\n", handle_tlbs[i]);
+ pr_debug("\t.set pop\n");
}
static void __init build_r3000_tlb_modify_handler(void)
@@ -1596,6 +1587,7 @@ static void __init build_r3000_tlb_modify_handler(void)
u32 *p = handle_tlbm;
struct label *l = labels;
struct reloc *r = relocs;
+ int i;
memset(handle_tlbm, 0, sizeof(handle_tlbm));
memset(labels, 0, sizeof(labels));
@@ -1615,17 +1607,14 @@ static void __init build_r3000_tlb_modify_handler(void)
panic("TLB modify handler fastpath space exceeded");
resolve_relocs(relocs, labels);
- printk("Synthesized TLB modify handler fastpath (%u instructions).\n",
- (unsigned int)(p - handle_tlbm));
+ pr_info("Synthesized TLB modify handler fastpath (%u instructions).\n",
+ (unsigned int)(p - handle_tlbm));
-#ifdef DEBUG_TLB
- {
- int i;
-
- for (i = 0; i < (p - handle_tlbm); i++)
- printk("%08x\n", handle_tlbm[i]);
- }
-#endif
+ pr_debug("\t.set push\n");
+ pr_debug("\t.set noreorder\n");
+ for (i = 0; i < (p - handle_tlbm); i++)
+ pr_debug("\t.word 0x%08x\n", handle_tlbm[i]);
+ pr_debug("\t.set pop\n");
}
/*
@@ -1677,6 +1666,7 @@ static void __init build_r4000_tlb_load_handler(void)
u32 *p = handle_tlbl;
struct label *l = labels;
struct reloc *r = relocs;
+ int i;
memset(handle_tlbl, 0, sizeof(handle_tlbl));
memset(labels, 0, sizeof(labels));
@@ -1704,17 +1694,14 @@ static void __init build_r4000_tlb_load_handler(void)
panic("TLB load handler fastpath space exceeded");
resolve_relocs(relocs, labels);
- printk("Synthesized TLB load handler fastpath (%u instructions).\n",
- (unsigned int)(p - handle_tlbl));
-
-#ifdef DEBUG_TLB
- {
- int i;
+ pr_info("Synthesized TLB load handler fastpath (%u instructions).\n",
+ (unsigned int)(p - handle_tlbl));
- for (i = 0; i < (p - handle_tlbl); i++)
- printk("%08x\n", handle_tlbl[i]);
- }
-#endif
+ pr_debug("\t.set push\n");
+ pr_debug("\t.set noreorder\n");
+ for (i = 0; i < (p - handle_tlbl); i++)
+ pr_debug("\t.word 0x%08x\n", handle_tlbl[i]);
+ pr_debug("\t.set pop\n");
}
static void __init build_r4000_tlb_store_handler(void)
@@ -1722,6 +1709,7 @@ static void __init build_r4000_tlb_store_handler(void)
u32 *p = handle_tlbs;
struct label *l = labels;
struct reloc *r = relocs;
+ int i;
memset(handle_tlbs, 0, sizeof(handle_tlbs));
memset(labels, 0, sizeof(labels));
@@ -1740,17 +1728,14 @@ static void __init build_r4000_tlb_store_handler(void)
panic("TLB store handler fastpath space exceeded");
resolve_relocs(relocs, labels);
- printk("Synthesized TLB store handler fastpath (%u instructions).\n",
- (unsigned int)(p - handle_tlbs));
-
-#ifdef DEBUG_TLB
- {
- int i;
+ pr_info("Synthesized TLB store handler fastpath (%u instructions).\n",
+ (unsigned int)(p - handle_tlbs));
- for (i = 0; i < (p - handle_tlbs); i++)
- printk("%08x\n", handle_tlbs[i]);
- }
-#endif
+ pr_debug("\t.set push\n");
+ pr_debug("\t.set noreorder\n");
+ for (i = 0; i < (p - handle_tlbs); i++)
+ pr_debug("\t.word 0x%08x\n", handle_tlbs[i]);
+ pr_debug("\t.set pop\n");
}
static void __init build_r4000_tlb_modify_handler(void)
@@ -1758,6 +1743,7 @@ static void __init build_r4000_tlb_modify_handler(void)
u32 *p = handle_tlbm;
struct label *l = labels;
struct reloc *r = relocs;
+ int i;
memset(handle_tlbm, 0, sizeof(handle_tlbm));
memset(labels, 0, sizeof(labels));
@@ -1777,17 +1763,14 @@ static void __init build_r4000_tlb_modify_handler(void)
panic("TLB modify handler fastpath space exceeded");
resolve_relocs(relocs, labels);
- printk("Synthesized TLB modify handler fastpath (%u instructions).\n",
- (unsigned int)(p - handle_tlbm));
-
-#ifdef DEBUG_TLB
- {
- int i;
-
- for (i = 0; i < (p - handle_tlbm); i++)
- printk("%08x\n", handle_tlbm[i]);
- }
-#endif
+ pr_info("Synthesized TLB modify handler fastpath (%u instructions).\n",
+ (unsigned int)(p - handle_tlbm));
+
+ pr_debug("\t.set push\n");
+ pr_debug("\t.set noreorder\n");
+ for (i = 0; i < (p - handle_tlbm); i++)
+ pr_debug("\t.word 0x%08x\n", handle_tlbm[i]);
+ pr_debug("\t.set pop\n");
}
void __init build_tlb_refill_handler(void)