arch/powerpc/kernel/setup_64.c

Source file repositories/reference/linux-study-clean/arch/powerpc/kernel/setup_64.c

File Facts

System
Linux kernel
Corpus path
arch/powerpc/kernel/setup_64.c
Extension
.c
Size
25420 bytes
Lines
929
Domain
Architecture Layer
Bucket
arch/powerpc
Inferred role
Architecture Layer: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

if (dn) {
			smt_option = of_get_property(dn, "ibm,smt-enabled",
						     NULL);

			if (smt_option) {
				if (!strcmp(smt_option, "on"))
					smt_enabled_at_boot = threads_per_core;
				else if (!strcmp(smt_option, "off"))
					smt_enabled_at_boot = 0;
			}

			of_node_put(dn);
		}
	}
}

/* Look for smt-enabled= cmdline option */
static int __init early_smt_enabled(char *p)
{
	smt_enabled_cmdline = p;
	return 0;
}
early_param("smt-enabled", early_smt_enabled);

#endif /* CONFIG_SMP */

/** Fix up paca fields required for the boot cpu */
static void __init fixup_boot_paca(struct paca_struct *boot_paca)
{
	/* The boot cpu is started */
	boot_paca->cpu_start = 1;
#ifdef CONFIG_PPC_BOOK3S_64
	/*
	 * Give the early boot machine check stack somewhere to use, use
	 * half of the init stack. This is a bit hacky but there should not be
	 * deep stack usage in early init so shouldn't overflow it or overwrite
	 * things.
	 */
	boot_paca->mc_emergency_sp = (void *)&init_thread_union +
		(THREAD_SIZE/2);
#endif
	/* Allow percpu accesses to work until we setup percpu data */
	boot_paca->data_offset = 0;
	/* Mark interrupts soft and hard disabled in PACA */
	boot_paca->irq_soft_mask = IRQS_DISABLED;
	boot_paca->irq_happened = PACA_IRQ_HARD_DIS;
	WARN_ON(mfmsr() & MSR_EE);
}

static void __init configure_exceptions(void)
{
	/*
	 * Setup the trampolines from the lowmem exception vectors
	 * to the kdump kernel when not using a relocatable kernel.
	 */
	setup_kdump_trampoline();

	/* Under a PAPR hypervisor, we need hypercalls */
	if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
		/*
		 * - PR KVM does not support AIL mode interrupts in the host
		 *   while a PR guest is running.
		 *
		 * - SCV system call interrupt vectors are only implemented for
		 *   AIL mode interrupts.
		 *
		 * - On pseries, AIL mode can only be enabled and disabled
		 *   system-wide so when a PR VM is created on a pseries host,
		 *   all CPUs of the host are set to AIL=0 mode.
		 *
		 * - Therefore host CPUs must not execute scv while a PR VM
		 *   exists.
		 *
		 * - SCV support can not be disabled dynamically because the
		 *   feature is advertised to host userspace. Disabling the
		 *   facility and emulating it would be possible but is not
		 *   implemented.
		 *
		 * - So SCV support is blanket disabled if PR KVM could possibly
		 *   run. That is, PR support compiled in, booting on pseries
		 *   with hash MMU.
		 */
		if (IS_ENABLED(CONFIG_KVM_BOOK3S_PR_POSSIBLE) && !radix_enabled()) {
			init_task.thread.fscr &= ~FSCR_SCV;
			cur_cpu_spec->cpu_user_features2 &= ~PPC_FEATURE2_SCV;
		}

		/* Enable AIL if possible */
		if (!pseries_enable_reloc_on_exc()) {
			init_task.thread.fscr &= ~FSCR_SCV;

Annotation

Implementation Notes