Commit d715e433 authored by Anton Blanchard's avatar Anton Blanchard Committed by Benjamin Herrenschmidt

powerpc: Copy down exception vectors after feature fixups

kdump fails because we try to execute an HV only instruction. Feature
fixups are being applied after we copy the exception vectors down to 0
so they miss out on any updates.

We have always had this issue but it only became critical in v3.0
when we added CFAR support (breaks POWER5) and v3.1 when we added
POWERNV (breaks everyone).
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Cc: <stable@kernel.org> [v3.0+]
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 6d1e2c6c
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#ifdef __powerpc64__ #ifdef __powerpc64__
extern char _end[]; extern char __end_interrupts[];
static inline int in_kernel_text(unsigned long addr) static inline int in_kernel_text(unsigned long addr)
{ {
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
extern unsigned int __start___lwsync_fixup, __stop___lwsync_fixup; extern unsigned int __start___lwsync_fixup, __stop___lwsync_fixup;
extern void do_lwsync_fixups(unsigned long value, void *fixup_start, extern void do_lwsync_fixups(unsigned long value, void *fixup_start,
void *fixup_end); void *fixup_end);
extern void do_final_fixups(void);
static inline void eieio(void) static inline void eieio(void)
{ {
......
...@@ -132,7 +132,6 @@ static void kvm_patch_ins_b(u32 *inst, int addr) ...@@ -132,7 +132,6 @@ static void kvm_patch_ins_b(u32 *inst, int addr)
/* On relocatable kernels interrupts handlers and our code /* On relocatable kernels interrupts handlers and our code
can be in different regions, so we don't patch them */ can be in different regions, so we don't patch them */
extern u32 __end_interrupts;
if ((ulong)inst < (ulong)&__end_interrupts) if ((ulong)inst < (ulong)&__end_interrupts)
return; return;
#endif #endif
......
...@@ -107,6 +107,8 @@ notrace unsigned long __init early_init(unsigned long dt_ptr) ...@@ -107,6 +107,8 @@ notrace unsigned long __init early_init(unsigned long dt_ptr)
PTRRELOC(&__start___lwsync_fixup), PTRRELOC(&__start___lwsync_fixup),
PTRRELOC(&__stop___lwsync_fixup)); PTRRELOC(&__stop___lwsync_fixup));
do_final_fixups();
return KERNELBASE + offset; return KERNELBASE + offset;
} }
......
...@@ -359,6 +359,7 @@ void __init setup_system(void) ...@@ -359,6 +359,7 @@ void __init setup_system(void)
&__start___fw_ftr_fixup, &__stop___fw_ftr_fixup); &__start___fw_ftr_fixup, &__stop___fw_ftr_fixup);
do_lwsync_fixups(cur_cpu_spec->cpu_features, do_lwsync_fixups(cur_cpu_spec->cpu_features,
&__start___lwsync_fixup, &__stop___lwsync_fixup); &__start___lwsync_fixup, &__stop___lwsync_fixup);
do_final_fixups();
/* /*
* Unflatten the device-tree passed by prom_init or kexec * Unflatten the device-tree passed by prom_init or kexec
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#include <linux/init.h> #include <linux/init.h>
#include <asm/cputable.h> #include <asm/cputable.h>
#include <asm/code-patching.h> #include <asm/code-patching.h>
#include <asm/page.h>
#include <asm/sections.h>
struct fixup_entry { struct fixup_entry {
...@@ -128,6 +130,27 @@ void do_lwsync_fixups(unsigned long value, void *fixup_start, void *fixup_end) ...@@ -128,6 +130,27 @@ void do_lwsync_fixups(unsigned long value, void *fixup_start, void *fixup_end)
} }
} }
void do_final_fixups(void)
{
#if defined(CONFIG_PPC64) && defined(CONFIG_RELOCATABLE)
int *src, *dest;
unsigned long length;
if (PHYSICAL_START == 0)
return;
src = (int *)(KERNELBASE + PHYSICAL_START);
dest = (int *)KERNELBASE;
length = (__end_interrupts - _stext) / sizeof(int);
while (length--) {
patch_instruction(dest, *src);
src++;
dest++;
}
#endif
}
#ifdef CONFIG_FTR_FIXUP_SELFTEST #ifdef CONFIG_FTR_FIXUP_SELFTEST
#define check(x) \ #define check(x) \
......
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