arch/powerpc/mm/init-common.c
Source file repositories/reference/linux-study-clean/arch/powerpc/mm/init-common.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/mm/init-common.c- Extension
.c- Size
- 4579 bytes
- Lines
- 168
- 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.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/string.hlinux/pgtable.hasm/pgalloc.hasm/kup.hasm/smp.h
Detected Declarations
function parse_nosmepfunction parse_nosmapfunction setup_kuepfunction setup_kupfunction voidfunction kmem_cachefunction pgtable_cache_initexport memstart_addrexport kernstart_addrexport kernstart_virt_addrexport pgtable_cacheexport pgtable_cache_add
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* PowerPC version
* Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
*
* Modifications by Paul Mackerras (PowerMac) (paulus@cs.anu.edu.au)
* and Cort Dougan (PReP) (cort@cs.nmt.edu)
* Copyright (C) 1996 Paul Mackerras
*
* Derived from "arch/i386/mm/init.c"
* Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
*
* Dave Engebretsen <engebret@us.ibm.com>
* Rework for PPC64 port.
*/
#undef DEBUG
#include <linux/string.h>
#include <linux/pgtable.h>
#include <asm/pgalloc.h>
#include <asm/kup.h>
#include <asm/smp.h>
phys_addr_t memstart_addr __ro_after_init = (phys_addr_t)~0ull;
EXPORT_SYMBOL_GPL(memstart_addr);
phys_addr_t kernstart_addr __ro_after_init;
EXPORT_SYMBOL_GPL(kernstart_addr);
unsigned long kernstart_virt_addr __ro_after_init = KERNELBASE;
EXPORT_SYMBOL_GPL(kernstart_virt_addr);
bool disable_kuep = !IS_ENABLED(CONFIG_PPC_KUEP);
bool disable_kuap = !IS_ENABLED(CONFIG_PPC_KUAP);
#ifdef CONFIG_KFENCE
bool __ro_after_init kfence_disabled;
bool __ro_after_init kfence_early_init = !!CONFIG_KFENCE_SAMPLE_INTERVAL;
#endif
static int __init parse_nosmep(char *p)
{
if (!IS_ENABLED(CONFIG_PPC_BOOK3S_64))
return 0;
disable_kuep = true;
pr_warn("Disabling Kernel Userspace Execution Prevention\n");
return 0;
}
early_param("nosmep", parse_nosmep);
static int __init parse_nosmap(char *p)
{
disable_kuap = true;
pr_warn("Disabling Kernel Userspace Access Protection\n");
return 0;
}
early_param("nosmap", parse_nosmap);
void __weak setup_kuep(bool disabled)
{
if (!IS_ENABLED(CONFIG_PPC_KUEP) || disabled)
return;
if (smp_processor_id() != boot_cpuid)
return;
pr_info("Activating Kernel Userspace Execution Prevention\n");
}
void setup_kup(void)
{
setup_kuap(disable_kuap);
setup_kuep(disable_kuep);
}
#define CTOR(shift) static void ctor_##shift(void *addr) \
{ \
memset(addr, 0, sizeof(pgd_t) << (shift)); \
}
CTOR(0); CTOR(1); CTOR(2); CTOR(3); CTOR(4); CTOR(5); CTOR(6); CTOR(7);
CTOR(8); CTOR(9); CTOR(10); CTOR(11); CTOR(12); CTOR(13); CTOR(14); CTOR(15);
static inline void (*ctor(int shift))(void *)
{
BUILD_BUG_ON(MAX_PGTABLE_INDEX_SIZE != 15);
switch (shift) {
case 0: return ctor_0;
case 1: return ctor_1;
case 2: return ctor_2;
Annotation
- Immediate include surface: `linux/string.h`, `linux/pgtable.h`, `asm/pgalloc.h`, `asm/kup.h`, `asm/smp.h`.
- Detected declarations: `function parse_nosmep`, `function parse_nosmap`, `function setup_kuep`, `function setup_kup`, `function void`, `function kmem_cache`, `function pgtable_cache_init`, `export memstart_addr`, `export kernstart_addr`, `export kernstart_virt_addr`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.