arch/powerpc/perf/isa207-common.c
Source file repositories/reference/linux-study-clean/arch/powerpc/perf/isa207-common.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/perf/isa207-common.c- Extension
.c- Size
- 22338 bytes
- Lines
- 853
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- 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
isa207-common.h
Detected Declarations
function event_is_fab_matchfunction is_event_validfunction is_event_markedfunction sdar_mod_valfunction mmcra_sdar_modefunction p10_thresh_cmp_valfunction thresh_cmp_valfunction combine_from_eventfunction combine_shiftfunction event_is_thresholdfunction is_thresh_cmp_validfunction dc_ic_rld_quad_l1_selfunction isa207_find_sourcefunction isa207_get_mem_data_srcfunction isa207_get_mem_weightfunction isa207_get_constraintfunction isa207_compute_mmcrfunction isa207_disable_pmcfunction find_alternativefunction isa207_get_alternativesfunction isa3XX_check_attr_config
Annotated Snippet
while ((64 - __builtin_clzl(value)) > 8) {
exp++;
value >>= 2;
}
/*
* Note that it is invalid to write a mantissa with the
* upper 2 bits of mantissa being zero, unless the
* exponent is also zero.
*/
if (!(value & 0xC0) && exp)
result = -1;
else
result = (exp << 8) | value;
}
return result;
}
static u64 thresh_cmp_val(u64 value)
{
if (cpu_has_feature(CPU_FTR_ARCH_31))
value = p10_thresh_cmp_val(value);
/*
* Since location of threshold compare bits in MMCRA
* is different for p8, using different shift value.
*/
if (cpu_has_feature(CPU_FTR_ARCH_300))
return value << p9_MMCRA_THR_CMP_SHIFT;
else
return value << MMCRA_THR_CMP_SHIFT;
}
static unsigned long combine_from_event(u64 event)
{
if (cpu_has_feature(CPU_FTR_ARCH_300))
return p9_EVENT_COMBINE(event);
return EVENT_COMBINE(event);
}
static unsigned long combine_shift(unsigned long pmc)
{
if (cpu_has_feature(CPU_FTR_ARCH_300))
return p9_MMCR1_COMBINE_SHIFT(pmc);
return MMCR1_COMBINE_SHIFT(pmc);
}
static inline bool event_is_threshold(u64 event)
{
return (event >> EVENT_THR_SEL_SHIFT) & EVENT_THR_SEL_MASK;
}
static bool is_thresh_cmp_valid(u64 event)
{
unsigned int cmp, exp;
if (cpu_has_feature(CPU_FTR_ARCH_31))
return p10_thresh_cmp_val(event) >= 0;
/*
* Check the mantissa upper two bits are not zero, unless the
* exponent is also zero. See the THRESH_CMP_MANTISSA doc.
*/
cmp = (event >> EVENT_THR_CMP_SHIFT) & EVENT_THR_CMP_MASK;
exp = cmp >> 7;
if (exp && (cmp & 0x60) == 0)
return false;
return true;
}
static unsigned int dc_ic_rld_quad_l1_sel(u64 event)
{
unsigned int cache;
cache = (event >> EVENT_CACHE_SEL_SHIFT) & MMCR1_DC_IC_QUAL_MASK;
return cache;
}
static inline u64 isa207_find_source(u64 idx, u32 sub_idx)
{
u64 ret = PERF_MEM_NA;
switch(idx) {
case 0:
/* Nothing to do */
Annotation
- Immediate include surface: `isa207-common.h`.
- Detected declarations: `function event_is_fab_match`, `function is_event_valid`, `function is_event_marked`, `function sdar_mod_val`, `function mmcra_sdar_mode`, `function p10_thresh_cmp_val`, `function thresh_cmp_val`, `function combine_from_event`, `function combine_shift`, `function event_is_threshold`.
- Atlas domain: Architecture Layer / arch/powerpc.
- 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.