drivers/perf/hisilicon/hns3_pmu.c
Source file repositories/reference/linux-study-clean/drivers/perf/hisilicon/hns3_pmu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/perf/hisilicon/hns3_pmu.c- Extension
.c- Size
- 51592 bytes
- Lines
- 1675
- Domain
- Driver Families
- Bucket
- drivers/perf
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/bitmap.hlinux/bug.hlinux/cpuhotplug.hlinux/cpumask.hlinux/delay.hlinux/device.hlinux/err.hlinux/interrupt.hlinux/iopoll.hlinux/io-64-nonatomic-hi-lo.hlinux/irq.hlinux/kernel.hlinux/list.hlinux/module.hlinux/pci.hlinux/pci-epf.hlinux/perf_event.hlinux/smp.h
Detected Declarations
struct hns3_pmu_event_attrstruct hns3_pmuenum hns3_pmu_hw_filter_modefunction hns3_pmu_event_showfunction hns3_pmu_filter_mode_showfunction identifier_showfunction cpumask_showfunction bdf_min_showfunction bdf_max_showfunction hw_clk_freq_showfunction hns3_pmu_get_eventfunction hns3_pmu_get_real_eventfunction hns3_pmu_get_offsetfunction hns3_pmu_readlfunction hns3_pmu_writelfunction hns3_pmu_readqfunction hns3_pmu_writeqfunction hns3_pmu_cmp_eventfunction hns3_pmu_find_related_event_idxfunction hns3_pmu_get_event_idxfunction hns3_pmu_valid_bdffunction hns3_pmu_set_qid_parafunction hns3_pmu_qid_req_startfunction hns3_pmu_valid_queuefunction hns3_pmu_set_func_modefunction hns3_pmu_set_func_queue_modefunction hns3_pmu_is_enabled_global_modefunction hns3_pmu_is_enabled_func_modefunction hns3_pmu_is_enabled_func_queue_modefunction hns3_pmu_is_enabled_port_modefunction hns3_pmu_is_enabled_port_tc_modefunction hns3_pmu_is_enabled_func_intr_modefunction hns3_pmu_select_filter_modefunction hns3_pmu_validate_event_groupfunction for_each_sibling_eventfunction hns3_pmu_get_filter_conditionfunction hns3_pmu_config_filterfunction hns3_pmu_enable_counterfunction hns3_pmu_disable_counterfunction hns3_pmu_enable_intrfunction hns3_pmu_disable_intrfunction hns3_pmu_clear_intr_statusfunction hns3_pmu_read_counterfunction hns3_pmu_write_counterfunction hns3_pmu_init_counterfunction hns3_pmu_event_initfunction hns3_pmu_readfunction hns3_pmu_start
Annotated Snippet
static struct pci_driver hns3_pmu_driver = {
.name = "hns3_pmu",
.id_table = hns3_pmu_ids,
.probe = hns3_pmu_probe,
.remove = hns3_pmu_remove,
};
static int __init hns3_pmu_module_init(void)
{
int ret;
ret = cpuhp_setup_state_multi(CPUHP_AP_PERF_ARM_HNS3_PMU_ONLINE,
"AP_PERF_ARM_HNS3_PMU_ONLINE",
hns3_pmu_online_cpu,
hns3_pmu_offline_cpu);
if (ret) {
pr_err("failed to setup HNS3 PMU hotplug, ret = %d.\n", ret);
return ret;
}
ret = pci_register_driver(&hns3_pmu_driver);
if (ret) {
pr_err("failed to register pci driver, ret = %d.\n", ret);
cpuhp_remove_multi_state(CPUHP_AP_PERF_ARM_HNS3_PMU_ONLINE);
}
return ret;
}
module_init(hns3_pmu_module_init);
static void __exit hns3_pmu_module_exit(void)
{
pci_unregister_driver(&hns3_pmu_driver);
cpuhp_remove_multi_state(CPUHP_AP_PERF_ARM_HNS3_PMU_ONLINE);
}
module_exit(hns3_pmu_module_exit);
MODULE_DESCRIPTION("HNS3 PMU driver");
MODULE_LICENSE("GPL v2");
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bitmap.h`, `linux/bug.h`, `linux/cpuhotplug.h`, `linux/cpumask.h`, `linux/delay.h`, `linux/device.h`, `linux/err.h`.
- Detected declarations: `struct hns3_pmu_event_attr`, `struct hns3_pmu`, `enum hns3_pmu_hw_filter_mode`, `function hns3_pmu_event_show`, `function hns3_pmu_filter_mode_show`, `function identifier_show`, `function cpumask_show`, `function bdf_min_show`, `function bdf_max_show`, `function hw_clk_freq_show`.
- Atlas domain: Driver Families / drivers/perf.
- Implementation status: pattern 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.