diff options
author | Chris Metcalf <cmetcalf@tilera.com> | 2010-10-14 16:23:03 -0400 |
---|---|---|
committer | Chris Metcalf <cmetcalf@tilera.com> | 2010-10-15 15:38:09 -0400 |
commit | a78c942df64ef4cf495fd4d8715e48501bd7f8a4 (patch) | |
tree | fe44212d36e6ca23dbe9f2c633824389216a3d1d /arch/tile/kernel | |
parent | bf65e440e8248f22b2eacf8d47961bb9d52260f7 (diff) |
arch/tile: parameterize system PLs to support KVM port
While not a port to KVM (yet), this change modifies the kernel
to be able to build either at PL1 or at PL2 with a suitable
config switch. Pushing up this change avoids handling branch
merge issues going forward with the KVM work.
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch/tile/kernel')
-rw-r--r-- | arch/tile/kernel/entry.S | 12 | ||||
-rw-r--r-- | arch/tile/kernel/head_32.S | 5 | ||||
-rw-r--r-- | arch/tile/kernel/intvec_32.S | 67 | ||||
-rw-r--r-- | arch/tile/kernel/irq.c | 16 | ||||
-rw-r--r-- | arch/tile/kernel/messaging.c | 2 | ||||
-rw-r--r-- | arch/tile/kernel/process.c | 12 | ||||
-rw-r--r-- | arch/tile/kernel/regs_32.S | 2 | ||||
-rw-r--r-- | arch/tile/kernel/setup.c | 28 | ||||
-rw-r--r-- | arch/tile/kernel/smp.c | 2 | ||||
-rw-r--r-- | arch/tile/kernel/traps.c | 2 |
10 files changed, 85 insertions, 63 deletions
diff --git a/arch/tile/kernel/entry.S b/arch/tile/kernel/entry.S index 80d13f013bb2..fd8dc42abdcb 100644 --- a/arch/tile/kernel/entry.S +++ b/arch/tile/kernel/entry.S | |||
@@ -15,7 +15,9 @@ | |||
15 | #include <linux/linkage.h> | 15 | #include <linux/linkage.h> |
16 | #include <linux/unistd.h> | 16 | #include <linux/unistd.h> |
17 | #include <asm/irqflags.h> | 17 | #include <asm/irqflags.h> |
18 | #include <asm/processor.h> | ||
18 | #include <arch/abi.h> | 19 | #include <arch/abi.h> |
20 | #include <arch/spr_def.h> | ||
19 | 21 | ||
20 | #ifdef __tilegx__ | 22 | #ifdef __tilegx__ |
21 | #define bnzt bnezt | 23 | #define bnzt bnezt |
@@ -80,7 +82,7 @@ STD_ENTRY(KBacktraceIterator_init_current) | |||
80 | STD_ENTRY(cpu_idle_on_new_stack) | 82 | STD_ENTRY(cpu_idle_on_new_stack) |
81 | { | 83 | { |
82 | move sp, r1 | 84 | move sp, r1 |
83 | mtspr SYSTEM_SAVE_1_0, r2 | 85 | mtspr SPR_SYSTEM_SAVE_K_0, r2 |
84 | } | 86 | } |
85 | jal free_thread_info | 87 | jal free_thread_info |
86 | j cpu_idle | 88 | j cpu_idle |
@@ -102,15 +104,15 @@ STD_ENTRY(smp_nap) | |||
102 | STD_ENTRY(_cpu_idle) | 104 | STD_ENTRY(_cpu_idle) |
103 | { | 105 | { |
104 | lnk r0 | 106 | lnk r0 |
105 | movei r1, 1 | 107 | movei r1, KERNEL_PL |
106 | } | 108 | } |
107 | { | 109 | { |
108 | addli r0, r0, _cpu_idle_nap - . | 110 | addli r0, r0, _cpu_idle_nap - . |
109 | mtspr INTERRUPT_CRITICAL_SECTION, r1 | 111 | mtspr INTERRUPT_CRITICAL_SECTION, r1 |
110 | } | 112 | } |
111 | IRQ_ENABLE(r2, r3) /* unmask, but still with ICS set */ | 113 | IRQ_ENABLE(r2, r3) /* unmask, but still with ICS set */ |
112 | mtspr EX_CONTEXT_1_1, r1 /* PL1, ICS clear */ | 114 | mtspr SPR_EX_CONTEXT_K_1, r1 /* Kernel PL, ICS clear */ |
113 | mtspr EX_CONTEXT_1_0, r0 | 115 | mtspr SPR_EX_CONTEXT_K_0, r0 |
114 | iret | 116 | iret |
115 | .global _cpu_idle_nap | 117 | .global _cpu_idle_nap |
116 | _cpu_idle_nap: | 118 | _cpu_idle_nap: |
diff --git a/arch/tile/kernel/head_32.S b/arch/tile/kernel/head_32.S index 2b4f6c091701..90e7c4435693 100644 --- a/arch/tile/kernel/head_32.S +++ b/arch/tile/kernel/head_32.S | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <asm/asm-offsets.h> | 23 | #include <asm/asm-offsets.h> |
24 | #include <hv/hypervisor.h> | 24 | #include <hv/hypervisor.h> |
25 | #include <arch/chip.h> | 25 | #include <arch/chip.h> |
26 | #include <arch/spr_def.h> | ||
26 | 27 | ||
27 | /* | 28 | /* |
28 | * This module contains the entry code for kernel images. It performs the | 29 | * This module contains the entry code for kernel images. It performs the |
@@ -76,7 +77,7 @@ ENTRY(_start) | |||
76 | } | 77 | } |
77 | 1: | 78 | 1: |
78 | 79 | ||
79 | /* Get our processor number and save it away in SAVE_1_0. */ | 80 | /* Get our processor number and save it away in SAVE_K_0. */ |
80 | jal hv_inquire_topology | 81 | jal hv_inquire_topology |
81 | mulll_uu r4, r1, r2 /* r1 == y, r2 == width */ | 82 | mulll_uu r4, r1, r2 /* r1 == y, r2 == width */ |
82 | add r4, r4, r0 /* r0 == x, so r4 == cpu == y*width + x */ | 83 | add r4, r4, r0 /* r0 == x, so r4 == cpu == y*width + x */ |
@@ -124,7 +125,7 @@ ENTRY(_start) | |||
124 | lw r0, r0 | 125 | lw r0, r0 |
125 | lw sp, r1 | 126 | lw sp, r1 |
126 | or r4, sp, r4 | 127 | or r4, sp, r4 |
127 | mtspr SYSTEM_SAVE_1_0, r4 /* save ksp0 + cpu */ | 128 | mtspr SPR_SYSTEM_SAVE_K_0, r4 /* save ksp0 + cpu */ |
128 | addi sp, sp, -STACK_TOP_DELTA | 129 | addi sp, sp, -STACK_TOP_DELTA |
129 | { | 130 | { |
130 | move lr, zero /* stop backtraces in the called function */ | 131 | move lr, zero /* stop backtraces in the called function */ |
diff --git a/arch/tile/kernel/intvec_32.S b/arch/tile/kernel/intvec_32.S index f87c5c044d6b..206dc7e1fe36 100644 --- a/arch/tile/kernel/intvec_32.S +++ b/arch/tile/kernel/intvec_32.S | |||
@@ -32,8 +32,8 @@ | |||
32 | # error "No support for kernel preemption currently" | 32 | # error "No support for kernel preemption currently" |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | #if INT_INTCTRL_1 < 32 || INT_INTCTRL_1 >= 48 | 35 | #if INT_INTCTRL_K < 32 || INT_INTCTRL_K >= 48 |
36 | # error INT_INTCTRL_1 coded to set high interrupt mask | 36 | # error INT_INTCTRL_K coded to set high interrupt mask |
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | #define PTREGS_PTR(reg, ptreg) addli reg, sp, C_ABI_SAVE_AREA_SIZE + (ptreg) | 39 | #define PTREGS_PTR(reg, ptreg) addli reg, sp, C_ABI_SAVE_AREA_SIZE + (ptreg) |
@@ -132,8 +132,8 @@ intvec_\vecname: | |||
132 | 132 | ||
133 | /* Temporarily save a register so we have somewhere to work. */ | 133 | /* Temporarily save a register so we have somewhere to work. */ |
134 | 134 | ||
135 | mtspr SYSTEM_SAVE_1_1, r0 | 135 | mtspr SPR_SYSTEM_SAVE_K_1, r0 |
136 | mfspr r0, EX_CONTEXT_1_1 | 136 | mfspr r0, SPR_EX_CONTEXT_K_1 |
137 | 137 | ||
138 | /* The cmpxchg code clears sp to force us to reset it here on fault. */ | 138 | /* The cmpxchg code clears sp to force us to reset it here on fault. */ |
139 | { | 139 | { |
@@ -167,18 +167,18 @@ intvec_\vecname: | |||
167 | * The page_fault handler may be downcalled directly by the | 167 | * The page_fault handler may be downcalled directly by the |
168 | * hypervisor even when Linux is running and has ICS set. | 168 | * hypervisor even when Linux is running and has ICS set. |
169 | * | 169 | * |
170 | * In this case the contents of EX_CONTEXT_1_1 reflect the | 170 | * In this case the contents of EX_CONTEXT_K_1 reflect the |
171 | * previous fault and can't be relied on to choose whether or | 171 | * previous fault and can't be relied on to choose whether or |
172 | * not to reinitialize the stack pointer. So we add a test | 172 | * not to reinitialize the stack pointer. So we add a test |
173 | * to see whether SYSTEM_SAVE_1_2 has the high bit set, | 173 | * to see whether SYSTEM_SAVE_K_2 has the high bit set, |
174 | * and if so we don't reinitialize sp, since we must be coming | 174 | * and if so we don't reinitialize sp, since we must be coming |
175 | * from Linux. (In fact the precise case is !(val & ~1), | 175 | * from Linux. (In fact the precise case is !(val & ~1), |
176 | * but any Linux PC has to have the high bit set.) | 176 | * but any Linux PC has to have the high bit set.) |
177 | * | 177 | * |
178 | * Note that the hypervisor *always* sets SYSTEM_SAVE_1_2 for | 178 | * Note that the hypervisor *always* sets SYSTEM_SAVE_K_2 for |
179 | * any path that turns into a downcall to one of our TLB handlers. | 179 | * any path that turns into a downcall to one of our TLB handlers. |
180 | */ | 180 | */ |
181 | mfspr r0, SYSTEM_SAVE_1_2 | 181 | mfspr r0, SPR_SYSTEM_SAVE_K_2 |
182 | { | 182 | { |
183 | blz r0, 0f /* high bit in S_S_1_2 is for a PC to use */ | 183 | blz r0, 0f /* high bit in S_S_1_2 is for a PC to use */ |
184 | move r0, sp | 184 | move r0, sp |
@@ -187,12 +187,12 @@ intvec_\vecname: | |||
187 | 187 | ||
188 | 2: | 188 | 2: |
189 | /* | 189 | /* |
190 | * SYSTEM_SAVE_1_0 holds the cpu number in the low bits, and | 190 | * SYSTEM_SAVE_K_0 holds the cpu number in the low bits, and |
191 | * the current stack top in the higher bits. So we recover | 191 | * the current stack top in the higher bits. So we recover |
192 | * our stack top by just masking off the low bits, then | 192 | * our stack top by just masking off the low bits, then |
193 | * point sp at the top aligned address on the actual stack page. | 193 | * point sp at the top aligned address on the actual stack page. |
194 | */ | 194 | */ |
195 | mfspr r0, SYSTEM_SAVE_1_0 | 195 | mfspr r0, SPR_SYSTEM_SAVE_K_0 |
196 | mm r0, r0, zero, LOG2_THREAD_SIZE, 31 | 196 | mm r0, r0, zero, LOG2_THREAD_SIZE, 31 |
197 | 197 | ||
198 | 0: | 198 | 0: |
@@ -254,7 +254,7 @@ intvec_\vecname: | |||
254 | sw sp, r3 | 254 | sw sp, r3 |
255 | addli sp, sp, PTREGS_OFFSET_PC - PTREGS_OFFSET_REG(3) | 255 | addli sp, sp, PTREGS_OFFSET_PC - PTREGS_OFFSET_REG(3) |
256 | } | 256 | } |
257 | mfspr r0, EX_CONTEXT_1_0 | 257 | mfspr r0, SPR_EX_CONTEXT_K_0 |
258 | .ifc \processing,handle_syscall | 258 | .ifc \processing,handle_syscall |
259 | /* | 259 | /* |
260 | * Bump the saved PC by one bundle so that when we return, we won't | 260 | * Bump the saved PC by one bundle so that when we return, we won't |
@@ -267,7 +267,7 @@ intvec_\vecname: | |||
267 | sw sp, r0 | 267 | sw sp, r0 |
268 | addli sp, sp, PTREGS_OFFSET_EX1 - PTREGS_OFFSET_PC | 268 | addli sp, sp, PTREGS_OFFSET_EX1 - PTREGS_OFFSET_PC |
269 | } | 269 | } |
270 | mfspr r0, EX_CONTEXT_1_1 | 270 | mfspr r0, SPR_EX_CONTEXT_K_1 |
271 | { | 271 | { |
272 | sw sp, r0 | 272 | sw sp, r0 |
273 | addi sp, sp, PTREGS_OFFSET_FAULTNUM - PTREGS_OFFSET_EX1 | 273 | addi sp, sp, PTREGS_OFFSET_FAULTNUM - PTREGS_OFFSET_EX1 |
@@ -289,7 +289,7 @@ intvec_\vecname: | |||
289 | .endif | 289 | .endif |
290 | addli sp, sp, PTREGS_OFFSET_REG(0) - PTREGS_OFFSET_FAULTNUM | 290 | addli sp, sp, PTREGS_OFFSET_REG(0) - PTREGS_OFFSET_FAULTNUM |
291 | } | 291 | } |
292 | mfspr r0, SYSTEM_SAVE_1_1 /* Original r0 */ | 292 | mfspr r0, SPR_SYSTEM_SAVE_K_1 /* Original r0 */ |
293 | { | 293 | { |
294 | sw sp, r0 | 294 | sw sp, r0 |
295 | addi sp, sp, -PTREGS_OFFSET_REG(0) - 4 | 295 | addi sp, sp, -PTREGS_OFFSET_REG(0) - 4 |
@@ -309,12 +309,12 @@ intvec_\vecname: | |||
309 | * See discussion below at "finish_interrupt_save". | 309 | * See discussion below at "finish_interrupt_save". |
310 | */ | 310 | */ |
311 | .ifc \c_routine, do_page_fault | 311 | .ifc \c_routine, do_page_fault |
312 | mfspr r2, SYSTEM_SAVE_1_3 /* address of page fault */ | 312 | mfspr r2, SPR_SYSTEM_SAVE_K_3 /* address of page fault */ |
313 | mfspr r3, SYSTEM_SAVE_1_2 /* info about page fault */ | 313 | mfspr r3, SPR_SYSTEM_SAVE_K_2 /* info about page fault */ |
314 | .else | 314 | .else |
315 | .ifc \vecnum, INT_DOUBLE_FAULT | 315 | .ifc \vecnum, INT_DOUBLE_FAULT |
316 | { | 316 | { |
317 | mfspr r2, SYSTEM_SAVE_1_2 /* double fault info from HV */ | 317 | mfspr r2, SPR_SYSTEM_SAVE_K_2 /* double fault info from HV */ |
318 | movei r3, 0 | 318 | movei r3, 0 |
319 | } | 319 | } |
320 | .else | 320 | .else |
@@ -467,7 +467,7 @@ intvec_\vecname: | |||
467 | /* Load tp with our per-cpu offset. */ | 467 | /* Load tp with our per-cpu offset. */ |
468 | #ifdef CONFIG_SMP | 468 | #ifdef CONFIG_SMP |
469 | { | 469 | { |
470 | mfspr r20, SYSTEM_SAVE_1_0 | 470 | mfspr r20, SPR_SYSTEM_SAVE_K_0 |
471 | moveli r21, lo16(__per_cpu_offset) | 471 | moveli r21, lo16(__per_cpu_offset) |
472 | } | 472 | } |
473 | { | 473 | { |
@@ -487,7 +487,7 @@ intvec_\vecname: | |||
487 | * We load flags in r32 here so we can jump to .Lrestore_regs | 487 | * We load flags in r32 here so we can jump to .Lrestore_regs |
488 | * directly after do_page_fault_ics() if necessary. | 488 | * directly after do_page_fault_ics() if necessary. |
489 | */ | 489 | */ |
490 | mfspr r32, EX_CONTEXT_1_1 | 490 | mfspr r32, SPR_EX_CONTEXT_K_1 |
491 | { | 491 | { |
492 | andi r32, r32, SPR_EX_CONTEXT_1_1__PL_MASK /* mask off ICS */ | 492 | andi r32, r32, SPR_EX_CONTEXT_1_1__PL_MASK /* mask off ICS */ |
493 | PTREGS_PTR(r21, PTREGS_OFFSET_FLAGS) | 493 | PTREGS_PTR(r21, PTREGS_OFFSET_FLAGS) |
@@ -957,11 +957,11 @@ STD_ENTRY(interrupt_return) | |||
957 | pop_reg_zero r21, r3, sp, PTREGS_OFFSET_EX1 - PTREGS_OFFSET_PC | 957 | pop_reg_zero r21, r3, sp, PTREGS_OFFSET_EX1 - PTREGS_OFFSET_PC |
958 | pop_reg_zero lr, r4, sp, PTREGS_OFFSET_REG(52) - PTREGS_OFFSET_EX1 | 958 | pop_reg_zero lr, r4, sp, PTREGS_OFFSET_REG(52) - PTREGS_OFFSET_EX1 |
959 | { | 959 | { |
960 | mtspr EX_CONTEXT_1_0, r21 | 960 | mtspr SPR_EX_CONTEXT_K_0, r21 |
961 | move r5, zero | 961 | move r5, zero |
962 | } | 962 | } |
963 | { | 963 | { |
964 | mtspr EX_CONTEXT_1_1, lr | 964 | mtspr SPR_EX_CONTEXT_K_1, lr |
965 | andi lr, lr, SPR_EX_CONTEXT_1_1__PL_MASK /* mask off ICS */ | 965 | andi lr, lr, SPR_EX_CONTEXT_1_1__PL_MASK /* mask off ICS */ |
966 | } | 966 | } |
967 | 967 | ||
@@ -1199,7 +1199,7 @@ STD_ENTRY(interrupt_return) | |||
1199 | STD_ENDPROC(interrupt_return) | 1199 | STD_ENDPROC(interrupt_return) |
1200 | 1200 | ||
1201 | /* | 1201 | /* |
1202 | * This interrupt variant clears the INT_INTCTRL_1 interrupt mask bit | 1202 | * This interrupt variant clears the INT_INTCTRL_K interrupt mask bit |
1203 | * before returning, so we can properly get more downcalls. | 1203 | * before returning, so we can properly get more downcalls. |
1204 | */ | 1204 | */ |
1205 | .pushsection .text.handle_interrupt_downcall,"ax" | 1205 | .pushsection .text.handle_interrupt_downcall,"ax" |
@@ -1208,11 +1208,11 @@ handle_interrupt_downcall: | |||
1208 | check_single_stepping normal, .Ldispatch_downcall | 1208 | check_single_stepping normal, .Ldispatch_downcall |
1209 | .Ldispatch_downcall: | 1209 | .Ldispatch_downcall: |
1210 | 1210 | ||
1211 | /* Clear INTCTRL_1 from the set of interrupts we ever enable. */ | 1211 | /* Clear INTCTRL_K from the set of interrupts we ever enable. */ |
1212 | GET_INTERRUPTS_ENABLED_MASK_PTR(r30) | 1212 | GET_INTERRUPTS_ENABLED_MASK_PTR(r30) |
1213 | { | 1213 | { |
1214 | addi r30, r30, 4 | 1214 | addi r30, r30, 4 |
1215 | movei r31, INT_MASK(INT_INTCTRL_1) | 1215 | movei r31, INT_MASK(INT_INTCTRL_K) |
1216 | } | 1216 | } |
1217 | { | 1217 | { |
1218 | lw r20, r30 | 1218 | lw r20, r30 |
@@ -1227,7 +1227,7 @@ handle_interrupt_downcall: | |||
1227 | } | 1227 | } |
1228 | FEEDBACK_REENTER(handle_interrupt_downcall) | 1228 | FEEDBACK_REENTER(handle_interrupt_downcall) |
1229 | 1229 | ||
1230 | /* Allow INTCTRL_1 to be enabled next time we enable interrupts. */ | 1230 | /* Allow INTCTRL_K to be enabled next time we enable interrupts. */ |
1231 | lw r20, r30 | 1231 | lw r20, r30 |
1232 | or r20, r20, r31 | 1232 | or r20, r20, r31 |
1233 | sw r30, r20 | 1233 | sw r30, r20 |
@@ -1509,7 +1509,7 @@ handle_ill: | |||
1509 | /* Various stub interrupt handlers and syscall handlers */ | 1509 | /* Various stub interrupt handlers and syscall handlers */ |
1510 | 1510 | ||
1511 | STD_ENTRY_LOCAL(_kernel_double_fault) | 1511 | STD_ENTRY_LOCAL(_kernel_double_fault) |
1512 | mfspr r1, EX_CONTEXT_1_0 | 1512 | mfspr r1, SPR_EX_CONTEXT_K_0 |
1513 | move r2, lr | 1513 | move r2, lr |
1514 | move r3, sp | 1514 | move r3, sp |
1515 | move r4, r52 | 1515 | move r4, r52 |
@@ -1518,7 +1518,7 @@ STD_ENTRY_LOCAL(_kernel_double_fault) | |||
1518 | STD_ENDPROC(_kernel_double_fault) | 1518 | STD_ENDPROC(_kernel_double_fault) |
1519 | 1519 | ||
1520 | STD_ENTRY_LOCAL(bad_intr) | 1520 | STD_ENTRY_LOCAL(bad_intr) |
1521 | mfspr r2, EX_CONTEXT_1_0 | 1521 | mfspr r2, SPR_EX_CONTEXT_K_0 |
1522 | panic "Unhandled interrupt %#x: PC %#lx" | 1522 | panic "Unhandled interrupt %#x: PC %#lx" |
1523 | STD_ENDPROC(bad_intr) | 1523 | STD_ENDPROC(bad_intr) |
1524 | 1524 | ||
@@ -1560,7 +1560,7 @@ STD_ENTRY(_sys_clone) | |||
1560 | * a page fault which would assume the stack was valid, it does | 1560 | * a page fault which would assume the stack was valid, it does |
1561 | * save/restore the stack pointer and zero it out to make sure it gets reset. | 1561 | * save/restore the stack pointer and zero it out to make sure it gets reset. |
1562 | * Since we always keep interrupts disabled, the hypervisor won't | 1562 | * Since we always keep interrupts disabled, the hypervisor won't |
1563 | * clobber our EX_CONTEXT_1_x registers, so we don't save/restore them | 1563 | * clobber our EX_CONTEXT_K_x registers, so we don't save/restore them |
1564 | * (other than to advance the PC on return). | 1564 | * (other than to advance the PC on return). |
1565 | * | 1565 | * |
1566 | * We have to manually validate the user vs kernel address range | 1566 | * We have to manually validate the user vs kernel address range |
@@ -1766,7 +1766,7 @@ ENTRY(sys_cmpxchg) | |||
1766 | /* Do slow mtspr here so the following "mf" waits less. */ | 1766 | /* Do slow mtspr here so the following "mf" waits less. */ |
1767 | { | 1767 | { |
1768 | move sp, r27 | 1768 | move sp, r27 |
1769 | mtspr EX_CONTEXT_1_0, r28 | 1769 | mtspr SPR_EX_CONTEXT_K_0, r28 |
1770 | } | 1770 | } |
1771 | mf | 1771 | mf |
1772 | 1772 | ||
@@ -1785,7 +1785,7 @@ ENTRY(sys_cmpxchg) | |||
1785 | } | 1785 | } |
1786 | { | 1786 | { |
1787 | move sp, r27 | 1787 | move sp, r27 |
1788 | mtspr EX_CONTEXT_1_0, r28 | 1788 | mtspr SPR_EX_CONTEXT_K_0, r28 |
1789 | } | 1789 | } |
1790 | iret | 1790 | iret |
1791 | 1791 | ||
@@ -1813,7 +1813,7 @@ ENTRY(sys_cmpxchg) | |||
1813 | #endif | 1813 | #endif |
1814 | 1814 | ||
1815 | /* Issue the slow SPR here while the tns result is in flight. */ | 1815 | /* Issue the slow SPR here while the tns result is in flight. */ |
1816 | mfspr r28, EX_CONTEXT_1_0 | 1816 | mfspr r28, SPR_EX_CONTEXT_K_0 |
1817 | 1817 | ||
1818 | { | 1818 | { |
1819 | addi r28, r28, 8 /* return to the instruction after the swint1 */ | 1819 | addi r28, r28, 8 /* return to the instruction after the swint1 */ |
@@ -1901,7 +1901,7 @@ ENTRY(sys_cmpxchg) | |||
1901 | .Lcmpxchg64_mismatch: | 1901 | .Lcmpxchg64_mismatch: |
1902 | { | 1902 | { |
1903 | move sp, r27 | 1903 | move sp, r27 |
1904 | mtspr EX_CONTEXT_1_0, r28 | 1904 | mtspr SPR_EX_CONTEXT_K_0, r28 |
1905 | } | 1905 | } |
1906 | mf | 1906 | mf |
1907 | { | 1907 | { |
@@ -1982,8 +1982,13 @@ int_unalign: | |||
1982 | int_hand INT_PERF_COUNT, PERF_COUNT, \ | 1982 | int_hand INT_PERF_COUNT, PERF_COUNT, \ |
1983 | op_handle_perf_interrupt, handle_nmi | 1983 | op_handle_perf_interrupt, handle_nmi |
1984 | int_hand INT_INTCTRL_3, INTCTRL_3, bad_intr | 1984 | int_hand INT_INTCTRL_3, INTCTRL_3, bad_intr |
1985 | #if CONFIG_KERNEL_PL == 2 | ||
1986 | dc_dispatch INT_INTCTRL_2, INTCTRL_2 | ||
1987 | int_hand INT_INTCTRL_1, INTCTRL_1, bad_intr | ||
1988 | #else | ||
1985 | int_hand INT_INTCTRL_2, INTCTRL_2, bad_intr | 1989 | int_hand INT_INTCTRL_2, INTCTRL_2, bad_intr |
1986 | dc_dispatch INT_INTCTRL_1, INTCTRL_1 | 1990 | dc_dispatch INT_INTCTRL_1, INTCTRL_1 |
1991 | #endif | ||
1987 | int_hand INT_INTCTRL_0, INTCTRL_0, bad_intr | 1992 | int_hand INT_INTCTRL_0, INTCTRL_0, bad_intr |
1988 | int_hand INT_MESSAGE_RCV_DWNCL, MESSAGE_RCV_DWNCL, \ | 1993 | int_hand INT_MESSAGE_RCV_DWNCL, MESSAGE_RCV_DWNCL, \ |
1989 | hv_message_intr, handle_interrupt_downcall | 1994 | hv_message_intr, handle_interrupt_downcall |
diff --git a/arch/tile/kernel/irq.c b/arch/tile/kernel/irq.c index 596c60086930..394d554f21aa 100644 --- a/arch/tile/kernel/irq.c +++ b/arch/tile/kernel/irq.c | |||
@@ -61,9 +61,9 @@ static DEFINE_SPINLOCK(available_irqs_lock); | |||
61 | 61 | ||
62 | #if CHIP_HAS_IPI() | 62 | #if CHIP_HAS_IPI() |
63 | /* Use SPRs to manipulate device interrupts. */ | 63 | /* Use SPRs to manipulate device interrupts. */ |
64 | #define mask_irqs(irq_mask) __insn_mtspr(SPR_IPI_MASK_SET_1, irq_mask) | 64 | #define mask_irqs(irq_mask) __insn_mtspr(SPR_IPI_MASK_SET_K, irq_mask) |
65 | #define unmask_irqs(irq_mask) __insn_mtspr(SPR_IPI_MASK_RESET_1, irq_mask) | 65 | #define unmask_irqs(irq_mask) __insn_mtspr(SPR_IPI_MASK_RESET_K, irq_mask) |
66 | #define clear_irqs(irq_mask) __insn_mtspr(SPR_IPI_EVENT_RESET_1, irq_mask) | 66 | #define clear_irqs(irq_mask) __insn_mtspr(SPR_IPI_EVENT_RESET_K, irq_mask) |
67 | #else | 67 | #else |
68 | /* Use HV to manipulate device interrupts. */ | 68 | /* Use HV to manipulate device interrupts. */ |
69 | #define mask_irqs(irq_mask) hv_disable_intr(irq_mask) | 69 | #define mask_irqs(irq_mask) hv_disable_intr(irq_mask) |
@@ -89,16 +89,16 @@ void tile_dev_intr(struct pt_regs *regs, int intnum) | |||
89 | * masked by a previous interrupt. Then, mask out the ones | 89 | * masked by a previous interrupt. Then, mask out the ones |
90 | * we're going to handle. | 90 | * we're going to handle. |
91 | */ | 91 | */ |
92 | unsigned long masked = __insn_mfspr(SPR_IPI_MASK_1); | 92 | unsigned long masked = __insn_mfspr(SPR_IPI_MASK_K); |
93 | original_irqs = __insn_mfspr(SPR_IPI_EVENT_1) & ~masked; | 93 | original_irqs = __insn_mfspr(SPR_IPI_EVENT_K) & ~masked; |
94 | __insn_mtspr(SPR_IPI_MASK_SET_1, original_irqs); | 94 | __insn_mtspr(SPR_IPI_MASK_SET_K, original_irqs); |
95 | #else | 95 | #else |
96 | /* | 96 | /* |
97 | * Hypervisor performs the equivalent of the Gx code above and | 97 | * Hypervisor performs the equivalent of the Gx code above and |
98 | * then puts the pending interrupt mask into a system save reg | 98 | * then puts the pending interrupt mask into a system save reg |
99 | * for us to find. | 99 | * for us to find. |
100 | */ | 100 | */ |
101 | original_irqs = __insn_mfspr(SPR_SYSTEM_SAVE_1_3); | 101 | original_irqs = __insn_mfspr(SPR_SYSTEM_SAVE_K_3); |
102 | #endif | 102 | #endif |
103 | remaining_irqs = original_irqs; | 103 | remaining_irqs = original_irqs; |
104 | 104 | ||
@@ -225,7 +225,7 @@ void __cpuinit setup_irq_regs(void) | |||
225 | /* Enable interrupt delivery. */ | 225 | /* Enable interrupt delivery. */ |
226 | unmask_irqs(~0UL); | 226 | unmask_irqs(~0UL); |
227 | #if CHIP_HAS_IPI() | 227 | #if CHIP_HAS_IPI() |
228 | raw_local_irq_unmask(INT_IPI_1); | 228 | raw_local_irq_unmask(INT_IPI_K); |
229 | #endif | 229 | #endif |
230 | } | 230 | } |
231 | 231 | ||
diff --git a/arch/tile/kernel/messaging.c b/arch/tile/kernel/messaging.c index 6d23ed271d10..997e3933f726 100644 --- a/arch/tile/kernel/messaging.c +++ b/arch/tile/kernel/messaging.c | |||
@@ -34,7 +34,7 @@ void __cpuinit init_messaging(void) | |||
34 | panic("hv_register_message_state: error %d", rc); | 34 | panic("hv_register_message_state: error %d", rc); |
35 | 35 | ||
36 | /* Make sure downcall interrupts will be enabled. */ | 36 | /* Make sure downcall interrupts will be enabled. */ |
37 | raw_local_irq_unmask(INT_INTCTRL_1); | 37 | raw_local_irq_unmask(INT_INTCTRL_K); |
38 | } | 38 | } |
39 | 39 | ||
40 | void hv_message_intr(struct pt_regs *regs, int intnum) | 40 | void hv_message_intr(struct pt_regs *regs, int intnum) |
diff --git a/arch/tile/kernel/process.c b/arch/tile/kernel/process.c index 221f12bd27fa..8430f45daea6 100644 --- a/arch/tile/kernel/process.c +++ b/arch/tile/kernel/process.c | |||
@@ -305,15 +305,25 @@ int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) | |||
305 | /* Allow user processes to access the DMA SPRs */ | 305 | /* Allow user processes to access the DMA SPRs */ |
306 | void grant_dma_mpls(void) | 306 | void grant_dma_mpls(void) |
307 | { | 307 | { |
308 | #if CONFIG_KERNEL_PL == 2 | ||
309 | __insn_mtspr(SPR_MPL_DMA_CPL_SET_1, 1); | ||
310 | __insn_mtspr(SPR_MPL_DMA_NOTIFY_SET_1, 1); | ||
311 | #else | ||
308 | __insn_mtspr(SPR_MPL_DMA_CPL_SET_0, 1); | 312 | __insn_mtspr(SPR_MPL_DMA_CPL_SET_0, 1); |
309 | __insn_mtspr(SPR_MPL_DMA_NOTIFY_SET_0, 1); | 313 | __insn_mtspr(SPR_MPL_DMA_NOTIFY_SET_0, 1); |
314 | #endif | ||
310 | } | 315 | } |
311 | 316 | ||
312 | /* Forbid user processes from accessing the DMA SPRs */ | 317 | /* Forbid user processes from accessing the DMA SPRs */ |
313 | void restrict_dma_mpls(void) | 318 | void restrict_dma_mpls(void) |
314 | { | 319 | { |
320 | #if CONFIG_KERNEL_PL == 2 | ||
321 | __insn_mtspr(SPR_MPL_DMA_CPL_SET_2, 1); | ||
322 | __insn_mtspr(SPR_MPL_DMA_NOTIFY_SET_2, 1); | ||
323 | #else | ||
315 | __insn_mtspr(SPR_MPL_DMA_CPL_SET_1, 1); | 324 | __insn_mtspr(SPR_MPL_DMA_CPL_SET_1, 1); |
316 | __insn_mtspr(SPR_MPL_DMA_NOTIFY_SET_1, 1); | 325 | __insn_mtspr(SPR_MPL_DMA_NOTIFY_SET_1, 1); |
326 | #endif | ||
317 | } | 327 | } |
318 | 328 | ||
319 | /* Pause the DMA engine, then save off its state registers. */ | 329 | /* Pause the DMA engine, then save off its state registers. */ |
@@ -524,7 +534,7 @@ struct task_struct *__sched _switch_to(struct task_struct *prev, | |||
524 | * Switch kernel SP, PC, and callee-saved registers. | 534 | * Switch kernel SP, PC, and callee-saved registers. |
525 | * In the context of the new task, return the old task pointer | 535 | * In the context of the new task, return the old task pointer |
526 | * (i.e. the task that actually called __switch_to). | 536 | * (i.e. the task that actually called __switch_to). |
527 | * Pass the value to use for SYSTEM_SAVE_1_0 when we reset our sp. | 537 | * Pass the value to use for SYSTEM_SAVE_K_0 when we reset our sp. |
528 | */ | 538 | */ |
529 | return __switch_to(prev, next, next_current_ksp0(next)); | 539 | return __switch_to(prev, next, next_current_ksp0(next)); |
530 | } | 540 | } |
diff --git a/arch/tile/kernel/regs_32.S b/arch/tile/kernel/regs_32.S index e88d6e122783..caa13101c264 100644 --- a/arch/tile/kernel/regs_32.S +++ b/arch/tile/kernel/regs_32.S | |||
@@ -85,7 +85,7 @@ STD_ENTRY_SECTION(__switch_to, .sched.text) | |||
85 | { | 85 | { |
86 | /* Update sp and ksp0 simultaneously to avoid backtracer warnings. */ | 86 | /* Update sp and ksp0 simultaneously to avoid backtracer warnings. */ |
87 | move sp, r13 | 87 | move sp, r13 |
88 | mtspr SYSTEM_SAVE_1_0, r2 | 88 | mtspr SPR_SYSTEM_SAVE_K_0, r2 |
89 | } | 89 | } |
90 | FOR_EACH_CALLEE_SAVED_REG(LOAD_REG) | 90 | FOR_EACH_CALLEE_SAVED_REG(LOAD_REG) |
91 | .L__switch_to_pc: | 91 | .L__switch_to_pc: |
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c index c1a697e68546..6444a2bbe1a4 100644 --- a/arch/tile/kernel/setup.c +++ b/arch/tile/kernel/setup.c | |||
@@ -187,11 +187,11 @@ early_param("vmalloc", parse_vmalloc); | |||
187 | 187 | ||
188 | #ifdef CONFIG_HIGHMEM | 188 | #ifdef CONFIG_HIGHMEM |
189 | /* | 189 | /* |
190 | * Determine for each controller where its lowmem is mapped and how | 190 | * Determine for each controller where its lowmem is mapped and how much of |
191 | * much of it is mapped there. On controller zero, the first few | 191 | * it is mapped there. On controller zero, the first few megabytes are |
192 | * megabytes are mapped at 0xfd000000 as code, so in principle we | 192 | * already mapped in as code at MEM_SV_INTRPT, so in principle we could |
193 | * could start our data mappings higher up, but for now we don't | 193 | * start our data mappings higher up, but for now we don't bother, to avoid |
194 | * bother, to avoid additional confusion. | 194 | * additional confusion. |
195 | * | 195 | * |
196 | * One question is whether, on systems with more than 768 Mb and | 196 | * One question is whether, on systems with more than 768 Mb and |
197 | * controllers of different sizes, to map in a proportionate amount of | 197 | * controllers of different sizes, to map in a proportionate amount of |
@@ -876,6 +876,9 @@ void __cpuinit setup_cpu(int boot) | |||
876 | #if CHIP_HAS_SN_PROC() | 876 | #if CHIP_HAS_SN_PROC() |
877 | raw_local_irq_unmask(INT_SNITLB_MISS); | 877 | raw_local_irq_unmask(INT_SNITLB_MISS); |
878 | #endif | 878 | #endif |
879 | #ifdef __tilegx__ | ||
880 | raw_local_irq_unmask(INT_SINGLE_STEP_K); | ||
881 | #endif | ||
879 | 882 | ||
880 | /* | 883 | /* |
881 | * Allow user access to many generic SPRs, like the cycle | 884 | * Allow user access to many generic SPRs, like the cycle |
@@ -893,11 +896,12 @@ void __cpuinit setup_cpu(int boot) | |||
893 | #endif | 896 | #endif |
894 | 897 | ||
895 | /* | 898 | /* |
896 | * Set the MPL for interrupt control 0 to user level. | 899 | * Set the MPL for interrupt control 0 & 1 to the corresponding |
897 | * This includes access to the SYSTEM_SAVE and EX_CONTEXT SPRs, | 900 | * values. This includes access to the SYSTEM_SAVE and EX_CONTEXT |
898 | * as well as the PL 0 interrupt mask. | 901 | * SPRs, as well as the interrupt mask. |
899 | */ | 902 | */ |
900 | __insn_mtspr(SPR_MPL_INTCTRL_0_SET_0, 1); | 903 | __insn_mtspr(SPR_MPL_INTCTRL_0_SET_0, 1); |
904 | __insn_mtspr(SPR_MPL_INTCTRL_1_SET_1, 1); | ||
901 | 905 | ||
902 | /* Initialize IRQ support for this cpu. */ | 906 | /* Initialize IRQ support for this cpu. */ |
903 | setup_irq_regs(); | 907 | setup_irq_regs(); |
@@ -1033,7 +1037,7 @@ static void __init validate_va(void) | |||
1033 | * In addition, make sure we CAN'T use the end of memory, since | 1037 | * In addition, make sure we CAN'T use the end of memory, since |
1034 | * we use the last chunk of each pgd for the pgd_list. | 1038 | * we use the last chunk of each pgd for the pgd_list. |
1035 | */ | 1039 | */ |
1036 | int i, fc_fd_ok = 0; | 1040 | int i, user_kernel_ok = 0; |
1037 | unsigned long max_va = 0; | 1041 | unsigned long max_va = 0; |
1038 | unsigned long list_va = | 1042 | unsigned long list_va = |
1039 | ((PGD_LIST_OFFSET / sizeof(pgd_t)) << PGDIR_SHIFT); | 1043 | ((PGD_LIST_OFFSET / sizeof(pgd_t)) << PGDIR_SHIFT); |
@@ -1044,13 +1048,13 @@ static void __init validate_va(void) | |||
1044 | break; | 1048 | break; |
1045 | if (range.start <= MEM_USER_INTRPT && | 1049 | if (range.start <= MEM_USER_INTRPT && |
1046 | range.start + range.size >= MEM_HV_INTRPT) | 1050 | range.start + range.size >= MEM_HV_INTRPT) |
1047 | fc_fd_ok = 1; | 1051 | user_kernel_ok = 1; |
1048 | if (range.start == 0) | 1052 | if (range.start == 0) |
1049 | max_va = range.size; | 1053 | max_va = range.size; |
1050 | BUG_ON(range.start + range.size > list_va); | 1054 | BUG_ON(range.start + range.size > list_va); |
1051 | } | 1055 | } |
1052 | if (!fc_fd_ok) | 1056 | if (!user_kernel_ok) |
1053 | early_panic("Hypervisor not configured for VAs 0xfc/0xfd\n"); | 1057 | early_panic("Hypervisor not configured for user/kernel VAs\n"); |
1054 | if (max_va == 0) | 1058 | if (max_va == 0) |
1055 | early_panic("Hypervisor not configured for low VAs\n"); | 1059 | early_panic("Hypervisor not configured for low VAs\n"); |
1056 | if (max_va < KERNEL_HIGH_VADDR) | 1060 | if (max_va < KERNEL_HIGH_VADDR) |
diff --git a/arch/tile/kernel/smp.c b/arch/tile/kernel/smp.c index 1cb5ec79de04..75255d90aff3 100644 --- a/arch/tile/kernel/smp.c +++ b/arch/tile/kernel/smp.c | |||
@@ -212,7 +212,7 @@ void __init ipi_init(void) | |||
212 | 212 | ||
213 | tile.x = cpu_x(cpu); | 213 | tile.x = cpu_x(cpu); |
214 | tile.y = cpu_y(cpu); | 214 | tile.y = cpu_y(cpu); |
215 | if (hv_get_ipi_pte(tile, 1, &pte) != 0) | 215 | if (hv_get_ipi_pte(tile, KERNEL_PL, &pte) != 0) |
216 | panic("Failed to initialize IPI for cpu %d\n", cpu); | 216 | panic("Failed to initialize IPI for cpu %d\n", cpu); |
217 | 217 | ||
218 | offset = hv_pte_get_pfn(pte) << PAGE_SHIFT; | 218 | offset = hv_pte_get_pfn(pte) << PAGE_SHIFT; |
diff --git a/arch/tile/kernel/traps.c b/arch/tile/kernel/traps.c index 0f362dc2c57f..7826a8b17997 100644 --- a/arch/tile/kernel/traps.c +++ b/arch/tile/kernel/traps.c | |||
@@ -278,7 +278,7 @@ void __kprobes do_trap(struct pt_regs *regs, int fault_num, | |||
278 | case INT_DOUBLE_FAULT: | 278 | case INT_DOUBLE_FAULT: |
279 | /* | 279 | /* |
280 | * For double fault, "reason" is actually passed as | 280 | * For double fault, "reason" is actually passed as |
281 | * SYSTEM_SAVE_1_2, the hypervisor's double-fault info, so | 281 | * SYSTEM_SAVE_K_2, the hypervisor's double-fault info, so |
282 | * we can provide the original fault number rather than | 282 | * we can provide the original fault number rather than |
283 | * the uninteresting "INT_DOUBLE_FAULT" so the user can | 283 | * the uninteresting "INT_DOUBLE_FAULT" so the user can |
284 | * learn what actually struck while PL0 ICS was set. | 284 | * learn what actually struck while PL0 ICS was set. |