arch/s390/kernel/ctlreg.c
Source file repositories/reference/linux-study-clean/arch/s390/kernel/ctlreg.c
File Facts
- System
- Linux kernel
- Corpus path
arch/s390/kernel/ctlreg.c- Extension
.c- Size
- 2662 bytes
- Lines
- 123
- Domain
- Architecture Layer
- Bucket
- arch/s390
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/irqflags.hlinux/spinlock.hlinux/export.hlinux/kernel.hlinux/init.hlinux/smp.hlinux/cache.hasm/abs_lowcore.hasm/ctlreg.h
Detected Declarations
struct ctlreg_parmsfunction system_ctlreg_lockfunction system_ctlreg_unlockfunction system_ctlreg_init_save_areafunction ctlreg_callbackfunction system_ctlreg_updatefunction system_ctlreg_modifyexport system_ctlreg_modify
Annotated Snippet
struct ctlreg_parms {
unsigned long andval;
unsigned long orval;
unsigned long val;
int request;
int cr;
};
static void ctlreg_callback(void *info)
{
struct ctlreg_parms *pp = info;
struct ctlreg regs[16];
__local_ctl_store(0, 15, regs);
if (pp->request == CTLREG_LOAD) {
regs[pp->cr].val = pp->val;
} else {
regs[pp->cr].val &= pp->andval;
regs[pp->cr].val |= pp->orval;
}
__local_ctl_load(0, 15, regs);
}
static void system_ctlreg_update(void *info)
{
unsigned long flags;
if (system_state == SYSTEM_BOOTING) {
/*
* For very early calls do not call on_each_cpu()
* since not everything might be setup.
*/
local_irq_save(flags);
ctlreg_callback(info);
local_irq_restore(flags);
} else {
on_each_cpu(ctlreg_callback, info, 1);
}
}
void system_ctlreg_modify(unsigned int cr, unsigned long data, int request)
{
struct ctlreg_parms pp = { .cr = cr, .request = request, };
struct lowcore *abs_lc;
switch (request) {
case CTLREG_SET_BIT:
pp.orval = 1UL << data;
pp.andval = -1UL;
break;
case CTLREG_CLEAR_BIT:
pp.orval = 0;
pp.andval = ~(1UL << data);
break;
case CTLREG_LOAD:
pp.val = data;
break;
}
if (system_ctlreg_area_init) {
system_ctlreg_lock();
abs_lc = get_abs_lowcore();
if (request == CTLREG_LOAD) {
abs_lc->cregs_save_area[cr].val = pp.val;
} else {
abs_lc->cregs_save_area[cr].val &= pp.andval;
abs_lc->cregs_save_area[cr].val |= pp.orval;
}
put_abs_lowcore(abs_lc);
system_ctlreg_update(&pp);
system_ctlreg_unlock();
} else {
system_ctlreg_update(&pp);
}
}
EXPORT_SYMBOL(system_ctlreg_modify);
Annotation
- Immediate include surface: `linux/irqflags.h`, `linux/spinlock.h`, `linux/export.h`, `linux/kernel.h`, `linux/init.h`, `linux/smp.h`, `linux/cache.h`, `asm/abs_lowcore.h`.
- Detected declarations: `struct ctlreg_parms`, `function system_ctlreg_lock`, `function system_ctlreg_unlock`, `function system_ctlreg_init_save_area`, `function ctlreg_callback`, `function system_ctlreg_update`, `function system_ctlreg_modify`, `export system_ctlreg_modify`.
- Atlas domain: Architecture Layer / arch/s390.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.