linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] powerpc/time: Rename mftbl() to mftb()
@ 2020-10-01 12:42 Christophe Leroy
  2020-10-01 12:42 ` [PATCH 2/6] powerpc/time: Make mftb() common to PPC32 and PPC64 Christophe Leroy
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Christophe Leroy @ 2020-10-01 12:42 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: linuxppc-dev, linux-kernel

On PPC64, we have mftb().
On PPC32, we have mftbl() and an #define mftb() mftbl().

mftb() and mftbl() are equivalent, their purpose is to read the
content of SPRN_TRBL, as returned by 'mftb' simplified instruction.

binutils seems to define 'mftbl' instruction as an equivalent
of 'mftb'.

However in both 32 bits and 64 bits documentation, only 'mftb' is
defined, and when performing a disassembly with objdump, the displayed
instruction is 'mftb'

No need to have two ways to do the same thing with different
names, rename mftbl() to have only mftb().

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/include/asm/reg.h  | 5 ++---
 arch/powerpc/include/asm/time.h | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 788058af1d44..c66dcdb47c44 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -1439,19 +1439,18 @@ static inline void msr_check_and_clear(unsigned long bits)
 #else /* __powerpc64__ */
 
 #if defined(CONFIG_PPC_8xx)
-#define mftbl()		({unsigned long rval;	\
+#define mftb()		({unsigned long rval;	\
 			asm volatile("mftbl %0" : "=r" (rval)); rval;})
 #define mftbu()		({unsigned long rval;	\
 			asm volatile("mftbu %0" : "=r" (rval)); rval;})
 #else
-#define mftbl()		({unsigned long rval;	\
+#define mftb()		({unsigned long rval;	\
 			asm volatile("mfspr %0, %1" : "=r" (rval) : \
 				"i" (SPRN_TBRL)); rval;})
 #define mftbu()		({unsigned long rval;	\
 			asm volatile("mfspr %0, %1" : "=r" (rval) : \
 				"i" (SPRN_TBRU)); rval;})
 #endif
-#define mftb()		mftbl()
 #endif /* !__powerpc64__ */
 
 #define mttbl(v)	asm volatile("mttbl %0":: "r"(v))
diff --git a/arch/powerpc/include/asm/time.h b/arch/powerpc/include/asm/time.h
index a80abf64c8a5..b0fb8456305f 100644
--- a/arch/powerpc/include/asm/time.h
+++ b/arch/powerpc/include/asm/time.h
@@ -50,7 +50,7 @@ struct div_result {
 
 static inline unsigned long get_tbl(void)
 {
-	return mftbl();
+	return mftb();
 }
 
 static inline unsigned int get_tbu(void)
-- 
2.25.0


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

end of thread, other threads:[~2020-10-09  6:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-01 12:42 [PATCH 1/6] powerpc/time: Rename mftbl() to mftb() Christophe Leroy
2020-10-01 12:42 ` [PATCH 2/6] powerpc/time: Make mftb() common to PPC32 and PPC64 Christophe Leroy
2020-10-01 12:42 ` [PATCH 3/6] powerpc/time: Avoid using get_tbl() and get_tbu() internally Christophe Leroy
2020-10-01 12:42 ` [PATCH 4/6] powerpc/time: Remove get_tbu() Christophe Leroy
2020-10-01 12:42 ` [PATCH 5/6] powerpc/time: Make get_tbl() common to PPC32 and PPC64 Christophe Leroy
2020-10-01 12:42 ` [PATCH 6/6] powerpc/time: Make get_tb() " Christophe Leroy
2020-10-01 20:44 ` [PATCH 1/6] powerpc/time: Rename mftbl() to mftb() Segher Boessenkool
2020-10-09  6:03 ` 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).