Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Boot code and exception vectors for Book3E processors |
| 3 | * |
| 4 | * Copyright (C) 2007 Ben. Herrenschmidt (benh@kernel.crashing.org), IBM Corp. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * as published by the Free Software Foundation; either version |
| 9 | * 2 of the License, or (at your option) any later version. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/threads.h> |
| 13 | #include <asm/reg.h> |
| 14 | #include <asm/page.h> |
| 15 | #include <asm/ppc_asm.h> |
| 16 | #include <asm/asm-offsets.h> |
| 17 | #include <asm/cputable.h> |
| 18 | #include <asm/setup.h> |
| 19 | #include <asm/thread_info.h> |
Jack Miller | a0496d4 | 2011-04-14 22:32:08 +0000 | [diff] [blame] | 20 | #include <asm/reg_a2.h> |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 21 | #include <asm/exception-64e.h> |
| 22 | #include <asm/bug.h> |
| 23 | #include <asm/irqflags.h> |
| 24 | #include <asm/ptrace.h> |
| 25 | #include <asm/ppc-opcode.h> |
| 26 | #include <asm/mmu.h> |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 27 | #include <asm/hw_irq.h> |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 28 | #include <asm/kvm_asm.h> |
| 29 | #include <asm/kvm_booke_hv_asm.h> |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 30 | |
| 31 | /* XXX This will ultimately add space for a special exception save |
| 32 | * structure used to save things like SRR0/SRR1, SPRGs, MAS, etc... |
| 33 | * when taking special interrupts. For now we don't support that, |
| 34 | * special interrupts from within a non-standard level will probably |
| 35 | * blow you up |
| 36 | */ |
| 37 | #define SPECIAL_EXC_FRAME_SIZE INT_FRAME_SIZE |
| 38 | |
| 39 | /* Exception prolog code for all exceptions */ |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 40 | #define EXCEPTION_PROLOG(n, intnum, type, addition) \ |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 41 | mtspr SPRN_SPRG_##type##_SCRATCH,r13; /* get spare registers */ \ |
| 42 | mfspr r13,SPRN_SPRG_PACA; /* get PACA */ \ |
| 43 | std r10,PACA_EX##type+EX_R10(r13); \ |
| 44 | std r11,PACA_EX##type+EX_R11(r13); \ |
| 45 | mfcr r10; /* save CR */ \ |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 46 | mfspr r11,SPRN_##type##_SRR1;/* what are we coming from */ \ |
| 47 | DO_KVM intnum,SPRN_##type##_SRR1; /* KVM hook */ \ |
Mihai Caraman | 79b5c8d | 2012-08-06 03:27:06 +0000 | [diff] [blame^] | 48 | stw r10,PACA_EX##type+EX_CR(r13); /* save old CR in the PACA */ \ |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 49 | addition; /* additional code for that exc. */ \ |
| 50 | std r1,PACA_EX##type+EX_R1(r13); /* save old r1 in the PACA */ \ |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 51 | type##_SET_KSTACK; /* get special stack if necessary */\ |
| 52 | andi. r10,r11,MSR_PR; /* save stack pointer */ \ |
| 53 | beq 1f; /* branch around if supervisor */ \ |
| 54 | ld r1,PACAKSAVE(r13); /* get kernel stack coming from usr */\ |
| 55 | 1: cmpdi cr1,r1,0; /* check if SP makes sense */ \ |
| 56 | bge- cr1,exc_##n##_bad_stack;/* bad stack (TODO: out of line) */ \ |
| 57 | mfspr r10,SPRN_##type##_SRR0; /* read SRR0 before touching stack */ |
| 58 | |
| 59 | /* Exception type-specific macros */ |
| 60 | #define GEN_SET_KSTACK \ |
| 61 | subi r1,r1,INT_FRAME_SIZE; /* alloc frame on kernel stack */ |
| 62 | #define SPRN_GEN_SRR0 SPRN_SRR0 |
| 63 | #define SPRN_GEN_SRR1 SPRN_SRR1 |
| 64 | |
Mihai Caraman | 5473eb1 | 2012-08-06 03:27:04 +0000 | [diff] [blame] | 65 | #define GDBELL_SET_KSTACK GEN_SET_KSTACK |
| 66 | #define SPRN_GDBELL_SRR0 SPRN_GSRR0 |
| 67 | #define SPRN_GDBELL_SRR1 SPRN_GSRR1 |
| 68 | |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 69 | #define CRIT_SET_KSTACK \ |
| 70 | ld r1,PACA_CRIT_STACK(r13); \ |
| 71 | subi r1,r1,SPECIAL_EXC_FRAME_SIZE; |
| 72 | #define SPRN_CRIT_SRR0 SPRN_CSRR0 |
| 73 | #define SPRN_CRIT_SRR1 SPRN_CSRR1 |
| 74 | |
| 75 | #define DBG_SET_KSTACK \ |
| 76 | ld r1,PACA_DBG_STACK(r13); \ |
| 77 | subi r1,r1,SPECIAL_EXC_FRAME_SIZE; |
| 78 | #define SPRN_DBG_SRR0 SPRN_DSRR0 |
| 79 | #define SPRN_DBG_SRR1 SPRN_DSRR1 |
| 80 | |
| 81 | #define MC_SET_KSTACK \ |
| 82 | ld r1,PACA_MC_STACK(r13); \ |
| 83 | subi r1,r1,SPECIAL_EXC_FRAME_SIZE; |
| 84 | #define SPRN_MC_SRR0 SPRN_MCSRR0 |
| 85 | #define SPRN_MC_SRR1 SPRN_MCSRR1 |
| 86 | |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 87 | #define NORMAL_EXCEPTION_PROLOG(n, intnum, addition) \ |
| 88 | EXCEPTION_PROLOG(n, intnum, GEN, addition##_GEN(n)) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 89 | |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 90 | #define CRIT_EXCEPTION_PROLOG(n, intnum, addition) \ |
| 91 | EXCEPTION_PROLOG(n, intnum, CRIT, addition##_CRIT(n)) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 92 | |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 93 | #define DBG_EXCEPTION_PROLOG(n, intnum, addition) \ |
| 94 | EXCEPTION_PROLOG(n, intnum, DBG, addition##_DBG(n)) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 95 | |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 96 | #define MC_EXCEPTION_PROLOG(n, intnum, addition) \ |
| 97 | EXCEPTION_PROLOG(n, intnum, MC, addition##_MC(n)) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 98 | |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 99 | #define GDBELL_EXCEPTION_PROLOG(n, intnum, addition) \ |
| 100 | EXCEPTION_PROLOG(n, intnum, GDBELL, addition##_GDBELL(n)) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 101 | |
| 102 | /* Variants of the "addition" argument for the prolog |
| 103 | */ |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 104 | #define PROLOG_ADDITION_NONE_GEN(n) |
Mihai Caraman | 5473eb1 | 2012-08-06 03:27:04 +0000 | [diff] [blame] | 105 | #define PROLOG_ADDITION_NONE_GDBELL(n) |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 106 | #define PROLOG_ADDITION_NONE_CRIT(n) |
| 107 | #define PROLOG_ADDITION_NONE_DBG(n) |
| 108 | #define PROLOG_ADDITION_NONE_MC(n) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 109 | |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 110 | #define PROLOG_ADDITION_MASKABLE_GEN(n) \ |
Mihai Caraman | 79b5c8d | 2012-08-06 03:27:06 +0000 | [diff] [blame^] | 111 | lbz r10,PACASOFTIRQEN(r13); /* are irqs soft-disabled ? */ \ |
| 112 | cmpwi cr0,r10,0; /* yes -> go out of line */ \ |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 113 | beq masked_interrupt_book3e_##n |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 114 | |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 115 | #define PROLOG_ADDITION_2REGS_GEN(n) \ |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 116 | std r14,PACA_EXGEN+EX_R14(r13); \ |
| 117 | std r15,PACA_EXGEN+EX_R15(r13) |
| 118 | |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 119 | #define PROLOG_ADDITION_1REG_GEN(n) \ |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 120 | std r14,PACA_EXGEN+EX_R14(r13); |
| 121 | |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 122 | #define PROLOG_ADDITION_2REGS_CRIT(n) \ |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 123 | std r14,PACA_EXCRIT+EX_R14(r13); \ |
| 124 | std r15,PACA_EXCRIT+EX_R15(r13) |
| 125 | |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 126 | #define PROLOG_ADDITION_2REGS_DBG(n) \ |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 127 | std r14,PACA_EXDBG+EX_R14(r13); \ |
| 128 | std r15,PACA_EXDBG+EX_R15(r13) |
| 129 | |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 130 | #define PROLOG_ADDITION_2REGS_MC(n) \ |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 131 | std r14,PACA_EXMC+EX_R14(r13); \ |
| 132 | std r15,PACA_EXMC+EX_R15(r13) |
| 133 | |
Scott Wood | 3d97a61 | 2011-06-22 11:19:49 +0000 | [diff] [blame] | 134 | |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 135 | /* Core exception code for all exceptions except TLB misses. |
| 136 | * XXX: Needs to make SPRN_SPRG_GEN depend on exception type |
| 137 | */ |
| 138 | #define EXCEPTION_COMMON(n, excf, ints) \ |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 139 | exc_##n##_common: \ |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 140 | std r0,GPR0(r1); /* save r0 in stackframe */ \ |
| 141 | std r2,GPR2(r1); /* save r2 in stackframe */ \ |
| 142 | SAVE_4GPRS(3, r1); /* save r3 - r6 in stackframe */ \ |
| 143 | SAVE_2GPRS(7, r1); /* save r7, r8 in stackframe */ \ |
| 144 | std r9,GPR9(r1); /* save r9 in stackframe */ \ |
| 145 | std r10,_NIP(r1); /* save SRR0 to stackframe */ \ |
| 146 | std r11,_MSR(r1); /* save SRR1 to stackframe */ \ |
| 147 | ACCOUNT_CPU_USER_ENTRY(r10,r11);/* accounting (uses cr0+eq) */ \ |
| 148 | ld r3,excf+EX_R10(r13); /* get back r10 */ \ |
| 149 | ld r4,excf+EX_R11(r13); /* get back r11 */ \ |
| 150 | mfspr r5,SPRN_SPRG_GEN_SCRATCH;/* get back r13 */ \ |
| 151 | std r12,GPR12(r1); /* save r12 in stackframe */ \ |
| 152 | ld r2,PACATOC(r13); /* get kernel TOC into r2 */ \ |
| 153 | mflr r6; /* save LR in stackframe */ \ |
| 154 | mfctr r7; /* save CTR in stackframe */ \ |
| 155 | mfspr r8,SPRN_XER; /* save XER in stackframe */ \ |
| 156 | ld r9,excf+EX_R1(r13); /* load orig r1 back from PACA */ \ |
| 157 | lwz r10,excf+EX_CR(r13); /* load orig CR back from PACA */ \ |
| 158 | lbz r11,PACASOFTIRQEN(r13); /* get current IRQ softe */ \ |
| 159 | ld r12,exception_marker@toc(r2); \ |
| 160 | li r0,0; \ |
| 161 | std r3,GPR10(r1); /* save r10 to stackframe */ \ |
| 162 | std r4,GPR11(r1); /* save r11 to stackframe */ \ |
| 163 | std r5,GPR13(r1); /* save it to stackframe */ \ |
| 164 | std r6,_LINK(r1); \ |
| 165 | std r7,_CTR(r1); \ |
| 166 | std r8,_XER(r1); \ |
| 167 | li r3,(n)+1; /* indicate partial regs in trap */ \ |
| 168 | std r9,0(r1); /* store stack frame back link */ \ |
| 169 | std r10,_CCR(r1); /* store orig CR in stackframe */ \ |
| 170 | std r9,GPR1(r1); /* store stack frame back link */ \ |
| 171 | std r11,SOFTE(r1); /* and save it to stackframe */ \ |
| 172 | std r12,STACK_FRAME_OVERHEAD-16(r1); /* mark the frame */ \ |
| 173 | std r3,_TRAP(r1); /* set trap number */ \ |
| 174 | std r0,RESULT(r1); /* clear regs->result */ \ |
| 175 | ints; |
| 176 | |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 177 | /* Variants for the "ints" argument. This one does nothing when we want |
| 178 | * to keep interrupts in their original state |
| 179 | */ |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 180 | #define INTS_KEEP |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 181 | |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 182 | /* This second version is meant for exceptions that don't immediately |
| 183 | * hard-enable. We set a bit in paca->irq_happened to ensure that |
| 184 | * a subsequent call to arch_local_irq_restore() will properly |
| 185 | * hard-enable and avoid the fast-path |
| 186 | */ |
| 187 | #define INTS_DISABLE SOFT_DISABLE_INTS(r3,r4) |
| 188 | |
| 189 | /* This is called by exceptions that used INTS_KEEP (that did not touch |
| 190 | * irq indicators in the PACA). This will restore MSR:EE to it's previous |
| 191 | * value |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 192 | * |
| 193 | * XXX In the long run, we may want to open-code it in order to separate the |
| 194 | * load from the wrtee, thus limiting the latency caused by the dependency |
| 195 | * but at this point, I'll favor code clarity until we have a near to final |
| 196 | * implementation |
| 197 | */ |
| 198 | #define INTS_RESTORE_HARD \ |
| 199 | ld r11,_MSR(r1); \ |
| 200 | wrtee r11; |
| 201 | |
| 202 | /* XXX FIXME: Restore r14/r15 when necessary */ |
| 203 | #define BAD_STACK_TRAMPOLINE(n) \ |
| 204 | exc_##n##_bad_stack: \ |
| 205 | li r1,(n); /* get exception number */ \ |
| 206 | sth r1,PACA_TRAP_SAVE(r13); /* store trap */ \ |
| 207 | b bad_stack_book3e; /* bad stack error */ |
| 208 | |
Benjamin Herrenschmidt | ff82c31 | 2010-06-08 10:58:58 +1000 | [diff] [blame] | 209 | /* WARNING: If you change the layout of this stub, make sure you chcek |
| 210 | * the debug exception handler which handles single stepping |
| 211 | * into exceptions from userspace, and the MM code in |
| 212 | * arch/powerpc/mm/tlb_nohash.c which patches the branch here |
| 213 | * and would need to be updated if that branch is moved |
| 214 | */ |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 215 | #define EXCEPTION_STUB(loc, label) \ |
| 216 | . = interrupt_base_book3e + loc; \ |
| 217 | nop; /* To make debug interrupts happy */ \ |
| 218 | b exc_##label##_book3e; |
| 219 | |
| 220 | #define ACK_NONE(r) |
| 221 | #define ACK_DEC(r) \ |
| 222 | lis r,TSR_DIS@h; \ |
| 223 | mtspr SPRN_TSR,r |
| 224 | #define ACK_FIT(r) \ |
| 225 | lis r,TSR_FIS@h; \ |
| 226 | mtspr SPRN_TSR,r |
| 227 | |
Benjamin Herrenschmidt | 34d97e0 | 2010-07-14 14:12:16 +1000 | [diff] [blame] | 228 | /* Used by asynchronous interrupt that may happen in the idle loop. |
| 229 | * |
| 230 | * This check if the thread was in the idle loop, and if yes, returns |
| 231 | * to the caller rather than the PC. This is to avoid a race if |
| 232 | * interrupts happen before the wait instruction. |
| 233 | */ |
| 234 | #define CHECK_NAPPING() \ |
Stuart Yoder | 9778b69 | 2012-07-05 04:41:35 +0000 | [diff] [blame] | 235 | CURRENT_THREAD_INFO(r11, r1); \ |
Benjamin Herrenschmidt | 34d97e0 | 2010-07-14 14:12:16 +1000 | [diff] [blame] | 236 | ld r10,TI_LOCAL_FLAGS(r11); \ |
| 237 | andi. r9,r10,_TLF_NAPPING; \ |
| 238 | beq+ 1f; \ |
| 239 | ld r8,_LINK(r1); \ |
| 240 | rlwinm r7,r10,0,~_TLF_NAPPING; \ |
| 241 | std r8,_NIP(r1); \ |
| 242 | std r7,TI_LOCAL_FLAGS(r11); \ |
| 243 | 1: |
| 244 | |
| 245 | |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 246 | #define MASKABLE_EXCEPTION(trapnum, intnum, label, hdlr, ack) \ |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 247 | START_EXCEPTION(label); \ |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 248 | NORMAL_EXCEPTION_PROLOG(trapnum, intnum, PROLOG_ADDITION_MASKABLE)\ |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 249 | EXCEPTION_COMMON(trapnum, PACA_EXGEN, INTS_DISABLE) \ |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 250 | ack(r8); \ |
Benjamin Herrenschmidt | 34d97e0 | 2010-07-14 14:12:16 +1000 | [diff] [blame] | 251 | CHECK_NAPPING(); \ |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 252 | addi r3,r1,STACK_FRAME_OVERHEAD; \ |
| 253 | bl hdlr; \ |
| 254 | b .ret_from_except_lite; |
| 255 | |
| 256 | /* This value is used to mark exception frames on the stack. */ |
| 257 | .section ".toc","aw" |
| 258 | exception_marker: |
| 259 | .tc ID_EXC_MARKER[TC],STACK_FRAME_REGS_MARKER |
| 260 | |
| 261 | |
| 262 | /* |
| 263 | * And here we have the exception vectors ! |
| 264 | */ |
| 265 | |
| 266 | .text |
| 267 | .balign 0x1000 |
| 268 | .globl interrupt_base_book3e |
| 269 | interrupt_base_book3e: /* fake trap */ |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 270 | EXCEPTION_STUB(0x000, machine_check) /* 0x0200 */ |
| 271 | EXCEPTION_STUB(0x020, critical_input) /* 0x0580 */ |
| 272 | EXCEPTION_STUB(0x040, debug_crit) /* 0x0d00 */ |
| 273 | EXCEPTION_STUB(0x060, data_storage) /* 0x0300 */ |
| 274 | EXCEPTION_STUB(0x080, instruction_storage) /* 0x0400 */ |
| 275 | EXCEPTION_STUB(0x0a0, external_input) /* 0x0500 */ |
| 276 | EXCEPTION_STUB(0x0c0, alignment) /* 0x0600 */ |
| 277 | EXCEPTION_STUB(0x0e0, program) /* 0x0700 */ |
| 278 | EXCEPTION_STUB(0x100, fp_unavailable) /* 0x0800 */ |
| 279 | EXCEPTION_STUB(0x120, system_call) /* 0x0c00 */ |
| 280 | EXCEPTION_STUB(0x140, ap_unavailable) /* 0x0f20 */ |
| 281 | EXCEPTION_STUB(0x160, decrementer) /* 0x0900 */ |
| 282 | EXCEPTION_STUB(0x180, fixed_interval) /* 0x0980 */ |
| 283 | EXCEPTION_STUB(0x1a0, watchdog) /* 0x09f0 */ |
| 284 | EXCEPTION_STUB(0x1c0, data_tlb_miss) |
| 285 | EXCEPTION_STUB(0x1e0, instruction_tlb_miss) |
Scott Wood | 3a6e9bd | 2011-05-09 16:26:00 -0500 | [diff] [blame] | 286 | EXCEPTION_STUB(0x260, perfmon) |
Benjamin Herrenschmidt | 89c8179 | 2010-07-09 15:31:28 +1000 | [diff] [blame] | 287 | EXCEPTION_STUB(0x280, doorbell) |
| 288 | EXCEPTION_STUB(0x2a0, doorbell_crit) |
Scott Wood | 3a6e9bd | 2011-05-09 16:26:00 -0500 | [diff] [blame] | 289 | EXCEPTION_STUB(0x2c0, guest_doorbell) |
| 290 | EXCEPTION_STUB(0x2e0, guest_doorbell_crit) |
| 291 | EXCEPTION_STUB(0x300, hypercall) |
| 292 | EXCEPTION_STUB(0x320, ehpriv) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 293 | |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 294 | .globl interrupt_end_book3e |
| 295 | interrupt_end_book3e: |
| 296 | |
| 297 | /* Critical Input Interrupt */ |
| 298 | START_EXCEPTION(critical_input); |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 299 | CRIT_EXCEPTION_PROLOG(0x100, BOOKE_INTERRUPT_CRITICAL, |
| 300 | PROLOG_ADDITION_NONE) |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 301 | // EXCEPTION_COMMON(0x100, PACA_EXCRIT, INTS_DISABLE) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 302 | // bl special_reg_save_crit |
Benjamin Herrenschmidt | 34d97e0 | 2010-07-14 14:12:16 +1000 | [diff] [blame] | 303 | // CHECK_NAPPING(); |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 304 | // addi r3,r1,STACK_FRAME_OVERHEAD |
| 305 | // bl .critical_exception |
| 306 | // b ret_from_crit_except |
| 307 | b . |
| 308 | |
| 309 | /* Machine Check Interrupt */ |
| 310 | START_EXCEPTION(machine_check); |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 311 | MC_EXCEPTION_PROLOG(0x200, BOOKE_INTERRUPT_MACHINE_CHECK, |
| 312 | PROLOG_ADDITION_NONE) |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 313 | // EXCEPTION_COMMON(0x200, PACA_EXMC, INTS_DISABLE) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 314 | // bl special_reg_save_mc |
| 315 | // addi r3,r1,STACK_FRAME_OVERHEAD |
Benjamin Herrenschmidt | 34d97e0 | 2010-07-14 14:12:16 +1000 | [diff] [blame] | 316 | // CHECK_NAPPING(); |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 317 | // bl .machine_check_exception |
| 318 | // b ret_from_mc_except |
| 319 | b . |
| 320 | |
| 321 | /* Data Storage Interrupt */ |
| 322 | START_EXCEPTION(data_storage) |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 323 | NORMAL_EXCEPTION_PROLOG(0x300, BOOKE_INTERRUPT_DATA_STORAGE, |
| 324 | PROLOG_ADDITION_2REGS) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 325 | mfspr r14,SPRN_DEAR |
| 326 | mfspr r15,SPRN_ESR |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 327 | EXCEPTION_COMMON(0x300, PACA_EXGEN, INTS_DISABLE) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 328 | b storage_fault_common |
| 329 | |
| 330 | /* Instruction Storage Interrupt */ |
| 331 | START_EXCEPTION(instruction_storage); |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 332 | NORMAL_EXCEPTION_PROLOG(0x400, BOOKE_INTERRUPT_INST_STORAGE, |
| 333 | PROLOG_ADDITION_2REGS) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 334 | li r15,0 |
| 335 | mr r14,r10 |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 336 | EXCEPTION_COMMON(0x400, PACA_EXGEN, INTS_DISABLE) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 337 | b storage_fault_common |
| 338 | |
| 339 | /* External Input Interrupt */ |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 340 | MASKABLE_EXCEPTION(0x500, BOOKE_INTERRUPT_EXTERNAL, |
| 341 | external_input, .do_IRQ, ACK_NONE) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 342 | |
| 343 | /* Alignment */ |
| 344 | START_EXCEPTION(alignment); |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 345 | NORMAL_EXCEPTION_PROLOG(0x600, BOOKE_INTERRUPT_ALIGNMENT, |
| 346 | PROLOG_ADDITION_2REGS) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 347 | mfspr r14,SPRN_DEAR |
| 348 | mfspr r15,SPRN_ESR |
| 349 | EXCEPTION_COMMON(0x600, PACA_EXGEN, INTS_KEEP) |
| 350 | b alignment_more /* no room, go out of line */ |
| 351 | |
| 352 | /* Program Interrupt */ |
| 353 | START_EXCEPTION(program); |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 354 | NORMAL_EXCEPTION_PROLOG(0x700, BOOKE_INTERRUPT_PROGRAM, |
| 355 | PROLOG_ADDITION_1REG) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 356 | mfspr r14,SPRN_ESR |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 357 | EXCEPTION_COMMON(0x700, PACA_EXGEN, INTS_DISABLE) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 358 | std r14,_DSISR(r1) |
| 359 | addi r3,r1,STACK_FRAME_OVERHEAD |
| 360 | ld r14,PACA_EXGEN+EX_R14(r13) |
| 361 | bl .save_nvgprs |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 362 | bl .program_check_exception |
| 363 | b .ret_from_except |
| 364 | |
| 365 | /* Floating Point Unavailable Interrupt */ |
| 366 | START_EXCEPTION(fp_unavailable); |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 367 | NORMAL_EXCEPTION_PROLOG(0x800, BOOKE_INTERRUPT_FP_UNAVAIL, |
| 368 | PROLOG_ADDITION_NONE) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 369 | /* we can probably do a shorter exception entry for that one... */ |
| 370 | EXCEPTION_COMMON(0x800, PACA_EXGEN, INTS_KEEP) |
Benjamin Herrenschmidt | 9424fab | 2012-03-05 10:55:04 +1100 | [diff] [blame] | 371 | ld r12,_MSR(r1) |
| 372 | andi. r0,r12,MSR_PR; |
| 373 | beq- 1f |
| 374 | bl .load_up_fpu |
| 375 | b fast_exception_return |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 376 | 1: INTS_DISABLE |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 377 | bl .save_nvgprs |
| 378 | addi r3,r1,STACK_FRAME_OVERHEAD |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 379 | bl .kernel_fp_unavailable_exception |
Benjamin Herrenschmidt | 9424fab | 2012-03-05 10:55:04 +1100 | [diff] [blame] | 380 | b .ret_from_except |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 381 | |
| 382 | /* Decrementer Interrupt */ |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 383 | MASKABLE_EXCEPTION(0x900, BOOKE_INTERRUPT_DECREMENTER, |
| 384 | decrementer, .timer_interrupt, ACK_DEC) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 385 | |
| 386 | /* Fixed Interval Timer Interrupt */ |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 387 | MASKABLE_EXCEPTION(0x980, BOOKE_INTERRUPT_FIT, |
| 388 | fixed_interval, .unknown_exception, ACK_FIT) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 389 | |
| 390 | /* Watchdog Timer Interrupt */ |
| 391 | START_EXCEPTION(watchdog); |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 392 | CRIT_EXCEPTION_PROLOG(0x9f0, BOOKE_INTERRUPT_WATCHDOG, |
| 393 | PROLOG_ADDITION_NONE) |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 394 | // EXCEPTION_COMMON(0x9f0, PACA_EXCRIT, INTS_DISABLE) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 395 | // bl special_reg_save_crit |
Benjamin Herrenschmidt | 34d97e0 | 2010-07-14 14:12:16 +1000 | [diff] [blame] | 396 | // CHECK_NAPPING(); |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 397 | // addi r3,r1,STACK_FRAME_OVERHEAD |
| 398 | // bl .unknown_exception |
| 399 | // b ret_from_crit_except |
| 400 | b . |
| 401 | |
| 402 | /* System Call Interrupt */ |
| 403 | START_EXCEPTION(system_call) |
| 404 | mr r9,r13 /* keep a copy of userland r13 */ |
| 405 | mfspr r11,SPRN_SRR0 /* get return address */ |
| 406 | mfspr r12,SPRN_SRR1 /* get previous MSR */ |
| 407 | mfspr r13,SPRN_SPRG_PACA /* get our PACA */ |
| 408 | b system_call_common |
| 409 | |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 410 | /* Auxiliary Processor Unavailable Interrupt */ |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 411 | START_EXCEPTION(ap_unavailable); |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 412 | NORMAL_EXCEPTION_PROLOG(0xf20, BOOKE_INTERRUPT_AP_UNAVAIL, |
| 413 | PROLOG_ADDITION_NONE) |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 414 | EXCEPTION_COMMON(0xf20, PACA_EXGEN, INTS_DISABLE) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 415 | bl .save_nvgprs |
Benjamin Herrenschmidt | 9f2f79e | 2012-03-01 15:47:44 +1100 | [diff] [blame] | 416 | addi r3,r1,STACK_FRAME_OVERHEAD |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 417 | bl .unknown_exception |
| 418 | b .ret_from_except |
| 419 | |
| 420 | /* Debug exception as a critical interrupt*/ |
| 421 | START_EXCEPTION(debug_crit); |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 422 | CRIT_EXCEPTION_PROLOG(0xd00, BOOKE_INTERRUPT_DEBUG, |
| 423 | PROLOG_ADDITION_2REGS) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 424 | |
| 425 | /* |
| 426 | * If there is a single step or branch-taken exception in an |
| 427 | * exception entry sequence, it was probably meant to apply to |
| 428 | * the code where the exception occurred (since exception entry |
| 429 | * doesn't turn off DE automatically). We simulate the effect |
| 430 | * of turning off DE on entry to an exception handler by turning |
| 431 | * off DE in the CSRR1 value and clearing the debug status. |
| 432 | */ |
| 433 | |
| 434 | mfspr r14,SPRN_DBSR /* check single-step/branch taken */ |
| 435 | andis. r15,r14,DBSR_IC@h |
| 436 | beq+ 1f |
| 437 | |
| 438 | LOAD_REG_IMMEDIATE(r14,interrupt_base_book3e) |
| 439 | LOAD_REG_IMMEDIATE(r15,interrupt_end_book3e) |
| 440 | cmpld cr0,r10,r14 |
| 441 | cmpld cr1,r10,r15 |
| 442 | blt+ cr0,1f |
| 443 | bge+ cr1,1f |
| 444 | |
| 445 | /* here it looks like we got an inappropriate debug exception. */ |
| 446 | lis r14,DBSR_IC@h /* clear the IC event */ |
| 447 | rlwinm r11,r11,0,~MSR_DE /* clear DE in the CSRR1 value */ |
| 448 | mtspr SPRN_DBSR,r14 |
| 449 | mtspr SPRN_CSRR1,r11 |
| 450 | lwz r10,PACA_EXCRIT+EX_CR(r13) /* restore registers */ |
| 451 | ld r1,PACA_EXCRIT+EX_R1(r13) |
| 452 | ld r14,PACA_EXCRIT+EX_R14(r13) |
| 453 | ld r15,PACA_EXCRIT+EX_R15(r13) |
| 454 | mtcr r10 |
| 455 | ld r10,PACA_EXCRIT+EX_R10(r13) /* restore registers */ |
| 456 | ld r11,PACA_EXCRIT+EX_R11(r13) |
| 457 | mfspr r13,SPRN_SPRG_CRIT_SCRATCH |
| 458 | rfci |
| 459 | |
| 460 | /* Normal debug exception */ |
| 461 | /* XXX We only handle coming from userspace for now since we can't |
| 462 | * quite save properly an interrupted kernel state yet |
| 463 | */ |
| 464 | 1: andi. r14,r11,MSR_PR; /* check for userspace again */ |
| 465 | beq kernel_dbg_exc; /* if from kernel mode */ |
| 466 | |
| 467 | /* Now we mash up things to make it look like we are coming on a |
| 468 | * normal exception |
| 469 | */ |
| 470 | mfspr r15,SPRN_SPRG_CRIT_SCRATCH |
| 471 | mtspr SPRN_SPRG_GEN_SCRATCH,r15 |
| 472 | mfspr r14,SPRN_DBSR |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 473 | EXCEPTION_COMMON(0xd00, PACA_EXCRIT, INTS_DISABLE) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 474 | std r14,_DSISR(r1) |
| 475 | addi r3,r1,STACK_FRAME_OVERHEAD |
| 476 | mr r4,r14 |
| 477 | ld r14,PACA_EXCRIT+EX_R14(r13) |
| 478 | ld r15,PACA_EXCRIT+EX_R15(r13) |
| 479 | bl .save_nvgprs |
| 480 | bl .DebugException |
| 481 | b .ret_from_except |
| 482 | |
| 483 | kernel_dbg_exc: |
| 484 | b . /* NYI */ |
| 485 | |
Kumar Gala | d36b4c4 | 2011-04-06 00:18:48 -0500 | [diff] [blame] | 486 | /* Debug exception as a debug interrupt*/ |
| 487 | START_EXCEPTION(debug_debug); |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 488 | DBG_EXCEPTION_PROLOG(0xd00, BOOKE_INTERRUPT_DEBUG, |
| 489 | PROLOG_ADDITION_2REGS) |
Kumar Gala | d36b4c4 | 2011-04-06 00:18:48 -0500 | [diff] [blame] | 490 | |
| 491 | /* |
| 492 | * If there is a single step or branch-taken exception in an |
| 493 | * exception entry sequence, it was probably meant to apply to |
| 494 | * the code where the exception occurred (since exception entry |
| 495 | * doesn't turn off DE automatically). We simulate the effect |
| 496 | * of turning off DE on entry to an exception handler by turning |
| 497 | * off DE in the DSRR1 value and clearing the debug status. |
| 498 | */ |
| 499 | |
| 500 | mfspr r14,SPRN_DBSR /* check single-step/branch taken */ |
| 501 | andis. r15,r14,DBSR_IC@h |
| 502 | beq+ 1f |
| 503 | |
| 504 | LOAD_REG_IMMEDIATE(r14,interrupt_base_book3e) |
| 505 | LOAD_REG_IMMEDIATE(r15,interrupt_end_book3e) |
| 506 | cmpld cr0,r10,r14 |
| 507 | cmpld cr1,r10,r15 |
| 508 | blt+ cr0,1f |
| 509 | bge+ cr1,1f |
| 510 | |
| 511 | /* here it looks like we got an inappropriate debug exception. */ |
| 512 | lis r14,DBSR_IC@h /* clear the IC event */ |
| 513 | rlwinm r11,r11,0,~MSR_DE /* clear DE in the DSRR1 value */ |
| 514 | mtspr SPRN_DBSR,r14 |
| 515 | mtspr SPRN_DSRR1,r11 |
| 516 | lwz r10,PACA_EXDBG+EX_CR(r13) /* restore registers */ |
| 517 | ld r1,PACA_EXDBG+EX_R1(r13) |
| 518 | ld r14,PACA_EXDBG+EX_R14(r13) |
| 519 | ld r15,PACA_EXDBG+EX_R15(r13) |
| 520 | mtcr r10 |
| 521 | ld r10,PACA_EXDBG+EX_R10(r13) /* restore registers */ |
| 522 | ld r11,PACA_EXDBG+EX_R11(r13) |
| 523 | mfspr r13,SPRN_SPRG_DBG_SCRATCH |
| 524 | rfdi |
| 525 | |
| 526 | /* Normal debug exception */ |
| 527 | /* XXX We only handle coming from userspace for now since we can't |
| 528 | * quite save properly an interrupted kernel state yet |
| 529 | */ |
| 530 | 1: andi. r14,r11,MSR_PR; /* check for userspace again */ |
| 531 | beq kernel_dbg_exc; /* if from kernel mode */ |
| 532 | |
| 533 | /* Now we mash up things to make it look like we are coming on a |
| 534 | * normal exception |
| 535 | */ |
| 536 | mfspr r15,SPRN_SPRG_DBG_SCRATCH |
| 537 | mtspr SPRN_SPRG_GEN_SCRATCH,r15 |
| 538 | mfspr r14,SPRN_DBSR |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 539 | EXCEPTION_COMMON(0xd08, PACA_EXDBG, INTS_DISABLE) |
Kumar Gala | d36b4c4 | 2011-04-06 00:18:48 -0500 | [diff] [blame] | 540 | std r14,_DSISR(r1) |
| 541 | addi r3,r1,STACK_FRAME_OVERHEAD |
| 542 | mr r4,r14 |
| 543 | ld r14,PACA_EXDBG+EX_R14(r13) |
| 544 | ld r15,PACA_EXDBG+EX_R15(r13) |
| 545 | bl .save_nvgprs |
| 546 | bl .DebugException |
| 547 | b .ret_from_except |
| 548 | |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 549 | START_EXCEPTION(perfmon); |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 550 | NORMAL_EXCEPTION_PROLOG(0x260, BOOKE_INTERRUPT_PERFORMANCE_MONITOR, |
| 551 | PROLOG_ADDITION_NONE) |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 552 | EXCEPTION_COMMON(0x260, PACA_EXGEN, INTS_DISABLE) |
| 553 | addi r3,r1,STACK_FRAME_OVERHEAD |
| 554 | bl .performance_monitor_exception |
| 555 | b .ret_from_except_lite |
Scott Wood | 3a6e9bd | 2011-05-09 16:26:00 -0500 | [diff] [blame] | 556 | |
Benjamin Herrenschmidt | 89c8179 | 2010-07-09 15:31:28 +1000 | [diff] [blame] | 557 | /* Doorbell interrupt */ |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 558 | MASKABLE_EXCEPTION(0x280, BOOKE_INTERRUPT_DOORBELL, |
| 559 | doorbell, .doorbell_exception, ACK_NONE) |
Benjamin Herrenschmidt | 89c8179 | 2010-07-09 15:31:28 +1000 | [diff] [blame] | 560 | |
| 561 | /* Doorbell critical Interrupt */ |
| 562 | START_EXCEPTION(doorbell_crit); |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 563 | CRIT_EXCEPTION_PROLOG(0x2a0, BOOKE_INTERRUPT_DOORBELL_CRITICAL, |
| 564 | PROLOG_ADDITION_NONE) |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 565 | // EXCEPTION_COMMON(0x2a0, PACA_EXCRIT, INTS_DISABLE) |
Benjamin Herrenschmidt | 89c8179 | 2010-07-09 15:31:28 +1000 | [diff] [blame] | 566 | // bl special_reg_save_crit |
Benjamin Herrenschmidt | 34d97e0 | 2010-07-14 14:12:16 +1000 | [diff] [blame] | 567 | // CHECK_NAPPING(); |
Benjamin Herrenschmidt | 89c8179 | 2010-07-09 15:31:28 +1000 | [diff] [blame] | 568 | // addi r3,r1,STACK_FRAME_OVERHEAD |
| 569 | // bl .doorbell_critical_exception |
| 570 | // b ret_from_crit_except |
| 571 | b . |
| 572 | |
Mihai Caraman | 5473eb1 | 2012-08-06 03:27:04 +0000 | [diff] [blame] | 573 | /* |
| 574 | * Guest doorbell interrupt |
| 575 | * This general exception use GSRRx save/restore registers |
| 576 | */ |
| 577 | START_EXCEPTION(guest_doorbell); |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 578 | GDBELL_EXCEPTION_PROLOG(0x2c0, BOOKE_INTERRUPT_GUEST_DBELL, |
| 579 | PROLOG_ADDITION_NONE) |
Mihai Caraman | 5473eb1 | 2012-08-06 03:27:04 +0000 | [diff] [blame] | 580 | EXCEPTION_COMMON(0x2c0, PACA_EXGEN, INTS_KEEP) |
| 581 | addi r3,r1,STACK_FRAME_OVERHEAD |
| 582 | bl .save_nvgprs |
| 583 | INTS_RESTORE_HARD |
| 584 | bl .unknown_exception |
| 585 | b .ret_from_except |
Scott Wood | 3a6e9bd | 2011-05-09 16:26:00 -0500 | [diff] [blame] | 586 | |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 587 | /* Guest Doorbell critical Interrupt */ |
| 588 | START_EXCEPTION(guest_doorbell_crit); |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 589 | CRIT_EXCEPTION_PROLOG(0x2e0, BOOKE_INTERRUPT_GUEST_DBELL_CRIT, |
| 590 | PROLOG_ADDITION_NONE) |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 591 | // EXCEPTION_COMMON(0x2e0, PACA_EXCRIT, INTS_DISABLE) |
| 592 | // bl special_reg_save_crit |
| 593 | // CHECK_NAPPING(); |
| 594 | // addi r3,r1,STACK_FRAME_OVERHEAD |
| 595 | // bl .guest_doorbell_critical_exception |
| 596 | // b ret_from_crit_except |
| 597 | b . |
| 598 | |
| 599 | /* Hypervisor call */ |
| 600 | START_EXCEPTION(hypercall); |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 601 | NORMAL_EXCEPTION_PROLOG(0x310, BOOKE_INTERRUPT_HV_SYSCALL, |
| 602 | PROLOG_ADDITION_NONE) |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 603 | EXCEPTION_COMMON(0x310, PACA_EXGEN, INTS_KEEP) |
| 604 | addi r3,r1,STACK_FRAME_OVERHEAD |
| 605 | bl .save_nvgprs |
| 606 | INTS_RESTORE_HARD |
| 607 | bl .unknown_exception |
| 608 | b .ret_from_except |
| 609 | |
| 610 | /* Embedded Hypervisor priviledged */ |
| 611 | START_EXCEPTION(ehpriv); |
Mihai Caraman | fecff0f | 2012-08-06 03:27:05 +0000 | [diff] [blame] | 612 | NORMAL_EXCEPTION_PROLOG(0x320, BOOKE_INTERRUPT_HV_PRIV, |
| 613 | PROLOG_ADDITION_NONE) |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 614 | EXCEPTION_COMMON(0x320, PACA_EXGEN, INTS_KEEP) |
| 615 | addi r3,r1,STACK_FRAME_OVERHEAD |
| 616 | bl .save_nvgprs |
| 617 | INTS_RESTORE_HARD |
| 618 | bl .unknown_exception |
| 619 | b .ret_from_except |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 620 | |
| 621 | /* |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 622 | * An interrupt came in while soft-disabled; We mark paca->irq_happened |
| 623 | * accordingly and if the interrupt is level sensitive, we hard disable |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 624 | */ |
Scott Wood | 3d97a61 | 2011-06-22 11:19:49 +0000 | [diff] [blame] | 625 | |
Mihai Caraman | 79b5c8d | 2012-08-06 03:27:06 +0000 | [diff] [blame^] | 626 | .macro masked_interrupt_book3e paca_irq full_mask |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 627 | lbz r10,PACAIRQHAPPENED(r13) |
Mihai Caraman | 79b5c8d | 2012-08-06 03:27:06 +0000 | [diff] [blame^] | 628 | ori r10,r10,\paca_irq |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 629 | stb r10,PACAIRQHAPPENED(r13) |
Mihai Caraman | 79b5c8d | 2012-08-06 03:27:06 +0000 | [diff] [blame^] | 630 | |
| 631 | .if \full_mask == 1 |
| 632 | rldicl r10,r11,48,1 /* clear MSR_EE */ |
| 633 | rotldi r11,r10,16 |
| 634 | mtspr SPRN_SRR1,r11 |
| 635 | .endif |
| 636 | |
| 637 | lwz r11,PACA_EXGEN+EX_CR(r13) |
| 638 | mtcr r11 |
| 639 | ld r10,PACA_EXGEN+EX_R10(r13) |
| 640 | ld r11,PACA_EXGEN+EX_R11(r13) |
| 641 | mfspr r13,SPRN_SPRG_GEN_SCRATCH |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 642 | rfi |
| 643 | b . |
Mihai Caraman | 79b5c8d | 2012-08-06 03:27:06 +0000 | [diff] [blame^] | 644 | .endm |
| 645 | |
| 646 | masked_interrupt_book3e_0x500: |
| 647 | // XXX When adding support for EPR, use PACA_IRQ_EE_EDGE |
| 648 | masked_interrupt_book3e PACA_IRQ_EE 1 |
| 649 | |
| 650 | masked_interrupt_book3e_0x900: |
| 651 | ACK_DEC(r10); |
| 652 | masked_interrupt_book3e PACA_IRQ_DEC 0 |
| 653 | |
| 654 | masked_interrupt_book3e_0x980: |
| 655 | ACK_FIT(r10); |
| 656 | masked_interrupt_book3e PACA_IRQ_DEC 0 |
| 657 | |
| 658 | masked_interrupt_book3e_0x280: |
| 659 | masked_interrupt_book3e_0x2c0: |
| 660 | masked_interrupt_book3e PACA_IRQ_DBELL 0 |
| 661 | |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 662 | /* |
| 663 | * Called from arch_local_irq_enable when an interrupt needs |
| 664 | * to be resent. r3 contains either 0x500,0x900,0x260 or 0x280 |
| 665 | * to indicate the kind of interrupt. MSR:EE is already off. |
| 666 | * We generate a stackframe like if a real interrupt had happened. |
| 667 | * |
| 668 | * Note: While MSR:EE is off, we need to make sure that _MSR |
| 669 | * in the generated frame has EE set to 1 or the exception |
| 670 | * handler will not properly re-enable them. |
| 671 | */ |
| 672 | _GLOBAL(__replay_interrupt) |
| 673 | /* We are going to jump to the exception common code which |
| 674 | * will retrieve various register values from the PACA which |
| 675 | * we don't give a damn about. |
| 676 | */ |
| 677 | mflr r10 |
| 678 | mfmsr r11 |
| 679 | mfcr r4 |
| 680 | mtspr SPRN_SPRG_GEN_SCRATCH,r13; |
| 681 | std r1,PACA_EXGEN+EX_R1(r13); |
| 682 | stw r4,PACA_EXGEN+EX_CR(r13); |
| 683 | ori r11,r11,MSR_EE |
| 684 | subi r1,r1,INT_FRAME_SIZE; |
| 685 | cmpwi cr0,r3,0x500 |
| 686 | beq exc_0x500_common |
| 687 | cmpwi cr0,r3,0x900 |
| 688 | beq exc_0x900_common |
| 689 | cmpwi cr0,r3,0x280 |
| 690 | beq exc_0x280_common |
| 691 | blr |
| 692 | |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 693 | |
| 694 | /* |
| 695 | * This is called from 0x300 and 0x400 handlers after the prologs with |
| 696 | * r14 and r15 containing the fault address and error code, with the |
| 697 | * original values stashed away in the PACA |
| 698 | */ |
| 699 | storage_fault_common: |
| 700 | std r14,_DAR(r1) |
| 701 | std r15,_DSISR(r1) |
| 702 | addi r3,r1,STACK_FRAME_OVERHEAD |
| 703 | mr r4,r14 |
| 704 | mr r5,r15 |
| 705 | ld r14,PACA_EXGEN+EX_R14(r13) |
| 706 | ld r15,PACA_EXGEN+EX_R15(r13) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 707 | bl .do_page_fault |
| 708 | cmpdi r3,0 |
| 709 | bne- 1f |
| 710 | b .ret_from_except_lite |
| 711 | 1: bl .save_nvgprs |
| 712 | mr r5,r3 |
| 713 | addi r3,r1,STACK_FRAME_OVERHEAD |
| 714 | ld r4,_DAR(r1) |
| 715 | bl .bad_page_fault |
| 716 | b .ret_from_except |
| 717 | |
| 718 | /* |
| 719 | * Alignment exception doesn't fit entirely in the 0x100 bytes so it |
| 720 | * continues here. |
| 721 | */ |
| 722 | alignment_more: |
| 723 | std r14,_DAR(r1) |
| 724 | std r15,_DSISR(r1) |
| 725 | addi r3,r1,STACK_FRAME_OVERHEAD |
| 726 | ld r14,PACA_EXGEN+EX_R14(r13) |
| 727 | ld r15,PACA_EXGEN+EX_R15(r13) |
| 728 | bl .save_nvgprs |
| 729 | INTS_RESTORE_HARD |
| 730 | bl .alignment_exception |
| 731 | b .ret_from_except |
| 732 | |
| 733 | /* |
| 734 | * We branch here from entry_64.S for the last stage of the exception |
| 735 | * return code path. MSR:EE is expected to be off at that point |
| 736 | */ |
| 737 | _GLOBAL(exception_return_book3e) |
| 738 | b 1f |
| 739 | |
| 740 | /* This is the return from load_up_fpu fast path which could do with |
| 741 | * less GPR restores in fact, but for now we have a single return path |
| 742 | */ |
| 743 | .globl fast_exception_return |
| 744 | fast_exception_return: |
| 745 | wrteei 0 |
| 746 | 1: mr r0,r13 |
| 747 | ld r10,_MSR(r1) |
| 748 | REST_4GPRS(2, r1) |
| 749 | andi. r6,r10,MSR_PR |
| 750 | REST_2GPRS(6, r1) |
| 751 | beq 1f |
| 752 | ACCOUNT_CPU_USER_EXIT(r10, r11) |
| 753 | ld r0,GPR13(r1) |
| 754 | |
| 755 | 1: stdcx. r0,0,r1 /* to clear the reservation */ |
| 756 | |
| 757 | ld r8,_CCR(r1) |
| 758 | ld r9,_LINK(r1) |
| 759 | ld r10,_CTR(r1) |
| 760 | ld r11,_XER(r1) |
| 761 | mtcr r8 |
| 762 | mtlr r9 |
| 763 | mtctr r10 |
| 764 | mtxer r11 |
| 765 | REST_2GPRS(8, r1) |
| 766 | ld r10,GPR10(r1) |
| 767 | ld r11,GPR11(r1) |
| 768 | ld r12,GPR12(r1) |
| 769 | mtspr SPRN_SPRG_GEN_SCRATCH,r0 |
| 770 | |
| 771 | std r10,PACA_EXGEN+EX_R10(r13); |
| 772 | std r11,PACA_EXGEN+EX_R11(r13); |
| 773 | ld r10,_NIP(r1) |
| 774 | ld r11,_MSR(r1) |
| 775 | ld r0,GPR0(r1) |
| 776 | ld r1,GPR1(r1) |
| 777 | mtspr SPRN_SRR0,r10 |
| 778 | mtspr SPRN_SRR1,r11 |
| 779 | ld r10,PACA_EXGEN+EX_R10(r13) |
| 780 | ld r11,PACA_EXGEN+EX_R11(r13) |
| 781 | mfspr r13,SPRN_SPRG_GEN_SCRATCH |
| 782 | rfi |
| 783 | |
| 784 | /* |
| 785 | * Trampolines used when spotting a bad kernel stack pointer in |
| 786 | * the exception entry code. |
| 787 | * |
| 788 | * TODO: move some bits like SRR0 read to trampoline, pass PACA |
| 789 | * index around, etc... to handle crit & mcheck |
| 790 | */ |
| 791 | BAD_STACK_TRAMPOLINE(0x000) |
| 792 | BAD_STACK_TRAMPOLINE(0x100) |
| 793 | BAD_STACK_TRAMPOLINE(0x200) |
Scott Wood | 3a6e9bd | 2011-05-09 16:26:00 -0500 | [diff] [blame] | 794 | BAD_STACK_TRAMPOLINE(0x260) |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 795 | BAD_STACK_TRAMPOLINE(0x280) |
| 796 | BAD_STACK_TRAMPOLINE(0x2a0) |
Scott Wood | 3a6e9bd | 2011-05-09 16:26:00 -0500 | [diff] [blame] | 797 | BAD_STACK_TRAMPOLINE(0x2c0) |
| 798 | BAD_STACK_TRAMPOLINE(0x2e0) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 799 | BAD_STACK_TRAMPOLINE(0x300) |
Scott Wood | 3a6e9bd | 2011-05-09 16:26:00 -0500 | [diff] [blame] | 800 | BAD_STACK_TRAMPOLINE(0x310) |
| 801 | BAD_STACK_TRAMPOLINE(0x320) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 802 | BAD_STACK_TRAMPOLINE(0x400) |
| 803 | BAD_STACK_TRAMPOLINE(0x500) |
| 804 | BAD_STACK_TRAMPOLINE(0x600) |
| 805 | BAD_STACK_TRAMPOLINE(0x700) |
| 806 | BAD_STACK_TRAMPOLINE(0x800) |
| 807 | BAD_STACK_TRAMPOLINE(0x900) |
| 808 | BAD_STACK_TRAMPOLINE(0x980) |
| 809 | BAD_STACK_TRAMPOLINE(0x9f0) |
| 810 | BAD_STACK_TRAMPOLINE(0xa00) |
| 811 | BAD_STACK_TRAMPOLINE(0xb00) |
| 812 | BAD_STACK_TRAMPOLINE(0xc00) |
| 813 | BAD_STACK_TRAMPOLINE(0xd00) |
Benjamin Herrenschmidt | 7230c56 | 2012-03-06 18:27:59 +1100 | [diff] [blame] | 814 | BAD_STACK_TRAMPOLINE(0xd08) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 815 | BAD_STACK_TRAMPOLINE(0xe00) |
| 816 | BAD_STACK_TRAMPOLINE(0xf00) |
| 817 | BAD_STACK_TRAMPOLINE(0xf20) |
| 818 | |
| 819 | .globl bad_stack_book3e |
| 820 | bad_stack_book3e: |
| 821 | /* XXX: Needs to make SPRN_SPRG_GEN depend on exception type */ |
| 822 | mfspr r10,SPRN_SRR0; /* read SRR0 before touching stack */ |
| 823 | ld r1,PACAEMERGSP(r13) |
| 824 | subi r1,r1,64+INT_FRAME_SIZE |
| 825 | std r10,_NIP(r1) |
| 826 | std r11,_MSR(r1) |
| 827 | ld r10,PACA_EXGEN+EX_R1(r13) /* FIXME for crit & mcheck */ |
| 828 | lwz r11,PACA_EXGEN+EX_CR(r13) /* FIXME for crit & mcheck */ |
| 829 | std r10,GPR1(r1) |
| 830 | std r11,_CCR(r1) |
| 831 | mfspr r10,SPRN_DEAR |
| 832 | mfspr r11,SPRN_ESR |
| 833 | std r10,_DAR(r1) |
| 834 | std r11,_DSISR(r1) |
| 835 | std r0,GPR0(r1); /* save r0 in stackframe */ \ |
| 836 | std r2,GPR2(r1); /* save r2 in stackframe */ \ |
| 837 | SAVE_4GPRS(3, r1); /* save r3 - r6 in stackframe */ \ |
| 838 | SAVE_2GPRS(7, r1); /* save r7, r8 in stackframe */ \ |
| 839 | std r9,GPR9(r1); /* save r9 in stackframe */ \ |
| 840 | ld r3,PACA_EXGEN+EX_R10(r13);/* get back r10 */ \ |
| 841 | ld r4,PACA_EXGEN+EX_R11(r13);/* get back r11 */ \ |
| 842 | mfspr r5,SPRN_SPRG_GEN_SCRATCH;/* get back r13 XXX can be wrong */ \ |
| 843 | std r3,GPR10(r1); /* save r10 to stackframe */ \ |
| 844 | std r4,GPR11(r1); /* save r11 to stackframe */ \ |
| 845 | std r12,GPR12(r1); /* save r12 in stackframe */ \ |
| 846 | std r5,GPR13(r1); /* save it to stackframe */ \ |
| 847 | mflr r10 |
| 848 | mfctr r11 |
| 849 | mfxer r12 |
| 850 | std r10,_LINK(r1) |
| 851 | std r11,_CTR(r1) |
| 852 | std r12,_XER(r1) |
| 853 | SAVE_10GPRS(14,r1) |
| 854 | SAVE_8GPRS(24,r1) |
| 855 | lhz r12,PACA_TRAP_SAVE(r13) |
| 856 | std r12,_TRAP(r1) |
| 857 | addi r11,r1,INT_FRAME_SIZE |
| 858 | std r11,0(r1) |
| 859 | li r12,0 |
| 860 | std r12,0(r11) |
| 861 | ld r2,PACATOC(r13) |
| 862 | 1: addi r3,r1,STACK_FRAME_OVERHEAD |
| 863 | bl .kernel_bad_stack |
| 864 | b 1b |
| 865 | |
| 866 | /* |
| 867 | * Setup the initial TLB for a core. This current implementation |
| 868 | * assume that whatever we are running off will not conflict with |
| 869 | * the new mapping at PAGE_OFFSET. |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 870 | */ |
| 871 | _GLOBAL(initial_tlb_book3e) |
| 872 | |
Kumar Gala | bb1af71 | 2009-08-18 19:08:33 +0000 | [diff] [blame] | 873 | /* Look for the first TLB with IPROT set */ |
| 874 | mfspr r4,SPRN_TLB0CFG |
| 875 | andi. r3,r4,TLBnCFG_IPROT |
| 876 | lis r3,MAS0_TLBSEL(0)@h |
| 877 | bne found_iprot |
| 878 | |
| 879 | mfspr r4,SPRN_TLB1CFG |
| 880 | andi. r3,r4,TLBnCFG_IPROT |
| 881 | lis r3,MAS0_TLBSEL(1)@h |
| 882 | bne found_iprot |
| 883 | |
| 884 | mfspr r4,SPRN_TLB2CFG |
| 885 | andi. r3,r4,TLBnCFG_IPROT |
| 886 | lis r3,MAS0_TLBSEL(2)@h |
| 887 | bne found_iprot |
| 888 | |
| 889 | lis r3,MAS0_TLBSEL(3)@h |
| 890 | mfspr r4,SPRN_TLB3CFG |
| 891 | /* fall through */ |
| 892 | |
| 893 | found_iprot: |
| 894 | andi. r5,r4,TLBnCFG_HES |
| 895 | bne have_hes |
| 896 | |
| 897 | mflr r8 /* save LR */ |
| 898 | /* 1. Find the index of the entry we're executing in |
| 899 | * |
| 900 | * r3 = MAS0_TLBSEL (for the iprot array) |
| 901 | * r4 = SPRN_TLBnCFG |
| 902 | */ |
| 903 | bl invstr /* Find our address */ |
| 904 | invstr: mflr r6 /* Make it accessible */ |
| 905 | mfmsr r7 |
| 906 | rlwinm r5,r7,27,31,31 /* extract MSR[IS] */ |
| 907 | mfspr r7,SPRN_PID |
| 908 | slwi r7,r7,16 |
| 909 | or r7,r7,r5 |
| 910 | mtspr SPRN_MAS6,r7 |
| 911 | tlbsx 0,r6 /* search MSR[IS], SPID=PID */ |
| 912 | |
| 913 | mfspr r3,SPRN_MAS0 |
| 914 | rlwinm r5,r3,16,20,31 /* Extract MAS0(Entry) */ |
| 915 | |
| 916 | mfspr r7,SPRN_MAS1 /* Insure IPROT set */ |
| 917 | oris r7,r7,MAS1_IPROT@h |
| 918 | mtspr SPRN_MAS1,r7 |
| 919 | tlbwe |
| 920 | |
| 921 | /* 2. Invalidate all entries except the entry we're executing in |
| 922 | * |
| 923 | * r3 = MAS0 w/TLBSEL & ESEL for the entry we are running in |
| 924 | * r4 = SPRN_TLBnCFG |
| 925 | * r5 = ESEL of entry we are running in |
| 926 | */ |
| 927 | andi. r4,r4,TLBnCFG_N_ENTRY /* Extract # entries */ |
| 928 | li r6,0 /* Set Entry counter to 0 */ |
| 929 | 1: mr r7,r3 /* Set MAS0(TLBSEL) */ |
| 930 | rlwimi r7,r6,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r6) */ |
| 931 | mtspr SPRN_MAS0,r7 |
| 932 | tlbre |
| 933 | mfspr r7,SPRN_MAS1 |
| 934 | rlwinm r7,r7,0,2,31 /* Clear MAS1 Valid and IPROT */ |
| 935 | cmpw r5,r6 |
| 936 | beq skpinv /* Dont update the current execution TLB */ |
| 937 | mtspr SPRN_MAS1,r7 |
| 938 | tlbwe |
| 939 | isync |
| 940 | skpinv: addi r6,r6,1 /* Increment */ |
| 941 | cmpw r6,r4 /* Are we done? */ |
| 942 | bne 1b /* If not, repeat */ |
| 943 | |
| 944 | /* Invalidate all TLBs */ |
Michael Neuling | 962cffb | 2012-06-25 13:33:25 +0000 | [diff] [blame] | 945 | PPC_TLBILX_ALL(0,R0) |
Kumar Gala | bb1af71 | 2009-08-18 19:08:33 +0000 | [diff] [blame] | 946 | sync |
| 947 | isync |
| 948 | |
| 949 | /* 3. Setup a temp mapping and jump to it |
| 950 | * |
| 951 | * r3 = MAS0 w/TLBSEL & ESEL for the entry we are running in |
| 952 | * r5 = ESEL of entry we are running in |
| 953 | */ |
| 954 | andi. r7,r5,0x1 /* Find an entry not used and is non-zero */ |
| 955 | addi r7,r7,0x1 |
| 956 | mr r4,r3 /* Set MAS0(TLBSEL) = 1 */ |
| 957 | mtspr SPRN_MAS0,r4 |
| 958 | tlbre |
| 959 | |
| 960 | rlwimi r4,r7,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r7) */ |
| 961 | mtspr SPRN_MAS0,r4 |
| 962 | |
| 963 | mfspr r7,SPRN_MAS1 |
| 964 | xori r6,r7,MAS1_TS /* Setup TMP mapping in the other Address space */ |
| 965 | mtspr SPRN_MAS1,r6 |
| 966 | |
| 967 | tlbwe |
| 968 | |
| 969 | mfmsr r6 |
| 970 | xori r6,r6,MSR_IS |
| 971 | mtspr SPRN_SRR1,r6 |
| 972 | bl 1f /* Find our address */ |
| 973 | 1: mflr r6 |
| 974 | addi r6,r6,(2f - 1b) |
| 975 | mtspr SPRN_SRR0,r6 |
| 976 | rfi |
| 977 | 2: |
| 978 | |
| 979 | /* 4. Clear out PIDs & Search info |
| 980 | * |
| 981 | * r3 = MAS0 w/TLBSEL & ESEL for the entry we started in |
| 982 | * r4 = MAS0 w/TLBSEL & ESEL for the temp mapping |
| 983 | * r5 = MAS3 |
| 984 | */ |
| 985 | li r6,0 |
| 986 | mtspr SPRN_MAS6,r6 |
| 987 | mtspr SPRN_PID,r6 |
| 988 | |
| 989 | /* 5. Invalidate mapping we started in |
| 990 | * |
| 991 | * r3 = MAS0 w/TLBSEL & ESEL for the entry we started in |
| 992 | * r4 = MAS0 w/TLBSEL & ESEL for the temp mapping |
| 993 | * r5 = MAS3 |
| 994 | */ |
| 995 | mtspr SPRN_MAS0,r3 |
| 996 | tlbre |
| 997 | mfspr r6,SPRN_MAS1 |
| 998 | rlwinm r6,r6,0,2,0 /* clear IPROT */ |
| 999 | mtspr SPRN_MAS1,r6 |
| 1000 | tlbwe |
| 1001 | |
| 1002 | /* Invalidate TLB1 */ |
Michael Neuling | 962cffb | 2012-06-25 13:33:25 +0000 | [diff] [blame] | 1003 | PPC_TLBILX_ALL(0,R0) |
Kumar Gala | bb1af71 | 2009-08-18 19:08:33 +0000 | [diff] [blame] | 1004 | sync |
| 1005 | isync |
| 1006 | |
| 1007 | /* The mapping only needs to be cache-coherent on SMP */ |
| 1008 | #ifdef CONFIG_SMP |
| 1009 | #define M_IF_SMP MAS2_M |
| 1010 | #else |
| 1011 | #define M_IF_SMP 0 |
| 1012 | #endif |
| 1013 | |
| 1014 | /* 6. Setup KERNELBASE mapping in TLB[0] |
| 1015 | * |
| 1016 | * r3 = MAS0 w/TLBSEL & ESEL for the entry we started in |
| 1017 | * r4 = MAS0 w/TLBSEL & ESEL for the temp mapping |
| 1018 | * r5 = MAS3 |
| 1019 | */ |
| 1020 | rlwinm r3,r3,0,16,3 /* clear ESEL */ |
| 1021 | mtspr SPRN_MAS0,r3 |
| 1022 | lis r6,(MAS1_VALID|MAS1_IPROT)@h |
| 1023 | ori r6,r6,(MAS1_TSIZE(BOOK3E_PAGESZ_1GB))@l |
| 1024 | mtspr SPRN_MAS1,r6 |
| 1025 | |
| 1026 | LOAD_REG_IMMEDIATE(r6, PAGE_OFFSET | M_IF_SMP) |
| 1027 | mtspr SPRN_MAS2,r6 |
| 1028 | |
| 1029 | rlwinm r5,r5,0,0,25 |
| 1030 | ori r5,r5,MAS3_SR | MAS3_SW | MAS3_SX |
| 1031 | mtspr SPRN_MAS3,r5 |
| 1032 | li r5,-1 |
| 1033 | rlwinm r5,r5,0,0,25 |
| 1034 | |
| 1035 | tlbwe |
| 1036 | |
| 1037 | /* 7. Jump to KERNELBASE mapping |
| 1038 | * |
| 1039 | * r4 = MAS0 w/TLBSEL & ESEL for the temp mapping |
| 1040 | */ |
| 1041 | /* Now we branch the new virtual address mapped by this entry */ |
| 1042 | LOAD_REG_IMMEDIATE(r6,2f) |
| 1043 | lis r7,MSR_KERNEL@h |
| 1044 | ori r7,r7,MSR_KERNEL@l |
| 1045 | mtspr SPRN_SRR0,r6 |
| 1046 | mtspr SPRN_SRR1,r7 |
| 1047 | rfi /* start execution out of TLB1[0] entry */ |
| 1048 | 2: |
| 1049 | |
| 1050 | /* 8. Clear out the temp mapping |
| 1051 | * |
| 1052 | * r4 = MAS0 w/TLBSEL & ESEL for the entry we are running in |
| 1053 | */ |
| 1054 | mtspr SPRN_MAS0,r4 |
| 1055 | tlbre |
| 1056 | mfspr r5,SPRN_MAS1 |
| 1057 | rlwinm r5,r5,0,2,0 /* clear IPROT */ |
| 1058 | mtspr SPRN_MAS1,r5 |
| 1059 | tlbwe |
| 1060 | |
| 1061 | /* Invalidate TLB1 */ |
Michael Neuling | 962cffb | 2012-06-25 13:33:25 +0000 | [diff] [blame] | 1062 | PPC_TLBILX_ALL(0,R0) |
Kumar Gala | bb1af71 | 2009-08-18 19:08:33 +0000 | [diff] [blame] | 1063 | sync |
| 1064 | isync |
| 1065 | |
| 1066 | /* We translate LR and return */ |
| 1067 | tovirt(r8,r8) |
| 1068 | mtlr r8 |
| 1069 | blr |
| 1070 | |
| 1071 | have_hes: |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 1072 | /* Setup MAS 0,1,2,3 and 7 for tlbwe of a 1G entry that maps the |
| 1073 | * kernel linear mapping. We also set MAS8 once for all here though |
| 1074 | * that will have to be made dependent on whether we are running under |
| 1075 | * a hypervisor I suppose. |
| 1076 | */ |
David Gibson | a1d0d98 | 2011-04-14 22:32:06 +0000 | [diff] [blame] | 1077 | |
| 1078 | /* BEWARE, MAGIC |
| 1079 | * This code is called as an ordinary function on the boot CPU. But to |
| 1080 | * avoid duplication, this code is also used in SCOM bringup of |
| 1081 | * secondary CPUs. We read the code between the initial_tlb_code_start |
| 1082 | * and initial_tlb_code_end labels one instruction at a time and RAM it |
| 1083 | * into the new core via SCOM. That doesn't process branches, so there |
| 1084 | * must be none between those two labels. It also means if this code |
| 1085 | * ever takes any parameters, the SCOM code must also be updated to |
| 1086 | * provide them. |
| 1087 | */ |
| 1088 | .globl a2_tlbinit_code_start |
| 1089 | a2_tlbinit_code_start: |
| 1090 | |
Benjamin Herrenschmidt | 1a51dde | 2011-04-14 22:32:04 +0000 | [diff] [blame] | 1091 | ori r11,r3,MAS0_WQ_ALLWAYS |
| 1092 | oris r11,r11,MAS0_ESEL(3)@h /* Use way 3: workaround A2 erratum 376 */ |
| 1093 | mtspr SPRN_MAS0,r11 |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 1094 | lis r3,(MAS1_VALID | MAS1_IPROT)@h |
| 1095 | ori r3,r3,BOOK3E_PAGESZ_1GB << MAS1_TSIZE_SHIFT |
| 1096 | mtspr SPRN_MAS1,r3 |
| 1097 | LOAD_REG_IMMEDIATE(r3, PAGE_OFFSET | MAS2_M) |
| 1098 | mtspr SPRN_MAS2,r3 |
| 1099 | li r3,MAS3_SR | MAS3_SW | MAS3_SX |
| 1100 | mtspr SPRN_MAS7_MAS3,r3 |
| 1101 | li r3,0 |
| 1102 | mtspr SPRN_MAS8,r3 |
| 1103 | |
| 1104 | /* Write the TLB entry */ |
| 1105 | tlbwe |
| 1106 | |
David Gibson | a1d0d98 | 2011-04-14 22:32:06 +0000 | [diff] [blame] | 1107 | .globl a2_tlbinit_after_linear_map |
| 1108 | a2_tlbinit_after_linear_map: |
| 1109 | |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 1110 | /* Now we branch the new virtual address mapped by this entry */ |
| 1111 | LOAD_REG_IMMEDIATE(r3,1f) |
| 1112 | mtctr r3 |
| 1113 | bctr |
| 1114 | |
| 1115 | 1: /* We are now running at PAGE_OFFSET, clean the TLB of everything |
Jack Miller | f0aae32 | 2011-04-14 22:32:05 +0000 | [diff] [blame] | 1116 | * else (including IPROTed things left by firmware) |
| 1117 | * r4 = TLBnCFG |
| 1118 | * r3 = current address (more or less) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 1119 | */ |
Jack Miller | f0aae32 | 2011-04-14 22:32:05 +0000 | [diff] [blame] | 1120 | |
| 1121 | li r5,0 |
| 1122 | mtspr SPRN_MAS6,r5 |
| 1123 | tlbsx 0,r3 |
| 1124 | |
| 1125 | rlwinm r9,r4,0,TLBnCFG_N_ENTRY |
| 1126 | rlwinm r10,r4,8,0xff |
| 1127 | addi r10,r10,-1 /* Get inner loop mask */ |
| 1128 | |
| 1129 | li r3,1 |
| 1130 | |
| 1131 | mfspr r5,SPRN_MAS1 |
| 1132 | rlwinm r5,r5,0,(~(MAS1_VALID|MAS1_IPROT)) |
| 1133 | |
| 1134 | mfspr r6,SPRN_MAS2 |
| 1135 | rldicr r6,r6,0,51 /* Extract EPN */ |
| 1136 | |
| 1137 | mfspr r7,SPRN_MAS0 |
| 1138 | rlwinm r7,r7,0,0xffff0fff /* Clear HES and WQ */ |
| 1139 | |
| 1140 | rlwinm r8,r7,16,0xfff /* Extract ESEL */ |
| 1141 | |
| 1142 | 2: add r4,r3,r8 |
| 1143 | and r4,r4,r10 |
| 1144 | |
| 1145 | rlwimi r7,r4,16,MAS0_ESEL_MASK |
| 1146 | |
| 1147 | mtspr SPRN_MAS0,r7 |
| 1148 | mtspr SPRN_MAS1,r5 |
| 1149 | mtspr SPRN_MAS2,r6 |
| 1150 | tlbwe |
| 1151 | |
| 1152 | addi r3,r3,1 |
| 1153 | and. r4,r3,r10 |
| 1154 | |
| 1155 | bne 3f |
| 1156 | addis r6,r6,(1<<30)@h |
| 1157 | 3: |
| 1158 | cmpw r3,r9 |
| 1159 | blt 2b |
| 1160 | |
David Gibson | a1d0d98 | 2011-04-14 22:32:06 +0000 | [diff] [blame] | 1161 | .globl a2_tlbinit_after_iprot_flush |
| 1162 | a2_tlbinit_after_iprot_flush: |
| 1163 | |
Jack Miller | a0496d4 | 2011-04-14 22:32:08 +0000 | [diff] [blame] | 1164 | #ifdef CONFIG_PPC_EARLY_DEBUG_WSP |
| 1165 | /* Now establish early debug mappings if applicable */ |
| 1166 | /* Restore the MAS0 we used for linear mapping load */ |
| 1167 | mtspr SPRN_MAS0,r11 |
| 1168 | |
| 1169 | lis r3,(MAS1_VALID | MAS1_IPROT)@h |
| 1170 | ori r3,r3,(BOOK3E_PAGESZ_4K << MAS1_TSIZE_SHIFT) |
| 1171 | mtspr SPRN_MAS1,r3 |
| 1172 | LOAD_REG_IMMEDIATE(r3, WSP_UART_VIRT | MAS2_I | MAS2_G) |
| 1173 | mtspr SPRN_MAS2,r3 |
| 1174 | LOAD_REG_IMMEDIATE(r3, WSP_UART_PHYS | MAS3_SR | MAS3_SW) |
| 1175 | mtspr SPRN_MAS7_MAS3,r3 |
| 1176 | /* re-use the MAS8 value from the linear mapping */ |
| 1177 | tlbwe |
| 1178 | #endif /* CONFIG_PPC_EARLY_DEBUG_WSP */ |
| 1179 | |
Michael Neuling | 962cffb | 2012-06-25 13:33:25 +0000 | [diff] [blame] | 1180 | PPC_TLBILX(0,0,R0) |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 1181 | sync |
| 1182 | isync |
| 1183 | |
David Gibson | a1d0d98 | 2011-04-14 22:32:06 +0000 | [diff] [blame] | 1184 | .globl a2_tlbinit_code_end |
| 1185 | a2_tlbinit_code_end: |
| 1186 | |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 1187 | /* We translate LR and return */ |
| 1188 | mflr r3 |
| 1189 | tovirt(r3,r3) |
| 1190 | mtlr r3 |
| 1191 | blr |
| 1192 | |
| 1193 | /* |
| 1194 | * Main entry (boot CPU, thread 0) |
| 1195 | * |
| 1196 | * We enter here from head_64.S, possibly after the prom_init trampoline |
| 1197 | * with r3 and r4 already saved to r31 and 30 respectively and in 64 bits |
| 1198 | * mode. Anything else is as it was left by the bootloader |
| 1199 | * |
| 1200 | * Initial requirements of this port: |
| 1201 | * |
| 1202 | * - Kernel loaded at 0 physical |
| 1203 | * - A good lump of memory mapped 0:0 by UTLB entry 0 |
| 1204 | * - MSR:IS & MSR:DS set to 0 |
| 1205 | * |
| 1206 | * Note that some of the above requirements will be relaxed in the future |
| 1207 | * as the kernel becomes smarter at dealing with different initial conditions |
| 1208 | * but for now you have to be careful |
| 1209 | */ |
| 1210 | _GLOBAL(start_initialization_book3e) |
| 1211 | mflr r28 |
| 1212 | |
| 1213 | /* First, we need to setup some initial TLBs to map the kernel |
| 1214 | * text, data and bss at PAGE_OFFSET. We don't have a real mode |
| 1215 | * and always use AS 0, so we just set it up to match our link |
| 1216 | * address and never use 0 based addresses. |
| 1217 | */ |
| 1218 | bl .initial_tlb_book3e |
| 1219 | |
| 1220 | /* Init global core bits */ |
| 1221 | bl .init_core_book3e |
| 1222 | |
| 1223 | /* Init per-thread bits */ |
| 1224 | bl .init_thread_book3e |
| 1225 | |
| 1226 | /* Return to common init code */ |
| 1227 | tovirt(r28,r28) |
| 1228 | mtlr r28 |
| 1229 | blr |
| 1230 | |
| 1231 | |
| 1232 | /* |
| 1233 | * Secondary core/processor entry |
| 1234 | * |
| 1235 | * This is entered for thread 0 of a secondary core, all other threads |
| 1236 | * are expected to be stopped. It's similar to start_initialization_book3e |
| 1237 | * except that it's generally entered from the holding loop in head_64.S |
| 1238 | * after CPUs have been gathered by Open Firmware. |
| 1239 | * |
| 1240 | * We assume we are in 32 bits mode running with whatever TLB entry was |
| 1241 | * set for us by the firmware or POR engine. |
| 1242 | */ |
| 1243 | _GLOBAL(book3e_secondary_core_init_tlb_set) |
| 1244 | li r4,1 |
| 1245 | b .generic_secondary_smp_init |
| 1246 | |
| 1247 | _GLOBAL(book3e_secondary_core_init) |
| 1248 | mflr r28 |
| 1249 | |
| 1250 | /* Do we need to setup initial TLB entry ? */ |
| 1251 | cmplwi r4,0 |
| 1252 | bne 2f |
| 1253 | |
| 1254 | /* Setup TLB for this core */ |
| 1255 | bl .initial_tlb_book3e |
| 1256 | |
| 1257 | /* We can return from the above running at a different |
| 1258 | * address, so recalculate r2 (TOC) |
| 1259 | */ |
| 1260 | bl .relative_toc |
| 1261 | |
| 1262 | /* Init global core bits */ |
| 1263 | 2: bl .init_core_book3e |
| 1264 | |
| 1265 | /* Init per-thread bits */ |
| 1266 | 3: bl .init_thread_book3e |
| 1267 | |
| 1268 | /* Return to common init code at proper virtual address. |
| 1269 | * |
| 1270 | * Due to various previous assumptions, we know we entered this |
| 1271 | * function at either the final PAGE_OFFSET mapping or using a |
| 1272 | * 1:1 mapping at 0, so we don't bother doing a complicated check |
| 1273 | * here, we just ensure the return address has the right top bits. |
| 1274 | * |
| 1275 | * Note that if we ever want to be smarter about where we can be |
| 1276 | * started from, we have to be careful that by the time we reach |
| 1277 | * the code below we may already be running at a different location |
| 1278 | * than the one we were called from since initial_tlb_book3e can |
| 1279 | * have moved us already. |
| 1280 | */ |
| 1281 | cmpdi cr0,r28,0 |
| 1282 | blt 1f |
| 1283 | lis r3,PAGE_OFFSET@highest |
| 1284 | sldi r3,r3,32 |
| 1285 | or r28,r28,r3 |
| 1286 | 1: mtlr r28 |
| 1287 | blr |
| 1288 | |
| 1289 | _GLOBAL(book3e_secondary_thread_init) |
| 1290 | mflr r28 |
| 1291 | b 3b |
| 1292 | |
| 1293 | _STATIC(init_core_book3e) |
| 1294 | /* Establish the interrupt vector base */ |
| 1295 | LOAD_REG_IMMEDIATE(r3, interrupt_base_book3e) |
| 1296 | mtspr SPRN_IVPR,r3 |
| 1297 | sync |
| 1298 | blr |
| 1299 | |
| 1300 | _STATIC(init_thread_book3e) |
| 1301 | lis r3,(SPRN_EPCR_ICM | SPRN_EPCR_GICM)@h |
| 1302 | mtspr SPRN_EPCR,r3 |
| 1303 | |
| 1304 | /* Make sure interrupts are off */ |
| 1305 | wrteei 0 |
| 1306 | |
Kumar Gala | 6c18882 | 2009-08-18 19:08:31 +0000 | [diff] [blame] | 1307 | /* disable all timers and clear out status */ |
| 1308 | li r3,0 |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 1309 | mtspr SPRN_TCR,r3 |
Kumar Gala | 6c18882 | 2009-08-18 19:08:31 +0000 | [diff] [blame] | 1310 | mfspr r3,SPRN_TSR |
| 1311 | mtspr SPRN_TSR,r3 |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 1312 | |
| 1313 | blr |
| 1314 | |
Kumar Gala | 4b98d9e | 2009-08-18 19:08:32 +0000 | [diff] [blame] | 1315 | _GLOBAL(__setup_base_ivors) |
| 1316 | SET_IVOR(0, 0x020) /* Critical Input */ |
| 1317 | SET_IVOR(1, 0x000) /* Machine Check */ |
| 1318 | SET_IVOR(2, 0x060) /* Data Storage */ |
| 1319 | SET_IVOR(3, 0x080) /* Instruction Storage */ |
| 1320 | SET_IVOR(4, 0x0a0) /* External Input */ |
| 1321 | SET_IVOR(5, 0x0c0) /* Alignment */ |
| 1322 | SET_IVOR(6, 0x0e0) /* Program */ |
| 1323 | SET_IVOR(7, 0x100) /* FP Unavailable */ |
| 1324 | SET_IVOR(8, 0x120) /* System Call */ |
| 1325 | SET_IVOR(9, 0x140) /* Auxiliary Processor Unavailable */ |
| 1326 | SET_IVOR(10, 0x160) /* Decrementer */ |
| 1327 | SET_IVOR(11, 0x180) /* Fixed Interval Timer */ |
| 1328 | SET_IVOR(12, 0x1a0) /* Watchdog Timer */ |
| 1329 | SET_IVOR(13, 0x1c0) /* Data TLB Error */ |
| 1330 | SET_IVOR(14, 0x1e0) /* Instruction TLB Error */ |
| 1331 | SET_IVOR(15, 0x040) /* Debug */ |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 1332 | |
Kumar Gala | 4b98d9e | 2009-08-18 19:08:32 +0000 | [diff] [blame] | 1333 | sync |
Benjamin Herrenschmidt | 2d27cfd | 2009-07-23 23:15:59 +0000 | [diff] [blame] | 1334 | |
Kumar Gala | 4b98d9e | 2009-08-18 19:08:32 +0000 | [diff] [blame] | 1335 | blr |
Scott Wood | 3a6e9bd | 2011-05-09 16:26:00 -0500 | [diff] [blame] | 1336 | |
| 1337 | _GLOBAL(setup_perfmon_ivor) |
| 1338 | SET_IVOR(35, 0x260) /* Performance Monitor */ |
| 1339 | blr |
| 1340 | |
| 1341 | _GLOBAL(setup_doorbell_ivors) |
| 1342 | SET_IVOR(36, 0x280) /* Processor Doorbell */ |
| 1343 | SET_IVOR(37, 0x2a0) /* Processor Doorbell Crit */ |
| 1344 | |
| 1345 | /* Check MMUCFG[LPIDSIZE] to determine if we have category E.HV */ |
| 1346 | mfspr r10,SPRN_MMUCFG |
| 1347 | rlwinm. r10,r10,0,MMUCFG_LPIDSIZE |
| 1348 | beqlr |
| 1349 | |
| 1350 | SET_IVOR(38, 0x2c0) /* Guest Processor Doorbell */ |
| 1351 | SET_IVOR(39, 0x2e0) /* Guest Processor Doorbell Crit/MC */ |
| 1352 | blr |
| 1353 | |
| 1354 | _GLOBAL(setup_ehv_ivors) |
| 1355 | /* |
| 1356 | * We may be running as a guest and lack E.HV even on a chip |
| 1357 | * that normally has it. |
| 1358 | */ |
| 1359 | mfspr r10,SPRN_MMUCFG |
| 1360 | rlwinm. r10,r10,0,MMUCFG_LPIDSIZE |
| 1361 | beqlr |
| 1362 | |
| 1363 | SET_IVOR(40, 0x300) /* Embedded Hypervisor System Call */ |
| 1364 | SET_IVOR(41, 0x320) /* Embedded Hypervisor Privilege */ |
| 1365 | blr |