| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Definitions for use by exception code on Book3-E |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2008 Ben. Herrenschmidt (benh@kernel.crashing.org), IBM Corp. |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or |
|---|
| 7 | | - * modify it under the terms of the GNU General Public License |
|---|
| 8 | | - * as published by the Free Software Foundation; either version |
|---|
| 9 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 10 | 6 | */ |
|---|
| 11 | 7 | #ifndef _ASM_POWERPC_EXCEPTION_64E_H |
|---|
| 12 | 8 | #define _ASM_POWERPC_EXCEPTION_64E_H |
|---|
| .. | .. |
|---|
| 70 | 66 | #define EX_TLB_SRR0 (10 * 8) |
|---|
| 71 | 67 | #define EX_TLB_SRR1 (11 * 8) |
|---|
| 72 | 68 | #define EX_TLB_R7 (12 * 8) |
|---|
| 73 | | -#ifdef CONFIG_BOOK3E_MMU_TLB_STATS |
|---|
| 74 | | -#define EX_TLB_R8 (13 * 8) |
|---|
| 75 | | -#define EX_TLB_R9 (14 * 8) |
|---|
| 76 | | -#define EX_TLB_LR (15 * 8) |
|---|
| 77 | | -#define EX_TLB_SIZE (16 * 8) |
|---|
| 78 | | -#else |
|---|
| 79 | 69 | #define EX_TLB_SIZE (13 * 8) |
|---|
| 80 | | -#endif |
|---|
| 81 | 70 | |
|---|
| 82 | 71 | #define START_EXCEPTION(label) \ |
|---|
| 83 | 72 | .globl exc_##label##_book3e; \ |
|---|
| .. | .. |
|---|
| 114 | 103 | std r11,EX_TLB_R12(r12); \ |
|---|
| 115 | 104 | mtspr SPRN_SPRG_TLB_EXFRAME,r14; \ |
|---|
| 116 | 105 | std r15,EX_TLB_SRR1(r12); \ |
|---|
| 117 | | - std r16,EX_TLB_SRR0(r12); \ |
|---|
| 118 | | - TLB_MISS_PROLOG_STATS |
|---|
| 106 | + std r16,EX_TLB_SRR0(r12); |
|---|
| 119 | 107 | |
|---|
| 120 | 108 | /* And these are the matching epilogs that restores things |
|---|
| 121 | 109 | * |
|---|
| .. | .. |
|---|
| 147 | 135 | mtspr SPRN_SRR0,r15; \ |
|---|
| 148 | 136 | ld r15,EX_TLB_R15(r12); \ |
|---|
| 149 | 137 | mtspr SPRN_SRR1,r16; \ |
|---|
| 150 | | - TLB_MISS_RESTORE_STATS \ |
|---|
| 151 | 138 | ld r16,EX_TLB_R16(r12); \ |
|---|
| 152 | 139 | ld r12,EX_TLB_R12(r12); \ |
|---|
| 153 | 140 | |
|---|
| .. | .. |
|---|
| 162 | 149 | addi r11,r13,PACA_EXTLB; \ |
|---|
| 163 | 150 | TLB_MISS_RESTORE(r11) |
|---|
| 164 | 151 | |
|---|
| 165 | | -#ifdef CONFIG_BOOK3E_MMU_TLB_STATS |
|---|
| 166 | | -#define TLB_MISS_PROLOG_STATS \ |
|---|
| 167 | | - mflr r10; \ |
|---|
| 168 | | - std r8,EX_TLB_R8(r12); \ |
|---|
| 169 | | - std r9,EX_TLB_R9(r12); \ |
|---|
| 170 | | - std r10,EX_TLB_LR(r12); |
|---|
| 171 | | -#define TLB_MISS_RESTORE_STATS \ |
|---|
| 172 | | - ld r16,EX_TLB_LR(r12); \ |
|---|
| 173 | | - ld r9,EX_TLB_R9(r12); \ |
|---|
| 174 | | - ld r8,EX_TLB_R8(r12); \ |
|---|
| 175 | | - mtlr r16; |
|---|
| 176 | | -#define TLB_MISS_STATS_D(name) \ |
|---|
| 177 | | - addi r9,r13,MMSTAT_DSTATS+name; \ |
|---|
| 178 | | - bl tlb_stat_inc; |
|---|
| 179 | | -#define TLB_MISS_STATS_I(name) \ |
|---|
| 180 | | - addi r9,r13,MMSTAT_ISTATS+name; \ |
|---|
| 181 | | - bl tlb_stat_inc; |
|---|
| 182 | | -#define TLB_MISS_STATS_X(name) \ |
|---|
| 183 | | - ld r8,PACA_EXTLB+EX_TLB_ESR(r13); \ |
|---|
| 184 | | - cmpdi cr2,r8,-1; \ |
|---|
| 185 | | - beq cr2,61f; \ |
|---|
| 186 | | - addi r9,r13,MMSTAT_DSTATS+name; \ |
|---|
| 187 | | - b 62f; \ |
|---|
| 188 | | -61: addi r9,r13,MMSTAT_ISTATS+name; \ |
|---|
| 189 | | -62: bl tlb_stat_inc; |
|---|
| 190 | | -#define TLB_MISS_STATS_SAVE_INFO \ |
|---|
| 191 | | - std r14,EX_TLB_ESR(r12); /* save ESR */ |
|---|
| 192 | | -#define TLB_MISS_STATS_SAVE_INFO_BOLTED \ |
|---|
| 193 | | - std r14,PACA_EXTLB+EX_TLB_ESR(r13); /* save ESR */ |
|---|
| 194 | | -#else |
|---|
| 195 | | -#define TLB_MISS_PROLOG_STATS |
|---|
| 196 | | -#define TLB_MISS_RESTORE_STATS |
|---|
| 197 | | -#define TLB_MISS_PROLOG_STATS_BOLTED |
|---|
| 198 | | -#define TLB_MISS_RESTORE_STATS_BOLTED |
|---|
| 199 | | -#define TLB_MISS_STATS_D(name) |
|---|
| 200 | | -#define TLB_MISS_STATS_I(name) |
|---|
| 201 | | -#define TLB_MISS_STATS_X(name) |
|---|
| 202 | | -#define TLB_MISS_STATS_Y(name) |
|---|
| 203 | | -#define TLB_MISS_STATS_SAVE_INFO |
|---|
| 204 | | -#define TLB_MISS_STATS_SAVE_INFO_BOLTED |
|---|
| 205 | | -#endif |
|---|
| 206 | | - |
|---|
| 207 | 152 | #define SET_IVOR(vector_number, vector_offset) \ |
|---|
| 208 | 153 | LOAD_REG_ADDR(r3,interrupt_base_book3e);\ |
|---|
| 209 | 154 | ori r3,r3,vector_offset@l; \ |
|---|
| 210 | 155 | mtspr SPRN_IVOR##vector_number,r3; |
|---|
| 211 | | - |
|---|
| 156 | +/* |
|---|
| 157 | + * powerpc relies on return from interrupt/syscall being context synchronising |
|---|
| 158 | + * (which rfi is) to support ARCH_HAS_MEMBARRIER_SYNC_CORE without additional |
|---|
| 159 | + * synchronisation instructions. |
|---|
| 160 | + */ |
|---|
| 212 | 161 | #define RFI_TO_KERNEL \ |
|---|
| 213 | 162 | rfi |
|---|
| 214 | 163 | |
|---|