setup_64.c (9b031c86506cef9acae45e61339fcf9deaabb793) setup_64.c (7fa95f9adaee7e5cbb195d3359741120829e488b)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 *
4 * Common boot and setup code.
5 *
6 * Copyright (C) 2001 PPC64 Team, IBM Corp
7 */
8

--- 16 unchanged lines hidden (view full) ---

25#include <linux/unistd.h>
26#include <linux/serial.h>
27#include <linux/serial_8250.h>
28#include <linux/memblock.h>
29#include <linux/pci.h>
30#include <linux/lockdep.h>
31#include <linux/memory.h>
32#include <linux/nmi.h>
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 *
4 * Common boot and setup code.
5 *
6 * Copyright (C) 2001 PPC64 Team, IBM Corp
7 */
8

--- 16 unchanged lines hidden (view full) ---

25#include <linux/unistd.h>
26#include <linux/serial.h>
27#include <linux/serial_8250.h>
28#include <linux/memblock.h>
29#include <linux/pci.h>
30#include <linux/lockdep.h>
31#include <linux/memory.h>
32#include <linux/nmi.h>
33#include <linux/pgtable.h>
33
34#include <asm/debugfs.h>
35#include <asm/io.h>
36#include <asm/kdump.h>
37#include <asm/prom.h>
38#include <asm/processor.h>
34
35#include <asm/debugfs.h>
36#include <asm/io.h>
37#include <asm/kdump.h>
38#include <asm/prom.h>
39#include <asm/processor.h>
39#include <asm/pgtable.h>
40#include <asm/smp.h>
41#include <asm/elf.h>
42#include <asm/machdep.h>
43#include <asm/paca.h>
44#include <asm/time.h>
45#include <asm/cputable.h>
46#include <asm/dt_cpu_ftrs.h>
47#include <asm/sections.h>

--- 143 unchanged lines hidden (view full) ---

191 * Setup the trampolines from the lowmem exception vectors
192 * to the kdump kernel when not using a relocatable kernel.
193 */
194 setup_kdump_trampoline();
195
196 /* Under a PAPR hypervisor, we need hypercalls */
197 if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
198 /* Enable AIL if possible */
40#include <asm/smp.h>
41#include <asm/elf.h>
42#include <asm/machdep.h>
43#include <asm/paca.h>
44#include <asm/time.h>
45#include <asm/cputable.h>
46#include <asm/dt_cpu_ftrs.h>
47#include <asm/sections.h>

--- 143 unchanged lines hidden (view full) ---

191 * Setup the trampolines from the lowmem exception vectors
192 * to the kdump kernel when not using a relocatable kernel.
193 */
194 setup_kdump_trampoline();
195
196 /* Under a PAPR hypervisor, we need hypercalls */
197 if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
198 /* Enable AIL if possible */
199 pseries_enable_reloc_on_exc();
199 if (!pseries_enable_reloc_on_exc()) {
200 init_task.thread.fscr &= ~FSCR_SCV;
201 cur_cpu_spec->cpu_user_features2 &= ~PPC_FEATURE2_SCV;
202 }
200
201 /*
202 * Tell the hypervisor that we want our exceptions to
203 * be taken in little endian mode.
204 *
205 * We don't call this for big endian as our calling convention
206 * makes us always enter in BE, and the call may fail under
207 * some circumstances with kdump.

--- 498 unchanged lines hidden (view full) ---

706
707/*
708 * Stack space used when we detect a bad kernel stack pointer, and
709 * early in SMP boots before relocation is enabled. Exclusive emergency
710 * stack for machine checks.
711 */
712void __init emergency_stack_init(void)
713{
203
204 /*
205 * Tell the hypervisor that we want our exceptions to
206 * be taken in little endian mode.
207 *
208 * We don't call this for big endian as our calling convention
209 * makes us always enter in BE, and the call may fail under
210 * some circumstances with kdump.

--- 498 unchanged lines hidden (view full) ---

709
710/*
711 * Stack space used when we detect a bad kernel stack pointer, and
712 * early in SMP boots before relocation is enabled. Exclusive emergency
713 * stack for machine checks.
714 */
715void __init emergency_stack_init(void)
716{
714 u64 limit;
717 u64 limit, mce_limit;
715 unsigned int i;
716
717 /*
718 * Emergency stacks must be under 256MB, we cannot afford to take
719 * SLB misses on them. The ABI also requires them to be 128-byte
720 * aligned.
721 *
722 * Since we use these as temporary stacks during secondary CPU
723 * bringup, machine check, system reset, and HMI, we need to get
724 * at them in real mode. This means they must also be within the RMO
725 * region.
726 *
727 * The IRQ stacks allocated elsewhere in this file are zeroed and
728 * initialized in kernel/irq.c. These are initialized here in order
729 * to have emergency stacks available as early as possible.
730 */
718 unsigned int i;
719
720 /*
721 * Emergency stacks must be under 256MB, we cannot afford to take
722 * SLB misses on them. The ABI also requires them to be 128-byte
723 * aligned.
724 *
725 * Since we use these as temporary stacks during secondary CPU
726 * bringup, machine check, system reset, and HMI, we need to get
727 * at them in real mode. This means they must also be within the RMO
728 * region.
729 *
730 * The IRQ stacks allocated elsewhere in this file are zeroed and
731 * initialized in kernel/irq.c. These are initialized here in order
732 * to have emergency stacks available as early as possible.
733 */
731 limit = min(ppc64_bolted_size(), ppc64_rma_size);
734 limit = mce_limit = min(ppc64_bolted_size(), ppc64_rma_size);
732
735
736 /*
737 * Machine check on pseries calls rtas, but can't use the static
738 * rtas_args due to a machine check hitting while the lock is held.
739 * rtas args have to be under 4GB, so the machine check stack is
740 * limited to 4GB so args can be put on stack.
741 */
742 if (firmware_has_feature(FW_FEATURE_LPAR) && mce_limit > SZ_4G)
743 mce_limit = SZ_4G;
744
733 for_each_possible_cpu(i) {
734 paca_ptrs[i]->emergency_sp = alloc_stack(limit, i) + THREAD_SIZE;
735
736#ifdef CONFIG_PPC_BOOK3S_64
737 /* emergency stack for NMI exception handling. */
738 paca_ptrs[i]->nmi_emergency_sp = alloc_stack(limit, i) + THREAD_SIZE;
739
740 /* emergency stack for machine check exception handling. */
745 for_each_possible_cpu(i) {
746 paca_ptrs[i]->emergency_sp = alloc_stack(limit, i) + THREAD_SIZE;
747
748#ifdef CONFIG_PPC_BOOK3S_64
749 /* emergency stack for NMI exception handling. */
750 paca_ptrs[i]->nmi_emergency_sp = alloc_stack(limit, i) + THREAD_SIZE;
751
752 /* emergency stack for machine check exception handling. */
741 paca_ptrs[i]->mc_emergency_sp = alloc_stack(limit, i) + THREAD_SIZE;
753 paca_ptrs[i]->mc_emergency_sp = alloc_stack(mce_limit, i) + THREAD_SIZE;
742#endif
743 }
744}
745
746#ifdef CONFIG_SMP
747#define PCPU_DYN_SIZE ()
748
749static void * __init pcpu_fc_alloc(unsigned int cpu, size_t size, size_t align)

--- 239 unchanged lines hidden ---
754#endif
755 }
756}
757
758#ifdef CONFIG_SMP
759#define PCPU_DYN_SIZE ()
760
761static void * __init pcpu_fc_alloc(unsigned int cpu, size_t size, size_t align)

--- 239 unchanged lines hidden ---