Skip to content

Commit 91b6fad

Browse files
ozbenhmpe
authored andcommitted
powerpc/pmac: Remove early allocation of the SMU command buffer
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>
1 parent d3cbff1 commit 91b6fad

3 files changed

Lines changed: 8 additions & 24 deletions

File tree

‎arch/powerpc/include/asm/smu.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -470,13 +470,6 @@ struct rtc_time;
470470
extern int smu_get_rtc_time(struct rtc_time *time, int spinwait);
471471
extern int smu_set_rtc_time(struct rtc_time *time, int spinwait);
472472

473-
/*
474-
* SMU command buffer absolute address, exported by pmac_setup,
475-
* this is allocated very early during boot.
476-
*/
477-
extern unsigned long smu_cmdbuf_abs;
478-
479-
480473
/*
481474
* Kernel asynchronous i2c interface
482475
*/

‎arch/powerpc/platforms/powermac/setup.c‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
#include <linux/suspend.h>
5353
#include <linux/of_device.h>
5454
#include <linux/of_platform.h>
55-
#include <linux/memblock.h>
5655

5756
#include <asm/reg.h>
5857
#include <asm/sections.h>
@@ -97,11 +96,6 @@ int sccdbg;
9796
sys_ctrler_t sys_ctrler = SYS_CTRLER_UNKNOWN;
9897
EXPORT_SYMBOL(sys_ctrler);
9998

100-
#ifdef CONFIG_PMAC_SMU
101-
unsigned long smu_cmdbuf_abs;
102-
EXPORT_SYMBOL(smu_cmdbuf_abs);
103-
#endif
104-
10599
static void pmac_show_cpuinfo(struct seq_file *m)
106100
{
107101
struct device_node *np;
@@ -325,7 +319,6 @@ static void __init pmac_setup_arch(void)
325319
defined(CONFIG_PPC64)
326320
pmac_nvram_init();
327321
#endif
328-
329322
#ifdef CONFIG_PPC32
330323
#ifdef CONFIG_BLK_DEV_INITRD
331324
if (initrd_start)
@@ -617,15 +610,6 @@ static int __init pmac_probe(void)
617610
DMA_MODE_WRITE = 2;
618611
#endif /* CONFIG_PPC32 */
619612

620-
#ifdef CONFIG_PMAC_SMU
621-
/*
622-
* SMU based G5s need some memory below 2Gb, at least the current
623-
* driver needs that. We have to allocate it now. We allocate 4k
624-
* (1 small page) for now.
625-
*/
626-
smu_cmdbuf_abs = memblock_alloc_base(4096, 4096, 0x80000000UL);
627-
#endif /* CONFIG_PMAC_SMU */
628-
629613
pm_power_off = pmac_power_off;
630614

631615
return 1;

‎drivers/macintosh/smu.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include <linux/of_irq.h>
3939
#include <linux/of_platform.h>
4040
#include <linux/slab.h>
41+
#include <linux/memblock.h>
4142

4243
#include <asm/byteorder.h>
4344
#include <asm/io.h>
@@ -99,6 +100,7 @@ static DEFINE_MUTEX(smu_mutex);
99100
static struct smu_device *smu;
100101
static DEFINE_MUTEX(smu_part_access);
101102
static int smu_irq_inited;
103+
static unsigned long smu_cmdbuf_abs;
102104

103105
static void smu_i2c_retry(unsigned long data);
104106

@@ -479,8 +481,13 @@ int __init smu_init (void)
479481

480482
printk(KERN_INFO "SMU: Driver %s %s\n", VERSION, AUTHOR);
481483

484+
/*
485+
* SMU based G5s need some memory below 2Gb. Thankfully this is
486+
* called at a time where memblock is still available.
487+
*/
488+
smu_cmdbuf_abs = memblock_alloc_base(4096, 4096, 0x80000000UL);
482489
if (smu_cmdbuf_abs == 0) {
483-
printk(KERN_ERR "SMU: Command buffer not allocated !\n");
490+
printk(KERN_ERR "SMU: Command buffer allocation failed !\n");
484491
ret = -EINVAL;
485492
goto fail_np;
486493
}

0 commit comments

Comments
 (0)