arch/powerpc/platforms/powernv/setup.c

Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/powernv/setup.c

File Facts

System
Linux kernel
Corpus path
arch/powerpc/platforms/powernv/setup.c
Extension
.c
Size
14801 bytes
Lines
589
Domain
Architecture Layer
Bucket
arch/powerpc
Inferred role
Architecture Layer: implementation source
Status
source 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

pvr_version_is(PVR_POWER8)) {
		security_ftr_clear(SEC_FTR_L1D_FLUSH_ENTRY);
		security_ftr_clear(SEC_FTR_L1D_FLUSH_UACCESS);
	}

	enable = security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) && \
		 (security_ftr_enabled(SEC_FTR_L1D_FLUSH_PR)   || \
		  security_ftr_enabled(SEC_FTR_L1D_FLUSH_HV));

	setup_rfi_flush(type, enable);
	setup_count_cache_flush();

	enable = security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) &&
		 security_ftr_enabled(SEC_FTR_L1D_FLUSH_ENTRY);
	setup_entry_flush(enable);

	enable = security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) &&
		 security_ftr_enabled(SEC_FTR_L1D_FLUSH_UACCESS);
	setup_uaccess_flush(enable);

	setup_stf_barrier();
}

static void __init pnv_check_guarded_cores(void)
{
	struct device_node *dn;
	int bad_count = 0;

	for_each_node_by_type(dn, "cpu") {
		if (of_property_match_string(dn, "status", "bad") >= 0)
			bad_count++;
	}

	if (bad_count) {
		printk("  _     _______________\n");
		pr_cont(" | |   /               \\\n");
		pr_cont(" | |   |    WARNING!   |\n");
		pr_cont(" | |   |               |\n");
		pr_cont(" | |   | It looks like |\n");
		pr_cont(" |_|   |  you have %*d |\n", 3, bad_count);
		pr_cont("  _    | guarded cores |\n");
		pr_cont(" (_)   \\_______________/\n");
	}
}

static void __init pnv_setup_arch(void)
{
	set_arch_panic_timeout(10, ARCH_PANIC_TIMEOUT);

	pnv_setup_security_mitigations();

	/* Initialize SMP */
	pnv_smp_init();

	/* Setup RTC and NVRAM callbacks */
	if (firmware_has_feature(FW_FEATURE_OPAL))
		opal_nvram_init();

	/* Enable NAP mode */
	powersave_nap = 1;

	pnv_check_guarded_cores();

	/* XXX PMCS */

	pnv_rng_init();
}

static void __init pnv_add_hw_description(void)
{
	struct device_node *dn;
	const char *s;

	dn = of_find_node_by_path("/ibm,opal/firmware");
	if (!dn)
		return;

	if (of_property_read_string(dn, "version", &s) == 0 ||
	    of_property_read_string(dn, "git-id", &s) == 0)
		seq_buf_printf(&ppc_hw_desc, "opal:%s ", s);

	if (of_property_read_string(dn, "mi-version", &s) == 0)
		seq_buf_printf(&ppc_hw_desc, "mi:%s ", s);

	of_node_put(dn);
}

static void __init pnv_init(void)
{
	pnv_add_hw_description();

Annotation

Implementation Notes