Commit 8b0c93c2 authored by Robin Murphy's avatar Robin Murphy Committed by Will Deacon

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: default avatarRobin Murphy <robin.murphy@arm.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent 28c01dc9
...@@ -6,30 +6,32 @@ menu "Performance monitor support" ...@@ -6,30 +6,32 @@ menu "Performance monitor support"
depends on PERF_EVENTS depends on PERF_EVENTS
config ARM_CCI_PMU config ARM_CCI_PMU
bool tristate "ARM CCI PMU driver"
depends on (ARM && CPU_V7) || ARM64
select ARM_CCI select ARM_CCI
help
Support for PMU events monitoring on the ARM CCI (Cache Coherent
Interconnect) family of products.
If compiled as a module, it will be called arm-cci.
config ARM_CCI400_PMU config ARM_CCI400_PMU
bool "ARM CCI400 PMU support" bool "support CCI-400"
depends on (ARM && CPU_V7) || ARM64 default y
depends on ARM_CCI_PMU
select ARM_CCI400_COMMON select ARM_CCI400_COMMON
select ARM_CCI_PMU
help help
Support for PMU events monitoring on the ARM CCI-400 (cache coherent CCI-400 provides 4 independent event counters counting events related
interconnect). CCI-400 supports counting events related to the to the connected slave/master interfaces, plus a cycle counter.
connected slave/master interfaces.
config ARM_CCI5xx_PMU config ARM_CCI5xx_PMU
bool "ARM CCI-500/CCI-550 PMU support" bool "support CCI-500/CCI-550"
depends on (ARM && CPU_V7) || ARM64 default y
select ARM_CCI_PMU depends on ARM_CCI_PMU
help help
Support for PMU events monitoring on the ARM CCI-500/CCI-550 cache CCI-500/CCI-550 both provide 8 independent event counters, which can
coherent interconnects. Both of them provide 8 independent event counters, count events pertaining to the slave/master interfaces as well as the
which can count events pertaining to the slave/master interfaces as well internal events to the CCI.
as the internal events to the CCI.
If unsure, say Y
config ARM_CCN config ARM_CCN
tristate "ARM CCN driver support" tristate "ARM CCN driver support"
......
...@@ -1407,6 +1407,7 @@ static int cci_pmu_init(struct cci_pmu *cci_pmu, struct platform_device *pdev) ...@@ -1407,6 +1407,7 @@ static int cci_pmu_init(struct cci_pmu *cci_pmu, struct platform_device *pdev)
pmu_format_attr_group.attrs = model->format_attrs; pmu_format_attr_group.attrs = model->format_attrs;
cci_pmu->pmu = (struct pmu) { cci_pmu->pmu = (struct pmu) {
.module = THIS_MODULE,
.name = cci_pmu->model->name, .name = cci_pmu->model->name,
.task_ctx_nr = perf_invalid_context, .task_ctx_nr = perf_invalid_context,
.pmu_enable = cci_pmu_enable, .pmu_enable = cci_pmu_enable,
...@@ -1572,6 +1573,7 @@ static const struct of_device_id arm_cci_pmu_matches[] = { ...@@ -1572,6 +1573,7 @@ static const struct of_device_id arm_cci_pmu_matches[] = {
#endif #endif
{}, {},
}; };
MODULE_DEVICE_TABLE(of, arm_cci_pmu_matches);
static bool is_duplicate_irq(int irq, int *irqs, int nr_irqs) static bool is_duplicate_irq(int irq, int *irqs, int nr_irqs)
{ {
...@@ -1693,14 +1695,27 @@ static int cci_pmu_probe(struct platform_device *pdev) ...@@ -1693,14 +1695,27 @@ static int cci_pmu_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int cci_pmu_remove(struct platform_device *pdev)
{
if (!g_cci_pmu)
return 0;
cpuhp_remove_state(CPUHP_AP_PERF_ARM_CCI_ONLINE);
perf_pmu_unregister(&g_cci_pmu->pmu);
g_cci_pmu = NULL;
return 0;
}
static struct platform_driver cci_pmu_driver = { static struct platform_driver cci_pmu_driver = {
.driver = { .driver = {
.name = DRIVER_NAME, .name = DRIVER_NAME,
.of_match_table = arm_cci_pmu_matches, .of_match_table = arm_cci_pmu_matches,
}, },
.probe = cci_pmu_probe, .probe = cci_pmu_probe,
.remove = cci_pmu_remove,
}; };
builtin_platform_driver(cci_pmu_driver); module_platform_driver(cci_pmu_driver);
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("ARM CCI PMU support"); MODULE_DESCRIPTION("ARM CCI PMU support");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment