2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15 * Copyright SUSE Linux Products GmbH 2009
17 * Authors: Alexander Graf <agraf@suse.de>
20 #define SHADOW_SLB_ENTRY_LEN 0x10
21 #define OFFSET_ESID(x) (SHADOW_SLB_ENTRY_LEN * x)
22 #define OFFSET_VSID(x) ((SHADOW_SLB_ENTRY_LEN * x) + 8)
24 /******************************************************************************
28 *****************************************************************************/
30 .macro LOAD_GUEST_SEGMENTS
39 * all other volatile GPRS = free except R4, R6
40 * SVCPU[CR] = guest CR
41 * SVCPU[XER] = guest XER
42 * SVCPU[CTR] = guest CTR
43 * SVCPU[LR] = guest LR
48 /* Declare SLB shadow as 0 entries big */
50 ld r11, PACA_SLBSHADOWPTR(r13)
54 END_FW_FTR_SECTION_IFSET(FW_FEATURE_LPAR)
62 /* Fill SLB with our shadow */
64 lbz r12, SVCPU_SLB_MAX(r3)
66 addi r12, r12, SVCPU_SLB
69 /* for (r11 = kvm_slb; r11 < kvm_slb + kvm_slb_size; r11+=slb_entry) */
77 andis. r9, r10, SLB_ESID_V@h
78 beq slb_loop_enter_skip
92 /******************************************************************************
96 *****************************************************************************/
98 .macro LOAD_HOST_SEGMENTS
100 /* Register usage at this point:
104 * R12 = exit handler id
105 * R13 = shadow vcpu - SHADOW_VCPU_OFF [=PACA on PPC64]
107 * SVCPU[CR] = guest CR
108 * SVCPU[XER] = guest XER
109 * SVCPU[CTR] = guest CTR
110 * SVCPU[LR] = guest LR
114 /* Remove all SLB entries that are in use. */
120 /* Restore bolted entries from the shadow */
122 ld r11, PACA_SLBSHADOWPTR(r13)
126 /* Declare SLB shadow as SLB_NUM_BOLTED entries big */
128 li r8, SLB_NUM_BOLTED
131 END_FW_FTR_SECTION_IFSET(FW_FEATURE_LPAR)
133 /* Manually load all entries from shadow SLB */
135 li r8, SLBSHADOW_SAVEAREA
136 li r7, SLBSHADOW_SAVEAREA + 8
144 1: addi r7, r7, SHADOW_SLB_ENTRY_LEN
145 addi r8, r8, SHADOW_SLB_ENTRY_LEN