powerpc/irq: use memblock functions returning virtual address
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. Suggested-by: Mike Rapoport <rppt@linux.ibm.com> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Acked-by: Mike Rapoport <rppt@linux.ibm.com> Reviewed-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:

committed by
Michael Ellerman

parent
eafd825ed7
commit
c8e409a33c
@@ -196,6 +196,17 @@ static int __init ppc_init(void)
|
||||
}
|
||||
arch_initcall(ppc_init);
|
||||
|
||||
static void *__init alloc_stack(void)
|
||||
{
|
||||
void *ptr = memblock_alloc(THREAD_SIZE, THREAD_SIZE);
|
||||
|
||||
if (!ptr)
|
||||
panic("cannot allocate %d bytes for stack at %pS\n",
|
||||
THREAD_SIZE, (void *)_RET_IP_);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void __init irqstack_early_init(void)
|
||||
{
|
||||
unsigned int i;
|
||||
@@ -203,10 +214,8 @@ void __init irqstack_early_init(void)
|
||||
/* interrupt stacks must be in lowmem, we get that for free on ppc32
|
||||
* as the memblock is limited to lowmem by default */
|
||||
for_each_possible_cpu(i) {
|
||||
softirq_ctx[i] = (struct thread_info *)
|
||||
__va(memblock_phys_alloc(THREAD_SIZE, THREAD_SIZE));
|
||||
hardirq_ctx[i] = (struct thread_info *)
|
||||
__va(memblock_phys_alloc(THREAD_SIZE, THREAD_SIZE));
|
||||
softirq_ctx[i] = alloc_stack();
|
||||
hardirq_ctx[i] = alloc_stack();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,13 +233,10 @@ void __init exc_lvl_early_init(void)
|
||||
hw_cpu = 0;
|
||||
#endif
|
||||
|
||||
critirq_ctx[hw_cpu] = (struct thread_info *)
|
||||
__va(memblock_phys_alloc(THREAD_SIZE, THREAD_SIZE));
|
||||
critirq_ctx[hw_cpu] = alloc_stack();
|
||||
#ifdef CONFIG_BOOKE
|
||||
dbgirq_ctx[hw_cpu] = (struct thread_info *)
|
||||
__va(memblock_phys_alloc(THREAD_SIZE, THREAD_SIZE));
|
||||
mcheckirq_ctx[hw_cpu] = (struct thread_info *)
|
||||
__va(memblock_phys_alloc(THREAD_SIZE, THREAD_SIZE));
|
||||
dbgirq_ctx[hw_cpu] = alloc_stack();
|
||||
mcheckirq_ctx[hw_cpu] = alloc_stack();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user