]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
powerpc: Enable relocation on during exceptions at boot
authorIan Munsie <imunsie@au1.ibm.com>
Thu, 8 Nov 2012 05:03:14 +0000 (16:03 +1100)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 15 Nov 2012 04:08:08 +0000 (15:08 +1100)
We currently do this synchronously at boot from setup_arch. On a large
system this could hypothetically take a little while to complete, so
currently we will give up if we are asked to wait for more than a second
in total.

If we actually start hitting that timeout in practice we can always move
this code into a kernel thread to take care of it in the background.

Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/pseries/setup.c

index e1a5b8a32d25532e2e2307db623ad0cba2170d6d..5d97553e5c226b92bcceb2de31020116c7f713be 100644 (file)
@@ -367,6 +367,36 @@ static void pSeries_idle(void)
        }
 }
 
+/*
+ * Enable relocation on during exceptions. This has partition wide scope and
+ * may take a while to complete, if it takes longer than one second we will
+ * just give up rather than wasting any more time on this - if that turns out
+ * to ever be a problem in practice we can move this into a kernel thread to
+ * finish off the process later in boot.
+ */
+static int __init pSeries_enable_reloc_on_exc(void)
+{
+       long rc;
+       unsigned int delay, total_delay = 0;
+
+       while (1) {
+               rc = enable_reloc_on_exceptions();
+               if (!H_IS_LONG_BUSY(rc))
+                       return rc;
+
+               delay = get_longbusy_msecs(rc);
+               total_delay += delay;
+               if (total_delay > 1000) {
+                       pr_warn("Warning: Giving up waiting to enable "
+                               "relocation on exceptions (%u msec)!\n",
+                               total_delay);
+                       return rc;
+               }
+
+               mdelay(delay);
+       }
+}
+
 static void __init pSeries_setup_arch(void)
 {
        panic_timeout = 10;
@@ -402,6 +432,14 @@ static void __init pSeries_setup_arch(void)
                ppc_md.enable_pmcs = pseries_lpar_enable_pmcs;
        else
                ppc_md.enable_pmcs = power4_enable_pmcs;
+
+       if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
+               long rc;
+               if ((rc = pSeries_enable_reloc_on_exc()) != H_SUCCESS) {
+                       pr_warn("Unable to enable relocation on exceptions: "
+                               "%ld\n", rc);
+               }
+       }
 }
 
 static int __init pSeries_init_panel(void)