linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] powerpc: Don't use local named register variable in current_thread_info
@ 2014-10-31  3:47 Anton Blanchard
  2014-10-31  3:47 ` [PATCH 2/3] powerpc: Remove double braces in alignment code Anton Blanchard
  2014-10-31  3:47 ` [PATCH 3/3] powerpc: LLVM complains about forward declaration of struct rtas_sensors Anton Blanchard
  0 siblings, 2 replies; 3+ messages in thread
From: Anton Blanchard @ 2014-10-31  3:47 UTC (permalink / raw)
  To: benh, paulus, mpe, ulrich.weigand; +Cc: linuxppc-dev

LLVM doesn't support local named register variables and is unlikely
to. current_thread_info is using one, fix it by moving it out and
calling it __current_r1().

I gave it a bit of an obscure name because we don't want anyone else
using it - they should use current_stack_pointer(). This specific
case is performance critical and we can't afford to call a function
to get it. Furthermore it isn't important to know exactly where in
the stack we are since we mask the lower bits.

Signed-off-by: Anton Blanchard <anton@samba.org>
---
 arch/powerpc/include/asm/thread_info.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index b034ecd..ebc4f16 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -71,13 +71,12 @@ struct thread_info {
 #define THREAD_SIZE_ORDER	(THREAD_SHIFT - PAGE_SHIFT)
 
 /* how to get the thread information struct from C */
+register unsigned long __current_r1 asm("r1");
 static inline struct thread_info *current_thread_info(void)
 {
-	register unsigned long sp asm("r1");
-
 	/* gcc4, at least, is smart enough to turn this into a single
 	 * rlwinm for ppc32 and clrrdi for ppc64 */
-	return (struct thread_info *)(sp & ~(THREAD_SIZE-1));
+	return (struct thread_info *)(__current_r1 & ~(THREAD_SIZE-1));
 }
 
 #endif /* __ASSEMBLY__ */
-- 
1.9.1

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

* [PATCH 2/3] powerpc: Remove double braces in alignment code.
  2014-10-31  3:47 [PATCH 1/3] powerpc: Don't use local named register variable in current_thread_info Anton Blanchard
@ 2014-10-31  3:47 ` Anton Blanchard
  2014-10-31  3:47 ` [PATCH 3/3] powerpc: LLVM complains about forward declaration of struct rtas_sensors Anton Blanchard
  1 sibling, 0 replies; 3+ messages in thread
From: Anton Blanchard @ 2014-10-31  3:47 UTC (permalink / raw)
  To: benh, paulus, mpe, ulrich.weigand; +Cc: linuxppc-dev

Looks like I introduced this when adding LE support.

Signed-off-by: Anton Blanchard <anton@samba.org>
---
 arch/powerpc/kernel/align.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c
index 34f5552..86150fb 100644
--- a/arch/powerpc/kernel/align.c
+++ b/arch/powerpc/kernel/align.c
@@ -908,7 +908,7 @@ int fix_alignment(struct pt_regs *regs)
 		flush_fp_to_thread(current);
 	}
 
-	if ((nb == 16)) {
+	if (nb == 16) {
 		if (flags & F) {
 			/* Special case for 16-byte FP loads and stores */
 			PPC_WARN_ALIGNMENT(fp_pair, regs);
-- 
1.9.1

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

* [PATCH 3/3] powerpc: LLVM complains about forward declaration of struct rtas_sensors
  2014-10-31  3:47 [PATCH 1/3] powerpc: Don't use local named register variable in current_thread_info Anton Blanchard
  2014-10-31  3:47 ` [PATCH 2/3] powerpc: Remove double braces in alignment code Anton Blanchard
@ 2014-10-31  3:47 ` Anton Blanchard
  1 sibling, 0 replies; 3+ messages in thread
From: Anton Blanchard @ 2014-10-31  3:47 UTC (permalink / raw)
  To: benh, paulus, mpe, ulrich.weigand; +Cc: linuxppc-dev

Move the declaration up to silence the warning.

Signed-off-by: Anton Blanchard <anton@samba.org>
---
 arch/powerpc/kernel/rtas-proc.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/kernel/rtas-proc.c b/arch/powerpc/kernel/rtas-proc.c
index 8777fb0..fb2fb3e 100644
--- a/arch/powerpc/kernel/rtas-proc.c
+++ b/arch/powerpc/kernel/rtas-proc.c
@@ -113,17 +113,6 @@
 #define SENSOR_PREFIX		"ibm,sensor-"
 #define cel_to_fahr(x)		((x*9/5)+32)
 
-
-/* Globals */
-static struct rtas_sensors sensors;
-static struct device_node *rtas_node = NULL;
-static unsigned long power_on_time = 0; /* Save the time the user set */
-static char progress_led[MAX_LINELENGTH];
-
-static unsigned long rtas_tone_frequency = 1000;
-static unsigned long rtas_tone_volume = 0;
-
-/* ****************STRUCTS******************************************* */
 struct individual_sensor {
 	unsigned int token;
 	unsigned int quant;
@@ -134,6 +123,15 @@ struct rtas_sensors {
 	unsigned int quant;
 };
 
+/* Globals */
+static struct rtas_sensors sensors;
+static struct device_node *rtas_node = NULL;
+static unsigned long power_on_time = 0; /* Save the time the user set */
+static char progress_led[MAX_LINELENGTH];
+
+static unsigned long rtas_tone_frequency = 1000;
+static unsigned long rtas_tone_volume = 0;
+
 /* ****************************************************************** */
 /* Declarations */
 static int ppc_rtas_sensors_show(struct seq_file *m, void *v);
-- 
1.9.1

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

end of thread, other threads:[~2014-10-31  3:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-31  3:47 [PATCH 1/3] powerpc: Don't use local named register variable in current_thread_info Anton Blanchard
2014-10-31  3:47 ` [PATCH 2/3] powerpc: Remove double braces in alignment code Anton Blanchard
2014-10-31  3:47 ` [PATCH 3/3] powerpc: LLVM complains about forward declaration of struct rtas_sensors Anton Blanchard

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