arch/s390/boot/physmem_info.c
Source file repositories/reference/linux-study-clean/arch/s390/boot/physmem_info.c
File Facts
- System
- Linux kernel
- Corpus path
arch/s390/boot/physmem_info.c- Extension
.c- Size
- 11015 bytes
- Lines
- 387
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/processor.hlinux/errno.hlinux/init.hasm/physmem_info.hasm/stacktrace.hasm/boot_data.hasm/sparsemem.hasm/sections.hasm/setup.hasm/sclp.hasm/asm.hasm/uv.hdecompressor.hboot.h
Detected Declarations
function add_physmem_online_rangefunction __diag260function diag260function diag500_storage_limitfunction tprotfunction search_mem_endfunction detect_max_physmem_endfunction detect_physmem_online_rangesfunction physmem_set_usable_limitfunction die_oomfunction _physmem_reservefunction physmem_reservefunction physmem_freefunction __physmem_alloc_intersectsfunction __physmem_alloc_rangefunction physmem_alloc_rangefunction physmem_allocfunction physmem_alloc_or_diefunction get_physmem_alloc_posfunction dump_physmem_reserved
Annotated Snippet
if (range->end == start) {
range->end = end;
return;
}
}
range = __get_physmem_range_ptr(physmem_info.range_count);
range->start = start;
range->end = end;
physmem_info.range_count++;
}
static int __diag260(unsigned long rx1, unsigned long rx2)
{
union register_pair rx;
int cc, exception;
unsigned long ry;
rx.even = rx1;
rx.odd = rx2;
ry = 0x10; /* storage configuration */
exception = 1;
asm_inline volatile(
" diag %[rx],%[ry],0x260\n"
"0: lhi %[exc],0\n"
"1:\n"
CC_IPM(cc)
EX_TABLE(0b, 1b)
: CC_OUT(cc, cc), [exc] "+d" (exception), [ry] "+d" (ry)
: [rx] "d" (rx.pair)
: CC_CLOBBER_LIST("memory"));
cc = exception ? -1 : CC_TRANSFORM(cc);
return cc == 0 ? ry : -1;
}
static int diag260(void)
{
int rc, i;
struct {
unsigned long start;
unsigned long end;
} storage_extents[8] __aligned(16); /* VM supports up to 8 extends */
memset(storage_extents, 0, sizeof(storage_extents));
rc = __diag260((unsigned long)storage_extents, sizeof(storage_extents));
if (rc == -1)
return -1;
for (i = 0; i < min_t(int, rc, ARRAY_SIZE(storage_extents)); i++)
add_physmem_online_range(storage_extents[i].start, storage_extents[i].end + 1);
return 0;
}
#define DIAG500_SC_STOR_LIMIT 4
static int diag500_storage_limit(unsigned long *max_physmem_end)
{
unsigned long storage_limit;
asm_inline volatile(
" lghi %%r1,%[subcode]\n"
" lghi %%r2,0\n"
" diag %%r2,%%r4,0x500\n"
"0: lgr %[slimit],%%r2\n"
EX_TABLE(0b, 0b)
: [slimit] "=d" (storage_limit)
: [subcode] "i" (DIAG500_SC_STOR_LIMIT)
: "memory", "1", "2");
if (!storage_limit)
return -EINVAL;
/* Convert inclusive end to exclusive end */
*max_physmem_end = storage_limit + 1;
return 0;
}
static int tprot(unsigned long addr)
{
int cc, exception;
exception = 1;
asm_inline volatile(
" tprot 0(%[addr]),0\n"
"0: lhi %[exc],0\n"
"1:\n"
CC_IPM(cc)
EX_TABLE(0b, 1b)
: CC_OUT(cc, cc), [exc] "+d" (exception)
: [addr] "a" (addr)
: CC_CLOBBER_LIST("memory"));
Annotation
- Immediate include surface: `linux/processor.h`, `linux/errno.h`, `linux/init.h`, `asm/physmem_info.h`, `asm/stacktrace.h`, `asm/boot_data.h`, `asm/sparsemem.h`, `asm/sections.h`.
- Detected declarations: `function add_physmem_online_range`, `function __diag260`, `function diag260`, `function diag500_storage_limit`, `function tprot`, `function search_mem_end`, `function detect_max_physmem_end`, `function detect_physmem_online_ranges`, `function physmem_set_usable_limit`, `function die_oom`.
- 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.