arch/s390/include/asm/pai.h
Source file repositories/reference/linux-study-clean/arch/s390/include/asm/pai.h
File Facts
- System
- Linux kernel
- Corpus path
arch/s390/include/asm/pai.h- Extension
.h- Size
- 2120 bytes
- Lines
- 84
- 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/jump_label.hasm/lowcore.hasm/ptrace.hasm/asm.h
Detected Declarations
struct qpaci_info_blockfunction qpacifunction pai_kernel_enterfunction pai_kernel_exit
Annotated Snippet
struct qpaci_info_block {
u64 header;
struct {
u64 : 8;
u64 num_cc : 8; /* # of supported crypto counters */
u64 : 9;
u64 num_nnpa : 7; /* # of supported NNPA counters */
u64 : 32;
};
};
static inline int qpaci(struct qpaci_info_block *info)
{
/* Size of info (in double words minus one) */
size_t size = sizeof(*info) / sizeof(u64) - 1;
int cc;
asm volatile(
" lgr 0,%[size]\n"
" .insn s,0xb28f0000,%[info]\n"
" lgr %[size],0\n"
CC_IPM(cc)
: CC_OUT(cc, cc), [info] "=Q" (*info), [size] "+&d" (size)
:
: CC_CLOBBER_LIST("0", "memory"));
return CC_TRANSFORM(cc) ? (size + 1) * sizeof(u64) : 0;
}
#define PAI_CRYPTO_BASE 0x1000 /* First event number */
#define PAI_CRYPTO_MAXCTR 256 /* Max # of event counters */
#define PAI_CRYPTO_KERNEL_OFFSET 2048
#define PAI_NNPA_BASE 0x1800 /* First event number */
#define PAI_NNPA_MAXCTR 128 /* Max # of event counters */
DECLARE_STATIC_KEY_FALSE(pai_key);
static __always_inline void pai_kernel_enter(struct pt_regs *regs)
{
if (!IS_ENABLED(CONFIG_PERF_EVENTS))
return;
if (!static_branch_unlikely(&pai_key))
return;
if (!get_lowcore()->ccd)
return;
if (!user_mode(regs))
return;
WRITE_ONCE(get_lowcore()->ccd, get_lowcore()->ccd | PAI_CRYPTO_KERNEL_OFFSET);
}
static __always_inline void pai_kernel_exit(struct pt_regs *regs)
{
if (!IS_ENABLED(CONFIG_PERF_EVENTS))
return;
if (!static_branch_unlikely(&pai_key))
return;
if (!get_lowcore()->ccd)
return;
if (!user_mode(regs))
return;
WRITE_ONCE(get_lowcore()->ccd, get_lowcore()->ccd & ~PAI_CRYPTO_KERNEL_OFFSET);
}
#define PAI_SAVE_AREA(x) ((x)->hw.event_base)
#define PAI_CPU_MASK(x) ((x)->hw.addr_filters)
#define PAI_PMU_IDX(x) ((x)->hw.last_tag)
#define PAI_SWLIST(x) (&(x)->hw.tp_list)
#endif
Annotation
- Immediate include surface: `linux/jump_label.h`, `asm/lowcore.h`, `asm/ptrace.h`, `asm/asm.h`.
- Detected declarations: `struct qpaci_info_block`, `function qpaci`, `function pai_kernel_enter`, `function pai_kernel_exit`.
- 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.