Skip to contentSkip to conversation

powerpc/e5500: Set r5 to point to cpu spec in setup_cpu_e5500()

PATCH In review Kumar Gala 2 participants 2 messages Sep 16, 2011 PowerPC

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH 1/1 powerpc/e5500: Set r5 to point to cpu spec in setup_cpu_e5500()

From: Laurentiu Tudor <[email protected]>

e500mc and e5500 share some eary setup code that need r5 to point to the cpu spec structure. setup_cpu_e500mc() sets it but setup_cpu_e5500() didn't.

This caused a crash on 32 bit e5500 running under hypervisor, when __setup_e500mc_ivors() tried to access the cpu features field.

---
 arch/powerpc/kernel/cpu_setup_fsl_booke.S |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/powerpc/kernel/cpu_setup_fsl_booke.S +2 -1
index 8053db0..f9f6a6f 100644
@@ -1,7 +1,7 @@
 /*
  * This file contains low level CPU setup functions.
  * Kumar Gala <[email protected]>
- * Copyright 2009 Freescale Semiconductor, Inc.
+ * Copyright 2009,2011 Freescale Semiconductor, Inc.
  *
  * Based on cpu_setup_6xx code by
  * Benjamin Herrenschmidt <[email protected]>
@@ -83,6 +83,7 @@ _GLOBAL(__setup_cpu_e500mc)
 /* Right now, restore and setup are the same thing */
 _GLOBAL(__restore_cpu_e5500)
 _GLOBAL(__setup_cpu_e5500)
+	mr	r5, r4
 	mflr	r4
 	bl	__e500_icache_setup
 	bl	__e500_dcache_setup
Signature · 1 line
1.7.3.4
#1 lore raw
Quoted 6 lines · Kumar Gala

From: Laurentiu Tudor <[email protected]>

e500mc and e5500 share some eary setup code that need r5 to point to the cpu spec structure. setup_cpu_e500mc() sets it but setup_cpu_e5500() didn't.

Quoted 8 lines

This caused a crash on 32 bit e5500 running under hypervisor, when __setup_e500mc_ivors() tried to access the cpu features field.

---
 arch/powerpc/kernel/cpu_setup_fsl_booke.S |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Unless I missed something going in recently, there's nothing in the mainline kernel that uses r5 in __setup_e500mc_ivors(). This is a fix for code that is currently just in our SDK, and should be combined with that code when it is posted. The interprocedural register allocation could stand to be done more simply as well (why not just pick a different register for lr, and leave r4 where it is?), and should be documented.

-Scott