arch/s390/kernel/os_info.c
Source file repositories/reference/linux-study-clean/arch/s390/kernel/os_info.c
File Facts
- System
- Linux kernel
- Corpus path
arch/s390/kernel/os_info.c- Extension
.c- Size
- 5014 bytes
- Lines
- 197
- Domain
- Architecture Layer
- Bucket
- arch/s390
- 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.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/crash_dump.hlinux/kernel.hlinux/slab.hasm/checksum.hasm/abs_lowcore.hasm/os_info.hasm/physmem_info.hasm/maccess.hasm/asm-offsets.hasm/sections.hasm/ipl.h
Detected Declarations
function os_info_csumfunction os_info_crashkernel_addfunction os_info_entry_add_datafunction os_info_entry_add_valfunction os_info_initfunction os_info_old_allocfunction os_info_old_init
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* OS info memory interface
*
* Copyright IBM Corp. 2012
* Author(s): Michael Holzheu <holzheu@linux.vnet.ibm.com>
*/
#define pr_fmt(fmt) "os_info: " fmt
#include <linux/crash_dump.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <asm/checksum.h>
#include <asm/abs_lowcore.h>
#include <asm/os_info.h>
#include <asm/physmem_info.h>
#include <asm/maccess.h>
#include <asm/asm-offsets.h>
#include <asm/sections.h>
#include <asm/ipl.h>
/*
* OS info structure has to be page aligned
*/
static struct os_info os_info __page_aligned_data;
/*
* Compute checksum over OS info structure
*/
u32 os_info_csum(struct os_info *os_info)
{
int size = sizeof(*os_info) - offsetof(struct os_info, version_major);
return (__force u32)cksm(&os_info->version_major, size, 0);
}
/*
* Add crashkernel info to OS info and update checksum
*/
void os_info_crashkernel_add(unsigned long base, unsigned long size)
{
os_info.crashkernel_addr = (u64)(unsigned long)base;
os_info.crashkernel_size = (u64)(unsigned long)size;
os_info.csum = os_info_csum(&os_info);
}
/*
* Add OS info data entry and update checksum
*/
void os_info_entry_add_data(int nr, void *ptr, u64 size)
{
os_info.entry[nr].addr = __pa(ptr);
os_info.entry[nr].size = size;
os_info.entry[nr].csum = (__force u32)cksm(ptr, size, 0);
os_info.csum = os_info_csum(&os_info);
}
/*
* Add OS info value entry and update checksum
*/
void os_info_entry_add_val(int nr, u64 value)
{
os_info.entry[nr].val = value;
os_info.entry[nr].size = 0;
os_info.entry[nr].csum = 0;
os_info.csum = os_info_csum(&os_info);
}
/*
* Initialize OS info structure and set lowcore pointer
*/
void __init os_info_init(void)
{
struct lowcore *abs_lc;
BUILD_BUG_ON(sizeof(struct os_info) != PAGE_SIZE);
os_info.version_major = OS_INFO_VERSION_MAJOR;
os_info.version_minor = OS_INFO_VERSION_MINOR;
os_info.magic = OS_INFO_MAGIC;
os_info_entry_add_val(OS_INFO_IDENTITY_BASE, __identity_base);
os_info_entry_add_val(OS_INFO_KASLR_OFFSET, kaslr_offset());
os_info_entry_add_val(OS_INFO_KASLR_OFF_PHYS, __kaslr_offset_phys);
os_info_entry_add_val(OS_INFO_VMEMMAP, (unsigned long)vmemmap);
os_info_entry_add_val(OS_INFO_AMODE31_START, AMODE31_START);
os_info_entry_add_val(OS_INFO_AMODE31_END, AMODE31_END);
os_info_entry_add_val(OS_INFO_IMAGE_START, (unsigned long)_stext);
os_info_entry_add_val(OS_INFO_IMAGE_END, (unsigned long)_end);
os_info_entry_add_val(OS_INFO_IMAGE_PHYS, __pa_symbol(_stext));
os_info.csum = os_info_csum(&os_info);
abs_lc = get_abs_lowcore();
Annotation
- Immediate include surface: `linux/crash_dump.h`, `linux/kernel.h`, `linux/slab.h`, `asm/checksum.h`, `asm/abs_lowcore.h`, `asm/os_info.h`, `asm/physmem_info.h`, `asm/maccess.h`.
- Detected declarations: `function os_info_csum`, `function os_info_crashkernel_add`, `function os_info_entry_add_data`, `function os_info_entry_add_val`, `function os_info_init`, `function os_info_old_alloc`, `function os_info_old_init`.
- Atlas domain: Architecture Layer / arch/s390.
- Implementation status: source 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.