drivers/perf/fsl_imx9_ddr_perf.c
Source file repositories/reference/linux-study-clean/drivers/perf/fsl_imx9_ddr_perf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/perf/fsl_imx9_ddr_perf.c- Extension
.c- Size
- 25624 bytes
- Lines
- 888
- Domain
- Driver Families
- Bucket
- drivers/perf
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/bitfield.hlinux/init.hlinux/interrupt.hlinux/io.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/perf_event.h
Detected Declarations
struct imx_ddr_devtype_datastruct ddr_pmustruct imx9_pmu_events_attrfunction axi_filter_v1function axi_filter_v2function ddr_perf_identifier_showfunction ddr_perf_cpumask_showfunction ddr_pmu_event_showfunction ddr_perf_events_attrs_is_visiblefunction ddr_perf_clear_counterfunction ddr_perf_read_counterfunction ddr_perf_counter_global_configfunction ddr_perf_counter_local_configfunction imx93_ddr_perf_monitor_configfunction imx95_ddr_perf_monitor_configfunction ddr_perf_event_updatefunction ddr_perf_event_initfunction for_each_sibling_eventfunction ddr_perf_event_startfunction ddr_perf_alloc_counterfunction ddr_perf_event_addfunction ddr_perf_event_stopfunction ddr_perf_event_delfunction ddr_perf_pmu_enablefunction ddr_perf_pmu_disablefunction ddr_perf_initfunction ddr_perf_irq_handlerfunction ddr_perf_offline_cpufunction ddr_perf_probefunction ddr_perf_remove
Annotated Snippet
struct imx_ddr_devtype_data {
const char *identifier; /* system PMU identifier for userspace */
unsigned int filter_ver; /* AXI filter version */
};
struct ddr_pmu {
struct pmu pmu;
void __iomem *base;
unsigned int cpu;
struct hlist_node node;
struct device *dev;
struct perf_event *events[NUM_COUNTERS];
int active_events;
enum cpuhp_state cpuhp_state;
const struct imx_ddr_devtype_data *devtype_data;
int irq;
int id;
};
static const struct imx_ddr_devtype_data imx91_devtype_data = {
.identifier = "imx91",
.filter_ver = DDR_PERF_AXI_FILTER_V1
};
static const struct imx_ddr_devtype_data imx93_devtype_data = {
.identifier = "imx93",
.filter_ver = DDR_PERF_AXI_FILTER_V1
};
static const struct imx_ddr_devtype_data imx94_devtype_data = {
.identifier = "imx94",
.filter_ver = DDR_PERF_AXI_FILTER_V2
};
static const struct imx_ddr_devtype_data imx95_devtype_data = {
.identifier = "imx95",
.filter_ver = DDR_PERF_AXI_FILTER_V2
};
static inline bool axi_filter_v1(struct ddr_pmu *pmu)
{
return pmu->devtype_data->filter_ver == DDR_PERF_AXI_FILTER_V1;
}
static inline bool axi_filter_v2(struct ddr_pmu *pmu)
{
return pmu->devtype_data->filter_ver == DDR_PERF_AXI_FILTER_V2;
}
static const struct of_device_id imx_ddr_pmu_dt_ids[] = {
{ .compatible = "fsl,imx91-ddr-pmu", .data = &imx91_devtype_data },
{ .compatible = "fsl,imx93-ddr-pmu", .data = &imx93_devtype_data },
{ .compatible = "fsl,imx94-ddr-pmu", .data = &imx94_devtype_data },
{ .compatible = "fsl,imx95-ddr-pmu", .data = &imx95_devtype_data },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, imx_ddr_pmu_dt_ids);
static ssize_t ddr_perf_identifier_show(struct device *dev,
struct device_attribute *attr,
char *page)
{
struct ddr_pmu *pmu = dev_get_drvdata(dev);
return sysfs_emit(page, "%s\n", pmu->devtype_data->identifier);
}
static struct device_attribute ddr_perf_identifier_attr =
__ATTR(identifier, 0444, ddr_perf_identifier_show, NULL);
static struct attribute *ddr_perf_identifier_attrs[] = {
&ddr_perf_identifier_attr.attr,
NULL,
};
static struct attribute_group ddr_perf_identifier_attr_group = {
.attrs = ddr_perf_identifier_attrs,
};
static ssize_t ddr_perf_cpumask_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct ddr_pmu *pmu = dev_get_drvdata(dev);
return cpumap_print_to_pagebuf(true, buf, cpumask_of(pmu->cpu));
}
static struct device_attribute ddr_perf_cpumask_attr =
__ATTR(cpumask, 0444, ddr_perf_cpumask_show, NULL);
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/init.h`, `linux/interrupt.h`, `linux/io.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/perf_event.h`.
- Detected declarations: `struct imx_ddr_devtype_data`, `struct ddr_pmu`, `struct imx9_pmu_events_attr`, `function axi_filter_v1`, `function axi_filter_v2`, `function ddr_perf_identifier_show`, `function ddr_perf_cpumask_show`, `function ddr_pmu_event_show`, `function ddr_perf_events_attrs_is_visible`, `function ddr_perf_clear_counter`.
- Atlas domain: Driver Families / drivers/perf.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.