Skip to content

Commit 8b0c93c

Browse files
rmurphy-armwildea01
authored andcommitted
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 <[email protected]> Signed-off-by: Will Deacon <[email protected]>
1 parent 28c01dc commit 8b0c93c

File tree

2 files changed

+34
-17
lines changed

2 files changed

+34
-17
lines changed

drivers/perf/Kconfig

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,32 @@ menu "Performance monitor support"
66
depends on PERF_EVENTS
77

88
config ARM_CCI_PMU
9-
bool
9+
tristate "ARM CCI PMU driver"
10+
depends on (ARM && CPU_V7) || ARM64
1011
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.
1117

1218
config ARM_CCI400_PMU
13-
bool "ARM CCI400 PMU support"
14-
depends on (ARM && CPU_V7) || ARM64
19+
bool "support CCI-400"
20+
default y
21+
depends on ARM_CCI_PMU
1522
select ARM_CCI400_COMMON
16-
select ARM_CCI_PMU
1723
help
18-
Support for PMU events monitoring on the ARM CCI-400 (cache coherent
19-
interconnect). CCI-400 supports counting events related to the
20-
connected slave/master interfaces.
24+
CCI-400 provides 4 independent event counters counting events related
25+
to the connected slave/master interfaces, plus a cycle counter.
2126

2227
config ARM_CCI5xx_PMU
23-
bool "ARM CCI-500/CCI-550 PMU support"
24-
depends on (ARM && CPU_V7) || ARM64
25-
select ARM_CCI_PMU
28+
bool "support CCI-500/CCI-550"
29+
default y
30+
depends on ARM_CCI_PMU
2631
help
27-
Support for PMU events monitoring on the ARM CCI-500/CCI-550 cache
28-
coherent interconnects. Both of them provide 8 independent event counters,
29-
which can count events pertaining to the slave/master interfaces as well
30-
as the internal events to the CCI.
31-
32-
If unsure, say Y
32+
CCI-500/CCI-550 both provide 8 independent event counters, which can
33+
count events pertaining to the slave/master interfaces as well as the
34+
internal events to the CCI.
3335

3436
config ARM_CCN
3537
tristate "ARM CCN driver support"

drivers/perf/arm-cci.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1407,6 +1407,7 @@ static int cci_pmu_init(struct cci_pmu *cci_pmu, struct platform_device *pdev)
14071407
pmu_format_attr_group.attrs = model->format_attrs;
14081408

14091409
cci_pmu->pmu = (struct pmu) {
1410+
.module = THIS_MODULE,
14101411
.name = cci_pmu->model->name,
14111412
.task_ctx_nr = perf_invalid_context,
14121413
.pmu_enable = cci_pmu_enable,
@@ -1572,6 +1573,7 @@ static const struct of_device_id arm_cci_pmu_matches[] = {
15721573
#endif
15731574
{},
15741575
};
1576+
MODULE_DEVICE_TABLE(of, arm_cci_pmu_matches);
15751577

15761578
static bool is_duplicate_irq(int irq, int *irqs, int nr_irqs)
15771579
{
@@ -1693,14 +1695,27 @@ static int cci_pmu_probe(struct platform_device *pdev)
16931695
return 0;
16941696
}
16951697

1698+
static 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+
16961710
static struct platform_driver cci_pmu_driver = {
16971711
.driver = {
16981712
.name = DRIVER_NAME,
16991713
.of_match_table = arm_cci_pmu_matches,
17001714
},
17011715
.probe = cci_pmu_probe,
1716+
.remove = cci_pmu_remove,
17021717
};
17031718

1704-
builtin_platform_driver(cci_pmu_driver);
1719+
module_platform_driver(cci_pmu_driver);
17051720
MODULE_LICENSE("GPL v2");
17061721
MODULE_DESCRIPTION("ARM CCI PMU support");

0 commit comments

Comments
 (0)