Skip to contentSkip to conversation

micro optimise pSeries_probe

PATCH New Anton Blanchard 2 participants 3 messages Dec 8, 2006 – Dec 9, 2006 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 micro optimise pSeries_probe

We find the OF root the line before, we may as well use it.

---

arch/powerpc/platforms/pseries/setup.c +2 -2
Index: kernel/arch/powerpc/platforms/pseries/setup.c
===================================================================
@@ -503,8 +503,8 @@ static int __init pSeries_probe_hypertas
 static int __init pSeries_probe(void)
 {
 	unsigned long root = of_get_flat_dt_root();
- 	char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(),
- 					  "device_type", NULL);
+ 	char *dtype = of_get_flat_dt_prop(root, "device_type", NULL);
+
  	if (dtype == NULL)
  		return 0;
  	if (strcmp(dtype, "chrp"))
#1 lore raw

PATCH 1/1 dont allow pSeries_probe to succeed without initialising MMU

pSeries_probe can decide that we are a pseries but then fail to initialise the MMU. If an rtas node doesnt exist, we continually fall out of pSeries_probe_hypertas early and never get to the MMU init code.

While pseries without RTAS is an illegal combination, the way we currently fail is a pain to track down, and can happen if your flattened device tree code has issues (like mine did :).

With the following patch we init the MMU, come up and print some warnings about RTAS not existing, instead of looping on 0x400 exceptions.

---

arch/powerpc/platforms/pseries/setup.c +5 -5
Index: kernel/arch/powerpc/platforms/pseries/setup.c
===================================================================
@@ -492,11 +492,6 @@ static int __init pSeries_probe_hypertas
 	if (of_get_flat_dt_prop(node, "ibm,hypertas-functions", NULL) != NULL)
  		powerpc_firmware_features |= FW_FEATURE_LPAR;
 
-	if (firmware_has_feature(FW_FEATURE_LPAR))
-		hpte_init_lpar();
-	else
-		hpte_init_native();
-
  	return 1;
 }
 
@@ -522,6 +517,11 @@ static int __init pSeries_probe(void)
 	/* Now try to figure out if we are running on LPAR */
 	of_scan_flat_dt(pSeries_probe_hypertas, NULL);
 
+	if (firmware_has_feature(FW_FEATURE_LPAR))
+		hpte_init_lpar();
+	else
+		hpte_init_native();
+
 	DBG("Machine is%s LPAR !\n",
 	    (powerpc_firmware_features & FW_FEATURE_LPAR) ? "" : " not");
 
#2 lore raw

Re: [PATCH] dont allow pSeries_probe to succeed without initialising MMU

arch/powerpc/platforms/pseries/setup.c static int __init pSeries_probe(void) · line 526

Quoted 3 lines · On Fri, 8 Dec 2006 18:22:09 +1100 Anton Blanchard <[email protected]> wrote:
arch/powerpc/platforms/pseries/setup.c +0 -0
 	DBG("Machine is%s LPAR !\n",
 	    (powerpc_firmware_features & FW_FEATURE_LPAR) ? "" : " not");
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Want to change that to firmware_has_feature(FW_FEATURE_LPAR) while you are there?

--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/