aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel
diff options
context:
space:
mode:
authorKhalid Aziz <khalid.aziz@oracle.com>2015-05-27 12:00:46 -0400
committerDavid S. Miller <davem@davemloft.net>2015-06-01 01:15:01 -0400
commit494e5b6faeda1d1e830a13e10b3c7bc323f35d97 (patch)
tree612e28b6b6678d133d960b9241401aa0e8ddc98d /arch/sparc/kernel
parentf0c1a1173773a56d500f1814893e63f97580f76a (diff)
sparc: Resolve conflict between sparc v9 and M7 on usage of bit 9 of TTE
sparc: Resolve conflict between sparc v9 and M7 on usage of bit 9 of TTE Bit 9 of TTE is CV (Cacheable in V-cache) on sparc v9 processor while the same bit 9 is MCDE (Memory Corruption Detection Enable) on M7 processor. This creates a conflicting usage of the same bit. Kernel sets TTE.cv bit on all pages for sun4v architecture which works well for sparc v9 but enables memory corruption detection on M7 processor which is not the intent. This patch adds code to determine if kernel is running on M7 processor and takes steps to not enable memory corruption detection in TTE erroneously. Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel')
-rw-r--r--arch/sparc/kernel/entry.h2
-rw-r--r--arch/sparc/kernel/setup_64.c21
-rw-r--r--arch/sparc/kernel/vmlinux.lds.S5
3 files changed, 28 insertions, 0 deletions
diff --git a/arch/sparc/kernel/entry.h b/arch/sparc/kernel/entry.h
index 07cc49e541f4..0f679421b468 100644
--- a/arch/sparc/kernel/entry.h
+++ b/arch/sparc/kernel/entry.h
@@ -69,6 +69,8 @@ void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *,
69 struct sun4v_1insn_patch_entry *); 69 struct sun4v_1insn_patch_entry *);
70void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *, 70void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *,
71 struct sun4v_2insn_patch_entry *); 71 struct sun4v_2insn_patch_entry *);
72void sun_m7_patch_2insn_range(struct sun4v_2insn_patch_entry *,
73 struct sun4v_2insn_patch_entry *);
72extern unsigned int dcache_parity_tl1_occurred; 74extern unsigned int dcache_parity_tl1_occurred;
73extern unsigned int icache_parity_tl1_occurred; 75extern unsigned int icache_parity_tl1_occurred;
74 76
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
index c38d19fc27ba..f7b261749383 100644
--- a/arch/sparc/kernel/setup_64.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -255,6 +255,24 @@ void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *start,
255 } 255 }
256} 256}
257 257
258void sun_m7_patch_2insn_range(struct sun4v_2insn_patch_entry *start,
259 struct sun4v_2insn_patch_entry *end)
260{
261 while (start < end) {
262 unsigned long addr = start->addr;
263
264 *(unsigned int *) (addr + 0) = start->insns[0];
265 wmb();
266 __asm__ __volatile__("flush %0" : : "r" (addr + 0));
267
268 *(unsigned int *) (addr + 4) = start->insns[1];
269 wmb();
270 __asm__ __volatile__("flush %0" : : "r" (addr + 4));
271
272 start++;
273 }
274}
275
258static void __init sun4v_patch(void) 276static void __init sun4v_patch(void)
259{ 277{
260 extern void sun4v_hvapi_init(void); 278 extern void sun4v_hvapi_init(void);
@@ -267,6 +285,9 @@ static void __init sun4v_patch(void)
267 285
268 sun4v_patch_2insn_range(&__sun4v_2insn_patch, 286 sun4v_patch_2insn_range(&__sun4v_2insn_patch,
269 &__sun4v_2insn_patch_end); 287 &__sun4v_2insn_patch_end);
288 if (sun4v_chip_type == SUN4V_CHIP_SPARC_M7)
289 sun_m7_patch_2insn_range(&__sun_m7_2insn_patch,
290 &__sun_m7_2insn_patch_end);
270 291
271 sun4v_hvapi_init(); 292 sun4v_hvapi_init();
272} 293}
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index 09243057cb0b..f1a2f688b28a 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -138,6 +138,11 @@ SECTIONS
138 *(.pause_3insn_patch) 138 *(.pause_3insn_patch)
139 __pause_3insn_patch_end = .; 139 __pause_3insn_patch_end = .;
140 } 140 }
141 .sun_m7_2insn_patch : {
142 __sun_m7_2insn_patch = .;
143 *(.sun_m7_2insn_patch)
144 __sun_m7_2insn_patch_end = .;
145 }
141 PERCPU_SECTION(SMP_CACHE_BYTES) 146 PERCPU_SECTION(SMP_CACHE_BYTES)
142 147
143 . = ALIGN(PAGE_SIZE); 148 . = ALIGN(PAGE_SIZE);