114cf11afSPaul Mackerras/* 214cf11afSPaul Mackerras * PowerPC version 314cf11afSPaul Mackerras * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) 414cf11afSPaul Mackerras * 514cf11afSPaul Mackerras * Rewritten by Cort Dougan (cort@cs.nmt.edu) for PReP 614cf11afSPaul Mackerras * Copyright (C) 1996 Cort Dougan <cort@cs.nmt.edu> 714cf11afSPaul Mackerras * Adapted for Power Macintosh by Paul Mackerras. 814cf11afSPaul Mackerras * Low-level exception handlers and MMU support 914cf11afSPaul Mackerras * rewritten by Paul Mackerras. 1014cf11afSPaul Mackerras * Copyright (C) 1996 Paul Mackerras. 1114cf11afSPaul Mackerras * 1214cf11afSPaul Mackerras * Adapted for 64bit PowerPC by Dave Engebretsen, Peter Bergner, and 1314cf11afSPaul Mackerras * Mike Corrigan {engebret|bergner|mikejc}@us.ibm.com 1414cf11afSPaul Mackerras * 1514cf11afSPaul Mackerras * This file contains the low-level support and setup for the 1614cf11afSPaul Mackerras * PowerPC-64 platform, including trap and interrupt dispatch. 1714cf11afSPaul Mackerras * 1814cf11afSPaul Mackerras * This program is free software; you can redistribute it and/or 1914cf11afSPaul Mackerras * modify it under the terms of the GNU General Public License 2014cf11afSPaul Mackerras * as published by the Free Software Foundation; either version 2114cf11afSPaul Mackerras * 2 of the License, or (at your option) any later version. 2214cf11afSPaul Mackerras */ 2314cf11afSPaul Mackerras 2414cf11afSPaul Mackerras#include <linux/config.h> 2514cf11afSPaul Mackerras#include <linux/threads.h> 26b5bbeb23SPaul Mackerras#include <asm/reg.h> 2714cf11afSPaul Mackerras#include <asm/page.h> 2814cf11afSPaul Mackerras#include <asm/mmu.h> 2914cf11afSPaul Mackerras#include <asm/ppc_asm.h> 3014cf11afSPaul Mackerras#include <asm/asm-offsets.h> 3114cf11afSPaul Mackerras#include <asm/bug.h> 3214cf11afSPaul Mackerras#include <asm/cputable.h> 3314cf11afSPaul Mackerras#include <asm/setup.h> 3414cf11afSPaul Mackerras#include <asm/hvcall.h> 35c43a55ffSKelly Daly#include <asm/iseries/lpar_map.h> 366cb7bfebSDavid Gibson#include <asm/thread_info.h> 3714cf11afSPaul Mackerras 3814cf11afSPaul Mackerras#ifdef CONFIG_PPC_ISERIES 3914cf11afSPaul Mackerras#define DO_SOFT_DISABLE 4014cf11afSPaul Mackerras#endif 4114cf11afSPaul Mackerras 4214cf11afSPaul Mackerras/* 4314cf11afSPaul Mackerras * We layout physical memory as follows: 4414cf11afSPaul Mackerras * 0x0000 - 0x00ff : Secondary processor spin code 4514cf11afSPaul Mackerras * 0x0100 - 0x2fff : pSeries Interrupt prologs 4614cf11afSPaul Mackerras * 0x3000 - 0x5fff : interrupt support, iSeries and common interrupt prologs 4714cf11afSPaul Mackerras * 0x6000 - 0x6fff : Initial (CPU0) segment table 4814cf11afSPaul Mackerras * 0x7000 - 0x7fff : FWNMI data area 4914cf11afSPaul Mackerras * 0x8000 - : Early init and support code 5014cf11afSPaul Mackerras */ 5114cf11afSPaul Mackerras 5214cf11afSPaul Mackerras/* 5314cf11afSPaul Mackerras * SPRG Usage 5414cf11afSPaul Mackerras * 5514cf11afSPaul Mackerras * Register Definition 5614cf11afSPaul Mackerras * 5714cf11afSPaul Mackerras * SPRG0 reserved for hypervisor 5814cf11afSPaul Mackerras * SPRG1 temp - used to save gpr 5914cf11afSPaul Mackerras * SPRG2 temp - used to save gpr 6014cf11afSPaul Mackerras * SPRG3 virt addr of paca 6114cf11afSPaul Mackerras */ 6214cf11afSPaul Mackerras 6314cf11afSPaul Mackerras/* 6414cf11afSPaul Mackerras * Entering into this code we make the following assumptions: 6514cf11afSPaul Mackerras * For pSeries: 6614cf11afSPaul Mackerras * 1. The MMU is off & open firmware is running in real mode. 6714cf11afSPaul Mackerras * 2. The kernel is entered at __start 6814cf11afSPaul Mackerras * 6914cf11afSPaul Mackerras * For iSeries: 7014cf11afSPaul Mackerras * 1. The MMU is on (as it always is for iSeries) 7114cf11afSPaul Mackerras * 2. The kernel is entered at system_reset_iSeries 7214cf11afSPaul Mackerras */ 7314cf11afSPaul Mackerras 7414cf11afSPaul Mackerras .text 7514cf11afSPaul Mackerras .globl _stext 7614cf11afSPaul Mackerras_stext: 7714cf11afSPaul Mackerras#ifdef CONFIG_PPC_MULTIPLATFORM 7814cf11afSPaul Mackerras_GLOBAL(__start) 7914cf11afSPaul Mackerras /* NOP this out unconditionally */ 8014cf11afSPaul MackerrasBEGIN_FTR_SECTION 8114cf11afSPaul Mackerras b .__start_initialization_multiplatform 8214cf11afSPaul MackerrasEND_FTR_SECTION(0, 1) 8314cf11afSPaul Mackerras#endif /* CONFIG_PPC_MULTIPLATFORM */ 8414cf11afSPaul Mackerras 8514cf11afSPaul Mackerras /* Catch branch to 0 in real mode */ 8614cf11afSPaul Mackerras trap 8714cf11afSPaul Mackerras 8814cf11afSPaul Mackerras /* Secondary processors spin on this value until it goes to 1. */ 8914cf11afSPaul Mackerras .globl __secondary_hold_spinloop 9014cf11afSPaul Mackerras__secondary_hold_spinloop: 9114cf11afSPaul Mackerras .llong 0x0 9214cf11afSPaul Mackerras 9314cf11afSPaul Mackerras /* Secondary processors write this value with their cpu # */ 9414cf11afSPaul Mackerras /* after they enter the spin loop immediately below. */ 9514cf11afSPaul Mackerras .globl __secondary_hold_acknowledge 9614cf11afSPaul Mackerras__secondary_hold_acknowledge: 9714cf11afSPaul Mackerras .llong 0x0 9814cf11afSPaul Mackerras 99*1dce0e30SMichael Ellerman#ifdef CONFIG_PPC_ISERIES 100*1dce0e30SMichael Ellerman /* 101*1dce0e30SMichael Ellerman * At offset 0x20, there is a pointer to iSeries LPAR data. 102*1dce0e30SMichael Ellerman * This is required by the hypervisor 103*1dce0e30SMichael Ellerman */ 104*1dce0e30SMichael Ellerman . = 0x20 105*1dce0e30SMichael Ellerman .llong hvReleaseData-KERNELBASE 106*1dce0e30SMichael Ellerman#endif /* CONFIG_PPC_ISERIES */ 107*1dce0e30SMichael Ellerman 10814cf11afSPaul Mackerras . = 0x60 10914cf11afSPaul Mackerras/* 11014cf11afSPaul Mackerras * The following code is used on pSeries to hold secondary processors 11114cf11afSPaul Mackerras * in a spin loop after they have been freed from OpenFirmware, but 11214cf11afSPaul Mackerras * before the bulk of the kernel has been relocated. This code 11314cf11afSPaul Mackerras * is relocated to physical address 0x60 before prom_init is run. 11414cf11afSPaul Mackerras * All of it must fit below the first exception vector at 0x100. 11514cf11afSPaul Mackerras */ 11614cf11afSPaul Mackerras_GLOBAL(__secondary_hold) 11714cf11afSPaul Mackerras mfmsr r24 11814cf11afSPaul Mackerras ori r24,r24,MSR_RI 11914cf11afSPaul Mackerras mtmsrd r24 /* RI on */ 12014cf11afSPaul Mackerras 121f1870f77SAnton Blanchard /* Grab our physical cpu number */ 12214cf11afSPaul Mackerras mr r24,r3 12314cf11afSPaul Mackerras 12414cf11afSPaul Mackerras /* Tell the master cpu we're here */ 12514cf11afSPaul Mackerras /* Relocation is off & we are located at an address less */ 12614cf11afSPaul Mackerras /* than 0x100, so only need to grab low order offset. */ 12714cf11afSPaul Mackerras std r24,__secondary_hold_acknowledge@l(0) 12814cf11afSPaul Mackerras sync 12914cf11afSPaul Mackerras 13014cf11afSPaul Mackerras /* All secondary cpus wait here until told to start. */ 13114cf11afSPaul Mackerras100: ld r4,__secondary_hold_spinloop@l(0) 13214cf11afSPaul Mackerras cmpdi 0,r4,1 13314cf11afSPaul Mackerras bne 100b 13414cf11afSPaul Mackerras 135f1870f77SAnton Blanchard#if defined(CONFIG_SMP) || defined(CONFIG_KEXEC) 136e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r4, .pSeries_secondary_smp_init) 137758438a7SMichael Ellerman mtctr r4 13814cf11afSPaul Mackerras mr r3,r24 139758438a7SMichael Ellerman bctr 14014cf11afSPaul Mackerras#else 14114cf11afSPaul Mackerras BUG_OPCODE 14214cf11afSPaul Mackerras#endif 14314cf11afSPaul Mackerras 14414cf11afSPaul Mackerras/* This value is used to mark exception frames on the stack. */ 14514cf11afSPaul Mackerras .section ".toc","aw" 14614cf11afSPaul Mackerrasexception_marker: 14714cf11afSPaul Mackerras .tc ID_72656773_68657265[TC],0x7265677368657265 14814cf11afSPaul Mackerras .text 14914cf11afSPaul Mackerras 15014cf11afSPaul Mackerras/* 15114cf11afSPaul Mackerras * The following macros define the code that appears as 15214cf11afSPaul Mackerras * the prologue to each of the exception handlers. They 15314cf11afSPaul Mackerras * are split into two parts to allow a single kernel binary 15414cf11afSPaul Mackerras * to be used for pSeries and iSeries. 15514cf11afSPaul Mackerras * LOL. One day... - paulus 15614cf11afSPaul Mackerras */ 15714cf11afSPaul Mackerras 15814cf11afSPaul Mackerras/* 15914cf11afSPaul Mackerras * We make as much of the exception code common between native 16014cf11afSPaul Mackerras * exception handlers (including pSeries LPAR) and iSeries LPAR 16114cf11afSPaul Mackerras * implementations as possible. 16214cf11afSPaul Mackerras */ 16314cf11afSPaul Mackerras 16414cf11afSPaul Mackerras/* 16514cf11afSPaul Mackerras * This is the start of the interrupt handlers for pSeries 16614cf11afSPaul Mackerras * This code runs with relocation off. 16714cf11afSPaul Mackerras */ 16814cf11afSPaul Mackerras#define EX_R9 0 16914cf11afSPaul Mackerras#define EX_R10 8 17014cf11afSPaul Mackerras#define EX_R11 16 17114cf11afSPaul Mackerras#define EX_R12 24 17214cf11afSPaul Mackerras#define EX_R13 32 17314cf11afSPaul Mackerras#define EX_SRR0 40 17414cf11afSPaul Mackerras#define EX_DAR 48 17514cf11afSPaul Mackerras#define EX_DSISR 56 17614cf11afSPaul Mackerras#define EX_CCR 60 1773c726f8dSBenjamin Herrenschmidt#define EX_R3 64 1783c726f8dSBenjamin Herrenschmidt#define EX_LR 72 17914cf11afSPaul Mackerras 180758438a7SMichael Ellerman/* 181e58c3495SDavid Gibson * We're short on space and time in the exception prolog, so we can't 182e58c3495SDavid Gibson * use the normal SET_REG_IMMEDIATE macro. Normally we just need the 183e58c3495SDavid Gibson * low halfword of the address, but for Kdump we need the whole low 184e58c3495SDavid Gibson * word. 185758438a7SMichael Ellerman */ 186758438a7SMichael Ellerman#ifdef CONFIG_CRASH_DUMP 187758438a7SMichael Ellerman#define LOAD_HANDLER(reg, label) \ 188758438a7SMichael Ellerman oris reg,reg,(label)@h; /* virt addr of handler ... */ \ 189758438a7SMichael Ellerman ori reg,reg,(label)@l; /* .. and the rest */ 190758438a7SMichael Ellerman#else 191758438a7SMichael Ellerman#define LOAD_HANDLER(reg, label) \ 192758438a7SMichael Ellerman ori reg,reg,(label)@l; /* virt addr of handler ... */ 193758438a7SMichael Ellerman#endif 194758438a7SMichael Ellerman 19514cf11afSPaul Mackerras#define EXCEPTION_PROLOG_PSERIES(area, label) \ 196b5bbeb23SPaul Mackerras mfspr r13,SPRN_SPRG3; /* get paca address into r13 */ \ 19714cf11afSPaul Mackerras std r9,area+EX_R9(r13); /* save r9 - r12 */ \ 19814cf11afSPaul Mackerras std r10,area+EX_R10(r13); \ 19914cf11afSPaul Mackerras std r11,area+EX_R11(r13); \ 20014cf11afSPaul Mackerras std r12,area+EX_R12(r13); \ 201b5bbeb23SPaul Mackerras mfspr r9,SPRN_SPRG1; \ 20214cf11afSPaul Mackerras std r9,area+EX_R13(r13); \ 20314cf11afSPaul Mackerras mfcr r9; \ 20414cf11afSPaul Mackerras clrrdi r12,r13,32; /* get high part of &label */ \ 20514cf11afSPaul Mackerras mfmsr r10; \ 206b5bbeb23SPaul Mackerras mfspr r11,SPRN_SRR0; /* save SRR0 */ \ 207758438a7SMichael Ellerman LOAD_HANDLER(r12,label) \ 20814cf11afSPaul Mackerras ori r10,r10,MSR_IR|MSR_DR|MSR_RI; \ 209b5bbeb23SPaul Mackerras mtspr SPRN_SRR0,r12; \ 210b5bbeb23SPaul Mackerras mfspr r12,SPRN_SRR1; /* and SRR1 */ \ 211b5bbeb23SPaul Mackerras mtspr SPRN_SRR1,r10; \ 21214cf11afSPaul Mackerras rfid; \ 21314cf11afSPaul Mackerras b . /* prevent speculative execution */ 21414cf11afSPaul Mackerras 21514cf11afSPaul Mackerras/* 21614cf11afSPaul Mackerras * This is the start of the interrupt handlers for iSeries 21714cf11afSPaul Mackerras * This code runs with relocation on. 21814cf11afSPaul Mackerras */ 21914cf11afSPaul Mackerras#define EXCEPTION_PROLOG_ISERIES_1(area) \ 220b5bbeb23SPaul Mackerras mfspr r13,SPRN_SPRG3; /* get paca address into r13 */ \ 22114cf11afSPaul Mackerras std r9,area+EX_R9(r13); /* save r9 - r12 */ \ 22214cf11afSPaul Mackerras std r10,area+EX_R10(r13); \ 22314cf11afSPaul Mackerras std r11,area+EX_R11(r13); \ 22414cf11afSPaul Mackerras std r12,area+EX_R12(r13); \ 225b5bbeb23SPaul Mackerras mfspr r9,SPRN_SPRG1; \ 22614cf11afSPaul Mackerras std r9,area+EX_R13(r13); \ 22714cf11afSPaul Mackerras mfcr r9 22814cf11afSPaul Mackerras 22914cf11afSPaul Mackerras#define EXCEPTION_PROLOG_ISERIES_2 \ 23014cf11afSPaul Mackerras mfmsr r10; \ 2313356bb9fSDavid Gibson ld r12,PACALPPACAPTR(r13); \ 2323356bb9fSDavid Gibson ld r11,LPPACASRR0(r12); \ 2333356bb9fSDavid Gibson ld r12,LPPACASRR1(r12); \ 23414cf11afSPaul Mackerras ori r10,r10,MSR_RI; \ 23514cf11afSPaul Mackerras mtmsrd r10,1 23614cf11afSPaul Mackerras 23714cf11afSPaul Mackerras/* 23814cf11afSPaul Mackerras * The common exception prolog is used for all except a few exceptions 23914cf11afSPaul Mackerras * such as a segment miss on a kernel address. We have to be prepared 24014cf11afSPaul Mackerras * to take another exception from the point where we first touch the 24114cf11afSPaul Mackerras * kernel stack onwards. 24214cf11afSPaul Mackerras * 24314cf11afSPaul Mackerras * On entry r13 points to the paca, r9-r13 are saved in the paca, 24414cf11afSPaul Mackerras * r9 contains the saved CR, r11 and r12 contain the saved SRR0 and 24514cf11afSPaul Mackerras * SRR1, and relocation is on. 24614cf11afSPaul Mackerras */ 24714cf11afSPaul Mackerras#define EXCEPTION_PROLOG_COMMON(n, area) \ 24814cf11afSPaul Mackerras andi. r10,r12,MSR_PR; /* See if coming from user */ \ 24914cf11afSPaul Mackerras mr r10,r1; /* Save r1 */ \ 25014cf11afSPaul Mackerras subi r1,r1,INT_FRAME_SIZE; /* alloc frame on kernel stack */ \ 25114cf11afSPaul Mackerras beq- 1f; \ 25214cf11afSPaul Mackerras ld r1,PACAKSAVE(r13); /* kernel stack to use */ \ 25314cf11afSPaul Mackerras1: cmpdi cr1,r1,0; /* check if r1 is in userspace */ \ 25414cf11afSPaul Mackerras bge- cr1,bad_stack; /* abort if it is */ \ 25514cf11afSPaul Mackerras std r9,_CCR(r1); /* save CR in stackframe */ \ 25614cf11afSPaul Mackerras std r11,_NIP(r1); /* save SRR0 in stackframe */ \ 25714cf11afSPaul Mackerras std r12,_MSR(r1); /* save SRR1 in stackframe */ \ 25814cf11afSPaul Mackerras std r10,0(r1); /* make stack chain pointer */ \ 25914cf11afSPaul Mackerras std r0,GPR0(r1); /* save r0 in stackframe */ \ 26014cf11afSPaul Mackerras std r10,GPR1(r1); /* save r1 in stackframe */ \ 261c6622f63SPaul Mackerras ACCOUNT_CPU_USER_ENTRY(r9, r10); \ 26214cf11afSPaul Mackerras std r2,GPR2(r1); /* save r2 in stackframe */ \ 26314cf11afSPaul Mackerras SAVE_4GPRS(3, r1); /* save r3 - r6 in stackframe */ \ 26414cf11afSPaul Mackerras SAVE_2GPRS(7, r1); /* save r7, r8 in stackframe */ \ 26514cf11afSPaul Mackerras ld r9,area+EX_R9(r13); /* move r9, r10 to stackframe */ \ 26614cf11afSPaul Mackerras ld r10,area+EX_R10(r13); \ 26714cf11afSPaul Mackerras std r9,GPR9(r1); \ 26814cf11afSPaul Mackerras std r10,GPR10(r1); \ 26914cf11afSPaul Mackerras ld r9,area+EX_R11(r13); /* move r11 - r13 to stackframe */ \ 27014cf11afSPaul Mackerras ld r10,area+EX_R12(r13); \ 27114cf11afSPaul Mackerras ld r11,area+EX_R13(r13); \ 27214cf11afSPaul Mackerras std r9,GPR11(r1); \ 27314cf11afSPaul Mackerras std r10,GPR12(r1); \ 27414cf11afSPaul Mackerras std r11,GPR13(r1); \ 27514cf11afSPaul Mackerras ld r2,PACATOC(r13); /* get kernel TOC into r2 */ \ 27614cf11afSPaul Mackerras mflr r9; /* save LR in stackframe */ \ 27714cf11afSPaul Mackerras std r9,_LINK(r1); \ 27814cf11afSPaul Mackerras mfctr r10; /* save CTR in stackframe */ \ 27914cf11afSPaul Mackerras std r10,_CTR(r1); \ 280b5bbeb23SPaul Mackerras mfspr r11,SPRN_XER; /* save XER in stackframe */ \ 28114cf11afSPaul Mackerras std r11,_XER(r1); \ 28214cf11afSPaul Mackerras li r9,(n)+1; \ 28314cf11afSPaul Mackerras std r9,_TRAP(r1); /* set trap number */ \ 28414cf11afSPaul Mackerras li r10,0; \ 28514cf11afSPaul Mackerras ld r11,exception_marker@toc(r2); \ 28614cf11afSPaul Mackerras std r10,RESULT(r1); /* clear regs->result */ \ 28714cf11afSPaul Mackerras std r11,STACK_FRAME_OVERHEAD-16(r1); /* mark the frame */ 28814cf11afSPaul Mackerras 28914cf11afSPaul Mackerras/* 29014cf11afSPaul Mackerras * Exception vectors. 29114cf11afSPaul Mackerras */ 29214cf11afSPaul Mackerras#define STD_EXCEPTION_PSERIES(n, label) \ 29314cf11afSPaul Mackerras . = n; \ 29414cf11afSPaul Mackerras .globl label##_pSeries; \ 29514cf11afSPaul Mackerraslabel##_pSeries: \ 29614cf11afSPaul Mackerras HMT_MEDIUM; \ 297b5bbeb23SPaul Mackerras mtspr SPRN_SPRG1,r13; /* save r13 */ \ 29814cf11afSPaul Mackerras EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common) 29914cf11afSPaul Mackerras 300acf7d768SBenjamin Herrenschmidt#define HSTD_EXCEPTION_PSERIES(n, label) \ 301acf7d768SBenjamin Herrenschmidt . = n; \ 302acf7d768SBenjamin Herrenschmidt .globl label##_pSeries; \ 303acf7d768SBenjamin Herrenschmidtlabel##_pSeries: \ 304acf7d768SBenjamin Herrenschmidt HMT_MEDIUM; \ 305acf7d768SBenjamin Herrenschmidt mtspr SPRN_SPRG1,r20; /* save r20 */ \ 306acf7d768SBenjamin Herrenschmidt mfspr r20,SPRN_HSRR0; /* copy HSRR0 to SRR0 */ \ 307acf7d768SBenjamin Herrenschmidt mtspr SPRN_SRR0,r20; \ 308acf7d768SBenjamin Herrenschmidt mfspr r20,SPRN_HSRR1; /* copy HSRR0 to SRR0 */ \ 309acf7d768SBenjamin Herrenschmidt mtspr SPRN_SRR1,r20; \ 310acf7d768SBenjamin Herrenschmidt mfspr r20,SPRN_SPRG1; /* restore r20 */ \ 311acf7d768SBenjamin Herrenschmidt mtspr SPRN_SPRG1,r13; /* save r13 */ \ 312acf7d768SBenjamin Herrenschmidt EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common) 313acf7d768SBenjamin Herrenschmidt 314acf7d768SBenjamin Herrenschmidt 31514cf11afSPaul Mackerras#define STD_EXCEPTION_ISERIES(n, label, area) \ 31614cf11afSPaul Mackerras .globl label##_iSeries; \ 31714cf11afSPaul Mackerraslabel##_iSeries: \ 31814cf11afSPaul Mackerras HMT_MEDIUM; \ 319b5bbeb23SPaul Mackerras mtspr SPRN_SPRG1,r13; /* save r13 */ \ 32014cf11afSPaul Mackerras EXCEPTION_PROLOG_ISERIES_1(area); \ 32114cf11afSPaul Mackerras EXCEPTION_PROLOG_ISERIES_2; \ 32214cf11afSPaul Mackerras b label##_common 32314cf11afSPaul Mackerras 32414cf11afSPaul Mackerras#define MASKABLE_EXCEPTION_ISERIES(n, label) \ 32514cf11afSPaul Mackerras .globl label##_iSeries; \ 32614cf11afSPaul Mackerraslabel##_iSeries: \ 32714cf11afSPaul Mackerras HMT_MEDIUM; \ 328b5bbeb23SPaul Mackerras mtspr SPRN_SPRG1,r13; /* save r13 */ \ 32914cf11afSPaul Mackerras EXCEPTION_PROLOG_ISERIES_1(PACA_EXGEN); \ 33014cf11afSPaul Mackerras lbz r10,PACAPROCENABLED(r13); \ 33114cf11afSPaul Mackerras cmpwi 0,r10,0; \ 33214cf11afSPaul Mackerras beq- label##_iSeries_masked; \ 33314cf11afSPaul Mackerras EXCEPTION_PROLOG_ISERIES_2; \ 33414cf11afSPaul Mackerras b label##_common; \ 33514cf11afSPaul Mackerras 33614cf11afSPaul Mackerras#ifdef DO_SOFT_DISABLE 33714cf11afSPaul Mackerras#define DISABLE_INTS \ 33814cf11afSPaul Mackerras lbz r10,PACAPROCENABLED(r13); \ 33914cf11afSPaul Mackerras li r11,0; \ 34014cf11afSPaul Mackerras std r10,SOFTE(r1); \ 34114cf11afSPaul Mackerras mfmsr r10; \ 34214cf11afSPaul Mackerras stb r11,PACAPROCENABLED(r13); \ 34314cf11afSPaul Mackerras ori r10,r10,MSR_EE; \ 34414cf11afSPaul Mackerras mtmsrd r10,1 34514cf11afSPaul Mackerras 34614cf11afSPaul Mackerras#define ENABLE_INTS \ 34714cf11afSPaul Mackerras lbz r10,PACAPROCENABLED(r13); \ 34814cf11afSPaul Mackerras mfmsr r11; \ 34914cf11afSPaul Mackerras std r10,SOFTE(r1); \ 35014cf11afSPaul Mackerras ori r11,r11,MSR_EE; \ 35114cf11afSPaul Mackerras mtmsrd r11,1 35214cf11afSPaul Mackerras 35314cf11afSPaul Mackerras#else /* hard enable/disable interrupts */ 35414cf11afSPaul Mackerras#define DISABLE_INTS 35514cf11afSPaul Mackerras 35614cf11afSPaul Mackerras#define ENABLE_INTS \ 35714cf11afSPaul Mackerras ld r12,_MSR(r1); \ 35814cf11afSPaul Mackerras mfmsr r11; \ 35914cf11afSPaul Mackerras rlwimi r11,r12,0,MSR_EE; \ 36014cf11afSPaul Mackerras mtmsrd r11,1 36114cf11afSPaul Mackerras 36214cf11afSPaul Mackerras#endif 36314cf11afSPaul Mackerras 36414cf11afSPaul Mackerras#define STD_EXCEPTION_COMMON(trap, label, hdlr) \ 36514cf11afSPaul Mackerras .align 7; \ 36614cf11afSPaul Mackerras .globl label##_common; \ 36714cf11afSPaul Mackerraslabel##_common: \ 36814cf11afSPaul Mackerras EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \ 36914cf11afSPaul Mackerras DISABLE_INTS; \ 37014cf11afSPaul Mackerras bl .save_nvgprs; \ 37114cf11afSPaul Mackerras addi r3,r1,STACK_FRAME_OVERHEAD; \ 37214cf11afSPaul Mackerras bl hdlr; \ 37314cf11afSPaul Mackerras b .ret_from_except 37414cf11afSPaul Mackerras 375f39224a8SPaul Mackerras/* 376f39224a8SPaul Mackerras * Like STD_EXCEPTION_COMMON, but for exceptions that can occur 377f39224a8SPaul Mackerras * in the idle task and therefore need the special idle handling. 378f39224a8SPaul Mackerras */ 379f39224a8SPaul Mackerras#define STD_EXCEPTION_COMMON_IDLE(trap, label, hdlr) \ 380f39224a8SPaul Mackerras .align 7; \ 381f39224a8SPaul Mackerras .globl label##_common; \ 382f39224a8SPaul Mackerraslabel##_common: \ 383f39224a8SPaul Mackerras EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \ 384f39224a8SPaul Mackerras FINISH_NAP; \ 385f39224a8SPaul Mackerras DISABLE_INTS; \ 386f39224a8SPaul Mackerras bl .save_nvgprs; \ 387f39224a8SPaul Mackerras addi r3,r1,STACK_FRAME_OVERHEAD; \ 388f39224a8SPaul Mackerras bl hdlr; \ 389f39224a8SPaul Mackerras b .ret_from_except 390f39224a8SPaul Mackerras 39114cf11afSPaul Mackerras#define STD_EXCEPTION_COMMON_LITE(trap, label, hdlr) \ 39214cf11afSPaul Mackerras .align 7; \ 39314cf11afSPaul Mackerras .globl label##_common; \ 39414cf11afSPaul Mackerraslabel##_common: \ 39514cf11afSPaul Mackerras EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \ 396f39224a8SPaul Mackerras FINISH_NAP; \ 39714cf11afSPaul Mackerras DISABLE_INTS; \ 398cb2c9b27SAnton Blanchard bl .ppc64_runlatch_on; \ 39914cf11afSPaul Mackerras addi r3,r1,STACK_FRAME_OVERHEAD; \ 40014cf11afSPaul Mackerras bl hdlr; \ 40114cf11afSPaul Mackerras b .ret_from_except_lite 40214cf11afSPaul Mackerras 40314cf11afSPaul Mackerras/* 404f39224a8SPaul Mackerras * When the idle code in power4_idle puts the CPU into NAP mode, 405f39224a8SPaul Mackerras * it has to do so in a loop, and relies on the external interrupt 406f39224a8SPaul Mackerras * and decrementer interrupt entry code to get it out of the loop. 407f39224a8SPaul Mackerras * It sets the _TLF_NAPPING bit in current_thread_info()->local_flags 408f39224a8SPaul Mackerras * to signal that it is in the loop and needs help to get out. 409f39224a8SPaul Mackerras */ 410f39224a8SPaul Mackerras#ifdef CONFIG_PPC_970_NAP 411f39224a8SPaul Mackerras#define FINISH_NAP \ 412f39224a8SPaul MackerrasBEGIN_FTR_SECTION \ 413f39224a8SPaul Mackerras clrrdi r11,r1,THREAD_SHIFT; \ 414f39224a8SPaul Mackerras ld r9,TI_LOCAL_FLAGS(r11); \ 415f39224a8SPaul Mackerras andi. r10,r9,_TLF_NAPPING; \ 416f39224a8SPaul Mackerras bnel power4_fixup_nap; \ 417f39224a8SPaul MackerrasEND_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP) 418f39224a8SPaul Mackerras#else 419f39224a8SPaul Mackerras#define FINISH_NAP 420f39224a8SPaul Mackerras#endif 421f39224a8SPaul Mackerras 422f39224a8SPaul Mackerras/* 42314cf11afSPaul Mackerras * Start of pSeries system interrupt routines 42414cf11afSPaul Mackerras */ 42514cf11afSPaul Mackerras . = 0x100 42614cf11afSPaul Mackerras .globl __start_interrupts 42714cf11afSPaul Mackerras__start_interrupts: 42814cf11afSPaul Mackerras 42914cf11afSPaul Mackerras STD_EXCEPTION_PSERIES(0x100, system_reset) 43014cf11afSPaul Mackerras 43114cf11afSPaul Mackerras . = 0x200 43214cf11afSPaul Mackerras_machine_check_pSeries: 43314cf11afSPaul Mackerras HMT_MEDIUM 434b5bbeb23SPaul Mackerras mtspr SPRN_SPRG1,r13 /* save r13 */ 43514cf11afSPaul Mackerras EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common) 43614cf11afSPaul Mackerras 43714cf11afSPaul Mackerras . = 0x300 43814cf11afSPaul Mackerras .globl data_access_pSeries 43914cf11afSPaul Mackerrasdata_access_pSeries: 44014cf11afSPaul Mackerras HMT_MEDIUM 441b5bbeb23SPaul Mackerras mtspr SPRN_SPRG1,r13 44214cf11afSPaul MackerrasBEGIN_FTR_SECTION 443b5bbeb23SPaul Mackerras mtspr SPRN_SPRG2,r12 444b5bbeb23SPaul Mackerras mfspr r13,SPRN_DAR 445b5bbeb23SPaul Mackerras mfspr r12,SPRN_DSISR 44614cf11afSPaul Mackerras srdi r13,r13,60 44714cf11afSPaul Mackerras rlwimi r13,r12,16,0x20 44814cf11afSPaul Mackerras mfcr r12 44914cf11afSPaul Mackerras cmpwi r13,0x2c 45014cf11afSPaul Mackerras beq .do_stab_bolted_pSeries 45114cf11afSPaul Mackerras mtcrf 0x80,r12 452b5bbeb23SPaul Mackerras mfspr r12,SPRN_SPRG2 45314cf11afSPaul MackerrasEND_FTR_SECTION_IFCLR(CPU_FTR_SLB) 45414cf11afSPaul Mackerras EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, data_access_common) 45514cf11afSPaul Mackerras 45614cf11afSPaul Mackerras . = 0x380 45714cf11afSPaul Mackerras .globl data_access_slb_pSeries 45814cf11afSPaul Mackerrasdata_access_slb_pSeries: 45914cf11afSPaul Mackerras HMT_MEDIUM 460b5bbeb23SPaul Mackerras mtspr SPRN_SPRG1,r13 461b5bbeb23SPaul Mackerras mfspr r13,SPRN_SPRG3 /* get paca address into r13 */ 4623c726f8dSBenjamin Herrenschmidt std r3,PACA_EXSLB+EX_R3(r13) 4633c726f8dSBenjamin Herrenschmidt mfspr r3,SPRN_DAR 46414cf11afSPaul Mackerras std r9,PACA_EXSLB+EX_R9(r13) /* save r9 - r12 */ 4653c726f8dSBenjamin Herrenschmidt mfcr r9 4663c726f8dSBenjamin Herrenschmidt#ifdef __DISABLED__ 4673c726f8dSBenjamin Herrenschmidt /* Keep that around for when we re-implement dynamic VSIDs */ 4683c726f8dSBenjamin Herrenschmidt cmpdi r3,0 4693c726f8dSBenjamin Herrenschmidt bge slb_miss_user_pseries 4703c726f8dSBenjamin Herrenschmidt#endif /* __DISABLED__ */ 47114cf11afSPaul Mackerras std r10,PACA_EXSLB+EX_R10(r13) 47214cf11afSPaul Mackerras std r11,PACA_EXSLB+EX_R11(r13) 47314cf11afSPaul Mackerras std r12,PACA_EXSLB+EX_R12(r13) 4743c726f8dSBenjamin Herrenschmidt mfspr r10,SPRN_SPRG1 4753c726f8dSBenjamin Herrenschmidt std r10,PACA_EXSLB+EX_R13(r13) 476b5bbeb23SPaul Mackerras mfspr r12,SPRN_SRR1 /* and SRR1 */ 4773c726f8dSBenjamin Herrenschmidt b .slb_miss_realmode /* Rel. branch works in real mode */ 47814cf11afSPaul Mackerras 47914cf11afSPaul Mackerras STD_EXCEPTION_PSERIES(0x400, instruction_access) 48014cf11afSPaul Mackerras 48114cf11afSPaul Mackerras . = 0x480 48214cf11afSPaul Mackerras .globl instruction_access_slb_pSeries 48314cf11afSPaul Mackerrasinstruction_access_slb_pSeries: 48414cf11afSPaul Mackerras HMT_MEDIUM 485b5bbeb23SPaul Mackerras mtspr SPRN_SPRG1,r13 486b5bbeb23SPaul Mackerras mfspr r13,SPRN_SPRG3 /* get paca address into r13 */ 4873c726f8dSBenjamin Herrenschmidt std r3,PACA_EXSLB+EX_R3(r13) 4883c726f8dSBenjamin Herrenschmidt mfspr r3,SPRN_SRR0 /* SRR0 is faulting address */ 48914cf11afSPaul Mackerras std r9,PACA_EXSLB+EX_R9(r13) /* save r9 - r12 */ 4903c726f8dSBenjamin Herrenschmidt mfcr r9 4913c726f8dSBenjamin Herrenschmidt#ifdef __DISABLED__ 4923c726f8dSBenjamin Herrenschmidt /* Keep that around for when we re-implement dynamic VSIDs */ 4933c726f8dSBenjamin Herrenschmidt cmpdi r3,0 4943c726f8dSBenjamin Herrenschmidt bge slb_miss_user_pseries 4953c726f8dSBenjamin Herrenschmidt#endif /* __DISABLED__ */ 49614cf11afSPaul Mackerras std r10,PACA_EXSLB+EX_R10(r13) 49714cf11afSPaul Mackerras std r11,PACA_EXSLB+EX_R11(r13) 49814cf11afSPaul Mackerras std r12,PACA_EXSLB+EX_R12(r13) 4993c726f8dSBenjamin Herrenschmidt mfspr r10,SPRN_SPRG1 5003c726f8dSBenjamin Herrenschmidt std r10,PACA_EXSLB+EX_R13(r13) 501b5bbeb23SPaul Mackerras mfspr r12,SPRN_SRR1 /* and SRR1 */ 5023c726f8dSBenjamin Herrenschmidt b .slb_miss_realmode /* Rel. branch works in real mode */ 50314cf11afSPaul Mackerras 50414cf11afSPaul Mackerras STD_EXCEPTION_PSERIES(0x500, hardware_interrupt) 50514cf11afSPaul Mackerras STD_EXCEPTION_PSERIES(0x600, alignment) 50614cf11afSPaul Mackerras STD_EXCEPTION_PSERIES(0x700, program_check) 50714cf11afSPaul Mackerras STD_EXCEPTION_PSERIES(0x800, fp_unavailable) 50814cf11afSPaul Mackerras STD_EXCEPTION_PSERIES(0x900, decrementer) 50914cf11afSPaul Mackerras STD_EXCEPTION_PSERIES(0xa00, trap_0a) 51014cf11afSPaul Mackerras STD_EXCEPTION_PSERIES(0xb00, trap_0b) 51114cf11afSPaul Mackerras 51214cf11afSPaul Mackerras . = 0xc00 51314cf11afSPaul Mackerras .globl system_call_pSeries 51414cf11afSPaul Mackerrassystem_call_pSeries: 51514cf11afSPaul Mackerras HMT_MEDIUM 51614cf11afSPaul Mackerras mr r9,r13 51714cf11afSPaul Mackerras mfmsr r10 518b5bbeb23SPaul Mackerras mfspr r13,SPRN_SPRG3 519b5bbeb23SPaul Mackerras mfspr r11,SPRN_SRR0 52014cf11afSPaul Mackerras clrrdi r12,r13,32 52114cf11afSPaul Mackerras oris r12,r12,system_call_common@h 52214cf11afSPaul Mackerras ori r12,r12,system_call_common@l 523b5bbeb23SPaul Mackerras mtspr SPRN_SRR0,r12 52414cf11afSPaul Mackerras ori r10,r10,MSR_IR|MSR_DR|MSR_RI 525b5bbeb23SPaul Mackerras mfspr r12,SPRN_SRR1 526b5bbeb23SPaul Mackerras mtspr SPRN_SRR1,r10 52714cf11afSPaul Mackerras rfid 52814cf11afSPaul Mackerras b . /* prevent speculative execution */ 52914cf11afSPaul Mackerras 53014cf11afSPaul Mackerras STD_EXCEPTION_PSERIES(0xd00, single_step) 53114cf11afSPaul Mackerras STD_EXCEPTION_PSERIES(0xe00, trap_0e) 53214cf11afSPaul Mackerras 53314cf11afSPaul Mackerras /* We need to deal with the Altivec unavailable exception 53414cf11afSPaul Mackerras * here which is at 0xf20, thus in the middle of the 53514cf11afSPaul Mackerras * prolog code of the PerformanceMonitor one. A little 53614cf11afSPaul Mackerras * trickery is thus necessary 53714cf11afSPaul Mackerras */ 53814cf11afSPaul Mackerras . = 0xf00 53914cf11afSPaul Mackerras b performance_monitor_pSeries 54014cf11afSPaul Mackerras 54114cf11afSPaul Mackerras STD_EXCEPTION_PSERIES(0xf20, altivec_unavailable) 54214cf11afSPaul Mackerras 543acf7d768SBenjamin Herrenschmidt#ifdef CONFIG_CBE_RAS 544acf7d768SBenjamin Herrenschmidt HSTD_EXCEPTION_PSERIES(0x1200, cbe_system_error) 545acf7d768SBenjamin Herrenschmidt#endif /* CONFIG_CBE_RAS */ 54614cf11afSPaul Mackerras STD_EXCEPTION_PSERIES(0x1300, instruction_breakpoint) 547acf7d768SBenjamin Herrenschmidt#ifdef CONFIG_CBE_RAS 548acf7d768SBenjamin Herrenschmidt HSTD_EXCEPTION_PSERIES(0x1600, cbe_maintenance) 549acf7d768SBenjamin Herrenschmidt#endif /* CONFIG_CBE_RAS */ 55014cf11afSPaul Mackerras STD_EXCEPTION_PSERIES(0x1700, altivec_assist) 551acf7d768SBenjamin Herrenschmidt#ifdef CONFIG_CBE_RAS 552acf7d768SBenjamin Herrenschmidt HSTD_EXCEPTION_PSERIES(0x1800, cbe_thermal) 553acf7d768SBenjamin Herrenschmidt#endif /* CONFIG_CBE_RAS */ 55414cf11afSPaul Mackerras 55514cf11afSPaul Mackerras . = 0x3000 55614cf11afSPaul Mackerras 55714cf11afSPaul Mackerras/*** pSeries interrupt support ***/ 55814cf11afSPaul Mackerras 55914cf11afSPaul Mackerras /* moved from 0xf00 */ 56014cf11afSPaul Mackerras STD_EXCEPTION_PSERIES(., performance_monitor) 56114cf11afSPaul Mackerras 56214cf11afSPaul Mackerras .align 7 56314cf11afSPaul Mackerras_GLOBAL(do_stab_bolted_pSeries) 56414cf11afSPaul Mackerras mtcrf 0x80,r12 565b5bbeb23SPaul Mackerras mfspr r12,SPRN_SPRG2 56614cf11afSPaul Mackerras EXCEPTION_PROLOG_PSERIES(PACA_EXSLB, .do_stab_bolted) 56714cf11afSPaul Mackerras 56814cf11afSPaul Mackerras/* 5693c726f8dSBenjamin Herrenschmidt * We have some room here we use that to put 5703c726f8dSBenjamin Herrenschmidt * the peries slb miss user trampoline code so it's reasonably 5713c726f8dSBenjamin Herrenschmidt * away from slb_miss_user_common to avoid problems with rfid 5723c726f8dSBenjamin Herrenschmidt * 5733c726f8dSBenjamin Herrenschmidt * This is used for when the SLB miss handler has to go virtual, 5743c726f8dSBenjamin Herrenschmidt * which doesn't happen for now anymore but will once we re-implement 5753c726f8dSBenjamin Herrenschmidt * dynamic VSIDs for shared page tables 5763c726f8dSBenjamin Herrenschmidt */ 5773c726f8dSBenjamin Herrenschmidt#ifdef __DISABLED__ 5783c726f8dSBenjamin Herrenschmidtslb_miss_user_pseries: 5793c726f8dSBenjamin Herrenschmidt std r10,PACA_EXGEN+EX_R10(r13) 5803c726f8dSBenjamin Herrenschmidt std r11,PACA_EXGEN+EX_R11(r13) 5813c726f8dSBenjamin Herrenschmidt std r12,PACA_EXGEN+EX_R12(r13) 5823c726f8dSBenjamin Herrenschmidt mfspr r10,SPRG1 5833c726f8dSBenjamin Herrenschmidt ld r11,PACA_EXSLB+EX_R9(r13) 5843c726f8dSBenjamin Herrenschmidt ld r12,PACA_EXSLB+EX_R3(r13) 5853c726f8dSBenjamin Herrenschmidt std r10,PACA_EXGEN+EX_R13(r13) 5863c726f8dSBenjamin Herrenschmidt std r11,PACA_EXGEN+EX_R9(r13) 5873c726f8dSBenjamin Herrenschmidt std r12,PACA_EXGEN+EX_R3(r13) 5883c726f8dSBenjamin Herrenschmidt clrrdi r12,r13,32 5893c726f8dSBenjamin Herrenschmidt mfmsr r10 5903c726f8dSBenjamin Herrenschmidt mfspr r11,SRR0 /* save SRR0 */ 5913c726f8dSBenjamin Herrenschmidt ori r12,r12,slb_miss_user_common@l /* virt addr of handler */ 5923c726f8dSBenjamin Herrenschmidt ori r10,r10,MSR_IR|MSR_DR|MSR_RI 5933c726f8dSBenjamin Herrenschmidt mtspr SRR0,r12 5943c726f8dSBenjamin Herrenschmidt mfspr r12,SRR1 /* and SRR1 */ 5953c726f8dSBenjamin Herrenschmidt mtspr SRR1,r10 5963c726f8dSBenjamin Herrenschmidt rfid 5973c726f8dSBenjamin Herrenschmidt b . /* prevent spec. execution */ 5983c726f8dSBenjamin Herrenschmidt#endif /* __DISABLED__ */ 5993c726f8dSBenjamin Herrenschmidt 6003c726f8dSBenjamin Herrenschmidt/* 60114cf11afSPaul Mackerras * Vectors for the FWNMI option. Share common code. 60214cf11afSPaul Mackerras */ 60314cf11afSPaul Mackerras .globl system_reset_fwnmi 6048c4f1f29SMichael Ellerman .align 7 60514cf11afSPaul Mackerrassystem_reset_fwnmi: 60614cf11afSPaul Mackerras HMT_MEDIUM 607b5bbeb23SPaul Mackerras mtspr SPRN_SPRG1,r13 /* save r13 */ 60814cf11afSPaul Mackerras EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common) 60914cf11afSPaul Mackerras 61014cf11afSPaul Mackerras .globl machine_check_fwnmi 6118c4f1f29SMichael Ellerman .align 7 61214cf11afSPaul Mackerrasmachine_check_fwnmi: 61314cf11afSPaul Mackerras HMT_MEDIUM 614b5bbeb23SPaul Mackerras mtspr SPRN_SPRG1,r13 /* save r13 */ 61514cf11afSPaul Mackerras EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common) 61614cf11afSPaul Mackerras 61714cf11afSPaul Mackerras#ifdef CONFIG_PPC_ISERIES 61814cf11afSPaul Mackerras/*** ISeries-LPAR interrupt handlers ***/ 61914cf11afSPaul Mackerras 62014cf11afSPaul Mackerras STD_EXCEPTION_ISERIES(0x200, machine_check, PACA_EXMC) 62114cf11afSPaul Mackerras 62214cf11afSPaul Mackerras .globl data_access_iSeries 62314cf11afSPaul Mackerrasdata_access_iSeries: 624b5bbeb23SPaul Mackerras mtspr SPRN_SPRG1,r13 62514cf11afSPaul MackerrasBEGIN_FTR_SECTION 626b5bbeb23SPaul Mackerras mtspr SPRN_SPRG2,r12 627b5bbeb23SPaul Mackerras mfspr r13,SPRN_DAR 628b5bbeb23SPaul Mackerras mfspr r12,SPRN_DSISR 62914cf11afSPaul Mackerras srdi r13,r13,60 63014cf11afSPaul Mackerras rlwimi r13,r12,16,0x20 63114cf11afSPaul Mackerras mfcr r12 63214cf11afSPaul Mackerras cmpwi r13,0x2c 63314cf11afSPaul Mackerras beq .do_stab_bolted_iSeries 63414cf11afSPaul Mackerras mtcrf 0x80,r12 635b5bbeb23SPaul Mackerras mfspr r12,SPRN_SPRG2 63614cf11afSPaul MackerrasEND_FTR_SECTION_IFCLR(CPU_FTR_SLB) 63714cf11afSPaul Mackerras EXCEPTION_PROLOG_ISERIES_1(PACA_EXGEN) 63814cf11afSPaul Mackerras EXCEPTION_PROLOG_ISERIES_2 63914cf11afSPaul Mackerras b data_access_common 64014cf11afSPaul Mackerras 64114cf11afSPaul Mackerras.do_stab_bolted_iSeries: 64214cf11afSPaul Mackerras mtcrf 0x80,r12 643b5bbeb23SPaul Mackerras mfspr r12,SPRN_SPRG2 64414cf11afSPaul Mackerras EXCEPTION_PROLOG_ISERIES_1(PACA_EXSLB) 64514cf11afSPaul Mackerras EXCEPTION_PROLOG_ISERIES_2 64614cf11afSPaul Mackerras b .do_stab_bolted 64714cf11afSPaul Mackerras 64814cf11afSPaul Mackerras .globl data_access_slb_iSeries 64914cf11afSPaul Mackerrasdata_access_slb_iSeries: 650b5bbeb23SPaul Mackerras mtspr SPRN_SPRG1,r13 /* save r13 */ 6513c726f8dSBenjamin Herrenschmidt mfspr r13,SPRN_SPRG3 /* get paca address into r13 */ 65214cf11afSPaul Mackerras std r3,PACA_EXSLB+EX_R3(r13) 653b5bbeb23SPaul Mackerras mfspr r3,SPRN_DAR 6543c726f8dSBenjamin Herrenschmidt std r9,PACA_EXSLB+EX_R9(r13) 6553c726f8dSBenjamin Herrenschmidt mfcr r9 6563c726f8dSBenjamin Herrenschmidt#ifdef __DISABLED__ 6573c726f8dSBenjamin Herrenschmidt cmpdi r3,0 6583c726f8dSBenjamin Herrenschmidt bge slb_miss_user_iseries 6593c726f8dSBenjamin Herrenschmidt#endif 6603c726f8dSBenjamin Herrenschmidt std r10,PACA_EXSLB+EX_R10(r13) 6613c726f8dSBenjamin Herrenschmidt std r11,PACA_EXSLB+EX_R11(r13) 6623c726f8dSBenjamin Herrenschmidt std r12,PACA_EXSLB+EX_R12(r13) 6633c726f8dSBenjamin Herrenschmidt mfspr r10,SPRN_SPRG1 6643c726f8dSBenjamin Herrenschmidt std r10,PACA_EXSLB+EX_R13(r13) 6653356bb9fSDavid Gibson ld r12,PACALPPACAPTR(r13) 6663356bb9fSDavid Gibson ld r12,LPPACASRR1(r12) 6673c726f8dSBenjamin Herrenschmidt b .slb_miss_realmode 66814cf11afSPaul Mackerras 66914cf11afSPaul Mackerras STD_EXCEPTION_ISERIES(0x400, instruction_access, PACA_EXGEN) 67014cf11afSPaul Mackerras 67114cf11afSPaul Mackerras .globl instruction_access_slb_iSeries 67214cf11afSPaul Mackerrasinstruction_access_slb_iSeries: 673b5bbeb23SPaul Mackerras mtspr SPRN_SPRG1,r13 /* save r13 */ 6743c726f8dSBenjamin Herrenschmidt mfspr r13,SPRN_SPRG3 /* get paca address into r13 */ 67514cf11afSPaul Mackerras std r3,PACA_EXSLB+EX_R3(r13) 6763356bb9fSDavid Gibson ld r3,PACALPPACAPTR(r13) 6773356bb9fSDavid Gibson ld r3,LPPACASRR0(r3) /* get SRR0 value */ 6783c726f8dSBenjamin Herrenschmidt std r9,PACA_EXSLB+EX_R9(r13) 6793c726f8dSBenjamin Herrenschmidt mfcr r9 6803c726f8dSBenjamin Herrenschmidt#ifdef __DISABLED__ 6813c726f8dSBenjamin Herrenschmidt cmpdi r3,0 6823c726f8dSBenjamin Herrenschmidt bge .slb_miss_user_iseries 6833c726f8dSBenjamin Herrenschmidt#endif 6843c726f8dSBenjamin Herrenschmidt std r10,PACA_EXSLB+EX_R10(r13) 6853c726f8dSBenjamin Herrenschmidt std r11,PACA_EXSLB+EX_R11(r13) 6863c726f8dSBenjamin Herrenschmidt std r12,PACA_EXSLB+EX_R12(r13) 6873c726f8dSBenjamin Herrenschmidt mfspr r10,SPRN_SPRG1 6883c726f8dSBenjamin Herrenschmidt std r10,PACA_EXSLB+EX_R13(r13) 6893356bb9fSDavid Gibson ld r12,PACALPPACAPTR(r13) 6903356bb9fSDavid Gibson ld r12,LPPACASRR1(r12) 6913c726f8dSBenjamin Herrenschmidt b .slb_miss_realmode 6923c726f8dSBenjamin Herrenschmidt 6933c726f8dSBenjamin Herrenschmidt#ifdef __DISABLED__ 6943c726f8dSBenjamin Herrenschmidtslb_miss_user_iseries: 6953c726f8dSBenjamin Herrenschmidt std r10,PACA_EXGEN+EX_R10(r13) 6963c726f8dSBenjamin Herrenschmidt std r11,PACA_EXGEN+EX_R11(r13) 6973c726f8dSBenjamin Herrenschmidt std r12,PACA_EXGEN+EX_R12(r13) 6983c726f8dSBenjamin Herrenschmidt mfspr r10,SPRG1 6993c726f8dSBenjamin Herrenschmidt ld r11,PACA_EXSLB+EX_R9(r13) 7003c726f8dSBenjamin Herrenschmidt ld r12,PACA_EXSLB+EX_R3(r13) 7013c726f8dSBenjamin Herrenschmidt std r10,PACA_EXGEN+EX_R13(r13) 7023c726f8dSBenjamin Herrenschmidt std r11,PACA_EXGEN+EX_R9(r13) 7033c726f8dSBenjamin Herrenschmidt std r12,PACA_EXGEN+EX_R3(r13) 7043c726f8dSBenjamin Herrenschmidt EXCEPTION_PROLOG_ISERIES_2 7053c726f8dSBenjamin Herrenschmidt b slb_miss_user_common 7063c726f8dSBenjamin Herrenschmidt#endif 70714cf11afSPaul Mackerras 70814cf11afSPaul Mackerras MASKABLE_EXCEPTION_ISERIES(0x500, hardware_interrupt) 70914cf11afSPaul Mackerras STD_EXCEPTION_ISERIES(0x600, alignment, PACA_EXGEN) 71014cf11afSPaul Mackerras STD_EXCEPTION_ISERIES(0x700, program_check, PACA_EXGEN) 71114cf11afSPaul Mackerras STD_EXCEPTION_ISERIES(0x800, fp_unavailable, PACA_EXGEN) 71214cf11afSPaul Mackerras MASKABLE_EXCEPTION_ISERIES(0x900, decrementer) 71314cf11afSPaul Mackerras STD_EXCEPTION_ISERIES(0xa00, trap_0a, PACA_EXGEN) 71414cf11afSPaul Mackerras STD_EXCEPTION_ISERIES(0xb00, trap_0b, PACA_EXGEN) 71514cf11afSPaul Mackerras 71614cf11afSPaul Mackerras .globl system_call_iSeries 71714cf11afSPaul Mackerrassystem_call_iSeries: 71814cf11afSPaul Mackerras mr r9,r13 719b5bbeb23SPaul Mackerras mfspr r13,SPRN_SPRG3 72014cf11afSPaul Mackerras EXCEPTION_PROLOG_ISERIES_2 72114cf11afSPaul Mackerras b system_call_common 72214cf11afSPaul Mackerras 72314cf11afSPaul Mackerras STD_EXCEPTION_ISERIES( 0xd00, single_step, PACA_EXGEN) 72414cf11afSPaul Mackerras STD_EXCEPTION_ISERIES( 0xe00, trap_0e, PACA_EXGEN) 72514cf11afSPaul Mackerras STD_EXCEPTION_ISERIES( 0xf00, performance_monitor, PACA_EXGEN) 72614cf11afSPaul Mackerras 72714cf11afSPaul Mackerras .globl system_reset_iSeries 72814cf11afSPaul Mackerrassystem_reset_iSeries: 729b5bbeb23SPaul Mackerras mfspr r13,SPRN_SPRG3 /* Get paca address */ 73014cf11afSPaul Mackerras mfmsr r24 73114cf11afSPaul Mackerras ori r24,r24,MSR_RI 73214cf11afSPaul Mackerras mtmsrd r24 /* RI on */ 73314cf11afSPaul Mackerras lhz r24,PACAPACAINDEX(r13) /* Get processor # */ 73414cf11afSPaul Mackerras cmpwi 0,r24,0 /* Are we processor 0? */ 73514cf11afSPaul Mackerras beq .__start_initialization_iSeries /* Start up the first processor */ 73614cf11afSPaul Mackerras mfspr r4,SPRN_CTRLF 73714cf11afSPaul Mackerras li r5,CTRL_RUNLATCH /* Turn off the run light */ 73814cf11afSPaul Mackerras andc r4,r4,r5 73914cf11afSPaul Mackerras mtspr SPRN_CTRLT,r4 74014cf11afSPaul Mackerras 74114cf11afSPaul Mackerras1: 74214cf11afSPaul Mackerras HMT_LOW 74314cf11afSPaul Mackerras#ifdef CONFIG_SMP 74414cf11afSPaul Mackerras lbz r23,PACAPROCSTART(r13) /* Test if this processor 74514cf11afSPaul Mackerras * should start */ 74614cf11afSPaul Mackerras sync 747e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r3,current_set) 74814cf11afSPaul Mackerras sldi r28,r24,3 /* get current_set[cpu#] */ 74914cf11afSPaul Mackerras ldx r3,r3,r28 75014cf11afSPaul Mackerras addi r1,r3,THREAD_SIZE 75114cf11afSPaul Mackerras subi r1,r1,STACK_FRAME_OVERHEAD 75214cf11afSPaul Mackerras 75314cf11afSPaul Mackerras cmpwi 0,r23,0 75414cf11afSPaul Mackerras beq iSeries_secondary_smp_loop /* Loop until told to go */ 75514cf11afSPaul Mackerras bne .__secondary_start /* Loop until told to go */ 75614cf11afSPaul MackerrasiSeries_secondary_smp_loop: 75714cf11afSPaul Mackerras /* Let the Hypervisor know we are alive */ 75814cf11afSPaul Mackerras /* 8002 is a call to HvCallCfg::getLps, a harmless Hypervisor function */ 75914cf11afSPaul Mackerras lis r3,0x8002 76014cf11afSPaul Mackerras rldicr r3,r3,32,15 /* r0 = (r3 << 32) & 0xffff000000000000 */ 76114cf11afSPaul Mackerras#else /* CONFIG_SMP */ 76214cf11afSPaul Mackerras /* Yield the processor. This is required for non-SMP kernels 76314cf11afSPaul Mackerras which are running on multi-threaded machines. */ 76414cf11afSPaul Mackerras lis r3,0x8000 76514cf11afSPaul Mackerras rldicr r3,r3,32,15 /* r3 = (r3 << 32) & 0xffff000000000000 */ 76614cf11afSPaul Mackerras addi r3,r3,18 /* r3 = 0x8000000000000012 which is "yield" */ 76714cf11afSPaul Mackerras li r4,0 /* "yield timed" */ 76814cf11afSPaul Mackerras li r5,-1 /* "yield forever" */ 76914cf11afSPaul Mackerras#endif /* CONFIG_SMP */ 77014cf11afSPaul Mackerras li r0,-1 /* r0=-1 indicates a Hypervisor call */ 77114cf11afSPaul Mackerras sc /* Invoke the hypervisor via a system call */ 772b5bbeb23SPaul Mackerras mfspr r13,SPRN_SPRG3 /* Put r13 back ???? */ 77314cf11afSPaul Mackerras b 1b /* If SMP not configured, secondaries 77414cf11afSPaul Mackerras * loop forever */ 77514cf11afSPaul Mackerras 77614cf11afSPaul Mackerras .globl decrementer_iSeries_masked 77714cf11afSPaul Mackerrasdecrementer_iSeries_masked: 778f9b4045dSMichael Ellerman /* We may not have a valid TOC pointer in here. */ 77914cf11afSPaul Mackerras li r11,1 7803356bb9fSDavid Gibson ld r12,PACALPPACAPTR(r13) 7813356bb9fSDavid Gibson stb r11,LPPACADECRINT(r12) 782f9b4045dSMichael Ellerman LOAD_REG_IMMEDIATE(r12, tb_ticks_per_jiffy) 783f9b4045dSMichael Ellerman lwz r12,0(r12) 78414cf11afSPaul Mackerras mtspr SPRN_DEC,r12 78514cf11afSPaul Mackerras /* fall through */ 78614cf11afSPaul Mackerras 78714cf11afSPaul Mackerras .globl hardware_interrupt_iSeries_masked 78814cf11afSPaul Mackerrashardware_interrupt_iSeries_masked: 78914cf11afSPaul Mackerras mtcrf 0x80,r9 /* Restore regs */ 7903356bb9fSDavid Gibson ld r12,PACALPPACAPTR(r13) 7913356bb9fSDavid Gibson ld r11,LPPACASRR0(r12) 7923356bb9fSDavid Gibson ld r12,LPPACASRR1(r12) 793b5bbeb23SPaul Mackerras mtspr SPRN_SRR0,r11 794b5bbeb23SPaul Mackerras mtspr SPRN_SRR1,r12 79514cf11afSPaul Mackerras ld r9,PACA_EXGEN+EX_R9(r13) 79614cf11afSPaul Mackerras ld r10,PACA_EXGEN+EX_R10(r13) 79714cf11afSPaul Mackerras ld r11,PACA_EXGEN+EX_R11(r13) 79814cf11afSPaul Mackerras ld r12,PACA_EXGEN+EX_R12(r13) 79914cf11afSPaul Mackerras ld r13,PACA_EXGEN+EX_R13(r13) 80014cf11afSPaul Mackerras rfid 80114cf11afSPaul Mackerras b . /* prevent speculative execution */ 80214cf11afSPaul Mackerras#endif /* CONFIG_PPC_ISERIES */ 80314cf11afSPaul Mackerras 80414cf11afSPaul Mackerras/*** Common interrupt handlers ***/ 80514cf11afSPaul Mackerras 80614cf11afSPaul Mackerras STD_EXCEPTION_COMMON(0x100, system_reset, .system_reset_exception) 80714cf11afSPaul Mackerras 80814cf11afSPaul Mackerras /* 80914cf11afSPaul Mackerras * Machine check is different because we use a different 81014cf11afSPaul Mackerras * save area: PACA_EXMC instead of PACA_EXGEN. 81114cf11afSPaul Mackerras */ 81214cf11afSPaul Mackerras .align 7 81314cf11afSPaul Mackerras .globl machine_check_common 81414cf11afSPaul Mackerrasmachine_check_common: 81514cf11afSPaul Mackerras EXCEPTION_PROLOG_COMMON(0x200, PACA_EXMC) 816f39224a8SPaul Mackerras FINISH_NAP 81714cf11afSPaul Mackerras DISABLE_INTS 81814cf11afSPaul Mackerras bl .save_nvgprs 81914cf11afSPaul Mackerras addi r3,r1,STACK_FRAME_OVERHEAD 82014cf11afSPaul Mackerras bl .machine_check_exception 82114cf11afSPaul Mackerras b .ret_from_except 82214cf11afSPaul Mackerras 82314cf11afSPaul Mackerras STD_EXCEPTION_COMMON_LITE(0x900, decrementer, .timer_interrupt) 82414cf11afSPaul Mackerras STD_EXCEPTION_COMMON(0xa00, trap_0a, .unknown_exception) 82514cf11afSPaul Mackerras STD_EXCEPTION_COMMON(0xb00, trap_0b, .unknown_exception) 82614cf11afSPaul Mackerras STD_EXCEPTION_COMMON(0xd00, single_step, .single_step_exception) 82714cf11afSPaul Mackerras STD_EXCEPTION_COMMON(0xe00, trap_0e, .unknown_exception) 828f39224a8SPaul Mackerras STD_EXCEPTION_COMMON_IDLE(0xf00, performance_monitor, .performance_monitor_exception) 82914cf11afSPaul Mackerras STD_EXCEPTION_COMMON(0x1300, instruction_breakpoint, .instruction_breakpoint_exception) 83014cf11afSPaul Mackerras#ifdef CONFIG_ALTIVEC 83114cf11afSPaul Mackerras STD_EXCEPTION_COMMON(0x1700, altivec_assist, .altivec_assist_exception) 83214cf11afSPaul Mackerras#else 83314cf11afSPaul Mackerras STD_EXCEPTION_COMMON(0x1700, altivec_assist, .unknown_exception) 83414cf11afSPaul Mackerras#endif 835acf7d768SBenjamin Herrenschmidt#ifdef CONFIG_CBE_RAS 836acf7d768SBenjamin Herrenschmidt STD_EXCEPTION_COMMON(0x1200, cbe_system_error, .cbe_system_error_exception) 837acf7d768SBenjamin Herrenschmidt STD_EXCEPTION_COMMON(0x1600, cbe_maintenance, .cbe_maintenance_exception) 838acf7d768SBenjamin Herrenschmidt STD_EXCEPTION_COMMON(0x1800, cbe_thermal, .cbe_thermal_exception) 839acf7d768SBenjamin Herrenschmidt#endif /* CONFIG_CBE_RAS */ 84014cf11afSPaul Mackerras 84114cf11afSPaul Mackerras/* 84214cf11afSPaul Mackerras * Here we have detected that the kernel stack pointer is bad. 84314cf11afSPaul Mackerras * R9 contains the saved CR, r13 points to the paca, 84414cf11afSPaul Mackerras * r10 contains the (bad) kernel stack pointer, 84514cf11afSPaul Mackerras * r11 and r12 contain the saved SRR0 and SRR1. 84614cf11afSPaul Mackerras * We switch to using an emergency stack, save the registers there, 84714cf11afSPaul Mackerras * and call kernel_bad_stack(), which panics. 84814cf11afSPaul Mackerras */ 84914cf11afSPaul Mackerrasbad_stack: 85014cf11afSPaul Mackerras ld r1,PACAEMERGSP(r13) 85114cf11afSPaul Mackerras subi r1,r1,64+INT_FRAME_SIZE 85214cf11afSPaul Mackerras std r9,_CCR(r1) 85314cf11afSPaul Mackerras std r10,GPR1(r1) 85414cf11afSPaul Mackerras std r11,_NIP(r1) 85514cf11afSPaul Mackerras std r12,_MSR(r1) 856b5bbeb23SPaul Mackerras mfspr r11,SPRN_DAR 857b5bbeb23SPaul Mackerras mfspr r12,SPRN_DSISR 85814cf11afSPaul Mackerras std r11,_DAR(r1) 85914cf11afSPaul Mackerras std r12,_DSISR(r1) 86014cf11afSPaul Mackerras mflr r10 86114cf11afSPaul Mackerras mfctr r11 86214cf11afSPaul Mackerras mfxer r12 86314cf11afSPaul Mackerras std r10,_LINK(r1) 86414cf11afSPaul Mackerras std r11,_CTR(r1) 86514cf11afSPaul Mackerras std r12,_XER(r1) 86614cf11afSPaul Mackerras SAVE_GPR(0,r1) 86714cf11afSPaul Mackerras SAVE_GPR(2,r1) 86814cf11afSPaul Mackerras SAVE_4GPRS(3,r1) 86914cf11afSPaul Mackerras SAVE_2GPRS(7,r1) 87014cf11afSPaul Mackerras SAVE_10GPRS(12,r1) 87114cf11afSPaul Mackerras SAVE_10GPRS(22,r1) 87214cf11afSPaul Mackerras addi r11,r1,INT_FRAME_SIZE 87314cf11afSPaul Mackerras std r11,0(r1) 87414cf11afSPaul Mackerras li r12,0 87514cf11afSPaul Mackerras std r12,0(r11) 87614cf11afSPaul Mackerras ld r2,PACATOC(r13) 87714cf11afSPaul Mackerras1: addi r3,r1,STACK_FRAME_OVERHEAD 87814cf11afSPaul Mackerras bl .kernel_bad_stack 87914cf11afSPaul Mackerras b 1b 88014cf11afSPaul Mackerras 88114cf11afSPaul Mackerras/* 88214cf11afSPaul Mackerras * Return from an exception with minimal checks. 88314cf11afSPaul Mackerras * The caller is assumed to have done EXCEPTION_PROLOG_COMMON. 88414cf11afSPaul Mackerras * If interrupts have been enabled, or anything has been 88514cf11afSPaul Mackerras * done that might have changed the scheduling status of 88614cf11afSPaul Mackerras * any task or sent any task a signal, you should use 88714cf11afSPaul Mackerras * ret_from_except or ret_from_except_lite instead of this. 88814cf11afSPaul Mackerras */ 88940ef8cbcSPaul Mackerras .globl fast_exception_return 89014cf11afSPaul Mackerrasfast_exception_return: 89114cf11afSPaul Mackerras ld r12,_MSR(r1) 89214cf11afSPaul Mackerras ld r11,_NIP(r1) 89314cf11afSPaul Mackerras andi. r3,r12,MSR_RI /* check if RI is set */ 89414cf11afSPaul Mackerras beq- unrecov_fer 895c6622f63SPaul Mackerras 896c6622f63SPaul Mackerras#ifdef CONFIG_VIRT_CPU_ACCOUNTING 897c6622f63SPaul Mackerras andi. r3,r12,MSR_PR 898c6622f63SPaul Mackerras beq 2f 899c6622f63SPaul Mackerras ACCOUNT_CPU_USER_EXIT(r3, r4) 900c6622f63SPaul Mackerras2: 901c6622f63SPaul Mackerras#endif 902c6622f63SPaul Mackerras 90314cf11afSPaul Mackerras ld r3,_CCR(r1) 90414cf11afSPaul Mackerras ld r4,_LINK(r1) 90514cf11afSPaul Mackerras ld r5,_CTR(r1) 90614cf11afSPaul Mackerras ld r6,_XER(r1) 90714cf11afSPaul Mackerras mtcr r3 90814cf11afSPaul Mackerras mtlr r4 90914cf11afSPaul Mackerras mtctr r5 91014cf11afSPaul Mackerras mtxer r6 91114cf11afSPaul Mackerras REST_GPR(0, r1) 91214cf11afSPaul Mackerras REST_8GPRS(2, r1) 91314cf11afSPaul Mackerras 91414cf11afSPaul Mackerras mfmsr r10 91514cf11afSPaul Mackerras clrrdi r10,r10,2 /* clear RI (LE is 0 already) */ 91614cf11afSPaul Mackerras mtmsrd r10,1 91714cf11afSPaul Mackerras 918b5bbeb23SPaul Mackerras mtspr SPRN_SRR1,r12 919b5bbeb23SPaul Mackerras mtspr SPRN_SRR0,r11 92014cf11afSPaul Mackerras REST_4GPRS(10, r1) 92114cf11afSPaul Mackerras ld r1,GPR1(r1) 92214cf11afSPaul Mackerras rfid 92314cf11afSPaul Mackerras b . /* prevent speculative execution */ 92414cf11afSPaul Mackerras 92514cf11afSPaul Mackerrasunrecov_fer: 92614cf11afSPaul Mackerras bl .save_nvgprs 92714cf11afSPaul Mackerras1: addi r3,r1,STACK_FRAME_OVERHEAD 92814cf11afSPaul Mackerras bl .unrecoverable_exception 92914cf11afSPaul Mackerras b 1b 93014cf11afSPaul Mackerras 93114cf11afSPaul Mackerras/* 93214cf11afSPaul Mackerras * Here r13 points to the paca, r9 contains the saved CR, 93314cf11afSPaul Mackerras * SRR0 and SRR1 are saved in r11 and r12, 93414cf11afSPaul Mackerras * r9 - r13 are saved in paca->exgen. 93514cf11afSPaul Mackerras */ 93614cf11afSPaul Mackerras .align 7 93714cf11afSPaul Mackerras .globl data_access_common 93814cf11afSPaul Mackerrasdata_access_common: 939b5bbeb23SPaul Mackerras mfspr r10,SPRN_DAR 94014cf11afSPaul Mackerras std r10,PACA_EXGEN+EX_DAR(r13) 941b5bbeb23SPaul Mackerras mfspr r10,SPRN_DSISR 94214cf11afSPaul Mackerras stw r10,PACA_EXGEN+EX_DSISR(r13) 94314cf11afSPaul Mackerras EXCEPTION_PROLOG_COMMON(0x300, PACA_EXGEN) 94414cf11afSPaul Mackerras ld r3,PACA_EXGEN+EX_DAR(r13) 94514cf11afSPaul Mackerras lwz r4,PACA_EXGEN+EX_DSISR(r13) 94614cf11afSPaul Mackerras li r5,0x300 94714cf11afSPaul Mackerras b .do_hash_page /* Try to handle as hpte fault */ 94814cf11afSPaul Mackerras 94914cf11afSPaul Mackerras .align 7 95014cf11afSPaul Mackerras .globl instruction_access_common 95114cf11afSPaul Mackerrasinstruction_access_common: 95214cf11afSPaul Mackerras EXCEPTION_PROLOG_COMMON(0x400, PACA_EXGEN) 95314cf11afSPaul Mackerras ld r3,_NIP(r1) 95414cf11afSPaul Mackerras andis. r4,r12,0x5820 95514cf11afSPaul Mackerras li r5,0x400 95614cf11afSPaul Mackerras b .do_hash_page /* Try to handle as hpte fault */ 95714cf11afSPaul Mackerras 9583c726f8dSBenjamin Herrenschmidt/* 9593c726f8dSBenjamin Herrenschmidt * Here is the common SLB miss user that is used when going to virtual 9603c726f8dSBenjamin Herrenschmidt * mode for SLB misses, that is currently not used 9613c726f8dSBenjamin Herrenschmidt */ 9623c726f8dSBenjamin Herrenschmidt#ifdef __DISABLED__ 9633c726f8dSBenjamin Herrenschmidt .align 7 9643c726f8dSBenjamin Herrenschmidt .globl slb_miss_user_common 9653c726f8dSBenjamin Herrenschmidtslb_miss_user_common: 9663c726f8dSBenjamin Herrenschmidt mflr r10 9673c726f8dSBenjamin Herrenschmidt std r3,PACA_EXGEN+EX_DAR(r13) 9683c726f8dSBenjamin Herrenschmidt stw r9,PACA_EXGEN+EX_CCR(r13) 9693c726f8dSBenjamin Herrenschmidt std r10,PACA_EXGEN+EX_LR(r13) 9703c726f8dSBenjamin Herrenschmidt std r11,PACA_EXGEN+EX_SRR0(r13) 9713c726f8dSBenjamin Herrenschmidt bl .slb_allocate_user 9723c726f8dSBenjamin Herrenschmidt 9733c726f8dSBenjamin Herrenschmidt ld r10,PACA_EXGEN+EX_LR(r13) 9743c726f8dSBenjamin Herrenschmidt ld r3,PACA_EXGEN+EX_R3(r13) 9753c726f8dSBenjamin Herrenschmidt lwz r9,PACA_EXGEN+EX_CCR(r13) 9763c726f8dSBenjamin Herrenschmidt ld r11,PACA_EXGEN+EX_SRR0(r13) 9773c726f8dSBenjamin Herrenschmidt mtlr r10 9783c726f8dSBenjamin Herrenschmidt beq- slb_miss_fault 9793c726f8dSBenjamin Herrenschmidt 9803c726f8dSBenjamin Herrenschmidt andi. r10,r12,MSR_RI /* check for unrecoverable exception */ 9813c726f8dSBenjamin Herrenschmidt beq- unrecov_user_slb 9823c726f8dSBenjamin Herrenschmidt mfmsr r10 9833c726f8dSBenjamin Herrenschmidt 9843c726f8dSBenjamin Herrenschmidt.machine push 9853c726f8dSBenjamin Herrenschmidt.machine "power4" 9863c726f8dSBenjamin Herrenschmidt mtcrf 0x80,r9 9873c726f8dSBenjamin Herrenschmidt.machine pop 9883c726f8dSBenjamin Herrenschmidt 9893c726f8dSBenjamin Herrenschmidt clrrdi r10,r10,2 /* clear RI before setting SRR0/1 */ 9903c726f8dSBenjamin Herrenschmidt mtmsrd r10,1 9913c726f8dSBenjamin Herrenschmidt 9923c726f8dSBenjamin Herrenschmidt mtspr SRR0,r11 9933c726f8dSBenjamin Herrenschmidt mtspr SRR1,r12 9943c726f8dSBenjamin Herrenschmidt 9953c726f8dSBenjamin Herrenschmidt ld r9,PACA_EXGEN+EX_R9(r13) 9963c726f8dSBenjamin Herrenschmidt ld r10,PACA_EXGEN+EX_R10(r13) 9973c726f8dSBenjamin Herrenschmidt ld r11,PACA_EXGEN+EX_R11(r13) 9983c726f8dSBenjamin Herrenschmidt ld r12,PACA_EXGEN+EX_R12(r13) 9993c726f8dSBenjamin Herrenschmidt ld r13,PACA_EXGEN+EX_R13(r13) 10003c726f8dSBenjamin Herrenschmidt rfid 10013c726f8dSBenjamin Herrenschmidt b . 10023c726f8dSBenjamin Herrenschmidt 10033c726f8dSBenjamin Herrenschmidtslb_miss_fault: 10043c726f8dSBenjamin Herrenschmidt EXCEPTION_PROLOG_COMMON(0x380, PACA_EXGEN) 10053c726f8dSBenjamin Herrenschmidt ld r4,PACA_EXGEN+EX_DAR(r13) 10063c726f8dSBenjamin Herrenschmidt li r5,0 10073c726f8dSBenjamin Herrenschmidt std r4,_DAR(r1) 10083c726f8dSBenjamin Herrenschmidt std r5,_DSISR(r1) 10093c726f8dSBenjamin Herrenschmidt b .handle_page_fault 10103c726f8dSBenjamin Herrenschmidt 10113c726f8dSBenjamin Herrenschmidtunrecov_user_slb: 10123c726f8dSBenjamin Herrenschmidt EXCEPTION_PROLOG_COMMON(0x4200, PACA_EXGEN) 10133c726f8dSBenjamin Herrenschmidt DISABLE_INTS 10143c726f8dSBenjamin Herrenschmidt bl .save_nvgprs 10153c726f8dSBenjamin Herrenschmidt1: addi r3,r1,STACK_FRAME_OVERHEAD 10163c726f8dSBenjamin Herrenschmidt bl .unrecoverable_exception 10173c726f8dSBenjamin Herrenschmidt b 1b 10183c726f8dSBenjamin Herrenschmidt 10193c726f8dSBenjamin Herrenschmidt#endif /* __DISABLED__ */ 10203c726f8dSBenjamin Herrenschmidt 10213c726f8dSBenjamin Herrenschmidt 10223c726f8dSBenjamin Herrenschmidt/* 10233c726f8dSBenjamin Herrenschmidt * r13 points to the PACA, r9 contains the saved CR, 10243c726f8dSBenjamin Herrenschmidt * r12 contain the saved SRR1, SRR0 is still ready for return 10253c726f8dSBenjamin Herrenschmidt * r3 has the faulting address 10263c726f8dSBenjamin Herrenschmidt * r9 - r13 are saved in paca->exslb. 10273c726f8dSBenjamin Herrenschmidt * r3 is saved in paca->slb_r3 10283c726f8dSBenjamin Herrenschmidt * We assume we aren't going to take any exceptions during this procedure. 10293c726f8dSBenjamin Herrenschmidt */ 10303c726f8dSBenjamin Herrenschmidt_GLOBAL(slb_miss_realmode) 10313c726f8dSBenjamin Herrenschmidt mflr r10 10323c726f8dSBenjamin Herrenschmidt 10333c726f8dSBenjamin Herrenschmidt stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */ 10343c726f8dSBenjamin Herrenschmidt std r10,PACA_EXSLB+EX_LR(r13) /* save LR */ 10353c726f8dSBenjamin Herrenschmidt 10363c726f8dSBenjamin Herrenschmidt bl .slb_allocate_realmode 10373c726f8dSBenjamin Herrenschmidt 10383c726f8dSBenjamin Herrenschmidt /* All done -- return from exception. */ 10393c726f8dSBenjamin Herrenschmidt 10403c726f8dSBenjamin Herrenschmidt ld r10,PACA_EXSLB+EX_LR(r13) 10413c726f8dSBenjamin Herrenschmidt ld r3,PACA_EXSLB+EX_R3(r13) 10423c726f8dSBenjamin Herrenschmidt lwz r9,PACA_EXSLB+EX_CCR(r13) /* get saved CR */ 10433c726f8dSBenjamin Herrenschmidt#ifdef CONFIG_PPC_ISERIES 10443356bb9fSDavid Gibson ld r11,PACALPPACAPTR(r13) 10453356bb9fSDavid Gibson ld r11,LPPACASRR0(r11) /* get SRR0 value */ 10463c726f8dSBenjamin Herrenschmidt#endif /* CONFIG_PPC_ISERIES */ 10473c726f8dSBenjamin Herrenschmidt 10483c726f8dSBenjamin Herrenschmidt mtlr r10 10493c726f8dSBenjamin Herrenschmidt 10503c726f8dSBenjamin Herrenschmidt andi. r10,r12,MSR_RI /* check for unrecoverable exception */ 10513c726f8dSBenjamin Herrenschmidt beq- unrecov_slb 10523c726f8dSBenjamin Herrenschmidt 10533c726f8dSBenjamin Herrenschmidt.machine push 10543c726f8dSBenjamin Herrenschmidt.machine "power4" 10553c726f8dSBenjamin Herrenschmidt mtcrf 0x80,r9 10563c726f8dSBenjamin Herrenschmidt mtcrf 0x01,r9 /* slb_allocate uses cr0 and cr7 */ 10573c726f8dSBenjamin Herrenschmidt.machine pop 10583c726f8dSBenjamin Herrenschmidt 10593c726f8dSBenjamin Herrenschmidt#ifdef CONFIG_PPC_ISERIES 10603c726f8dSBenjamin Herrenschmidt mtspr SPRN_SRR0,r11 10613c726f8dSBenjamin Herrenschmidt mtspr SPRN_SRR1,r12 10623c726f8dSBenjamin Herrenschmidt#endif /* CONFIG_PPC_ISERIES */ 10633c726f8dSBenjamin Herrenschmidt ld r9,PACA_EXSLB+EX_R9(r13) 10643c726f8dSBenjamin Herrenschmidt ld r10,PACA_EXSLB+EX_R10(r13) 10653c726f8dSBenjamin Herrenschmidt ld r11,PACA_EXSLB+EX_R11(r13) 10663c726f8dSBenjamin Herrenschmidt ld r12,PACA_EXSLB+EX_R12(r13) 10673c726f8dSBenjamin Herrenschmidt ld r13,PACA_EXSLB+EX_R13(r13) 10683c726f8dSBenjamin Herrenschmidt rfid 10693c726f8dSBenjamin Herrenschmidt b . /* prevent speculative execution */ 10703c726f8dSBenjamin Herrenschmidt 10713c726f8dSBenjamin Herrenschmidtunrecov_slb: 10723c726f8dSBenjamin Herrenschmidt EXCEPTION_PROLOG_COMMON(0x4100, PACA_EXSLB) 10733c726f8dSBenjamin Herrenschmidt DISABLE_INTS 10743c726f8dSBenjamin Herrenschmidt bl .save_nvgprs 10753c726f8dSBenjamin Herrenschmidt1: addi r3,r1,STACK_FRAME_OVERHEAD 10763c726f8dSBenjamin Herrenschmidt bl .unrecoverable_exception 10773c726f8dSBenjamin Herrenschmidt b 1b 10783c726f8dSBenjamin Herrenschmidt 107914cf11afSPaul Mackerras .align 7 108014cf11afSPaul Mackerras .globl hardware_interrupt_common 108114cf11afSPaul Mackerras .globl hardware_interrupt_entry 108214cf11afSPaul Mackerrashardware_interrupt_common: 108314cf11afSPaul Mackerras EXCEPTION_PROLOG_COMMON(0x500, PACA_EXGEN) 1084f39224a8SPaul Mackerras FINISH_NAP 108514cf11afSPaul Mackerrashardware_interrupt_entry: 108614cf11afSPaul Mackerras DISABLE_INTS 1087cb2c9b27SAnton Blanchard bl .ppc64_runlatch_on 108814cf11afSPaul Mackerras addi r3,r1,STACK_FRAME_OVERHEAD 108914cf11afSPaul Mackerras bl .do_IRQ 109014cf11afSPaul Mackerras b .ret_from_except_lite 109114cf11afSPaul Mackerras 1092f39224a8SPaul Mackerras#ifdef CONFIG_PPC_970_NAP 1093f39224a8SPaul Mackerraspower4_fixup_nap: 1094f39224a8SPaul Mackerras andc r9,r9,r10 1095f39224a8SPaul Mackerras std r9,TI_LOCAL_FLAGS(r11) 1096f39224a8SPaul Mackerras ld r10,_LINK(r1) /* make idle task do the */ 1097f39224a8SPaul Mackerras std r10,_NIP(r1) /* equivalent of a blr */ 1098f39224a8SPaul Mackerras blr 1099f39224a8SPaul Mackerras#endif 1100f39224a8SPaul Mackerras 110114cf11afSPaul Mackerras .align 7 110214cf11afSPaul Mackerras .globl alignment_common 110314cf11afSPaul Mackerrasalignment_common: 1104b5bbeb23SPaul Mackerras mfspr r10,SPRN_DAR 110514cf11afSPaul Mackerras std r10,PACA_EXGEN+EX_DAR(r13) 1106b5bbeb23SPaul Mackerras mfspr r10,SPRN_DSISR 110714cf11afSPaul Mackerras stw r10,PACA_EXGEN+EX_DSISR(r13) 110814cf11afSPaul Mackerras EXCEPTION_PROLOG_COMMON(0x600, PACA_EXGEN) 110914cf11afSPaul Mackerras ld r3,PACA_EXGEN+EX_DAR(r13) 111014cf11afSPaul Mackerras lwz r4,PACA_EXGEN+EX_DSISR(r13) 111114cf11afSPaul Mackerras std r3,_DAR(r1) 111214cf11afSPaul Mackerras std r4,_DSISR(r1) 111314cf11afSPaul Mackerras bl .save_nvgprs 111414cf11afSPaul Mackerras addi r3,r1,STACK_FRAME_OVERHEAD 111514cf11afSPaul Mackerras ENABLE_INTS 111614cf11afSPaul Mackerras bl .alignment_exception 111714cf11afSPaul Mackerras b .ret_from_except 111814cf11afSPaul Mackerras 111914cf11afSPaul Mackerras .align 7 112014cf11afSPaul Mackerras .globl program_check_common 112114cf11afSPaul Mackerrasprogram_check_common: 112214cf11afSPaul Mackerras EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN) 112314cf11afSPaul Mackerras bl .save_nvgprs 112414cf11afSPaul Mackerras addi r3,r1,STACK_FRAME_OVERHEAD 112514cf11afSPaul Mackerras ENABLE_INTS 112614cf11afSPaul Mackerras bl .program_check_exception 112714cf11afSPaul Mackerras b .ret_from_except 112814cf11afSPaul Mackerras 112914cf11afSPaul Mackerras .align 7 113014cf11afSPaul Mackerras .globl fp_unavailable_common 113114cf11afSPaul Mackerrasfp_unavailable_common: 113214cf11afSPaul Mackerras EXCEPTION_PROLOG_COMMON(0x800, PACA_EXGEN) 113314cf11afSPaul Mackerras bne .load_up_fpu /* if from user, just load it up */ 113414cf11afSPaul Mackerras bl .save_nvgprs 113514cf11afSPaul Mackerras addi r3,r1,STACK_FRAME_OVERHEAD 113614cf11afSPaul Mackerras ENABLE_INTS 113714cf11afSPaul Mackerras bl .kernel_fp_unavailable_exception 113814cf11afSPaul Mackerras BUG_OPCODE 113914cf11afSPaul Mackerras 114014cf11afSPaul Mackerras .align 7 114114cf11afSPaul Mackerras .globl altivec_unavailable_common 114214cf11afSPaul Mackerrasaltivec_unavailable_common: 114314cf11afSPaul Mackerras EXCEPTION_PROLOG_COMMON(0xf20, PACA_EXGEN) 114414cf11afSPaul Mackerras#ifdef CONFIG_ALTIVEC 114514cf11afSPaul MackerrasBEGIN_FTR_SECTION 114614cf11afSPaul Mackerras bne .load_up_altivec /* if from user, just load it up */ 114714cf11afSPaul MackerrasEND_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) 114814cf11afSPaul Mackerras#endif 114914cf11afSPaul Mackerras bl .save_nvgprs 115014cf11afSPaul Mackerras addi r3,r1,STACK_FRAME_OVERHEAD 115114cf11afSPaul Mackerras ENABLE_INTS 115214cf11afSPaul Mackerras bl .altivec_unavailable_exception 115314cf11afSPaul Mackerras b .ret_from_except 115414cf11afSPaul Mackerras 115514cf11afSPaul Mackerras#ifdef CONFIG_ALTIVEC 115614cf11afSPaul Mackerras/* 115714cf11afSPaul Mackerras * load_up_altivec(unused, unused, tsk) 115814cf11afSPaul Mackerras * Disable VMX for the task which had it previously, 115914cf11afSPaul Mackerras * and save its vector registers in its thread_struct. 116014cf11afSPaul Mackerras * Enables the VMX for use in the kernel on return. 116114cf11afSPaul Mackerras * On SMP we know the VMX is free, since we give it up every 116214cf11afSPaul Mackerras * switch (ie, no lazy save of the vector registers). 116314cf11afSPaul Mackerras * On entry: r13 == 'current' && last_task_used_altivec != 'current' 116414cf11afSPaul Mackerras */ 116514cf11afSPaul Mackerras_STATIC(load_up_altivec) 116614cf11afSPaul Mackerras mfmsr r5 /* grab the current MSR */ 116714cf11afSPaul Mackerras oris r5,r5,MSR_VEC@h 116814cf11afSPaul Mackerras mtmsrd r5 /* enable use of VMX now */ 116914cf11afSPaul Mackerras isync 117014cf11afSPaul Mackerras 117114cf11afSPaul Mackerras/* 117214cf11afSPaul Mackerras * For SMP, we don't do lazy VMX switching because it just gets too 117314cf11afSPaul Mackerras * horrendously complex, especially when a task switches from one CPU 117414cf11afSPaul Mackerras * to another. Instead we call giveup_altvec in switch_to. 117514cf11afSPaul Mackerras * VRSAVE isn't dealt with here, that is done in the normal context 117614cf11afSPaul Mackerras * switch code. Note that we could rely on vrsave value to eventually 117714cf11afSPaul Mackerras * avoid saving all of the VREGs here... 117814cf11afSPaul Mackerras */ 117914cf11afSPaul Mackerras#ifndef CONFIG_SMP 118014cf11afSPaul Mackerras ld r3,last_task_used_altivec@got(r2) 118114cf11afSPaul Mackerras ld r4,0(r3) 118214cf11afSPaul Mackerras cmpdi 0,r4,0 118314cf11afSPaul Mackerras beq 1f 118414cf11afSPaul Mackerras /* Save VMX state to last_task_used_altivec's THREAD struct */ 118514cf11afSPaul Mackerras addi r4,r4,THREAD 118614cf11afSPaul Mackerras SAVE_32VRS(0,r5,r4) 118714cf11afSPaul Mackerras mfvscr vr0 118814cf11afSPaul Mackerras li r10,THREAD_VSCR 118914cf11afSPaul Mackerras stvx vr0,r10,r4 119014cf11afSPaul Mackerras /* Disable VMX for last_task_used_altivec */ 119114cf11afSPaul Mackerras ld r5,PT_REGS(r4) 119214cf11afSPaul Mackerras ld r4,_MSR-STACK_FRAME_OVERHEAD(r5) 119314cf11afSPaul Mackerras lis r6,MSR_VEC@h 119414cf11afSPaul Mackerras andc r4,r4,r6 119514cf11afSPaul Mackerras std r4,_MSR-STACK_FRAME_OVERHEAD(r5) 119614cf11afSPaul Mackerras1: 119714cf11afSPaul Mackerras#endif /* CONFIG_SMP */ 119814cf11afSPaul Mackerras /* Hack: if we get an altivec unavailable trap with VRSAVE 119914cf11afSPaul Mackerras * set to all zeros, we assume this is a broken application 120014cf11afSPaul Mackerras * that fails to set it properly, and thus we switch it to 120114cf11afSPaul Mackerras * all 1's 120214cf11afSPaul Mackerras */ 120314cf11afSPaul Mackerras mfspr r4,SPRN_VRSAVE 120414cf11afSPaul Mackerras cmpdi 0,r4,0 120514cf11afSPaul Mackerras bne+ 1f 120614cf11afSPaul Mackerras li r4,-1 120714cf11afSPaul Mackerras mtspr SPRN_VRSAVE,r4 120814cf11afSPaul Mackerras1: 120914cf11afSPaul Mackerras /* enable use of VMX after return */ 121014cf11afSPaul Mackerras ld r4,PACACURRENT(r13) 121114cf11afSPaul Mackerras addi r5,r4,THREAD /* Get THREAD */ 121214cf11afSPaul Mackerras oris r12,r12,MSR_VEC@h 121314cf11afSPaul Mackerras std r12,_MSR(r1) 121414cf11afSPaul Mackerras li r4,1 121514cf11afSPaul Mackerras li r10,THREAD_VSCR 121614cf11afSPaul Mackerras stw r4,THREAD_USED_VR(r5) 121714cf11afSPaul Mackerras lvx vr0,r10,r5 121814cf11afSPaul Mackerras mtvscr vr0 121914cf11afSPaul Mackerras REST_32VRS(0,r4,r5) 122014cf11afSPaul Mackerras#ifndef CONFIG_SMP 122114cf11afSPaul Mackerras /* Update last_task_used_math to 'current' */ 122214cf11afSPaul Mackerras subi r4,r5,THREAD /* Back to 'current' */ 122314cf11afSPaul Mackerras std r4,0(r3) 122414cf11afSPaul Mackerras#endif /* CONFIG_SMP */ 122514cf11afSPaul Mackerras /* restore registers and return */ 122614cf11afSPaul Mackerras b fast_exception_return 122714cf11afSPaul Mackerras#endif /* CONFIG_ALTIVEC */ 122814cf11afSPaul Mackerras 122914cf11afSPaul Mackerras/* 123014cf11afSPaul Mackerras * Hash table stuff 123114cf11afSPaul Mackerras */ 123214cf11afSPaul Mackerras .align 7 123314cf11afSPaul Mackerras_GLOBAL(do_hash_page) 123414cf11afSPaul Mackerras std r3,_DAR(r1) 123514cf11afSPaul Mackerras std r4,_DSISR(r1) 123614cf11afSPaul Mackerras 123714cf11afSPaul Mackerras andis. r0,r4,0xa450 /* weird error? */ 123814cf11afSPaul Mackerras bne- .handle_page_fault /* if not, try to insert a HPTE */ 123914cf11afSPaul MackerrasBEGIN_FTR_SECTION 124014cf11afSPaul Mackerras andis. r0,r4,0x0020 /* Is it a segment table fault? */ 124114cf11afSPaul Mackerras bne- .do_ste_alloc /* If so handle it */ 124214cf11afSPaul MackerrasEND_FTR_SECTION_IFCLR(CPU_FTR_SLB) 124314cf11afSPaul Mackerras 124414cf11afSPaul Mackerras /* 124514cf11afSPaul Mackerras * We need to set the _PAGE_USER bit if MSR_PR is set or if we are 124614cf11afSPaul Mackerras * accessing a userspace segment (even from the kernel). We assume 124714cf11afSPaul Mackerras * kernel addresses always have the high bit set. 124814cf11afSPaul Mackerras */ 124914cf11afSPaul Mackerras rlwinm r4,r4,32-25+9,31-9,31-9 /* DSISR_STORE -> _PAGE_RW */ 125014cf11afSPaul Mackerras rotldi r0,r3,15 /* Move high bit into MSR_PR posn */ 125114cf11afSPaul Mackerras orc r0,r12,r0 /* MSR_PR | ~high_bit */ 125214cf11afSPaul Mackerras rlwimi r4,r0,32-13,30,30 /* becomes _PAGE_USER access bit */ 125314cf11afSPaul Mackerras ori r4,r4,1 /* add _PAGE_PRESENT */ 125414cf11afSPaul Mackerras rlwimi r4,r5,22+2,31-2,31-2 /* Set _PAGE_EXEC if trap is 0x400 */ 125514cf11afSPaul Mackerras 125614cf11afSPaul Mackerras /* 125714cf11afSPaul Mackerras * On iSeries, we soft-disable interrupts here, then 125814cf11afSPaul Mackerras * hard-enable interrupts so that the hash_page code can spin on 125914cf11afSPaul Mackerras * the hash_table_lock without problems on a shared processor. 126014cf11afSPaul Mackerras */ 126114cf11afSPaul Mackerras DISABLE_INTS 126214cf11afSPaul Mackerras 126314cf11afSPaul Mackerras /* 126414cf11afSPaul Mackerras * r3 contains the faulting address 126514cf11afSPaul Mackerras * r4 contains the required access permissions 126614cf11afSPaul Mackerras * r5 contains the trap number 126714cf11afSPaul Mackerras * 126814cf11afSPaul Mackerras * at return r3 = 0 for success 126914cf11afSPaul Mackerras */ 127014cf11afSPaul Mackerras bl .hash_page /* build HPTE if possible */ 127114cf11afSPaul Mackerras cmpdi r3,0 /* see if hash_page succeeded */ 127214cf11afSPaul Mackerras 127314cf11afSPaul Mackerras#ifdef DO_SOFT_DISABLE 127414cf11afSPaul Mackerras /* 127514cf11afSPaul Mackerras * If we had interrupts soft-enabled at the point where the 127614cf11afSPaul Mackerras * DSI/ISI occurred, and an interrupt came in during hash_page, 127714cf11afSPaul Mackerras * handle it now. 127814cf11afSPaul Mackerras * We jump to ret_from_except_lite rather than fast_exception_return 127914cf11afSPaul Mackerras * because ret_from_except_lite will check for and handle pending 128014cf11afSPaul Mackerras * interrupts if necessary. 128114cf11afSPaul Mackerras */ 128214cf11afSPaul Mackerras beq .ret_from_except_lite 128314cf11afSPaul Mackerras /* For a hash failure, we don't bother re-enabling interrupts */ 128414cf11afSPaul Mackerras ble- 12f 128514cf11afSPaul Mackerras 128614cf11afSPaul Mackerras /* 128714cf11afSPaul Mackerras * hash_page couldn't handle it, set soft interrupt enable back 128814cf11afSPaul Mackerras * to what it was before the trap. Note that .local_irq_restore 128914cf11afSPaul Mackerras * handles any interrupts pending at this point. 129014cf11afSPaul Mackerras */ 129114cf11afSPaul Mackerras ld r3,SOFTE(r1) 129214cf11afSPaul Mackerras bl .local_irq_restore 129314cf11afSPaul Mackerras b 11f 129414cf11afSPaul Mackerras#else 129514cf11afSPaul Mackerras beq fast_exception_return /* Return from exception on success */ 129614cf11afSPaul Mackerras ble- 12f /* Failure return from hash_page */ 129714cf11afSPaul Mackerras 129814cf11afSPaul Mackerras /* fall through */ 129914cf11afSPaul Mackerras#endif 130014cf11afSPaul Mackerras 130114cf11afSPaul Mackerras/* Here we have a page fault that hash_page can't handle. */ 130214cf11afSPaul Mackerras_GLOBAL(handle_page_fault) 130314cf11afSPaul Mackerras ENABLE_INTS 130414cf11afSPaul Mackerras11: ld r4,_DAR(r1) 130514cf11afSPaul Mackerras ld r5,_DSISR(r1) 130614cf11afSPaul Mackerras addi r3,r1,STACK_FRAME_OVERHEAD 130714cf11afSPaul Mackerras bl .do_page_fault 130814cf11afSPaul Mackerras cmpdi r3,0 130914cf11afSPaul Mackerras beq+ .ret_from_except_lite 131014cf11afSPaul Mackerras bl .save_nvgprs 131114cf11afSPaul Mackerras mr r5,r3 131214cf11afSPaul Mackerras addi r3,r1,STACK_FRAME_OVERHEAD 131314cf11afSPaul Mackerras lwz r4,_DAR(r1) 131414cf11afSPaul Mackerras bl .bad_page_fault 131514cf11afSPaul Mackerras b .ret_from_except 131614cf11afSPaul Mackerras 131714cf11afSPaul Mackerras/* We have a page fault that hash_page could handle but HV refused 131814cf11afSPaul Mackerras * the PTE insertion 131914cf11afSPaul Mackerras */ 132014cf11afSPaul Mackerras12: bl .save_nvgprs 132114cf11afSPaul Mackerras addi r3,r1,STACK_FRAME_OVERHEAD 132214cf11afSPaul Mackerras lwz r4,_DAR(r1) 132314cf11afSPaul Mackerras bl .low_hash_fault 132414cf11afSPaul Mackerras b .ret_from_except 132514cf11afSPaul Mackerras 132614cf11afSPaul Mackerras /* here we have a segment miss */ 132714cf11afSPaul Mackerras_GLOBAL(do_ste_alloc) 132814cf11afSPaul Mackerras bl .ste_allocate /* try to insert stab entry */ 132914cf11afSPaul Mackerras cmpdi r3,0 133014cf11afSPaul Mackerras beq+ fast_exception_return 133114cf11afSPaul Mackerras b .handle_page_fault 133214cf11afSPaul Mackerras 133314cf11afSPaul Mackerras/* 133414cf11afSPaul Mackerras * r13 points to the PACA, r9 contains the saved CR, 133514cf11afSPaul Mackerras * r11 and r12 contain the saved SRR0 and SRR1. 133614cf11afSPaul Mackerras * r9 - r13 are saved in paca->exslb. 133714cf11afSPaul Mackerras * We assume we aren't going to take any exceptions during this procedure. 133814cf11afSPaul Mackerras * We assume (DAR >> 60) == 0xc. 133914cf11afSPaul Mackerras */ 134014cf11afSPaul Mackerras .align 7 134114cf11afSPaul Mackerras_GLOBAL(do_stab_bolted) 134214cf11afSPaul Mackerras stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */ 134314cf11afSPaul Mackerras std r11,PACA_EXSLB+EX_SRR0(r13) /* save SRR0 in exc. frame */ 134414cf11afSPaul Mackerras 134514cf11afSPaul Mackerras /* Hash to the primary group */ 134614cf11afSPaul Mackerras ld r10,PACASTABVIRT(r13) 1347b5bbeb23SPaul Mackerras mfspr r11,SPRN_DAR 134814cf11afSPaul Mackerras srdi r11,r11,28 134914cf11afSPaul Mackerras rldimi r10,r11,7,52 /* r10 = first ste of the group */ 135014cf11afSPaul Mackerras 135114cf11afSPaul Mackerras /* Calculate VSID */ 135214cf11afSPaul Mackerras /* This is a kernel address, so protovsid = ESID */ 135314cf11afSPaul Mackerras ASM_VSID_SCRAMBLE(r11, r9) 135414cf11afSPaul Mackerras rldic r9,r11,12,16 /* r9 = vsid << 12 */ 135514cf11afSPaul Mackerras 135614cf11afSPaul Mackerras /* Search the primary group for a free entry */ 135714cf11afSPaul Mackerras1: ld r11,0(r10) /* Test valid bit of the current ste */ 135814cf11afSPaul Mackerras andi. r11,r11,0x80 135914cf11afSPaul Mackerras beq 2f 136014cf11afSPaul Mackerras addi r10,r10,16 136114cf11afSPaul Mackerras andi. r11,r10,0x70 136214cf11afSPaul Mackerras bne 1b 136314cf11afSPaul Mackerras 136414cf11afSPaul Mackerras /* Stick for only searching the primary group for now. */ 136514cf11afSPaul Mackerras /* At least for now, we use a very simple random castout scheme */ 136614cf11afSPaul Mackerras /* Use the TB as a random number ; OR in 1 to avoid entry 0 */ 136714cf11afSPaul Mackerras mftb r11 136814cf11afSPaul Mackerras rldic r11,r11,4,57 /* r11 = (r11 << 4) & 0x70 */ 136914cf11afSPaul Mackerras ori r11,r11,0x10 137014cf11afSPaul Mackerras 137114cf11afSPaul Mackerras /* r10 currently points to an ste one past the group of interest */ 137214cf11afSPaul Mackerras /* make it point to the randomly selected entry */ 137314cf11afSPaul Mackerras subi r10,r10,128 137414cf11afSPaul Mackerras or r10,r10,r11 /* r10 is the entry to invalidate */ 137514cf11afSPaul Mackerras 137614cf11afSPaul Mackerras isync /* mark the entry invalid */ 137714cf11afSPaul Mackerras ld r11,0(r10) 137814cf11afSPaul Mackerras rldicl r11,r11,56,1 /* clear the valid bit */ 137914cf11afSPaul Mackerras rotldi r11,r11,8 138014cf11afSPaul Mackerras std r11,0(r10) 138114cf11afSPaul Mackerras sync 138214cf11afSPaul Mackerras 138314cf11afSPaul Mackerras clrrdi r11,r11,28 /* Get the esid part of the ste */ 138414cf11afSPaul Mackerras slbie r11 138514cf11afSPaul Mackerras 138614cf11afSPaul Mackerras2: std r9,8(r10) /* Store the vsid part of the ste */ 138714cf11afSPaul Mackerras eieio 138814cf11afSPaul Mackerras 1389b5bbeb23SPaul Mackerras mfspr r11,SPRN_DAR /* Get the new esid */ 139014cf11afSPaul Mackerras clrrdi r11,r11,28 /* Permits a full 32b of ESID */ 139114cf11afSPaul Mackerras ori r11,r11,0x90 /* Turn on valid and kp */ 139214cf11afSPaul Mackerras std r11,0(r10) /* Put new entry back into the stab */ 139314cf11afSPaul Mackerras 139414cf11afSPaul Mackerras sync 139514cf11afSPaul Mackerras 139614cf11afSPaul Mackerras /* All done -- return from exception. */ 139714cf11afSPaul Mackerras lwz r9,PACA_EXSLB+EX_CCR(r13) /* get saved CR */ 139814cf11afSPaul Mackerras ld r11,PACA_EXSLB+EX_SRR0(r13) /* get saved SRR0 */ 139914cf11afSPaul Mackerras 140014cf11afSPaul Mackerras andi. r10,r12,MSR_RI 140114cf11afSPaul Mackerras beq- unrecov_slb 140214cf11afSPaul Mackerras 140314cf11afSPaul Mackerras mtcrf 0x80,r9 /* restore CR */ 140414cf11afSPaul Mackerras 140514cf11afSPaul Mackerras mfmsr r10 140614cf11afSPaul Mackerras clrrdi r10,r10,2 140714cf11afSPaul Mackerras mtmsrd r10,1 140814cf11afSPaul Mackerras 1409b5bbeb23SPaul Mackerras mtspr SPRN_SRR0,r11 1410b5bbeb23SPaul Mackerras mtspr SPRN_SRR1,r12 141114cf11afSPaul Mackerras ld r9,PACA_EXSLB+EX_R9(r13) 141214cf11afSPaul Mackerras ld r10,PACA_EXSLB+EX_R10(r13) 141314cf11afSPaul Mackerras ld r11,PACA_EXSLB+EX_R11(r13) 141414cf11afSPaul Mackerras ld r12,PACA_EXSLB+EX_R12(r13) 141514cf11afSPaul Mackerras ld r13,PACA_EXSLB+EX_R13(r13) 141614cf11afSPaul Mackerras rfid 141714cf11afSPaul Mackerras b . /* prevent speculative execution */ 141814cf11afSPaul Mackerras 141914cf11afSPaul Mackerras/* 142014cf11afSPaul Mackerras * Space for CPU0's segment table. 142114cf11afSPaul Mackerras * 142214cf11afSPaul Mackerras * On iSeries, the hypervisor must fill in at least one entry before 142314cf11afSPaul Mackerras * we get control (with relocate on). The address is give to the hv 1424ee400b63SStephen Rothwell * as a page number (see xLparMap in lpardata.c), so this must be at a 142514cf11afSPaul Mackerras * fixed address (the linker can't compute (u64)&initial_stab >> 142614cf11afSPaul Mackerras * PAGE_SHIFT). 142714cf11afSPaul Mackerras */ 1428758438a7SMichael Ellerman . = STAB0_OFFSET /* 0x6000 */ 142914cf11afSPaul Mackerras .globl initial_stab 143014cf11afSPaul Mackerrasinitial_stab: 143114cf11afSPaul Mackerras .space 4096 143214cf11afSPaul Mackerras 143314cf11afSPaul Mackerras/* 143414cf11afSPaul Mackerras * Data area reserved for FWNMI option. 143514cf11afSPaul Mackerras * This address (0x7000) is fixed by the RPA. 143614cf11afSPaul Mackerras */ 143714cf11afSPaul Mackerras .= 0x7000 143814cf11afSPaul Mackerras .globl fwnmi_data_area 143914cf11afSPaul Mackerrasfwnmi_data_area: 144014cf11afSPaul Mackerras 144114cf11afSPaul Mackerras /* iSeries does not use the FWNMI stuff, so it is safe to put 144214cf11afSPaul Mackerras * this here, even if we later allow kernels that will boot on 144314cf11afSPaul Mackerras * both pSeries and iSeries */ 144414cf11afSPaul Mackerras#ifdef CONFIG_PPC_ISERIES 144514cf11afSPaul Mackerras . = LPARMAP_PHYS 144614cf11afSPaul Mackerras#include "lparmap.s" 144714cf11afSPaul Mackerras/* 144814cf11afSPaul Mackerras * This ".text" is here for old compilers that generate a trailing 144914cf11afSPaul Mackerras * .note section when compiling .c files to .s 145014cf11afSPaul Mackerras */ 145114cf11afSPaul Mackerras .text 145214cf11afSPaul Mackerras#endif /* CONFIG_PPC_ISERIES */ 145314cf11afSPaul Mackerras 145414cf11afSPaul Mackerras . = 0x8000 145514cf11afSPaul Mackerras 145614cf11afSPaul Mackerras/* 145714cf11afSPaul Mackerras * On pSeries, secondary processors spin in the following code. 145814cf11afSPaul Mackerras * At entry, r3 = this processor's number (physical cpu id) 145914cf11afSPaul Mackerras */ 146014cf11afSPaul Mackerras_GLOBAL(pSeries_secondary_smp_init) 146114cf11afSPaul Mackerras mr r24,r3 146214cf11afSPaul Mackerras 146314cf11afSPaul Mackerras /* turn on 64-bit mode */ 146414cf11afSPaul Mackerras bl .enable_64b_mode 146514cf11afSPaul Mackerras isync 146614cf11afSPaul Mackerras 146714cf11afSPaul Mackerras /* Copy some CPU settings from CPU 0 */ 146814cf11afSPaul Mackerras bl .__restore_cpu_setup 146914cf11afSPaul Mackerras 147014cf11afSPaul Mackerras /* Set up a paca value for this processor. Since we have the 147114cf11afSPaul Mackerras * physical cpu id in r24, we need to search the pacas to find 147214cf11afSPaul Mackerras * which logical id maps to our physical one. 147314cf11afSPaul Mackerras */ 1474e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r13, paca) /* Get base vaddr of paca array */ 147514cf11afSPaul Mackerras li r5,0 /* logical cpu id */ 147614cf11afSPaul Mackerras1: lhz r6,PACAHWCPUID(r13) /* Load HW procid from paca */ 147714cf11afSPaul Mackerras cmpw r6,r24 /* Compare to our id */ 147814cf11afSPaul Mackerras beq 2f 147914cf11afSPaul Mackerras addi r13,r13,PACA_SIZE /* Loop to next PACA on miss */ 148014cf11afSPaul Mackerras addi r5,r5,1 148114cf11afSPaul Mackerras cmpwi r5,NR_CPUS 148214cf11afSPaul Mackerras blt 1b 148314cf11afSPaul Mackerras 148414cf11afSPaul Mackerras mr r3,r24 /* not found, copy phys to r3 */ 148514cf11afSPaul Mackerras b .kexec_wait /* next kernel might do better */ 148614cf11afSPaul Mackerras 1487b5bbeb23SPaul Mackerras2: mtspr SPRN_SPRG3,r13 /* Save vaddr of paca in SPRG3 */ 148814cf11afSPaul Mackerras /* From now on, r24 is expected to be logical cpuid */ 148914cf11afSPaul Mackerras mr r24,r5 149014cf11afSPaul Mackerras3: HMT_LOW 149114cf11afSPaul Mackerras lbz r23,PACAPROCSTART(r13) /* Test if this processor should */ 149214cf11afSPaul Mackerras /* start. */ 149314cf11afSPaul Mackerras sync 149414cf11afSPaul Mackerras 149514cf11afSPaul Mackerras /* Create a temp kernel stack for use before relocation is on. */ 149614cf11afSPaul Mackerras ld r1,PACAEMERGSP(r13) 149714cf11afSPaul Mackerras subi r1,r1,STACK_FRAME_OVERHEAD 149814cf11afSPaul Mackerras 149914cf11afSPaul Mackerras cmpwi 0,r23,0 150014cf11afSPaul Mackerras#ifdef CONFIG_SMP 150114cf11afSPaul Mackerras bne .__secondary_start 150214cf11afSPaul Mackerras#endif 150314cf11afSPaul Mackerras b 3b /* Loop until told to go */ 150414cf11afSPaul Mackerras 150514cf11afSPaul Mackerras#ifdef CONFIG_PPC_ISERIES 150614cf11afSPaul Mackerras_STATIC(__start_initialization_iSeries) 150714cf11afSPaul Mackerras /* Clear out the BSS */ 1508e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r11,__bss_stop) 1509e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r8,__bss_start) 151014cf11afSPaul Mackerras sub r11,r11,r8 /* bss size */ 151114cf11afSPaul Mackerras addi r11,r11,7 /* round up to an even double word */ 151214cf11afSPaul Mackerras rldicl. r11,r11,61,3 /* shift right by 3 */ 151314cf11afSPaul Mackerras beq 4f 151414cf11afSPaul Mackerras addi r8,r8,-8 151514cf11afSPaul Mackerras li r0,0 151614cf11afSPaul Mackerras mtctr r11 /* zero this many doublewords */ 151714cf11afSPaul Mackerras3: stdu r0,8(r8) 151814cf11afSPaul Mackerras bdnz 3b 151914cf11afSPaul Mackerras4: 1520e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r1,init_thread_union) 152114cf11afSPaul Mackerras addi r1,r1,THREAD_SIZE 152214cf11afSPaul Mackerras li r0,0 152314cf11afSPaul Mackerras stdu r0,-STACK_FRAME_OVERHEAD(r1) 152414cf11afSPaul Mackerras 1525e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r3,cpu_specs) 1526e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r4,cur_cpu_spec) 152714cf11afSPaul Mackerras li r5,0 152814cf11afSPaul Mackerras bl .identify_cpu 152914cf11afSPaul Mackerras 1530e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r2,__toc_start) 153114cf11afSPaul Mackerras addi r2,r2,0x4000 153214cf11afSPaul Mackerras addi r2,r2,0x4000 153314cf11afSPaul Mackerras 153414cf11afSPaul Mackerras bl .iSeries_early_setup 1535ee400b63SStephen Rothwell bl .early_setup 153614cf11afSPaul Mackerras 153714cf11afSPaul Mackerras /* relocation is on at this point */ 153814cf11afSPaul Mackerras 153914cf11afSPaul Mackerras b .start_here_common 154014cf11afSPaul Mackerras#endif /* CONFIG_PPC_ISERIES */ 154114cf11afSPaul Mackerras 154214cf11afSPaul Mackerras#ifdef CONFIG_PPC_MULTIPLATFORM 154314cf11afSPaul Mackerras 154414cf11afSPaul Mackerras_STATIC(__mmu_off) 154514cf11afSPaul Mackerras mfmsr r3 154614cf11afSPaul Mackerras andi. r0,r3,MSR_IR|MSR_DR 154714cf11afSPaul Mackerras beqlr 154814cf11afSPaul Mackerras andc r3,r3,r0 154914cf11afSPaul Mackerras mtspr SPRN_SRR0,r4 155014cf11afSPaul Mackerras mtspr SPRN_SRR1,r3 155114cf11afSPaul Mackerras sync 155214cf11afSPaul Mackerras rfid 155314cf11afSPaul Mackerras b . /* prevent speculative execution */ 155414cf11afSPaul Mackerras 155514cf11afSPaul Mackerras 155614cf11afSPaul Mackerras/* 155714cf11afSPaul Mackerras * Here is our main kernel entry point. We support currently 2 kind of entries 155814cf11afSPaul Mackerras * depending on the value of r5. 155914cf11afSPaul Mackerras * 156014cf11afSPaul Mackerras * r5 != NULL -> OF entry, we go to prom_init, "legacy" parameter content 156114cf11afSPaul Mackerras * in r3...r7 156214cf11afSPaul Mackerras * 156314cf11afSPaul Mackerras * r5 == NULL -> kexec style entry. r3 is a physical pointer to the 156414cf11afSPaul Mackerras * DT block, r4 is a physical pointer to the kernel itself 156514cf11afSPaul Mackerras * 156614cf11afSPaul Mackerras */ 156714cf11afSPaul Mackerras_GLOBAL(__start_initialization_multiplatform) 1568be42d5faSPaul Mackerras#ifdef CONFIG_PPC_MULTIPLATFORM 156914cf11afSPaul Mackerras /* 157014cf11afSPaul Mackerras * Are we booted from a PROM Of-type client-interface ? 157114cf11afSPaul Mackerras */ 157214cf11afSPaul Mackerras cmpldi cr0,r5,0 157314cf11afSPaul Mackerras bne .__boot_from_prom /* yes -> prom */ 1574be42d5faSPaul Mackerras#endif 157514cf11afSPaul Mackerras 157614cf11afSPaul Mackerras /* Save parameters */ 157714cf11afSPaul Mackerras mr r31,r3 157814cf11afSPaul Mackerras mr r30,r4 157914cf11afSPaul Mackerras 158014cf11afSPaul Mackerras /* Make sure we are running in 64 bits mode */ 158114cf11afSPaul Mackerras bl .enable_64b_mode 158214cf11afSPaul Mackerras 158314cf11afSPaul Mackerras /* Setup some critical 970 SPRs before switching MMU off */ 158414cf11afSPaul Mackerras bl .__970_cpu_preinit 158514cf11afSPaul Mackerras 158614cf11afSPaul Mackerras /* cpu # */ 158714cf11afSPaul Mackerras li r24,0 158814cf11afSPaul Mackerras 158914cf11afSPaul Mackerras /* Switch off MMU if not already */ 1590e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r4, .__after_prom_start - KERNELBASE) 159114cf11afSPaul Mackerras add r4,r4,r30 159214cf11afSPaul Mackerras bl .__mmu_off 159314cf11afSPaul Mackerras b .__after_prom_start 159414cf11afSPaul Mackerras 1595be42d5faSPaul Mackerras#ifdef CONFIG_PPC_MULTIPLATFORM 159614cf11afSPaul Mackerras_STATIC(__boot_from_prom) 159714cf11afSPaul Mackerras /* Save parameters */ 159814cf11afSPaul Mackerras mr r31,r3 159914cf11afSPaul Mackerras mr r30,r4 160014cf11afSPaul Mackerras mr r29,r5 160114cf11afSPaul Mackerras mr r28,r6 160214cf11afSPaul Mackerras mr r27,r7 160314cf11afSPaul Mackerras 16046088857bSOlaf Hering /* 16056088857bSOlaf Hering * Align the stack to 16-byte boundary 16066088857bSOlaf Hering * Depending on the size and layout of the ELF sections in the initial 16076088857bSOlaf Hering * boot binary, the stack pointer will be unalignet on PowerMac 16086088857bSOlaf Hering */ 1609c05b4770SLinus Torvalds rldicr r1,r1,0,59 1610c05b4770SLinus Torvalds 161114cf11afSPaul Mackerras /* Make sure we are running in 64 bits mode */ 161214cf11afSPaul Mackerras bl .enable_64b_mode 161314cf11afSPaul Mackerras 161414cf11afSPaul Mackerras /* put a relocation offset into r3 */ 161514cf11afSPaul Mackerras bl .reloc_offset 161614cf11afSPaul Mackerras 1617e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r2,__toc_start) 161814cf11afSPaul Mackerras addi r2,r2,0x4000 161914cf11afSPaul Mackerras addi r2,r2,0x4000 162014cf11afSPaul Mackerras 162114cf11afSPaul Mackerras /* Relocate the TOC from a virt addr to a real addr */ 16225a408329SPaul Mackerras add r2,r2,r3 162314cf11afSPaul Mackerras 162414cf11afSPaul Mackerras /* Restore parameters */ 162514cf11afSPaul Mackerras mr r3,r31 162614cf11afSPaul Mackerras mr r4,r30 162714cf11afSPaul Mackerras mr r5,r29 162814cf11afSPaul Mackerras mr r6,r28 162914cf11afSPaul Mackerras mr r7,r27 163014cf11afSPaul Mackerras 163114cf11afSPaul Mackerras /* Do all of the interaction with OF client interface */ 163214cf11afSPaul Mackerras bl .prom_init 163314cf11afSPaul Mackerras /* We never return */ 163414cf11afSPaul Mackerras trap 1635be42d5faSPaul Mackerras#endif 163614cf11afSPaul Mackerras 163714cf11afSPaul Mackerras/* 163814cf11afSPaul Mackerras * At this point, r3 contains the physical address we are running at, 163914cf11afSPaul Mackerras * returned by prom_init() 164014cf11afSPaul Mackerras */ 164114cf11afSPaul Mackerras_STATIC(__after_prom_start) 164214cf11afSPaul Mackerras 164314cf11afSPaul Mackerras/* 1644758438a7SMichael Ellerman * We need to run with __start at physical address PHYSICAL_START. 164514cf11afSPaul Mackerras * This will leave some code in the first 256B of 164614cf11afSPaul Mackerras * real memory, which are reserved for software use. 164714cf11afSPaul Mackerras * The remainder of the first page is loaded with the fixed 164814cf11afSPaul Mackerras * interrupt vectors. The next two pages are filled with 164914cf11afSPaul Mackerras * unknown exception placeholders. 165014cf11afSPaul Mackerras * 165114cf11afSPaul Mackerras * Note: This process overwrites the OF exception vectors. 165214cf11afSPaul Mackerras * r26 == relocation offset 165314cf11afSPaul Mackerras * r27 == KERNELBASE 165414cf11afSPaul Mackerras */ 165514cf11afSPaul Mackerras bl .reloc_offset 165614cf11afSPaul Mackerras mr r26,r3 1657e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r27, KERNELBASE) 165814cf11afSPaul Mackerras 1659e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r3, PHYSICAL_START) /* target addr */ 166014cf11afSPaul Mackerras 166114cf11afSPaul Mackerras // XXX FIXME: Use phys returned by OF (r30) 16625a408329SPaul Mackerras add r4,r27,r26 /* source addr */ 166314cf11afSPaul Mackerras /* current address of _start */ 166414cf11afSPaul Mackerras /* i.e. where we are running */ 166514cf11afSPaul Mackerras /* the source addr */ 166614cf11afSPaul Mackerras 1667e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r5,copy_to_here) /* # bytes of memory to copy */ 166814cf11afSPaul Mackerras sub r5,r5,r27 166914cf11afSPaul Mackerras 167014cf11afSPaul Mackerras li r6,0x100 /* Start offset, the first 0x100 */ 167114cf11afSPaul Mackerras /* bytes were copied earlier. */ 167214cf11afSPaul Mackerras 167314cf11afSPaul Mackerras bl .copy_and_flush /* copy the first n bytes */ 167414cf11afSPaul Mackerras /* this includes the code being */ 167514cf11afSPaul Mackerras /* executed here. */ 167614cf11afSPaul Mackerras 1677e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r0, 4f) /* Jump to the copy of this code */ 167814cf11afSPaul Mackerras mtctr r0 /* that we just made/relocated */ 167914cf11afSPaul Mackerras bctr 168014cf11afSPaul Mackerras 1681e58c3495SDavid Gibson4: LOAD_REG_IMMEDIATE(r5,klimit) 16825a408329SPaul Mackerras add r5,r5,r26 168314cf11afSPaul Mackerras ld r5,0(r5) /* get the value of klimit */ 168414cf11afSPaul Mackerras sub r5,r5,r27 168514cf11afSPaul Mackerras bl .copy_and_flush /* copy the rest */ 168614cf11afSPaul Mackerras b .start_here_multiplatform 168714cf11afSPaul Mackerras 168814cf11afSPaul Mackerras#endif /* CONFIG_PPC_MULTIPLATFORM */ 168914cf11afSPaul Mackerras 169014cf11afSPaul Mackerras/* 169114cf11afSPaul Mackerras * Copy routine used to copy the kernel to start at physical address 0 169214cf11afSPaul Mackerras * and flush and invalidate the caches as needed. 169314cf11afSPaul Mackerras * r3 = dest addr, r4 = source addr, r5 = copy limit, r6 = start offset 169414cf11afSPaul Mackerras * on exit, r3, r4, r5 are unchanged, r6 is updated to be >= r5. 169514cf11afSPaul Mackerras * 169614cf11afSPaul Mackerras * Note: this routine *only* clobbers r0, r6 and lr 169714cf11afSPaul Mackerras */ 169814cf11afSPaul Mackerras_GLOBAL(copy_and_flush) 169914cf11afSPaul Mackerras addi r5,r5,-8 170014cf11afSPaul Mackerras addi r6,r6,-8 170114cf11afSPaul Mackerras4: li r0,16 /* Use the least common */ 170214cf11afSPaul Mackerras /* denominator cache line */ 170314cf11afSPaul Mackerras /* size. This results in */ 170414cf11afSPaul Mackerras /* extra cache line flushes */ 170514cf11afSPaul Mackerras /* but operation is correct. */ 170614cf11afSPaul Mackerras /* Can't get cache line size */ 170714cf11afSPaul Mackerras /* from NACA as it is being */ 170814cf11afSPaul Mackerras /* moved too. */ 170914cf11afSPaul Mackerras 171014cf11afSPaul Mackerras mtctr r0 /* put # words/line in ctr */ 171114cf11afSPaul Mackerras3: addi r6,r6,8 /* copy a cache line */ 171214cf11afSPaul Mackerras ldx r0,r6,r4 171314cf11afSPaul Mackerras stdx r0,r6,r3 171414cf11afSPaul Mackerras bdnz 3b 171514cf11afSPaul Mackerras dcbst r6,r3 /* write it to memory */ 171614cf11afSPaul Mackerras sync 171714cf11afSPaul Mackerras icbi r6,r3 /* flush the icache line */ 171814cf11afSPaul Mackerras cmpld 0,r6,r5 171914cf11afSPaul Mackerras blt 4b 172014cf11afSPaul Mackerras sync 172114cf11afSPaul Mackerras addi r5,r5,8 172214cf11afSPaul Mackerras addi r6,r6,8 172314cf11afSPaul Mackerras blr 172414cf11afSPaul Mackerras 172514cf11afSPaul Mackerras.align 8 172614cf11afSPaul Mackerrascopy_to_here: 172714cf11afSPaul Mackerras 172814cf11afSPaul Mackerras#ifdef CONFIG_SMP 172914cf11afSPaul Mackerras#ifdef CONFIG_PPC_PMAC 173014cf11afSPaul Mackerras/* 173114cf11afSPaul Mackerras * On PowerMac, secondary processors starts from the reset vector, which 173214cf11afSPaul Mackerras * is temporarily turned into a call to one of the functions below. 173314cf11afSPaul Mackerras */ 173414cf11afSPaul Mackerras .section ".text"; 173514cf11afSPaul Mackerras .align 2 ; 173614cf11afSPaul Mackerras 173735499c01SPaul Mackerras .globl __secondary_start_pmac_0 173835499c01SPaul Mackerras__secondary_start_pmac_0: 173935499c01SPaul Mackerras /* NB the entries for cpus 0, 1, 2 must each occupy 8 bytes. */ 174035499c01SPaul Mackerras li r24,0 174135499c01SPaul Mackerras b 1f 174214cf11afSPaul Mackerras li r24,1 174335499c01SPaul Mackerras b 1f 174414cf11afSPaul Mackerras li r24,2 174535499c01SPaul Mackerras b 1f 174614cf11afSPaul Mackerras li r24,3 174735499c01SPaul Mackerras1: 174814cf11afSPaul Mackerras 174914cf11afSPaul Mackerras_GLOBAL(pmac_secondary_start) 175014cf11afSPaul Mackerras /* turn on 64-bit mode */ 175114cf11afSPaul Mackerras bl .enable_64b_mode 175214cf11afSPaul Mackerras isync 175314cf11afSPaul Mackerras 175414cf11afSPaul Mackerras /* Copy some CPU settings from CPU 0 */ 175514cf11afSPaul Mackerras bl .__restore_cpu_setup 175614cf11afSPaul Mackerras 175714cf11afSPaul Mackerras /* pSeries do that early though I don't think we really need it */ 175814cf11afSPaul Mackerras mfmsr r3 175914cf11afSPaul Mackerras ori r3,r3,MSR_RI 176014cf11afSPaul Mackerras mtmsrd r3 /* RI on */ 176114cf11afSPaul Mackerras 176214cf11afSPaul Mackerras /* Set up a paca value for this processor. */ 1763e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r4, paca) /* Get base vaddr of paca array */ 176414cf11afSPaul Mackerras mulli r13,r24,PACA_SIZE /* Calculate vaddr of right paca */ 176514cf11afSPaul Mackerras add r13,r13,r4 /* for this processor. */ 1766b5bbeb23SPaul Mackerras mtspr SPRN_SPRG3,r13 /* Save vaddr of paca in SPRG3 */ 176714cf11afSPaul Mackerras 176814cf11afSPaul Mackerras /* Create a temp kernel stack for use before relocation is on. */ 176914cf11afSPaul Mackerras ld r1,PACAEMERGSP(r13) 177014cf11afSPaul Mackerras subi r1,r1,STACK_FRAME_OVERHEAD 177114cf11afSPaul Mackerras 177214cf11afSPaul Mackerras b .__secondary_start 177314cf11afSPaul Mackerras 177414cf11afSPaul Mackerras#endif /* CONFIG_PPC_PMAC */ 177514cf11afSPaul Mackerras 177614cf11afSPaul Mackerras/* 177714cf11afSPaul Mackerras * This function is called after the master CPU has released the 177814cf11afSPaul Mackerras * secondary processors. The execution environment is relocation off. 177914cf11afSPaul Mackerras * The paca for this processor has the following fields initialized at 178014cf11afSPaul Mackerras * this point: 178114cf11afSPaul Mackerras * 1. Processor number 178214cf11afSPaul Mackerras * 2. Segment table pointer (virtual address) 178314cf11afSPaul Mackerras * On entry the following are set: 178414cf11afSPaul Mackerras * r1 = stack pointer. vaddr for iSeries, raddr (temp stack) for pSeries 178514cf11afSPaul Mackerras * r24 = cpu# (in Linux terms) 178614cf11afSPaul Mackerras * r13 = paca virtual address 178714cf11afSPaul Mackerras * SPRG3 = paca virtual address 178814cf11afSPaul Mackerras */ 178914cf11afSPaul Mackerras_GLOBAL(__secondary_start) 1790799d6046SPaul Mackerras /* Set thread priority to MEDIUM */ 1791799d6046SPaul Mackerras HMT_MEDIUM 179214cf11afSPaul Mackerras 1793799d6046SPaul Mackerras /* Load TOC */ 179414cf11afSPaul Mackerras ld r2,PACATOC(r13) 179514cf11afSPaul Mackerras 1796799d6046SPaul Mackerras /* Do early setup for that CPU (stab, slb, hash table pointer) */ 1797799d6046SPaul Mackerras bl .early_setup_secondary 179814cf11afSPaul Mackerras 179914cf11afSPaul Mackerras /* Initialize the kernel stack. Just a repeat for iSeries. */ 1800e58c3495SDavid Gibson LOAD_REG_ADDR(r3, current_set) 180114cf11afSPaul Mackerras sldi r28,r24,3 /* get current_set[cpu#] */ 180214cf11afSPaul Mackerras ldx r1,r3,r28 180314cf11afSPaul Mackerras addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD 180414cf11afSPaul Mackerras std r1,PACAKSAVE(r13) 180514cf11afSPaul Mackerras 1806799d6046SPaul Mackerras /* Clear backchain so we get nice backtraces */ 180714cf11afSPaul Mackerras li r7,0 180814cf11afSPaul Mackerras mtlr r7 180914cf11afSPaul Mackerras 181014cf11afSPaul Mackerras /* enable MMU and jump to start_secondary */ 1811e58c3495SDavid Gibson LOAD_REG_ADDR(r3, .start_secondary_prolog) 1812e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r4, MSR_KERNEL) 181314cf11afSPaul Mackerras#ifdef DO_SOFT_DISABLE 181414cf11afSPaul Mackerras ori r4,r4,MSR_EE 181514cf11afSPaul Mackerras#endif 1816b5bbeb23SPaul Mackerras mtspr SPRN_SRR0,r3 1817b5bbeb23SPaul Mackerras mtspr SPRN_SRR1,r4 181814cf11afSPaul Mackerras rfid 181914cf11afSPaul Mackerras b . /* prevent speculative execution */ 182014cf11afSPaul Mackerras 182114cf11afSPaul Mackerras/* 182214cf11afSPaul Mackerras * Running with relocation on at this point. All we want to do is 182314cf11afSPaul Mackerras * zero the stack back-chain pointer before going into C code. 182414cf11afSPaul Mackerras */ 182514cf11afSPaul Mackerras_GLOBAL(start_secondary_prolog) 182614cf11afSPaul Mackerras li r3,0 182714cf11afSPaul Mackerras std r3,0(r1) /* Zero the stack frame pointer */ 182814cf11afSPaul Mackerras bl .start_secondary 1829799d6046SPaul Mackerras b . 183014cf11afSPaul Mackerras#endif 183114cf11afSPaul Mackerras 183214cf11afSPaul Mackerras/* 183314cf11afSPaul Mackerras * This subroutine clobbers r11 and r12 183414cf11afSPaul Mackerras */ 183514cf11afSPaul Mackerras_GLOBAL(enable_64b_mode) 183614cf11afSPaul Mackerras mfmsr r11 /* grab the current MSR */ 183714cf11afSPaul Mackerras li r12,1 183814cf11afSPaul Mackerras rldicr r12,r12,MSR_SF_LG,(63-MSR_SF_LG) 183914cf11afSPaul Mackerras or r11,r11,r12 184014cf11afSPaul Mackerras li r12,1 184114cf11afSPaul Mackerras rldicr r12,r12,MSR_ISF_LG,(63-MSR_ISF_LG) 184214cf11afSPaul Mackerras or r11,r11,r12 184314cf11afSPaul Mackerras mtmsrd r11 184414cf11afSPaul Mackerras isync 184514cf11afSPaul Mackerras blr 184614cf11afSPaul Mackerras 184714cf11afSPaul Mackerras#ifdef CONFIG_PPC_MULTIPLATFORM 184814cf11afSPaul Mackerras/* 184914cf11afSPaul Mackerras * This is where the main kernel code starts. 185014cf11afSPaul Mackerras */ 185114cf11afSPaul Mackerras_STATIC(start_here_multiplatform) 185214cf11afSPaul Mackerras /* get a new offset, now that the kernel has moved. */ 185314cf11afSPaul Mackerras bl .reloc_offset 185414cf11afSPaul Mackerras mr r26,r3 185514cf11afSPaul Mackerras 185614cf11afSPaul Mackerras /* Clear out the BSS. It may have been done in prom_init, 185714cf11afSPaul Mackerras * already but that's irrelevant since prom_init will soon 185814cf11afSPaul Mackerras * be detached from the kernel completely. Besides, we need 185914cf11afSPaul Mackerras * to clear it now for kexec-style entry. 186014cf11afSPaul Mackerras */ 1861e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r11,__bss_stop) 1862e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r8,__bss_start) 186314cf11afSPaul Mackerras sub r11,r11,r8 /* bss size */ 186414cf11afSPaul Mackerras addi r11,r11,7 /* round up to an even double word */ 186514cf11afSPaul Mackerras rldicl. r11,r11,61,3 /* shift right by 3 */ 186614cf11afSPaul Mackerras beq 4f 186714cf11afSPaul Mackerras addi r8,r8,-8 186814cf11afSPaul Mackerras li r0,0 186914cf11afSPaul Mackerras mtctr r11 /* zero this many doublewords */ 187014cf11afSPaul Mackerras3: stdu r0,8(r8) 187114cf11afSPaul Mackerras bdnz 3b 187214cf11afSPaul Mackerras4: 187314cf11afSPaul Mackerras 187414cf11afSPaul Mackerras mfmsr r6 187514cf11afSPaul Mackerras ori r6,r6,MSR_RI 187614cf11afSPaul Mackerras mtmsrd r6 /* RI on */ 187714cf11afSPaul Mackerras 187814cf11afSPaul Mackerras /* The following gets the stack and TOC set up with the regs */ 187914cf11afSPaul Mackerras /* pointing to the real addr of the kernel stack. This is */ 188014cf11afSPaul Mackerras /* all done to support the C function call below which sets */ 188114cf11afSPaul Mackerras /* up the htab. This is done because we have relocated the */ 188214cf11afSPaul Mackerras /* kernel but are still running in real mode. */ 188314cf11afSPaul Mackerras 1884e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r3,init_thread_union) 18855a408329SPaul Mackerras add r3,r3,r26 188614cf11afSPaul Mackerras 188714cf11afSPaul Mackerras /* set up a stack pointer (physical address) */ 188814cf11afSPaul Mackerras addi r1,r3,THREAD_SIZE 188914cf11afSPaul Mackerras li r0,0 189014cf11afSPaul Mackerras stdu r0,-STACK_FRAME_OVERHEAD(r1) 189114cf11afSPaul Mackerras 189214cf11afSPaul Mackerras /* set up the TOC (physical address) */ 1893e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r2,__toc_start) 189414cf11afSPaul Mackerras addi r2,r2,0x4000 189514cf11afSPaul Mackerras addi r2,r2,0x4000 18965a408329SPaul Mackerras add r2,r2,r26 189714cf11afSPaul Mackerras 1898e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r3, cpu_specs) 18995a408329SPaul Mackerras add r3,r3,r26 1900e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r4,cur_cpu_spec) 19015a408329SPaul Mackerras add r4,r4,r26 190214cf11afSPaul Mackerras mr r5,r26 190314cf11afSPaul Mackerras bl .identify_cpu 190414cf11afSPaul Mackerras 190514cf11afSPaul Mackerras /* Save some low level config HIDs of CPU0 to be copied to 190614cf11afSPaul Mackerras * other CPUs later on, or used for suspend/resume 190714cf11afSPaul Mackerras */ 190814cf11afSPaul Mackerras bl .__save_cpu_setup 190914cf11afSPaul Mackerras sync 191014cf11afSPaul Mackerras 191114cf11afSPaul Mackerras /* Do very early kernel initializations, including initial hash table, 191214cf11afSPaul Mackerras * stab and slb setup before we turn on relocation. */ 191314cf11afSPaul Mackerras 191414cf11afSPaul Mackerras /* Restore parameters passed from prom_init/kexec */ 191514cf11afSPaul Mackerras mr r3,r31 191614cf11afSPaul Mackerras bl .early_setup 191714cf11afSPaul Mackerras 1918e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r3, .start_here_common) 1919e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r4, MSR_KERNEL) 1920b5bbeb23SPaul Mackerras mtspr SPRN_SRR0,r3 1921b5bbeb23SPaul Mackerras mtspr SPRN_SRR1,r4 192214cf11afSPaul Mackerras rfid 192314cf11afSPaul Mackerras b . /* prevent speculative execution */ 192414cf11afSPaul Mackerras#endif /* CONFIG_PPC_MULTIPLATFORM */ 192514cf11afSPaul Mackerras 192614cf11afSPaul Mackerras /* This is where all platforms converge execution */ 192714cf11afSPaul Mackerras_STATIC(start_here_common) 192814cf11afSPaul Mackerras /* relocation is on at this point */ 192914cf11afSPaul Mackerras 193014cf11afSPaul Mackerras /* The following code sets up the SP and TOC now that we are */ 193114cf11afSPaul Mackerras /* running with translation enabled. */ 193214cf11afSPaul Mackerras 1933e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r3,init_thread_union) 193414cf11afSPaul Mackerras 193514cf11afSPaul Mackerras /* set up the stack */ 193614cf11afSPaul Mackerras addi r1,r3,THREAD_SIZE 193714cf11afSPaul Mackerras li r0,0 193814cf11afSPaul Mackerras stdu r0,-STACK_FRAME_OVERHEAD(r1) 193914cf11afSPaul Mackerras 194014cf11afSPaul Mackerras /* Apply the CPUs-specific fixups (nop out sections not relevant 194114cf11afSPaul Mackerras * to this CPU 194214cf11afSPaul Mackerras */ 194314cf11afSPaul Mackerras li r3,0 194414cf11afSPaul Mackerras bl .do_cpu_ftr_fixups 194514cf11afSPaul Mackerras 1946e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r26, boot_cpuid) 194714cf11afSPaul Mackerras lwz r26,0(r26) 194814cf11afSPaul Mackerras 1949e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r24, paca) /* Get base vaddr of paca array */ 195014cf11afSPaul Mackerras mulli r13,r26,PACA_SIZE /* Calculate vaddr of right paca */ 195114cf11afSPaul Mackerras add r13,r13,r24 /* for this processor. */ 1952b5bbeb23SPaul Mackerras mtspr SPRN_SPRG3,r13 195314cf11afSPaul Mackerras 195414cf11afSPaul Mackerras /* ptr to current */ 1955e58c3495SDavid Gibson LOAD_REG_IMMEDIATE(r4, init_task) 195614cf11afSPaul Mackerras std r4,PACACURRENT(r13) 195714cf11afSPaul Mackerras 195814cf11afSPaul Mackerras /* Load the TOC */ 195914cf11afSPaul Mackerras ld r2,PACATOC(r13) 196014cf11afSPaul Mackerras std r1,PACAKSAVE(r13) 196114cf11afSPaul Mackerras 196214cf11afSPaul Mackerras bl .setup_system 196314cf11afSPaul Mackerras 196414cf11afSPaul Mackerras /* Load up the kernel context */ 196514cf11afSPaul Mackerras5: 196614cf11afSPaul Mackerras#ifdef DO_SOFT_DISABLE 196714cf11afSPaul Mackerras li r5,0 196814cf11afSPaul Mackerras stb r5,PACAPROCENABLED(r13) /* Soft Disabled */ 196914cf11afSPaul Mackerras mfmsr r5 197014cf11afSPaul Mackerras ori r5,r5,MSR_EE /* Hard Enabled */ 197114cf11afSPaul Mackerras mtmsrd r5 197214cf11afSPaul Mackerras#endif 197314cf11afSPaul Mackerras 197414cf11afSPaul Mackerras bl .start_kernel 197514cf11afSPaul Mackerras 1976f1870f77SAnton Blanchard /* Not reached */ 1977f1870f77SAnton Blanchard BUG_OPCODE 197814cf11afSPaul Mackerras 19794df20460SAnton Blanchard/* Put the paca pointer into r13 and SPRG3 */ 19804df20460SAnton Blanchard_GLOBAL(setup_boot_paca) 19814df20460SAnton Blanchard LOAD_REG_IMMEDIATE(r3, boot_cpuid) 19824df20460SAnton Blanchard lwz r3,0(r3) 19834df20460SAnton Blanchard LOAD_REG_IMMEDIATE(r4, paca) /* Get base vaddr of paca array */ 19844df20460SAnton Blanchard mulli r3,r3,PACA_SIZE /* Calculate vaddr of right paca */ 19854df20460SAnton Blanchard add r13,r3,r4 /* for this processor. */ 19864df20460SAnton Blanchard mtspr SPRN_SPRG3,r13 19874df20460SAnton Blanchard 19884df20460SAnton Blanchard blr 19894df20460SAnton Blanchard 199014cf11afSPaul Mackerras/* 199114cf11afSPaul Mackerras * We put a few things here that have to be page-aligned. 199214cf11afSPaul Mackerras * This stuff goes at the beginning of the bss, which is page-aligned. 199314cf11afSPaul Mackerras */ 199414cf11afSPaul Mackerras .section ".bss" 199514cf11afSPaul Mackerras 199614cf11afSPaul Mackerras .align PAGE_SHIFT 199714cf11afSPaul Mackerras 199814cf11afSPaul Mackerras .globl empty_zero_page 199914cf11afSPaul Mackerrasempty_zero_page: 200014cf11afSPaul Mackerras .space PAGE_SIZE 200114cf11afSPaul Mackerras 200214cf11afSPaul Mackerras .globl swapper_pg_dir 200314cf11afSPaul Mackerrasswapper_pg_dir: 200414cf11afSPaul Mackerras .space PAGE_SIZE 200514cf11afSPaul Mackerras 200614cf11afSPaul Mackerras/* 200714cf11afSPaul Mackerras * This space gets a copy of optional info passed to us by the bootstrap 200814cf11afSPaul Mackerras * Used to pass parameters into the kernel like root=/dev/sda1, etc. 200914cf11afSPaul Mackerras */ 201014cf11afSPaul Mackerras .globl cmd_line 201114cf11afSPaul Mackerrascmd_line: 201214cf11afSPaul Mackerras .space COMMAND_LINE_SIZE 2013