drivers/gpu/drm/i915/i915_pmu.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/i915_pmu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/i915_pmu.c- Extension
.c- Size
- 29523 bytes
- Lines
- 1234
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pm_runtime.hdrm/drm_print.hgt/intel_engine.hgt/intel_engine_pm.hgt/intel_engine_regs.hgt/intel_engine_user.hgt/intel_gt.hgt/intel_gt_pm.hgt/intel_gt_regs.hgt/intel_rc6.hgt/intel_rps.hi915_drv.hi915_pmu.h
Detected Declarations
struct i915_str_attributestruct i915_ext_attributefunction BITfunction engine_config_samplefunction engine_event_samplefunction engine_event_classfunction engine_event_instancefunction is_engine_configfunction config_gt_idfunction config_counterfunction other_bitfunction config_bitfunction config_maskfunction is_engine_eventfunction event_bitfunction frequency_enabled_maskfunction pmu_needs_timerfunction __get_rc6function ktime_since_rawfunction read_samplefunction store_samplefunction add_sample_multfunction get_rc6function init_rc6function for_each_gtfunction with_intel_runtime_pmfunction park_rc6function __i915_pmu_maybe_start_timerfunction i915_pmu_gt_parkedfunction i915_pmu_gt_unparkedfunction add_samplefunction exclusive_mmio_accessfunction gen3_engine_samplefunction gen2_engine_samplefunction engine_samplefunction engines_samplefunction for_each_enginefunction frequency_sampling_enabledfunction frequency_samplefunction i915_samplefunction for_each_gtfunction i915_pmu_event_destroyfunction engine_event_statusfunction config_statusfunction engine_event_initfunction i915_pmu_event_initfunction __i915_pmu_event_readfunction i915_pmu_event_read
Annotated Snippet
struct i915_str_attribute {
struct device_attribute attr;
const char *str;
};
static ssize_t i915_pmu_format_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct i915_str_attribute *eattr;
eattr = container_of(attr, struct i915_str_attribute, attr);
return sysfs_emit(buf, "%s\n", eattr->str);
}
#define I915_PMU_FORMAT_ATTR(_name, _config) \
(&((struct i915_str_attribute[]) { \
{ .attr = __ATTR(_name, 0444, i915_pmu_format_show, NULL), \
.str = _config, } \
})[0].attr.attr)
static struct attribute *i915_pmu_format_attrs[] = {
I915_PMU_FORMAT_ATTR(i915_eventid, "config:0-20"),
NULL,
};
static const struct attribute_group i915_pmu_format_attr_group = {
.name = "format",
.attrs = i915_pmu_format_attrs,
};
struct i915_ext_attribute {
struct device_attribute attr;
unsigned long val;
};
static ssize_t i915_pmu_event_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct i915_ext_attribute *eattr;
eattr = container_of(attr, struct i915_ext_attribute, attr);
return sysfs_emit(buf, "config=0x%lx\n", eattr->val);
}
#define __event(__counter, __name, __unit) \
{ \
.counter = (__counter), \
.name = (__name), \
.unit = (__unit), \
.global = false, \
}
#define __global_event(__counter, __name, __unit) \
{ \
.counter = (__counter), \
.name = (__name), \
.unit = (__unit), \
.global = true, \
}
#define __engine_event(__sample, __name) \
{ \
.sample = (__sample), \
.name = (__name), \
}
static struct i915_ext_attribute *
add_i915_attr(struct i915_ext_attribute *attr, const char *name, u64 config)
{
sysfs_attr_init(&attr->attr.attr);
attr->attr.attr.name = name;
attr->attr.attr.mode = 0444;
attr->attr.show = i915_pmu_event_show;
attr->val = config;
return ++attr;
}
static struct perf_pmu_events_attr *
add_pmu_attr(struct perf_pmu_events_attr *attr, const char *name,
const char *str)
{
sysfs_attr_init(&attr->attr.attr);
attr->attr.attr.name = name;
attr->attr.attr.mode = 0444;
attr->attr.show = perf_event_sysfs_show;
attr->event_str = str;
return ++attr;
}
Annotation
- Immediate include surface: `linux/pm_runtime.h`, `drm/drm_print.h`, `gt/intel_engine.h`, `gt/intel_engine_pm.h`, `gt/intel_engine_regs.h`, `gt/intel_engine_user.h`, `gt/intel_gt.h`, `gt/intel_gt_pm.h`.
- Detected declarations: `struct i915_str_attribute`, `struct i915_ext_attribute`, `function BIT`, `function engine_config_sample`, `function engine_event_sample`, `function engine_event_class`, `function engine_event_instance`, `function is_engine_config`, `function config_gt_id`, `function config_counter`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.