[PATCH 02/14] powerpc/pseries: remove cross-fixup branches in exception code
Nicholas Piggin
nicholas.piggin at gmail.com
Thu Jul 21 16:44:01 AEST 2016
In preparation for reworking the alternate feature patching code,
remove a case of cross-fixup branching in the exception code. That
is, a branch from one alt feature section targeting another alt
feature section.
We have the following:
BEGIN_FTR_SECTION
b do_kvm_0x502
...
do_kvm_0x502:
...
FTR_SECTION_ELSE
b do_kvm_0x500
...
do_kvm_0x500:
...
ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206)
BEGIN_FTR_SECTION
b do_kvm_0x502
FTR_SECTION_ELSE
b do_kvm_0x500
ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE)
This somehow manages to work today. The first branch to do_kvm_0x500 works
as expected and branches to the do_kvm_0x500 code that is moved to the
destination location. The second branch to it branches to the linked
location of the do_kvm_0x500 code. Two copies of the code are being
executed.
A subsequent patch moves the patchcode far away and discards it after
boot, so this type of branch doesn't work.
Signed-off-by: Nick Piggin <npiggin at gmail.com>
---
arch/powerpc/kernel/exceptions-64s.S | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 4c94406..18befa5 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -257,13 +257,18 @@ hardware_interrupt_hv:
BEGIN_FTR_SECTION
_MASKABLE_EXCEPTION_PSERIES(0x502, hardware_interrupt,
EXC_HV, SOFTEN_TEST_HV)
- KVM_HANDLER(PACA_EXGEN, EXC_HV, 0x502)
FTR_SECTION_ELSE
_MASKABLE_EXCEPTION_PSERIES(0x500, hardware_interrupt,
EXC_STD, SOFTEN_TEST_PR)
- KVM_HANDLER(PACA_EXGEN, EXC_STD, 0x500)
ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206)
+ /*
+ * Relon code jumps to these KVM handlers too so can't put them
+ * in the feature sections.
+ */
+ KVM_HANDLER(PACA_EXGEN, EXC_HV, 0x502)
+ KVM_HANDLER(PACA_EXGEN, EXC_STD, 0x500)
+
STD_EXCEPTION_PSERIES(0x600, alignment)
KVM_HANDLER(PACA_EXGEN, EXC_STD, 0x600)
--
2.8.1
More information about the Linuxppc-dev
mailing list