include/linux/intel_rapl.h
Source file repositories/reference/linux-study-clean/include/linux/intel_rapl.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/intel_rapl.h- Extension
.h- Size
- 7566 bytes
- Lines
- 270
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/powercap.hlinux/cpuhotplug.h
Detected Declarations
struct rapl_domainstruct rapl_domain_datastruct rapl_power_limitstruct rapl_packagestruct rapl_domainstruct reg_actionstruct rapl_defaultsstruct rapl_primitive_infostruct rapl_if_privstruct rapl_package_pmu_datastruct rapl_packageenum rapl_if_typeenum rapl_domain_typeenum rapl_domain_reg_idenum rapl_primitivesenum unit_typefunction rapl_package_add_pmufunction rapl_package_add_pmu_lockedfunction rapl_package_remove_pmu
Annotated Snippet
struct rapl_domain_data {
u64 primitives[NR_RAPL_PRIMITIVES];
unsigned long timestamp;
};
#define NR_POWER_LIMITS (POWER_LIMIT4 + 1)
struct rapl_power_limit {
struct powercap_zone_constraint *constraint;
struct rapl_domain *domain;
const char *name;
bool locked;
u64 last_power_limit;
};
struct rapl_package;
#define RAPL_DOMAIN_NAME_LENGTH 16
union rapl_reg {
void __iomem *mmio;
u32 msr;
u64 val;
};
struct rapl_domain {
char name[RAPL_DOMAIN_NAME_LENGTH];
enum rapl_domain_type id;
union rapl_reg regs[RAPL_DOMAIN_REG_MAX];
struct powercap_zone power_zone;
struct rapl_domain_data rdd;
struct rapl_power_limit rpl[NR_POWER_LIMITS];
u64 attr_map; /* track capabilities */
unsigned int state;
unsigned int power_unit;
unsigned int energy_unit;
unsigned int time_unit;
struct rapl_package *rp;
};
struct reg_action {
union rapl_reg reg;
u64 mask;
u64 value;
int err;
};
struct rapl_defaults {
u8 floor_freq_reg_addr;
int (*check_unit)(struct rapl_domain *rd);
void (*set_floor_freq)(struct rapl_domain *rd, bool mode);
u64 (*compute_time_window)(struct rapl_domain *rd, u64 val, bool to_raw);
unsigned int dram_domain_energy_unit;
unsigned int psys_domain_energy_unit;
bool spr_psys_bits;
bool msr_pl4_support;
bool msr_pmu_support;
};
#define PRIMITIVE_INFO_INIT(p, m, s, i, u, f) { \
.name = #p, \
.mask = m, \
.shift = s, \
.id = i, \
.unit = u, \
.flag = f \
}
enum unit_type {
ARBITRARY_UNIT, /* no translation */
POWER_UNIT,
ENERGY_UNIT,
TIME_UNIT,
};
/* per domain data. used to describe individual knobs such that access function
* can be consolidated into one instead of many inline functions.
*/
struct rapl_primitive_info {
const char *name;
u64 mask;
int shift;
enum rapl_domain_reg_id id;
enum unit_type unit;
u32 flag;
};
/**
* struct rapl_if_priv: private data for different RAPL interfaces
* @control_type: Each RAPL interface must have its own powercap
Annotation
- Immediate include surface: `linux/types.h`, `linux/powercap.h`, `linux/cpuhotplug.h`.
- Detected declarations: `struct rapl_domain`, `struct rapl_domain_data`, `struct rapl_power_limit`, `struct rapl_package`, `struct rapl_domain`, `struct reg_action`, `struct rapl_defaults`, `struct rapl_primitive_info`, `struct rapl_if_priv`, `struct rapl_package_pmu_data`.
- Atlas domain: Core OS / Core Kernel Interface.
- 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.