arch/s390/kernel/cpufeature.c
Source file repositories/reference/linux-study-clean/arch/s390/kernel/cpufeature.c
File Facts
- System
- Linux kernel
- Corpus path
arch/s390/kernel/cpufeature.c- Extension
.c- Size
- 1216 bytes
- Lines
- 53
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cpufeature.hlinux/export.hlinux/bug.hasm/machine.hasm/elf.h
Detected Declarations
struct s390_cpu_featurefunction cpu_have_featureexport cpu_have_feature
Annotated Snippet
struct s390_cpu_feature {
unsigned int type : 4;
unsigned int num : 28;
};
static struct s390_cpu_feature s390_cpu_features[MAX_CPU_FEATURES] = {
[S390_CPU_FEATURE_MSA] = {.type = TYPE_HWCAP, .num = HWCAP_NR_MSA},
[S390_CPU_FEATURE_VXRS] = {.type = TYPE_HWCAP, .num = HWCAP_NR_VXRS},
[S390_CPU_FEATURE_UV] = {.type = TYPE_FACILITY, .num = 158},
[S390_CPU_FEATURE_D288] = {.type = TYPE_MACHINE, .num = MFEATURE_DIAG288},
};
/*
* cpu_have_feature - Test CPU features on module initialization
*/
int cpu_have_feature(unsigned int num)
{
struct s390_cpu_feature *feature;
if (WARN_ON_ONCE(num >= MAX_CPU_FEATURES))
return 0;
feature = &s390_cpu_features[num];
switch (feature->type) {
case TYPE_HWCAP:
return !!(elf_hwcap & BIT(feature->num));
case TYPE_FACILITY:
return test_facility(feature->num);
case TYPE_MACHINE:
return test_machine_feature(feature->num);
default:
WARN_ON_ONCE(1);
return 0;
}
}
EXPORT_SYMBOL(cpu_have_feature);
Annotation
- Immediate include surface: `linux/cpufeature.h`, `linux/export.h`, `linux/bug.h`, `asm/machine.h`, `asm/elf.h`.
- Detected declarations: `struct s390_cpu_feature`, `function cpu_have_feature`, `export cpu_have_feature`.
- Atlas domain: Architecture Layer / arch/s390.
- 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.