diff options
Diffstat (limited to 'arch/powerpc/kvm/book3s_rmhandlers.S')
-rw-r--r-- | arch/powerpc/kvm/book3s_rmhandlers.S | 51 |
1 files changed, 17 insertions, 34 deletions
diff --git a/arch/powerpc/kvm/book3s_rmhandlers.S b/arch/powerpc/kvm/book3s_rmhandlers.S index 5ee66edd749d..34187585c507 100644 --- a/arch/powerpc/kvm/book3s_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_rmhandlers.S | |||
@@ -36,9 +36,8 @@ | |||
36 | 36 | ||
37 | #if defined(CONFIG_PPC_BOOK3S_64) | 37 | #if defined(CONFIG_PPC_BOOK3S_64) |
38 | 38 | ||
39 | #define LOAD_SHADOW_VCPU(reg) GET_PACA(reg) | ||
40 | #define MSR_NOIRQ MSR_KERNEL & ~(MSR_IR | MSR_DR) | ||
41 | #define FUNC(name) GLUE(.,name) | 39 | #define FUNC(name) GLUE(.,name) |
40 | #define MTMSR_EERI(reg) mtmsrd (reg),1 | ||
42 | 41 | ||
43 | .globl kvmppc_skip_interrupt | 42 | .globl kvmppc_skip_interrupt |
44 | kvmppc_skip_interrupt: | 43 | kvmppc_skip_interrupt: |
@@ -68,8 +67,8 @@ kvmppc_skip_Hinterrupt: | |||
68 | 67 | ||
69 | #elif defined(CONFIG_PPC_BOOK3S_32) | 68 | #elif defined(CONFIG_PPC_BOOK3S_32) |
70 | 69 | ||
71 | #define MSR_NOIRQ MSR_KERNEL | ||
72 | #define FUNC(name) name | 70 | #define FUNC(name) name |
71 | #define MTMSR_EERI(reg) mtmsr (reg) | ||
73 | 72 | ||
74 | .macro INTERRUPT_TRAMPOLINE intno | 73 | .macro INTERRUPT_TRAMPOLINE intno |
75 | 74 | ||
@@ -170,40 +169,24 @@ kvmppc_handler_skip_ins: | |||
170 | #endif | 169 | #endif |
171 | 170 | ||
172 | /* | 171 | /* |
173 | * This trampoline brings us back to a real mode handler | 172 | * Call kvmppc_handler_trampoline_enter in real mode |
174 | * | ||
175 | * Input Registers: | ||
176 | * | ||
177 | * R5 = SRR0 | ||
178 | * R6 = SRR1 | ||
179 | * LR = real-mode IP | ||
180 | * | 173 | * |
174 | * On entry, r4 contains the guest shadow MSR | ||
181 | */ | 175 | */ |
182 | .global kvmppc_handler_lowmem_trampoline | 176 | _GLOBAL(kvmppc_entry_trampoline) |
183 | kvmppc_handler_lowmem_trampoline: | 177 | mfmsr r5 |
184 | 178 | LOAD_REG_ADDR(r7, kvmppc_handler_trampoline_enter) | |
185 | mtsrr0 r5 | 179 | toreal(r7) |
180 | |||
181 | li r9, MSR_RI | ||
182 | ori r9, r9, MSR_EE | ||
183 | andc r9, r5, r9 /* Clear EE and RI in MSR value */ | ||
184 | li r6, MSR_IR | MSR_DR | ||
185 | ori r6, r6, MSR_EE | ||
186 | andc r6, r5, r6 /* Clear EE, DR and IR in MSR value */ | ||
187 | MTMSR_EERI(r9) /* Clear EE and RI in MSR */ | ||
188 | mtsrr0 r7 /* before we set srr0/1 */ | ||
186 | mtsrr1 r6 | 189 | mtsrr1 r6 |
187 | blr | ||
188 | kvmppc_handler_lowmem_trampoline_end: | ||
189 | |||
190 | /* | ||
191 | * Call a function in real mode | ||
192 | * | ||
193 | * Input Registers: | ||
194 | * | ||
195 | * R3 = function | ||
196 | * R4 = MSR | ||
197 | * R5 = scratch register | ||
198 | * | ||
199 | */ | ||
200 | _GLOBAL(kvmppc_rmcall) | ||
201 | LOAD_REG_IMMEDIATE(r5, MSR_NOIRQ) | ||
202 | mtmsr r5 /* Disable relocation and interrupts, so mtsrr | ||
203 | doesn't get interrupted */ | ||
204 | sync | ||
205 | mtsrr0 r3 | ||
206 | mtsrr1 r4 | ||
207 | RFI | 190 | RFI |
208 | 191 | ||
209 | #if defined(CONFIG_PPC_BOOK3S_32) | 192 | #if defined(CONFIG_PPC_BOOK3S_32) |