aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/perf
diff options
context:
space:
mode:
authorRobin Murphy <robin.murphy@arm.com>2018-05-14 09:34:53 -0400
committerWill Deacon <will.deacon@arm.com>2018-05-21 13:12:54 -0400
commit8b0c93c20ef78f15d8b760964ff79bda7f68c610 (patch)
tree2151d7fded7c7907b9a9c5d2784a6ded6aaac7ea /drivers/perf
parent28c01dc9d85e4cd744f254c45d3c894bca168ed6 (diff)
perf/arm-cci: Allow building as a module
Fill in the few extra bits and annotations needed to make the driver work properly as a module, and jiggle the Kconfig to expose the driver-level ARM_CCI_PMU option. Signed-off-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'drivers/perf')
-rw-r--r--drivers/perf/Kconfig34
-rw-r--r--drivers/perf/arm-cci.c17
2 files changed, 34 insertions, 17 deletions
diff --git a/drivers/perf/Kconfig b/drivers/perf/Kconfig
index 28bb5a029558..110330ecf714 100644
--- a/drivers/perf/Kconfig
+++ b/drivers/perf/Kconfig
@@ -6,30 +6,32 @@ menu "Performance monitor support"
6 depends on PERF_EVENTS 6 depends on PERF_EVENTS
7 7
8config ARM_CCI_PMU 8config ARM_CCI_PMU
9 bool 9 tristate "ARM CCI PMU driver"
10 depends on (ARM && CPU_V7) || ARM64
10 select ARM_CCI 11 select ARM_CCI
12 help
13 Support for PMU events monitoring on the ARM CCI (Cache Coherent
14 Interconnect) family of products.
15
16 If compiled as a module, it will be called arm-cci.
11 17
12config ARM_CCI400_PMU 18config ARM_CCI400_PMU
13 bool "ARM CCI400 PMU support" 19 bool "support CCI-400"
14 depends on (ARM && CPU_V7) || ARM64 20 default y
21 depends on ARM_CCI_PMU
15 select ARM_CCI400_COMMON 22 select ARM_CCI400_COMMON
16 select ARM_CCI_PMU
17 help 23 help
18 Support for PMU events monitoring on the ARM CCI-400 (cache coherent 24 CCI-400 provides 4 independent event counters counting events related
19 interconnect). CCI-400 supports counting events related to the 25 to the connected slave/master interfaces, plus a cycle counter.
20 connected slave/master interfaces.
21 26
22config ARM_CCI5xx_PMU 27config ARM_CCI5xx_PMU
23 bool "ARM CCI-500/CCI-550 PMU support" 28 bool "support CCI-500/CCI-550"
24 depends on (ARM && CPU_V7) || ARM64 29 default y
25 select ARM_CCI_PMU 30 depends on ARM_CCI_PMU
26 help 31 help
27 Support for PMU events monitoring on the ARM CCI-500/CCI-550 cache 32 CCI-500/CCI-550 both provide 8 independent event counters, which can
28 coherent interconnects. Both of them provide 8 independent event counters, 33 count events pertaining to the slave/master interfaces as well as the
29 which can count events pertaining to the slave/master interfaces as well 34 internal events to the CCI.
30 as the internal events to the CCI.
31
32 If unsure, say Y
33 35
34config ARM_CCN 36config ARM_CCN
35 tristate "ARM CCN driver support" 37 tristate "ARM CCN driver support"
diff --git a/drivers/perf/arm-cci.c b/drivers/perf/arm-cci.c
index 33b47c292d79..e6fadc8e1178 100644
--- a/drivers/perf/arm-cci.c
+++ b/drivers/perf/arm-cci.c
@@ -1407,6 +1407,7 @@ static int cci_pmu_init(struct cci_pmu *cci_pmu, struct platform_device *pdev)
1407 pmu_format_attr_group.attrs = model->format_attrs; 1407 pmu_format_attr_group.attrs = model->format_attrs;
1408 1408
1409 cci_pmu->pmu = (struct pmu) { 1409 cci_pmu->pmu = (struct pmu) {
1410 .module = THIS_MODULE,
1410 .name = cci_pmu->model->name, 1411 .name = cci_pmu->model->name,
1411 .task_ctx_nr = perf_invalid_context, 1412 .task_ctx_nr = perf_invalid_context,
1412 .pmu_enable = cci_pmu_enable, 1413 .pmu_enable = cci_pmu_enable,
@@ -1572,6 +1573,7 @@ static const struct of_device_id arm_cci_pmu_matches[] = {
1572#endif 1573#endif
1573 {}, 1574 {},
1574}; 1575};
1576MODULE_DEVICE_TABLE(of, arm_cci_pmu_matches);
1575 1577
1576static bool is_duplicate_irq(int irq, int *irqs, int nr_irqs) 1578static bool is_duplicate_irq(int irq, int *irqs, int nr_irqs)
1577{ 1579{
@@ -1693,14 +1695,27 @@ static int cci_pmu_probe(struct platform_device *pdev)
1693 return 0; 1695 return 0;
1694} 1696}
1695 1697
1698static int cci_pmu_remove(struct platform_device *pdev)
1699{
1700 if (!g_cci_pmu)
1701 return 0;
1702
1703 cpuhp_remove_state(CPUHP_AP_PERF_ARM_CCI_ONLINE);
1704 perf_pmu_unregister(&g_cci_pmu->pmu);
1705 g_cci_pmu = NULL;
1706
1707 return 0;
1708}
1709
1696static struct platform_driver cci_pmu_driver = { 1710static struct platform_driver cci_pmu_driver = {
1697 .driver = { 1711 .driver = {
1698 .name = DRIVER_NAME, 1712 .name = DRIVER_NAME,
1699 .of_match_table = arm_cci_pmu_matches, 1713 .of_match_table = arm_cci_pmu_matches,
1700 }, 1714 },
1701 .probe = cci_pmu_probe, 1715 .probe = cci_pmu_probe,
1716 .remove = cci_pmu_remove,
1702}; 1717};
1703 1718
1704builtin_platform_driver(cci_pmu_driver); 1719module_platform_driver(cci_pmu_driver);
1705MODULE_LICENSE("GPL v2"); 1720MODULE_LICENSE("GPL v2");
1706MODULE_DESCRIPTION("ARM CCI PMU support"); 1721MODULE_DESCRIPTION("ARM CCI PMU support");