linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/9] powerpc: simplify patch_instruction_site() and patch_branch_site()
@ 2018-11-09 17:33 Christophe Leroy
  2018-11-09 17:33 ` [PATCH 2/9] powerpc: add modify_instruction() and modify_instruction_site() Christophe Leroy
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Christophe Leroy @ 2018-11-09 17:33 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: linux-kernel, linuxppc-dev

Using patch_site_addr() helper, patch_instruction_site() and
patch_branch_site() can be simplified and inlined.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 arch/powerpc/include/asm/code-patching.h | 12 ++++++++++--
 arch/powerpc/lib/code-patching.c         | 16 ----------------
 2 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/arch/powerpc/include/asm/code-patching.h b/arch/powerpc/include/asm/code-patching.h
index 3d5acd2b113a..0eeed21e4898 100644
--- a/arch/powerpc/include/asm/code-patching.h
+++ b/arch/powerpc/include/asm/code-patching.h
@@ -33,14 +33,22 @@ unsigned int create_cond_branch(const unsigned int *addr,
 int patch_branch(unsigned int *addr, unsigned long target, int flags);
 int patch_instruction(unsigned int *addr, unsigned int instr);
 int raw_patch_instruction(unsigned int *addr, unsigned int instr);
-int patch_instruction_site(s32 *addr, unsigned int instr);
-int patch_branch_site(s32 *site, unsigned long target, int flags);
 
 static inline unsigned long patch_site_addr(s32 *site)
 {
 	return (unsigned long)site + *site;
 }
 
+static inline int patch_instruction_site(s32 *site, unsigned int instr)
+{
+	return patch_instruction((unsigned int *)patch_site_addr(site), instr);
+}
+
+static inline int patch_branch_site(s32 *site, unsigned long target, int flags)
+{
+	return patch_branch((unsigned int *)patch_site_addr(site), target, flags);
+}
+
 int instr_is_relative_branch(unsigned int instr);
 int instr_is_relative_link_branch(unsigned int instr);
 int instr_is_branch_to_addr(const unsigned int *instr, unsigned long addr);
diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c
index 89502cbccb1b..506413a2c25e 100644
--- a/arch/powerpc/lib/code-patching.c
+++ b/arch/powerpc/lib/code-patching.c
@@ -204,22 +204,6 @@ int patch_branch(unsigned int *addr, unsigned long target, int flags)
 	return patch_instruction(addr, create_branch(addr, target, flags));
 }
 
-int patch_branch_site(s32 *site, unsigned long target, int flags)
-{
-	unsigned int *addr;
-
-	addr = (unsigned int *)((unsigned long)site + *site);
-	return patch_instruction(addr, create_branch(addr, target, flags));
-}
-
-int patch_instruction_site(s32 *site, unsigned int instr)
-{
-	unsigned int *addr;
-
-	addr = (unsigned int *)((unsigned long)site + *site);
-	return patch_instruction(addr, instr);
-}
-
 bool is_offset_in_branch_range(long offset)
 {
 	/*
-- 
2.13.3


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-12-22 17:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-09 17:33 [PATCH 1/9] powerpc: simplify patch_instruction_site() and patch_branch_site() Christophe Leroy
2018-11-09 17:33 ` [PATCH 2/9] powerpc: add modify_instruction() and modify_instruction_site() Christophe Leroy
2018-11-09 17:33 ` [PATCH 3/9] powerpc/32: use patch_site_addr() in machine_init() Christophe Leroy
2018-11-09 17:33 ` [PATCH 4/9] powerpc/book3s/32: Use MMU_FTR_HPTE_TABLE in head_32.S Christophe Leroy
2018-11-09 17:33 ` [PATCH 5/9] powerpc/book3s/32: Use patch_site to patch hash functions Christophe Leroy
2018-11-09 17:33 ` [PATCH 6/9] powerpc/8xx: use modify_instruction_site() Christophe Leroy
2018-11-09 17:33 ` [PATCH 7/9] powerpc/signal: Use code patching instead of hardcoding Christophe Leroy
2018-11-09 17:33 ` [PATCH 8/9] powerpc/44x: use patch_sites for TLB handlers patching Christophe Leroy
2018-11-09 17:33 ` [PATCH 9/9] powerpc/smp: Use code patching to restore reset vector Christophe Leroy
2018-12-22  9:55 ` [1/9] powerpc: simplify patch_instruction_site() and patch_branch_site() Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).