powerpc/pmac: Remove early allocation of the SMU command buffer
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 5 Jul 2016 05:03:50 +0000 (15:03 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 21 Jul 2016 08:56:38 +0000 (18:56 +1000)
The SMU command buffer needs to be allocated below 2G using memblock.

In the past, this had to be done very early from the arch code as
memblock wasn't available past that point. That is no longer the
case though, smu_init() is called from setup_arch() when memblock
is still functional these days. So move the allocation to the
SMU driver itself.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/smu.h
arch/powerpc/platforms/powermac/setup.c
drivers/macintosh/smu.c

index 9dc2de5da35aab00b23c0aef0ace282be2521cad..09f98e8618696e7260a109a5ace9e982ed182b73 100644 (file)
@@ -470,13 +470,6 @@ struct rtc_time;
 extern int smu_get_rtc_time(struct rtc_time *time, int spinwait);
 extern int smu_set_rtc_time(struct rtc_time *time, int spinwait);
 
-/*
- * SMU command buffer absolute address, exported by pmac_setup,
- * this is allocated very early during boot.
- */
-extern unsigned long smu_cmdbuf_abs;
-
-
 /*
  * Kernel asynchronous i2c interface
  */
index fc0b69f6e3d4c8d85ce20ac54f3a3c337a26b7b6..4ad61687c67050761ec06560adbc8ff6793ab3ac 100644 (file)
@@ -52,7 +52,6 @@
 #include <linux/suspend.h>
 #include <linux/of_device.h>
 #include <linux/of_platform.h>
-#include <linux/memblock.h>
 
 #include <asm/reg.h>
 #include <asm/sections.h>
@@ -97,11 +96,6 @@ int sccdbg;
 sys_ctrler_t sys_ctrler = SYS_CTRLER_UNKNOWN;
 EXPORT_SYMBOL(sys_ctrler);
 
-#ifdef CONFIG_PMAC_SMU
-unsigned long smu_cmdbuf_abs;
-EXPORT_SYMBOL(smu_cmdbuf_abs);
-#endif
-
 static void pmac_show_cpuinfo(struct seq_file *m)
 {
        struct device_node *np;
@@ -325,7 +319,6 @@ static void __init pmac_setup_arch(void)
     defined(CONFIG_PPC64)
        pmac_nvram_init();
 #endif
-
 #ifdef CONFIG_PPC32
 #ifdef CONFIG_BLK_DEV_INITRD
        if (initrd_start)
@@ -617,15 +610,6 @@ static int __init pmac_probe(void)
        DMA_MODE_WRITE = 2;
 #endif /* CONFIG_PPC32 */
 
-#ifdef CONFIG_PMAC_SMU
-       /*
-        * SMU based G5s need some memory below 2Gb, at least the current
-        * driver needs that. We have to allocate it now. We allocate 4k
-        * (1 small page) for now.
-        */
-       smu_cmdbuf_abs = memblock_alloc_base(4096, 4096, 0x80000000UL);
-#endif /* CONFIG_PMAC_SMU */
-
        pm_power_off = pmac_power_off;
 
        return 1;
index d531f804455d254ec90aa0f2e4573f21aef57ba8..d6f72c826c1c8f0acc732232debb2a639694c7d7 100644 (file)
@@ -38,6 +38,7 @@
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/slab.h>
+#include <linux/memblock.h>
 
 #include <asm/byteorder.h>
 #include <asm/io.h>
@@ -99,6 +100,7 @@ static DEFINE_MUTEX(smu_mutex);
 static struct smu_device       *smu;
 static DEFINE_MUTEX(smu_part_access);
 static int smu_irq_inited;
+static unsigned long smu_cmdbuf_abs;
 
 static void smu_i2c_retry(unsigned long data);
 
@@ -479,8 +481,13 @@ int __init smu_init (void)
 
        printk(KERN_INFO "SMU: Driver %s %s\n", VERSION, AUTHOR);
 
+       /*
+        * SMU based G5s need some memory below 2Gb. Thankfully this is
+        * called at a time where memblock is still available.
+        */
+       smu_cmdbuf_abs = memblock_alloc_base(4096, 4096, 0x80000000UL);
        if (smu_cmdbuf_abs == 0) {
-               printk(KERN_ERR "SMU: Command buffer not allocated !\n");
+               printk(KERN_ERR "SMU: Command buffer allocation failed !\n");
                ret = -EINVAL;
                goto fail_np;
        }
This page took 0.029345 seconds and 5 git commands to generate.