All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/64s: Use symbolic macros for function entry encoding
@ 2021-03-09  7:15 Michael Ellerman
  2021-03-09 10:42 ` Naveen N. Rao
  2021-03-14 10:04 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Ellerman @ 2021-03-09  7:15 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: naveen.n.rao

In ppc_function_entry() we look for a specific set of instructions by
masking the instructions and comparing with a known value. Currently
those known values are just literal hex values, and we recently
discovered one of them was wrong.

Instead construct the values using the existing constants we have for
defining various fields of instructions.

Suggested-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/include/asm/code-patching.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/include/asm/code-patching.h b/arch/powerpc/include/asm/code-patching.h
index d5b3c3bb95b4..f1d029bf906e 100644
--- a/arch/powerpc/include/asm/code-patching.h
+++ b/arch/powerpc/include/asm/code-patching.h
@@ -73,9 +73,10 @@ void __patch_exception(int exc, unsigned long addr);
 #endif
 
 #define OP_RT_RA_MASK	0xffff0000UL
-#define LIS_R2		0x3c400000UL
-#define ADDIS_R2_R12	0x3c4c0000UL
-#define ADDI_R2_R2	0x38420000UL
+#define LIS_R2		(PPC_INST_ADDIS | __PPC_RT(R2))
+#define ADDIS_R2_R12	(PPC_INST_ADDIS | __PPC_RT(R2) | __PPC_RA(R12))
+#define ADDI_R2_R2	(PPC_INST_ADDI  | __PPC_RT(R2) | __PPC_RA(R2))
+
 
 static inline unsigned long ppc_function_entry(void *func)
 {
-- 
2.25.1


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

* Re: [PATCH] powerpc/64s: Use symbolic macros for function entry encoding
  2021-03-09  7:15 [PATCH] powerpc/64s: Use symbolic macros for function entry encoding Michael Ellerman
@ 2021-03-09 10:42 ` Naveen N. Rao
  2021-03-14 10:04 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Naveen N. Rao @ 2021-03-09 10:42 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: naveen.n.rao, linuxppc-dev

On 2021/03/09 06:15PM, Michael Ellerman wrote:
> In ppc_function_entry() we look for a specific set of instructions by
> masking the instructions and comparing with a known value. Currently
> those known values are just literal hex values, and we recently
> discovered one of them was wrong.
> 
> Instead construct the values using the existing constants we have for
> defining various fields of instructions.
> 
> Suggested-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
>  arch/powerpc/include/asm/code-patching.h | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

Thanks,
Acked-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>

- Naveen


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

* Re: [PATCH] powerpc/64s: Use symbolic macros for function entry encoding
  2021-03-09  7:15 [PATCH] powerpc/64s: Use symbolic macros for function entry encoding Michael Ellerman
  2021-03-09 10:42 ` Naveen N. Rao
@ 2021-03-14 10:04 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2021-03-14 10:04 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev; +Cc: naveen.n.rao

On Tue, 9 Mar 2021 18:15:44 +1100, Michael Ellerman wrote:
> In ppc_function_entry() we look for a specific set of instructions by
> masking the instructions and comparing with a known value. Currently
> those known values are just literal hex values, and we recently
> discovered one of them was wrong.
> 
> Instead construct the values using the existing constants we have for
> defining various fields of instructions.

Applied to powerpc/fixes.

[1/1] powerpc/64s: Use symbolic macros for function entry encoding
      https://git.kernel.org/powerpc/c/7aed41cff35a9aaf3431b8c0c23daa7d8bb77cd3

cheers

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

end of thread, other threads:[~2021-03-14 10:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09  7:15 [PATCH] powerpc/64s: Use symbolic macros for function entry encoding Michael Ellerman
2021-03-09 10:42 ` Naveen N. Rao
2021-03-14 10:04 ` Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.