[PATCH 1/5] perf/arm_cspmu: Export arm_cspmu_apmt_node

Besar Wicaksono posted 5 patches 1 month, 3 weeks ago
There is a newer version of this series
[PATCH 1/5] perf/arm_cspmu: Export arm_cspmu_apmt_node
Posted by Besar Wicaksono 1 month, 3 weeks ago
Make arm_cspmu_apmt_node API accessible to vendor driver.

Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com>
---
 drivers/perf/arm_cspmu/arm_cspmu.c | 3 ++-
 drivers/perf/arm_cspmu/arm_cspmu.h | 4 ++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c
index efa9b229e701..e4b98cfa606c 100644
--- a/drivers/perf/arm_cspmu/arm_cspmu.c
+++ b/drivers/perf/arm_cspmu/arm_cspmu.c
@@ -70,12 +70,13 @@ static void arm_cspmu_set_ev_filter(struct arm_cspmu *cspmu,
 static void arm_cspmu_set_cc_filter(struct arm_cspmu *cspmu,
 				    const struct perf_event *event);
 
-static struct acpi_apmt_node *arm_cspmu_apmt_node(struct device *dev)
+struct acpi_apmt_node *arm_cspmu_apmt_node(struct device *dev)
 {
 	struct acpi_apmt_node **ptr = dev_get_platdata(dev);
 
 	return ptr ? *ptr : NULL;
 }
+EXPORT_SYMBOL_GPL(arm_cspmu_apmt_node);
 
 /*
  * In CoreSight PMU architecture, all of the MMIO registers are 32-bit except
diff --git a/drivers/perf/arm_cspmu/arm_cspmu.h b/drivers/perf/arm_cspmu/arm_cspmu.h
index 19684b76bd96..36c1dcce33d6 100644
--- a/drivers/perf/arm_cspmu/arm_cspmu.h
+++ b/drivers/perf/arm_cspmu/arm_cspmu.h
@@ -8,6 +8,7 @@
 #ifndef __ARM_CSPMU_H__
 #define __ARM_CSPMU_H__
 
+#include <linux/acpi.h>
 #include <linux/bitfield.h>
 #include <linux/cpumask.h>
 #include <linux/device.h>
@@ -222,4 +223,7 @@ int arm_cspmu_impl_register(const struct arm_cspmu_impl_match *impl_match);
 /* Unregister vendor backend. */
 void arm_cspmu_impl_unregister(const struct arm_cspmu_impl_match *impl_match);
 
+/* Get ACPI APMT node. */
+struct acpi_apmt_node *arm_cspmu_apmt_node(struct device *dev);
+
 #endif /* __ARM_CSPMU_H__ */
-- 
2.47.0
Re: [PATCH 1/5] perf/arm_cspmu: Export arm_cspmu_apmt_node
Posted by Ilkka Koskinen 1 month, 2 weeks ago
Hi Ben,

On Tue, 12 Aug 2025, Besar Wicaksono wrote:
> Make arm_cspmu_apmt_node API accessible to vendor driver.

I think I haven't seen the latest version of the spec. So, I'm curious,
what kind of information the table has that the vendor drivers needs to 
have access to it?

>
> Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com>
> ---
> drivers/perf/arm_cspmu/arm_cspmu.c | 3 ++-
> drivers/perf/arm_cspmu/arm_cspmu.h | 4 ++++
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c
> index efa9b229e701..e4b98cfa606c 100644
> --- a/drivers/perf/arm_cspmu/arm_cspmu.c
> +++ b/drivers/perf/arm_cspmu/arm_cspmu.c
> @@ -70,12 +70,13 @@ static void arm_cspmu_set_ev_filter(struct arm_cspmu *cspmu,
> static void arm_cspmu_set_cc_filter(struct arm_cspmu *cspmu,
> 				    const struct perf_event *event);
>
> -static struct acpi_apmt_node *arm_cspmu_apmt_node(struct device *dev)
> +struct acpi_apmt_node *arm_cspmu_apmt_node(struct device *dev)
> {
> 	struct acpi_apmt_node **ptr = dev_get_platdata(dev);
>
> 	return ptr ? *ptr : NULL;
> }
> +EXPORT_SYMBOL_GPL(arm_cspmu_apmt_node);

Rather than exporting the function, wouldn't it be better to move it to 
arm_cspmu.h instead?

Cheers, Ilkka

>
> /*
>  * In CoreSight PMU architecture, all of the MMIO registers are 32-bit except
> diff --git a/drivers/perf/arm_cspmu/arm_cspmu.h b/drivers/perf/arm_cspmu/arm_cspmu.h
> index 19684b76bd96..36c1dcce33d6 100644
> --- a/drivers/perf/arm_cspmu/arm_cspmu.h
> +++ b/drivers/perf/arm_cspmu/arm_cspmu.h
> @@ -8,6 +8,7 @@
> #ifndef __ARM_CSPMU_H__
> #define __ARM_CSPMU_H__
>
> +#include <linux/acpi.h>
> #include <linux/bitfield.h>
> #include <linux/cpumask.h>
> #include <linux/device.h>
> @@ -222,4 +223,7 @@ int arm_cspmu_impl_register(const struct arm_cspmu_impl_match *impl_match);
> /* Unregister vendor backend. */
> void arm_cspmu_impl_unregister(const struct arm_cspmu_impl_match *impl_match);
>
> +/* Get ACPI APMT node. */
> +struct acpi_apmt_node *arm_cspmu_apmt_node(struct device *dev);
> +
> #endif /* __ARM_CSPMU_H__ */
> -- 
> 2.47.0
>
>