Commit ca1769f7 authored by Michael Ellerman's avatar Michael Ellerman Committed by Benjamin Herrenschmidt

powerpc: Index crit/dbg/mcheck stacks using cpu number on 64bit

In exc_lvl_ctx_init() we index into the crit/dbg/mcheck stacks using
the hard cpu id, but that assumes the hard cpu id is zero based and
contiguous. That is not the case on A2.

The root of the problem is that the 32bit code has no equivalent of the
paca to allow it to do the hard->soft mapping in assembler. Until the
32bit code is updated to handle that, index the stacks using the soft
cpu ids on 64bit and hard on 32 bit.
Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent bd491781
...@@ -397,24 +397,28 @@ struct thread_info *mcheckirq_ctx[NR_CPUS] __read_mostly; ...@@ -397,24 +397,28 @@ struct thread_info *mcheckirq_ctx[NR_CPUS] __read_mostly;
void exc_lvl_ctx_init(void) void exc_lvl_ctx_init(void)
{ {
struct thread_info *tp; struct thread_info *tp;
int i, hw_cpu; int i, cpu_nr;
for_each_possible_cpu(i) { for_each_possible_cpu(i) {
hw_cpu = get_hard_smp_processor_id(i); #ifdef CONFIG_PPC64
memset((void *)critirq_ctx[hw_cpu], 0, THREAD_SIZE); cpu_nr = i;
tp = critirq_ctx[hw_cpu]; #else
tp->cpu = i; cpu_nr = get_hard_smp_processor_id(i);
#endif
memset((void *)critirq_ctx[cpu_nr], 0, THREAD_SIZE);
tp = critirq_ctx[cpu_nr];
tp->cpu = cpu_nr;
tp->preempt_count = 0; tp->preempt_count = 0;
#ifdef CONFIG_BOOKE #ifdef CONFIG_BOOKE
memset((void *)dbgirq_ctx[hw_cpu], 0, THREAD_SIZE); memset((void *)dbgirq_ctx[cpu_nr], 0, THREAD_SIZE);
tp = dbgirq_ctx[hw_cpu]; tp = dbgirq_ctx[cpu_nr];
tp->cpu = i; tp->cpu = cpu_nr;
tp->preempt_count = 0; tp->preempt_count = 0;
memset((void *)mcheckirq_ctx[hw_cpu], 0, THREAD_SIZE); memset((void *)mcheckirq_ctx[cpu_nr], 0, THREAD_SIZE);
tp = mcheckirq_ctx[hw_cpu]; tp = mcheckirq_ctx[cpu_nr];
tp->cpu = i; tp->cpu = cpu_nr;
tp->preempt_count = HARDIRQ_OFFSET; tp->preempt_count = HARDIRQ_OFFSET;
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment