arch/s390/include/asm/machine.h
Source file repositories/reference/linux-study-clean/arch/s390/include/asm/machine.h
File Facts
- System
- Linux kernel
- Corpus path
arch/s390/include/asm/machine.h- Extension
.h- Size
- 2596 bytes
- Lines
- 105
- 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.
Dependency Surface
linux/const.hlinux/bitops.hasm/alternative.h
Detected Declarations
function __set_machine_featurefunction set_machine_featurefunction __clear_machine_featurefunction clear_machine_featurefunction __test_machine_featurefunction test_machine_featurefunction __test_machine_feature_constant
Annotated Snippet
#ifndef __ASM_S390_MACHINE_H
#define __ASM_S390_MACHINE_H
#include <linux/const.h>
#define MFEATURE_LOWCORE 0
#define MFEATURE_PCI_MIO 1
#define MFEATURE_SCC 2
#define MFEATURE_TLB_GUEST 3
#define MFEATURE_TX 4
#define MFEATURE_ESOP 5
#define MFEATURE_DIAG9C 6
#define MFEATURE_VM 7
#define MFEATURE_KVM 8
#define MFEATURE_LPAR 9
#define MFEATURE_DIAG288 10
#ifndef __ASSEMBLER__
#include <linux/bitops.h>
#include <asm/alternative.h>
extern unsigned long machine_features[1];
#define MAX_MFEATURE_BIT (sizeof(machine_features) * BITS_PER_BYTE)
static inline void __set_machine_feature(unsigned int nr, unsigned long *mfeatures)
{
if (nr >= MAX_MFEATURE_BIT)
return;
__set_bit(nr, mfeatures);
}
static inline void set_machine_feature(unsigned int nr)
{
__set_machine_feature(nr, machine_features);
}
static inline void __clear_machine_feature(unsigned int nr, unsigned long *mfeatures)
{
if (nr >= MAX_MFEATURE_BIT)
return;
__clear_bit(nr, mfeatures);
}
static inline void clear_machine_feature(unsigned int nr)
{
__clear_machine_feature(nr, machine_features);
}
static bool __test_machine_feature(unsigned int nr, unsigned long *mfeatures)
{
if (nr >= MAX_MFEATURE_BIT)
return false;
return test_bit(nr, mfeatures);
}
static bool test_machine_feature(unsigned int nr)
{
return __test_machine_feature(nr, machine_features);
}
static __always_inline bool __test_machine_feature_constant(unsigned int nr)
{
asm goto(
ALTERNATIVE("brcl 15,%l[l_no]", "brcl 0,0", ALT_FEATURE(%[nr]))
:
: [nr] "i" (nr)
:
: l_no);
return true;
l_no:
return false;
}
#define DEFINE_MACHINE_HAS_FEATURE(name, feature) \
static __always_inline bool machine_has_##name(void) \
{ \
if (!__is_defined(__DECOMPRESSOR) && __builtin_constant_p(feature)) \
return __test_machine_feature_constant(feature); \
return test_machine_feature(feature); \
}
DEFINE_MACHINE_HAS_FEATURE(relocated_lowcore, MFEATURE_LOWCORE)
DEFINE_MACHINE_HAS_FEATURE(scc, MFEATURE_SCC)
DEFINE_MACHINE_HAS_FEATURE(tlb_guest, MFEATURE_TLB_GUEST)
DEFINE_MACHINE_HAS_FEATURE(tx, MFEATURE_TX)
DEFINE_MACHINE_HAS_FEATURE(esop, MFEATURE_ESOP)
DEFINE_MACHINE_HAS_FEATURE(diag9c, MFEATURE_DIAG9C)
DEFINE_MACHINE_HAS_FEATURE(vm, MFEATURE_VM)
Annotation
- Immediate include surface: `linux/const.h`, `linux/bitops.h`, `asm/alternative.h`.
- Detected declarations: `function __set_machine_feature`, `function set_machine_feature`, `function __clear_machine_feature`, `function clear_machine_feature`, `function __test_machine_feature`, `function test_machine_feature`, `function __test_machine_feature_constant`.
- 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.