Commit 7ca8316c authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Greg Kroah-Hartman

powerpc/64s: Simple RFI macro conversions

commit 222f20f1 upstream.

This commit does simple conversions of rfi/rfid to the new macros that
include the expected destination context. By simple we mean cases
where there is a single well known destination context, and it's
simply a matter of substituting the instruction for the appropriate
macro.
Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
[Balbir fixed issues with backporting to stable]
Signed-off-by: default avatarBalbir Singh <bsingharora@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a8a9925f
...@@ -220,7 +220,7 @@ END_FTR_SECTION_NESTED(ftr,ftr,943) ...@@ -220,7 +220,7 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
mtspr SPRN_##h##SRR0,r12; \ mtspr SPRN_##h##SRR0,r12; \
mfspr r12,SPRN_##h##SRR1; /* and SRR1 */ \ mfspr r12,SPRN_##h##SRR1; /* and SRR1 */ \
mtspr SPRN_##h##SRR1,r10; \ mtspr SPRN_##h##SRR1,r10; \
h##rfid; \ h##RFI_TO_KERNEL; \
b . /* prevent speculative execution */ b . /* prevent speculative execution */
#define EXCEPTION_PROLOG_PSERIES_1(label, h) \ #define EXCEPTION_PROLOG_PSERIES_1(label, h) \
__EXCEPTION_PROLOG_PSERIES_1(label, h) __EXCEPTION_PROLOG_PSERIES_1(label, h)
......
...@@ -36,6 +36,11 @@ ...@@ -36,6 +36,11 @@
#include <asm/hw_irq.h> #include <asm/hw_irq.h>
#include <asm/context_tracking.h> #include <asm/context_tracking.h>
#include <asm/tm.h> #include <asm/tm.h>
#ifdef CONFIG_PPC_BOOK3S
#include <asm/exception-64s.h>
#else
#include <asm/exception-64e.h>
#endif
/* /*
* System calls. * System calls.
...@@ -353,8 +358,7 @@ tabort_syscall: ...@@ -353,8 +358,7 @@ tabort_syscall:
mtmsrd r10, 1 mtmsrd r10, 1
mtspr SPRN_SRR0, r11 mtspr SPRN_SRR0, r11
mtspr SPRN_SRR1, r12 mtspr SPRN_SRR1, r12
RFI_TO_USER
rfid
b . /* prevent speculative execution */ b . /* prevent speculative execution */
#endif #endif
...@@ -1077,7 +1081,7 @@ _GLOBAL(enter_rtas) ...@@ -1077,7 +1081,7 @@ _GLOBAL(enter_rtas)
mtspr SPRN_SRR0,r5 mtspr SPRN_SRR0,r5
mtspr SPRN_SRR1,r6 mtspr SPRN_SRR1,r6
rfid RFI_TO_KERNEL
b . /* prevent speculative execution */ b . /* prevent speculative execution */
rtas_return_loc: rtas_return_loc:
...@@ -1102,7 +1106,7 @@ rtas_return_loc: ...@@ -1102,7 +1106,7 @@ rtas_return_loc:
mtspr SPRN_SRR0,r3 mtspr SPRN_SRR0,r3
mtspr SPRN_SRR1,r4 mtspr SPRN_SRR1,r4
rfid RFI_TO_KERNEL
b . /* prevent speculative execution */ b . /* prevent speculative execution */
.align 3 .align 3
...@@ -1173,7 +1177,7 @@ _GLOBAL(enter_prom) ...@@ -1173,7 +1177,7 @@ _GLOBAL(enter_prom)
LOAD_REG_IMMEDIATE(r12, MSR_SF | MSR_ISF | MSR_LE) LOAD_REG_IMMEDIATE(r12, MSR_SF | MSR_ISF | MSR_LE)
andc r11,r11,r12 andc r11,r11,r12
mtsrr1 r11 mtsrr1 r11
rfid RFI_TO_KERNEL
#endif /* CONFIG_PPC_BOOK3E */ #endif /* CONFIG_PPC_BOOK3E */
1: /* Return from OF */ 1: /* Return from OF */
......
...@@ -46,7 +46,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) \ ...@@ -46,7 +46,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) \
mtspr SPRN_SRR0,r10 ; \ mtspr SPRN_SRR0,r10 ; \
ld r10,PACAKMSR(r13) ; \ ld r10,PACAKMSR(r13) ; \
mtspr SPRN_SRR1,r10 ; \ mtspr SPRN_SRR1,r10 ; \
rfid ; \ RFI_TO_KERNEL ; \
b . ; /* prevent speculative execution */ b . ; /* prevent speculative execution */
#define SYSCALL_PSERIES_3 \ #define SYSCALL_PSERIES_3 \
...@@ -54,7 +54,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) \ ...@@ -54,7 +54,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) \
1: mfspr r12,SPRN_SRR1 ; \ 1: mfspr r12,SPRN_SRR1 ; \
xori r12,r12,MSR_LE ; \ xori r12,r12,MSR_LE ; \
mtspr SPRN_SRR1,r12 ; \ mtspr SPRN_SRR1,r12 ; \
rfid ; /* return to userspace */ \ RFI_TO_USER ; /* return to userspace */ \
b . ; /* prevent speculative execution */ b . ; /* prevent speculative execution */
#if defined(CONFIG_RELOCATABLE) #if defined(CONFIG_RELOCATABLE)
...@@ -507,7 +507,7 @@ BEGIN_FTR_SECTION ...@@ -507,7 +507,7 @@ BEGIN_FTR_SECTION
LOAD_HANDLER(r12, machine_check_handle_early) LOAD_HANDLER(r12, machine_check_handle_early)
1: mtspr SPRN_SRR0,r12 1: mtspr SPRN_SRR0,r12
mtspr SPRN_SRR1,r11 mtspr SPRN_SRR1,r11
rfid RFI_TO_KERNEL
b . /* prevent speculative execution */ b . /* prevent speculative execution */
2: 2:
/* Stack overflow. Stay on emergency stack and panic. /* Stack overflow. Stay on emergency stack and panic.
...@@ -601,7 +601,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_CFAR) ...@@ -601,7 +601,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
ld r11,PACA_EXGEN+EX_R11(r13) ld r11,PACA_EXGEN+EX_R11(r13)
ld r12,PACA_EXGEN+EX_R12(r13) ld r12,PACA_EXGEN+EX_R12(r13)
ld r13,PACA_EXGEN+EX_R13(r13) ld r13,PACA_EXGEN+EX_R13(r13)
HRFID HRFI_TO_UNKNOWN
b . b .
#endif #endif
...@@ -666,7 +666,7 @@ masked_##_H##interrupt: \ ...@@ -666,7 +666,7 @@ masked_##_H##interrupt: \
ld r10,PACA_EXGEN+EX_R10(r13); \ ld r10,PACA_EXGEN+EX_R10(r13); \
ld r11,PACA_EXGEN+EX_R11(r13); \ ld r11,PACA_EXGEN+EX_R11(r13); \
GET_SCRATCH0(r13); \ GET_SCRATCH0(r13); \
##_H##rfid; \ ##_H##RFI_TO_KERNEL; \
b . b .
MASKED_INTERRUPT() MASKED_INTERRUPT()
...@@ -756,7 +756,7 @@ kvmppc_skip_interrupt: ...@@ -756,7 +756,7 @@ kvmppc_skip_interrupt:
addi r13, r13, 4 addi r13, r13, 4
mtspr SPRN_SRR0, r13 mtspr SPRN_SRR0, r13
GET_SCRATCH0(r13) GET_SCRATCH0(r13)
rfid RFI_TO_KERNEL
b . b .
kvmppc_skip_Hinterrupt: kvmppc_skip_Hinterrupt:
...@@ -768,7 +768,7 @@ kvmppc_skip_Hinterrupt: ...@@ -768,7 +768,7 @@ kvmppc_skip_Hinterrupt:
addi r13, r13, 4 addi r13, r13, 4
mtspr SPRN_HSRR0, r13 mtspr SPRN_HSRR0, r13
GET_SCRATCH0(r13) GET_SCRATCH0(r13)
hrfid HRFI_TO_KERNEL
b . b .
#endif #endif
...@@ -1439,7 +1439,7 @@ machine_check_handle_early: ...@@ -1439,7 +1439,7 @@ machine_check_handle_early:
li r3,MSR_ME li r3,MSR_ME
andc r10,r10,r3 /* Turn off MSR_ME */ andc r10,r10,r3 /* Turn off MSR_ME */
mtspr SPRN_SRR1,r10 mtspr SPRN_SRR1,r10
rfid RFI_TO_KERNEL
b . b .
2: 2:
/* /*
...@@ -1457,7 +1457,7 @@ machine_check_handle_early: ...@@ -1457,7 +1457,7 @@ machine_check_handle_early:
*/ */
bl machine_check_queue_event bl machine_check_queue_event
MACHINE_CHECK_HANDLER_WINDUP MACHINE_CHECK_HANDLER_WINDUP
rfid RFI_TO_USER_OR_KERNEL
9: 9:
/* Deliver the machine check to host kernel in V mode. */ /* Deliver the machine check to host kernel in V mode. */
MACHINE_CHECK_HANDLER_WINDUP MACHINE_CHECK_HANDLER_WINDUP
......
...@@ -64,7 +64,7 @@ _GLOBAL_TOC(kvmppc_hv_entry_trampoline) ...@@ -64,7 +64,7 @@ _GLOBAL_TOC(kvmppc_hv_entry_trampoline)
mtmsrd r0,1 /* clear RI in MSR */ mtmsrd r0,1 /* clear RI in MSR */
mtsrr0 r5 mtsrr0 r5
mtsrr1 r6 mtsrr1 r6
RFI RFI_TO_KERNEL
kvmppc_call_hv_entry: kvmppc_call_hv_entry:
ld r4, HSTATE_KVM_VCPU(r13) ld r4, HSTATE_KVM_VCPU(r13)
...@@ -170,7 +170,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) ...@@ -170,7 +170,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
mtsrr0 r8 mtsrr0 r8
mtsrr1 r7 mtsrr1 r7
beq cr1, 13f /* machine check */ beq cr1, 13f /* machine check */
RFI RFI_TO_KERNEL
/* On POWER7, we have external interrupts set to use HSRR0/1 */ /* On POWER7, we have external interrupts set to use HSRR0/1 */
11: mtspr SPRN_HSRR0, r8 11: mtspr SPRN_HSRR0, r8
...@@ -965,8 +965,7 @@ BEGIN_FTR_SECTION ...@@ -965,8 +965,7 @@ BEGIN_FTR_SECTION
END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR) END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
ld r0, VCPU_GPR(R0)(r4) ld r0, VCPU_GPR(R0)(r4)
ld r4, VCPU_GPR(R4)(r4) ld r4, VCPU_GPR(R4)(r4)
HRFI_TO_GUEST
hrfid
b . b .
secondary_too_late: secondary_too_late:
......
...@@ -46,6 +46,9 @@ ...@@ -46,6 +46,9 @@
#define FUNC(name) name #define FUNC(name) name
#define RFI_TO_KERNEL RFI
#define RFI_TO_GUEST RFI
.macro INTERRUPT_TRAMPOLINE intno .macro INTERRUPT_TRAMPOLINE intno
.global kvmppc_trampoline_\intno .global kvmppc_trampoline_\intno
...@@ -141,7 +144,7 @@ kvmppc_handler_skip_ins: ...@@ -141,7 +144,7 @@ kvmppc_handler_skip_ins:
GET_SCRATCH0(r13) GET_SCRATCH0(r13)
/* And get back into the code */ /* And get back into the code */
RFI RFI_TO_KERNEL
#endif #endif
/* /*
...@@ -164,6 +167,6 @@ _GLOBAL_TOC(kvmppc_entry_trampoline) ...@@ -164,6 +167,6 @@ _GLOBAL_TOC(kvmppc_entry_trampoline)
ori r5, r5, MSR_EE ori r5, r5, MSR_EE
mtsrr0 r7 mtsrr0 r7
mtsrr1 r6 mtsrr1 r6
RFI RFI_TO_KERNEL
#include "book3s_segment.S" #include "book3s_segment.S"
...@@ -156,7 +156,7 @@ no_dcbz32_on: ...@@ -156,7 +156,7 @@ no_dcbz32_on:
PPC_LL r9, SVCPU_R9(r3) PPC_LL r9, SVCPU_R9(r3)
PPC_LL r3, (SVCPU_R3)(r3) PPC_LL r3, (SVCPU_R3)(r3)
RFI RFI_TO_GUEST
kvmppc_handler_trampoline_enter_end: kvmppc_handler_trampoline_enter_end:
...@@ -389,5 +389,5 @@ END_FTR_SECTION_IFSET(CPU_FTR_HVMODE) ...@@ -389,5 +389,5 @@ END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
cmpwi r12, BOOK3S_INTERRUPT_DOORBELL cmpwi r12, BOOK3S_INTERRUPT_DOORBELL
beqa BOOK3S_INTERRUPT_DOORBELL beqa BOOK3S_INTERRUPT_DOORBELL
RFI RFI_TO_KERNEL
kvmppc_handler_trampoline_exit_end: kvmppc_handler_trampoline_exit_end:
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment