Commit 8183d99f authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/lib/feature-fixups: use raw_patch_instruction()

feature fixups need to use patch_instruction() early in the boot,
even before the code is relocated to its final address, requiring
patch_instruction() to use PTRRELOC() in order to address data.

But feature fixups applies on code before it is set to read only,
even for modules. Therefore, feature fixups can use
raw_patch_instruction() instead.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 8cf4c057
...@@ -31,6 +31,7 @@ unsigned int create_cond_branch(const unsigned int *addr, ...@@ -31,6 +31,7 @@ unsigned int create_cond_branch(const unsigned int *addr,
unsigned long target, int flags); unsigned long target, int flags);
int patch_branch(unsigned int *addr, unsigned long target, int flags); int patch_branch(unsigned int *addr, unsigned long target, int flags);
int patch_instruction(unsigned int *addr, unsigned int instr); int patch_instruction(unsigned int *addr, unsigned int instr);
int raw_patch_instruction(unsigned int *addr, unsigned int instr);
int instr_is_relative_branch(unsigned int instr); int instr_is_relative_branch(unsigned int instr);
int instr_is_relative_link_branch(unsigned int instr); int instr_is_relative_link_branch(unsigned int instr);
......
...@@ -38,7 +38,7 @@ static int __patch_instruction(unsigned int *exec_addr, unsigned int instr, ...@@ -38,7 +38,7 @@ static int __patch_instruction(unsigned int *exec_addr, unsigned int instr,
return 0; return 0;
} }
static int raw_patch_instruction(unsigned int *addr, unsigned int instr) int raw_patch_instruction(unsigned int *addr, unsigned int instr)
{ {
return __patch_instruction(addr, instr, addr); return __patch_instruction(addr, instr, addr);
} }
...@@ -155,7 +155,7 @@ int patch_instruction(unsigned int *addr, unsigned int instr) ...@@ -155,7 +155,7 @@ int patch_instruction(unsigned int *addr, unsigned int instr)
* when text_poke_area is not ready, but we still need * when text_poke_area is not ready, but we still need
* to allow patching. We just do the plain old patching * to allow patching. We just do the plain old patching
*/ */
if (!this_cpu_read(*PTRRELOC(&text_poke_area))) if (!this_cpu_read(text_poke_area))
return raw_patch_instruction(addr, instr); return raw_patch_instruction(addr, instr);
local_irq_save(flags); local_irq_save(flags);
......
...@@ -62,7 +62,7 @@ static int patch_alt_instruction(unsigned int *src, unsigned int *dest, ...@@ -62,7 +62,7 @@ static int patch_alt_instruction(unsigned int *src, unsigned int *dest,
} }
} }
patch_instruction(dest, instr); raw_patch_instruction(dest, instr);
return 0; return 0;
} }
...@@ -91,7 +91,7 @@ static int patch_feature_section(unsigned long value, struct fixup_entry *fcur) ...@@ -91,7 +91,7 @@ static int patch_feature_section(unsigned long value, struct fixup_entry *fcur)
} }
for (; dest < end; dest++) for (; dest < end; dest++)
patch_instruction(dest, PPC_INST_NOP); raw_patch_instruction(dest, PPC_INST_NOP);
return 0; return 0;
} }
...@@ -129,7 +129,7 @@ void do_lwsync_fixups(unsigned long value, void *fixup_start, void *fixup_end) ...@@ -129,7 +129,7 @@ void do_lwsync_fixups(unsigned long value, void *fixup_start, void *fixup_end)
for (; start < end; start++) { for (; start < end; start++) {
dest = (void *)start + *start; dest = (void *)start + *start;
patch_instruction(dest, PPC_INST_LWSYNC); raw_patch_instruction(dest, PPC_INST_LWSYNC);
} }
} }
...@@ -147,7 +147,7 @@ static void do_final_fixups(void) ...@@ -147,7 +147,7 @@ static void do_final_fixups(void)
length = (__end_interrupts - _stext) / sizeof(int); length = (__end_interrupts - _stext) / sizeof(int);
while (length--) { while (length--) {
patch_instruction(dest, *src); raw_patch_instruction(dest, *src);
src++; src++;
dest++; dest++;
} }
......
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