linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] powerpc/tm: Move tm_enable definition
@ 2018-10-01 19:47 Breno Leitao
  2018-10-01 19:47 ` [PATCH 2/2] powerpc/tm: Avoid SPR flush if TM is disabled Breno Leitao
  2021-06-11  7:32 ` [PATCH 1/2] powerpc/tm: Move tm_enable definition Christophe Leroy
  0 siblings, 2 replies; 5+ messages in thread
From: Breno Leitao @ 2018-10-01 19:47 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Breno Leitao, mikey, gromero

The goal of this patch is to move function tm_enabled() to tm.h in order
to allow this function to be used by other files as an inline function.

This patch also removes the double inclusion of tm.h in the traps.c
source code. One inclusion is inside a CONFIG_PPC64 ifdef block, and
another one is in the generic part. This double inclusion causes a
redefinition of tm_enable(), that is why it is being fixed here.

There is generic code (non CONFIG_PPC64, thus, non
CONFIG_PPC_TRANSACTIONAL_MEM also) using some TM definitions, which
explains why tm.h is being imported in the generic code. This is
not correct, and this code is now surrounded by a
CONFIG_PPC_TRANSACTIONAL_MEM ifdef block.

These ifdef inclusion will avoid calling tm_abort_check() completely,
but it is not a problem since this function is just returning 'false' if
CONFIG_PPC_TRANSACTIONAL_MEM is not defined.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 arch/powerpc/include/asm/tm.h | 5 +++++
 arch/powerpc/kernel/process.c | 5 -----
 arch/powerpc/kernel/traps.c   | 5 ++++-
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/include/asm/tm.h b/arch/powerpc/include/asm/tm.h
index e94f6db5e367..646d45a2aaae 100644
--- a/arch/powerpc/include/asm/tm.h
+++ b/arch/powerpc/include/asm/tm.h
@@ -19,4 +19,9 @@ extern void tm_restore_sprs(struct thread_struct *thread);
 
 extern bool tm_suspend_disabled;
 
+static inline bool tm_enabled(struct task_struct *tsk)
+{
+	return tsk && tsk->thread.regs && (tsk->thread.regs->msr & MSR_TM);
+}
+
 #endif /* __ASSEMBLY__ */
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 913c5725cdb2..c1ca2451fa3b 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -862,11 +862,6 @@ static inline bool hw_brk_match(struct arch_hw_breakpoint *a,
 
 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
 
-static inline bool tm_enabled(struct task_struct *tsk)
-{
-	return tsk && tsk->thread.regs && (tsk->thread.regs->msr & MSR_TM);
-}
-
 static void tm_reclaim_thread(struct thread_struct *thr, uint8_t cause)
 {
 	/*
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index c85adb858271..a3d6298b8074 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -64,7 +64,6 @@
 #include <asm/rio.h>
 #include <asm/fadump.h>
 #include <asm/switch_to.h>
-#include <asm/tm.h>
 #include <asm/debug.h>
 #include <asm/asm-prototypes.h>
 #include <asm/hmi.h>
@@ -1276,9 +1275,11 @@ static int emulate_instruction(struct pt_regs *regs)
 
 	/* Emulate load/store string insn. */
 	if ((instword & PPC_INST_STRING_GEN_MASK) == PPC_INST_STRING) {
+#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
 		if (tm_abort_check(regs,
 				   TM_CAUSE_EMULATE | TM_CAUSE_PERSISTENT))
 			return -EINVAL;
+#endif
 		PPC_WARN_EMULATED(string, regs);
 		return emulate_string_inst(regs, instword);
 	}
@@ -1508,8 +1509,10 @@ void alignment_exception(struct pt_regs *regs)
 	if (!arch_irq_disabled_regs(regs))
 		local_irq_enable();
 
+#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
 	if (tm_abort_check(regs, TM_CAUSE_ALIGNMENT | TM_CAUSE_PERSISTENT))
 		goto bail;
+#endif
 
 	/* we don't implement logging of alignment exceptions */
 	if (!(current->thread.align_ctl & PR_UNALIGN_SIGBUS))
-- 
2.19.0


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

end of thread, other threads:[~2021-06-11  7:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-01 19:47 [PATCH 1/2] powerpc/tm: Move tm_enable definition Breno Leitao
2018-10-01 19:47 ` [PATCH 2/2] powerpc/tm: Avoid SPR flush if TM is disabled Breno Leitao
2018-10-02  0:05   ` Michael Neuling
2021-06-11  7:35   ` Christophe Leroy
2021-06-11  7:32 ` [PATCH 1/2] powerpc/tm: Move tm_enable definition Christophe Leroy

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).