]> git.baikalelectronics.ru Git - kernel.git/commitdiff
powerpc: use memblock functions returning virtual address
authorChristophe Leroy <christophe.leroy@c-s.fr>
Tue, 12 Mar 2019 06:29:00 +0000 (23:29 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 12 Mar 2019 17:04:01 +0000 (10:04 -0700)
Since only the virtual address of allocated blocks is used, lets use
functions returning directly virtual address.

Those functions have the advantage of also zeroing the block.

[rppt@linux.ibm.com: powerpc: remove duplicated alloc_stack() function]
Link: http://lkml.kernel.org/r/20190226064032.GA5873@rapoport-lnx
[rppt@linux.ibm.com: updated error message in alloc_stack() to be more verbose]
[rppt@linux.ibm.com: convereted several additional call sites ]
Link: http://lkml.kernel.org/r/1548057848-15136-3-git-send-email-rppt@linux.ibm.com
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Dennis Zhou <dennis@kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Greentime Hu <green.hu@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Guan Xuetao <gxt@pku.edu.cn>
Cc: Guo Ren <guoren@kernel.org>
Cc: Guo Ren <ren_guo@c-sky.com> [c-sky]
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Juergen Gross <jgross@suse.com> [Xen]
Cc: Mark Salter <msalter@redhat.com>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Paul Burton <paul.burton@mips.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Rich Felker <dalias@libc.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Stafford Horne <shorne@gmail.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/powerpc/kernel/dt_cpu_ftrs.c
arch/powerpc/kernel/paca.c
arch/powerpc/kernel/prom.c

index e49bd5efcfe66b5092f241bca00a2688ce5ac396..28c076c771de8610396663008ce79a989f3ef98a 100644 (file)
@@ -810,7 +810,6 @@ static int __init process_cpufeatures_node(unsigned long node,
        int len;
 
        f = &dt_cpu_features[i];
-       memset(f, 0, sizeof(struct dt_cpu_feature));
 
        f->node = node;
 
@@ -1005,7 +1004,7 @@ static int __init dt_cpu_ftrs_scan_callback(unsigned long node, const char
        /* Count and allocate space for cpu features */
        of_scan_flat_dt_subnodes(node, count_cpufeatures_subnodes,
                                                &nr_dt_cpu_features);
-       dt_cpu_features = __va(memblock_phys_alloc(sizeof(struct dt_cpu_feature) * nr_dt_cpu_features, PAGE_SIZE));
+       dt_cpu_features = memblock_alloc(sizeof(struct dt_cpu_feature) * nr_dt_cpu_features, PAGE_SIZE);
 
        cpufeatures_setup_start(isa);
 
index 8c890c6557edea1c1335d3df1fab94685e06ec42..e7382abee86849f136a6337eedf58a417dba6ea9 100644 (file)
@@ -196,7 +196,11 @@ void __init allocate_paca_ptrs(void)
        paca_nr_cpu_ids = nr_cpu_ids;
 
        paca_ptrs_size = sizeof(struct paca_struct *) * nr_cpu_ids;
-       paca_ptrs = __va(memblock_phys_alloc(paca_ptrs_size, SMP_CACHE_BYTES));
+       paca_ptrs = memblock_alloc_raw(paca_ptrs_size, SMP_CACHE_BYTES);
+       if (!paca_ptrs)
+               panic("Failed to allocate %d bytes for paca pointers\n",
+                     paca_ptrs_size);
+
        memset(paca_ptrs, 0x88, paca_ptrs_size);
 }
 
index 4181ec715f8889c4bf041b74da247632c7a2f651..4221527b082f40d1989a0fa86660a394b9380892 100644 (file)
@@ -126,7 +126,10 @@ static void __init move_device_tree(void)
        if ((memory_limit && (start + size) > PHYSICAL_START + memory_limit) ||
            !memblock_is_memory(start + size - 1) ||
            overlaps_crashkernel(start, size) || overlaps_initrd(start, size)) {
-               p = __va(memblock_phys_alloc(size, PAGE_SIZE));
+               p = memblock_alloc_raw(size, PAGE_SIZE);
+               if (!p)
+                       panic("Failed to allocate %lu bytes to move device tree\n",
+                             size);
                memcpy(p, initial_boot_params, size);
                initial_boot_params = p;
                DBG("Moved device tree to 0x%px\n", p);