Skip to content

Commit 04a3411

Browse files
haokexinozbenh
authored andcommitted
powerpc/ppc32: Fix the bug in the init of non-base exception stack for UP
We would allocate one specific exception stack for each kind of non-base exceptions for every CPU. For ppc32 the CPU hard ID is used as the subscript to get the specific exception stack for one CPU. But for an UP kernel, there is only one element in the each kind of exception stack array. We would get stuck if the CPU hard ID is not equal to '0'. So in this case we should use the subscript '0' no matter what the CPU hard ID is. Signed-off-by: Kevin Hao <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
1 parent d2b496e commit 04a3411

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

arch/powerpc/kernel/irq.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,8 +559,13 @@ void exc_lvl_ctx_init(void)
559559
#ifdef CONFIG_PPC64
560560
cpu_nr = i;
561561
#else
562+
#ifdef CONFIG_SMP
562563
cpu_nr = get_hard_smp_processor_id(i);
564+
#else
565+
cpu_nr = 0;
563566
#endif
567+
#endif
568+
564569
memset((void *)critirq_ctx[cpu_nr], 0, THREAD_SIZE);
565570
tp = critirq_ctx[cpu_nr];
566571
tp->cpu = cpu_nr;

arch/powerpc/kernel/setup_32.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,12 @@ static void __init exc_lvl_early_init(void)
247247
/* interrupt stacks must be in lowmem, we get that for free on ppc32
248248
* as the memblock is limited to lowmem by MEMBLOCK_REAL_LIMIT */
249249
for_each_possible_cpu(i) {
250+
#ifdef CONFIG_SMP
250251
hw_cpu = get_hard_smp_processor_id(i);
252+
#else
253+
hw_cpu = 0;
254+
#endif
255+
251256
critirq_ctx[hw_cpu] = (struct thread_info *)
252257
__va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
253258
#ifdef CONFIG_BOOKE

0 commit comments

Comments
 (0)