Skip to contentSkip to conversation

perf: arm_cspmu: ampere: Add support for Ampere SoC PMUs

PATCH Superseded Ilkka Koskinen 2 participants 10 messages Aug 15, 2023 – Aug 16, 2023

Subsystems (2)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 cover perf: arm_cspmu: ampere: Add support for Ampere SoC PMUs

Changes since v5:
* Implemented the needed parts for vendor registration API
* Rebased on top of Besar's patch

[PATCH v5] perf: arm_cspmu: Separate Arm and vendor module
https://lore.kernel.org/all/[email protected]/

* v5: https://lore.kernel.org/all/[email protected]/

Changes since v4:
* "Support implementation specific filters" patch:
- Added comment about filter and impdef registers and reference to the Coresight PMU specification to the commit message

* "Add support for Ampere SoC PMU" patch:
- Fixed the documentation and added more comments
- Changed the incrementing PMU index number to idr_alloc() (Needs a impdef release hook patch to release unused index)
- Fixed style in init_ops() to more reasonable
- Moved bank parameter to config1

Changes since v3:
* use_64b_counter_reg => has_atomic_dword (patch 1/4)
* Removed the unnecessary hook for group validation (patch 3/4)
* Added group config validation to ampere_cspmu_validate_event() (patch 4/4)
* Rebased the patchset

Changes since v2:
* Changed to use supports_64bits_atomics() and replaced the split writes with lo_hi_writeq()
* Added implementation specific group validation to patch 3
* Dropped shared interrupt patch
* Removed unnecessary filter_enable parameter from ampere module
* Added group validation to ampere module

Changes since v1:
* Rather than creating a completely new driver, implemented as a submodule of Arm CoreSight PMU driver
* Fixed shared filter handling

Ilkka Koskinen (4):
perf: arm_cspmu: Split 64-bit write to 32-bit writes
perf: arm_cspmu: Support implementation specific filters
perf: arm_cspmu: Support implementation specific validation
perf: arm_cspmu: ampere_cspmu: Add support for Ampere SoC PMU

 .../admin-guide/perf/ampere_cspmu.rst         |  29 ++
 drivers/perf/arm_cspmu/Kconfig                |  10 +
 drivers/perf/arm_cspmu/Makefile               |   2 +
 drivers/perf/arm_cspmu/ampere_cspmu.c         | 271 ++++++++++++++++++
 drivers/perf/arm_cspmu/arm_cspmu.c            |  33 ++-
 drivers/perf/arm_cspmu/arm_cspmu.h            |   7 +
 6 files changed, 346 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/admin-guide/perf/ampere_cspmu.rst
 create mode 100644 drivers/perf/arm_cspmu/ampere_cspmu.c
Signature · 7 lines
2.41.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw

PATCH v6 1/4 perf: arm_cspmu: Split 64-bit write to 32-bit writes

Split the 64-bit register accesses if 64-bit access is not supported by the PMU.

---
 drivers/perf/arm_cspmu/arm_cspmu.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/perf/arm_cspmu/arm_cspmu.c +4 -1
index 04be94b4aa48..6387cbad7a7d 100644
@@ -715,7 +715,10 @@ static void arm_cspmu_write_counter(struct perf_event *event, u64 val)
 	if (use_64b_counter_reg(cspmu)) {
 		offset = counter_offset(sizeof(u64), event->hw.idx);
 
-		writeq(val, cspmu->base1 + offset);
+		if (cspmu->has_atomic_dword)
+			writeq(val, cspmu->base1 + offset);
+		else
+			lo_hi_writeq(val, cspmu->base1 + offset);
 	} else {
 		offset = counter_offset(sizeof(u32), event->hw.idx);
 
Signature · 7 lines
2.41.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Reviewed-by on v6 1/4
#2 lore raw

Re: [PATCH v6 1/4] perf: arm_cspmu: Split 64-bit write to 32-bit writes

Quoted 5 lines · Ilkka Koskinen

Split the 64-bit register accesses if 64-bit access is not supported by the PMU.

Do we need a Fixes tag ?

With that:

Suzuki

Quoted 20 lines
---
  drivers/perf/arm_cspmu/arm_cspmu.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/perf/arm_cspmu/arm_cspmu.c +4 -1
index 04be94b4aa48..6387cbad7a7d 100644
@@ -715,7 +715,10 @@ static void arm_cspmu_write_counter(struct perf_event *event, u64 val)
  	if (use_64b_counter_reg(cspmu)) {
  		offset = counter_offset(sizeof(u64), event->hw.idx);
 
-		writeq(val, cspmu->base1 + offset);
+		if (cspmu->has_atomic_dword)
+			writeq(val, cspmu->base1 + offset);
+		else
+			lo_hi_writeq(val, cspmu->base1 + offset);
 
 
  	} else {
Quoted 2 lines
  		offset = counter_offset(sizeof(u32), event->hw.idx);

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#3 lore raw

Re: [PATCH v6 1/4] perf: arm_cspmu: Split 64-bit write to 32-bit writes

Hi Suzuki,

Quoted 8 lines · Suzuki K Poulose
Quoted 5 lines · Ilkka Koskinen

Split the 64-bit register accesses if 64-bit access is not supported by the PMU.

Do we need a Fixes tag ?

I believe, NVIDIA's PMU supports 64-bit access while Ampere's one doesn't and since this patchset enables support for the latter one, it doesn't seem like we need a Fixes tag here.

Cheers, Ilkka

Quoted 31 lines

With that:

Suzuki

Quoted 22 lines
---
  drivers/perf/arm_cspmu/arm_cspmu.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/perf/arm_cspmu/arm_cspmu.c +4 -0
index 04be94b4aa48..6387cbad7a7d 100644
@@ -715,7 +715,10 @@ static void arm_cspmu_write_counter(struct perf_event 
 *event, u64 val)
  	if (use_64b_counter_reg(cspmu)) {
  		offset = counter_offset(sizeof(u64), event->hw.idx);
  -		writeq(val, cspmu->base1 + offset);
+		if (cspmu->has_atomic_dword)
+			writeq(val, cspmu->base1 + offset);
+		else
+			lo_hi_writeq(val, cspmu->base1 + offset);
 
 
  	} else {
  		offset = counter_offset(sizeof(u32), event->hw.idx);

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#4 lore raw

Re: [PATCH v6 1/4] perf: arm_cspmu: Split 64-bit write to 32-bit writes

Quoted 8 lines · Ilkka Koskinen

Hi Suzuki,

Quoted 4 lines · Suzuki K Poulose
Quoted 3 lines · Ilkka Koskinen

Split the 64-bit register accesses if 64-bit access is not supported by the PMU.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Do we need a Fixes tag ?

I believe, NVIDIA's PMU supports 64-bit access while Ampere's one doesn't and since this patchset enables support for the latter one, it doesn't seem like we need a Fixes tag here.

Ok, makes sense.

Suzuki

Quoted 34 lines

Cheers, Ilkka

Quoted 31 lines

With that:

Suzuki

Quoted 22 lines

---
  drivers/perf/arm_cspmu/arm_cspmu.c | 5 ++++-

  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/perf/arm_cspmu/arm_cspmu.c +4 -0
index 04be94b4aa48..6387cbad7a7d 100644
@@ -715,7 +715,10 @@ static void arm_cspmu_write_counter(struct 
 perf_event *event, u64 val)
       if (use_64b_counter_reg(cspmu)) {
           offset = counter_offset(sizeof(u64), event->hw.idx);
   -        writeq(val, cspmu->base1 + offset);
+        if (cspmu->has_atomic_dword)
+            writeq(val, cspmu->base1 + offset);
+        else
+            lo_hi_writeq(val, cspmu->base1 + offset);
 
 

      } else {
          offset = counter_offset(sizeof(u32), event->hw.idx);

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#5 lore raw

PATCH v6 2/4 perf: arm_cspmu: Support implementation specific filters

In reply to Ilkka Koskinen

ARM Coresight PMU architecture specification [1] defines PMEVTYPER and PMEVFILT* registers as optional in Chapter 2.1. Moreover, implementers may choose to use PMIMPDEF* registers (offset: 0xD80-> 0xDFF) to filter the events. Add support for those by adding implementation specific filter callback function.

[1] https://developer.arm.com/documentation/ihi0091/latest

---
 drivers/perf/arm_cspmu/arm_cspmu.c | 12 ++++++++----
 drivers/perf/arm_cspmu/arm_cspmu.h |  3 +++
 2 files changed, 11 insertions(+), 4 deletions(-)
drivers/perf/arm_cspmu/arm_cspmu.c +8 -4
index 6387cbad7a7d..94f6856ec786 100644
@@ -116,6 +116,9 @@ static unsigned long arm_cspmu_cpuhp_state;
 
 static DEFINE_MUTEX(arm_cspmu_lock);
 
+static void arm_cspmu_set_ev_filter(struct arm_cspmu *cspmu,
+				    struct hw_perf_event *hwc, u32 filter);
+
 static struct acpi_apmt_node *arm_cspmu_apmt_node(struct device *dev)
 {
 	return *(struct acpi_apmt_node **)dev_get_platdata(dev);
@@ -450,6 +453,7 @@ static int arm_cspmu_init_impl_ops(struct arm_cspmu *cspmu)
 	CHECK_DEFAULT_IMPL_OPS(impl_ops, event_type);
 	CHECK_DEFAULT_IMPL_OPS(impl_ops, event_filter);
 	CHECK_DEFAULT_IMPL_OPS(impl_ops, event_attr_is_visible);
+	CHECK_DEFAULT_IMPL_OPS(impl_ops, set_ev_filter);
 
 	return 0;
 }
@@ -811,9 +815,9 @@ static inline void arm_cspmu_set_event(struct arm_cspmu *cspmu,
 	writel(hwc->config, cspmu->base0 + offset);
 }
 
-static inline void arm_cspmu_set_ev_filter(struct arm_cspmu *cspmu,
-					   struct hw_perf_event *hwc,
-					   u32 filter)
+static void arm_cspmu_set_ev_filter(struct arm_cspmu *cspmu,
+					struct hw_perf_event *hwc,
+					u32 filter)
 {
 	u32 offset = PMEVFILTR + (4 * hwc->idx);
 
@@ -845,7 +849,7 @@ static void arm_cspmu_start(struct perf_event *event, int pmu_flags)
 		arm_cspmu_set_cc_filter(cspmu, filter);
 	} else {
 		arm_cspmu_set_event(cspmu, hwc);
-		arm_cspmu_set_ev_filter(cspmu, hwc, filter);
+		cspmu->impl.ops.set_ev_filter(cspmu, hwc, filter);
 	}
 
 	hwc->state = 0;
drivers/perf/arm_cspmu/arm_cspmu.h +3 -0
index e5c6dff2ce7f..274ca3d10578 100644
@@ -104,6 +104,9 @@ struct arm_cspmu_impl_ops {
 	u32 (*event_type)(const struct perf_event *event);
 	/* Decode filter value from configs */
 	u32 (*event_filter)(const struct perf_event *event);
+	/* Set event filter */
+	void (*set_ev_filter)(struct arm_cspmu *cspmu,
+			      struct hw_perf_event *hwc, u32 filter);
 	/* Hide/show unsupported events */
 	umode_t (*event_attr_is_visible)(struct kobject *kobj,
 					 struct attribute *attr, int unused);
Signature · 7 lines
2.41.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Reviewed-by on v6 2/4
#6 lore raw

Re: [PATCH v6 2/4] perf: arm_cspmu: Support implementation specific filters

Quoted 10 lines · Ilkka Koskinen

ARM Coresight PMU architecture specification [1] defines PMEVTYPER and PMEVFILT* registers as optional in Chapter 2.1. Moreover, implementers may choose to use PMIMPDEF* registers (offset: 0xD80-> 0xDFF) to filter the events. Add support for those by adding implementation specific filter callback function.

[1] https://developer.arm.com/documentation/ihi0091/latest

Quoted 54 lines
---
  drivers/perf/arm_cspmu/arm_cspmu.c | 12 ++++++++----
  drivers/perf/arm_cspmu/arm_cspmu.h |  3 +++
  2 files changed, 11 insertions(+), 4 deletions(-)
drivers/perf/arm_cspmu/arm_cspmu.c +8 -4
index 6387cbad7a7d..94f6856ec786 100644
@@ -116,6 +116,9 @@ static unsigned long arm_cspmu_cpuhp_state;
 
  static DEFINE_MUTEX(arm_cspmu_lock);
 
+static void arm_cspmu_set_ev_filter(struct arm_cspmu *cspmu,
+				    struct hw_perf_event *hwc, u32 filter);
+
  static struct acpi_apmt_node *arm_cspmu_apmt_node(struct device *dev)
  {
  	return *(struct acpi_apmt_node **)dev_get_platdata(dev);
@@ -450,6 +453,7 @@ static int arm_cspmu_init_impl_ops(struct arm_cspmu *cspmu)
  	CHECK_DEFAULT_IMPL_OPS(impl_ops, event_type);
  	CHECK_DEFAULT_IMPL_OPS(impl_ops, event_filter);
  	CHECK_DEFAULT_IMPL_OPS(impl_ops, event_attr_is_visible);
+	CHECK_DEFAULT_IMPL_OPS(impl_ops, set_ev_filter);
 
  	return 0;
  }
@@ -811,9 +815,9 @@ static inline void arm_cspmu_set_event(struct arm_cspmu *cspmu,
  	writel(hwc->config, cspmu->base0 + offset);
  }
 
-static inline void arm_cspmu_set_ev_filter(struct arm_cspmu *cspmu,
-					   struct hw_perf_event *hwc,
-					   u32 filter)
+static void arm_cspmu_set_ev_filter(struct arm_cspmu *cspmu,
+					struct hw_perf_event *hwc,
+					u32 filter)
  {
  	u32 offset = PMEVFILTR + (4 * hwc->idx);
 
@@ -845,7 +849,7 @@ static void arm_cspmu_start(struct perf_event *event, int pmu_flags)
  		arm_cspmu_set_cc_filter(cspmu, filter);
  	} else {
  		arm_cspmu_set_event(cspmu, hwc);
-		arm_cspmu_set_ev_filter(cspmu, hwc, filter);
+		cspmu->impl.ops.set_ev_filter(cspmu, hwc, filter);
  	}
 
  	hwc->state = 0;
drivers/perf/arm_cspmu/arm_cspmu.h +0 -0
index e5c6dff2ce7f..274ca3d10578 100644

drivers/perf/arm_cspmu/arm_cspmu.h struct arm_cspmu_impl_ops { · line 112

Quoted 9 lines
drivers/perf/arm_cspmu/arm_cspmu.h +3 -0
@@ -104,6 +104,9 @@ struct arm_cspmu_impl_ops {
  	u32 (*event_type)(const struct perf_event *event);
  	/* Decode filter value from configs */
  	u32 (*event_filter)(const struct perf_event *event);
+	/* Set event filter */
+	void (*set_ev_filter)(struct arm_cspmu *cspmu,
+			      struct hw_perf_event *hwc, u32 filter);
  	/* Hide/show unsupported events */
  	umode_t (*event_attr_is_visible)(struct kobject *kobj,
  					 struct attribute *attr, int unused);

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#7 lore raw

PATCH v6 3/4 perf: arm_cspmu: Support implementation specific validation

In reply to Ilkka Koskinen

Some platforms may use e.g. different filtering mechanism and, thus, may need different way to validate the events and group.

---
 drivers/perf/arm_cspmu/arm_cspmu.c | 8 +++++++-
 drivers/perf/arm_cspmu/arm_cspmu.h | 3 +++
 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/perf/arm_cspmu/arm_cspmu.c +7 -1
index 94f6856ec786..585ce96ac03f 100644
@@ -572,7 +572,7 @@ static void arm_cspmu_disable(struct pmu *pmu)
 static int arm_cspmu_get_event_idx(struct arm_cspmu_hw_events *hw_events,
 				struct perf_event *event)
 {
-	int idx;
+	int idx, ret;
 	struct arm_cspmu *cspmu = to_arm_cspmu(event->pmu);
 
 	if (supports_cycle_counter(cspmu)) {
@@ -606,6 +606,12 @@ static int arm_cspmu_get_event_idx(struct arm_cspmu_hw_events *hw_events,
 	if (idx >= cspmu->num_logical_ctrs)
 		return -EAGAIN;
 
+	if (cspmu->impl.ops.validate_event) {
+		ret = cspmu->impl.ops.validate_event(cspmu, event);
+		if (ret)
+			return ret;
+	}
+
 	set_bit(idx, hw_events->used_ctrs);
 
 	return idx;
drivers/perf/arm_cspmu/arm_cspmu.h +3 -0
index 274ca3d10578..05577f74b8a0 100644
@@ -107,6 +107,9 @@ struct arm_cspmu_impl_ops {
 	/* Set event filter */
 	void (*set_ev_filter)(struct arm_cspmu *cspmu,
 			      struct hw_perf_event *hwc, u32 filter);
+	/* Implementation specific event validation */
+	int (*validate_event)(struct arm_cspmu *cspmu,
+			      struct perf_event *event);
 	/* Hide/show unsupported events */
 	umode_t (*event_attr_is_visible)(struct kobject *kobj,
 					 struct attribute *attr, int unused);
Signature · 7 lines
2.41.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Reviewed-by on v6 3/4
#8 lore raw

Re: [PATCH v6 3/4] perf: arm_cspmu: Support implementation specific validation

Quoted 5 lines · Ilkka Koskinen

Some platforms may use e.g. different filtering mechanism and, thus, may need different way to validate the events and group.

Quoted 36 lines
---
  drivers/perf/arm_cspmu/arm_cspmu.c | 8 +++++++-
  drivers/perf/arm_cspmu/arm_cspmu.h | 3 +++
  2 files changed, 10 insertions(+), 1 deletion(-)
drivers/perf/arm_cspmu/arm_cspmu.c +7 -1
index 94f6856ec786..585ce96ac03f 100644
@@ -572,7 +572,7 @@ static void arm_cspmu_disable(struct pmu *pmu)
  static int arm_cspmu_get_event_idx(struct arm_cspmu_hw_events *hw_events,
  				struct perf_event *event)
  {
-	int idx;
+	int idx, ret;
  	struct arm_cspmu *cspmu = to_arm_cspmu(event->pmu);
 
  	if (supports_cycle_counter(cspmu)) {
@@ -606,6 +606,12 @@ static int arm_cspmu_get_event_idx(struct arm_cspmu_hw_events *hw_events,
  	if (idx >= cspmu->num_logical_ctrs)
  		return -EAGAIN;
 
+	if (cspmu->impl.ops.validate_event) {
+		ret = cspmu->impl.ops.validate_event(cspmu, event);
+		if (ret)
+			return ret;
+	}
+
  	set_bit(idx, hw_events->used_ctrs);
 
  	return idx;
drivers/perf/arm_cspmu/arm_cspmu.h +0 -0
index 274ca3d10578..05577f74b8a0 100644

drivers/perf/arm_cspmu/arm_cspmu.h struct arm_cspmu_impl_ops { · line 115

Quoted 9 lines
drivers/perf/arm_cspmu/arm_cspmu.h +3 -0
@@ -107,6 +107,9 @@ struct arm_cspmu_impl_ops {
  	/* Set event filter */
  	void (*set_ev_filter)(struct arm_cspmu *cspmu,
  			      struct hw_perf_event *hwc, u32 filter);
+	/* Implementation specific event validation */
+	int (*validate_event)(struct arm_cspmu *cspmu,
+			      struct perf_event *event);
  	/* Hide/show unsupported events */
  	umode_t (*event_attr_is_visible)(struct kobject *kobj,
  					 struct attribute *attr, int unused);

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#9 lore raw

PATCH v6 4/4 perf: arm_cspmu: ampere_cspmu: Add support for Ampere SoC PMU

In reply to Ilkka Koskinen

Ampere SoC PMU follows CoreSight PMU architecture. It uses implementation specific registers to filter events rather than PMEVFILTnR registers.

---
 .../admin-guide/perf/ampere_cspmu.rst         |  29 ++
 drivers/perf/arm_cspmu/Kconfig                |  10 +
 drivers/perf/arm_cspmu/Makefile               |   2 +
 drivers/perf/arm_cspmu/ampere_cspmu.c         | 271 ++++++++++++++++++
 drivers/perf/arm_cspmu/arm_cspmu.c            |   8 +
 drivers/perf/arm_cspmu/arm_cspmu.h            |   1 +
 6 files changed, 321 insertions(+)
 create mode 100644 Documentation/admin-guide/perf/ampere_cspmu.rst
 create mode 100644 drivers/perf/arm_cspmu/ampere_cspmu.c
Documentation/admin-guide/perf/ampere_cspmu.rst new file +29 -0
new file mode 100644
index 000000000000..94f93f5aee6c
@@ -0,0 +1,29 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+============================================
+Ampere SoC Performance Monitoring Unit (PMU)
+============================================
+
+Ampere SoC PMU is a generic PMU IP that follows Arm CoreSight PMU architecture.
+Therefore, the driver is implemented as a submodule of arm_cspmu driver. At the
+first phase it's used for counting MCU events on AmpereOne.
+
+
+MCU PMU events
+--------------
+
+The PMU driver supports setting filters for "rank", "bank", and "threshold".
+Note, that the filters are per PMU instance rather than per event.
+
+
+Example for perf tool use::
+
+  / # perf list ampere
+
+    ampere_mcu_pmu_0/act_sent/                         [Kernel PMU event]
+    <...>
+    ampere_mcu_pmu_1/rd_sent/                          [Kernel PMU event]
+    <...>
+
+  / # perf stat -a -e ampere_mcu_pmu_0/act_sent,bank=5,rank=3,threshold=2/,ampere_mcu_pmu_1/rd_sent/ \
+        sleep 1
drivers/perf/arm_cspmu/Kconfig +10 -0
index d5f787d22234..6f4e28fc84a2 100644
@@ -17,3 +17,13 @@ config NVIDIA_CORESIGHT_PMU_ARCH_SYSTEM_PMU
 	help
 	  Provides NVIDIA specific attributes for performance monitoring unit
 	  (PMU) devices based on ARM CoreSight PMU architecture.
+
+config AMPERE_CORESIGHT_PMU_ARCH_SYSTEM_PMU
+       tristate "Ampere Coresight Architecture PMU"
+       depends on  ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU
+	help
+	  Provides Ampere specific attributes for performance monitoring unit
+	  (PMU) devices based on ARM CoreSight PMU architecture.
+
+	  In the first phase, the driver enables support on MCU PMU used in
+	  AmpereOne SoC family.
drivers/perf/arm_cspmu/Makefile +2 -0
index 0309d2ff264a..220a734efd54 100644
@@ -3,6 +3,8 @@
 # SPDX-License-Identifier: GPL-2.0
 
 obj-$(CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU) += arm_cspmu_module.o
+
 arm_cspmu_module-y := arm_cspmu.o
 
 obj-$(CONFIG_NVIDIA_CORESIGHT_PMU_ARCH_SYSTEM_PMU) += nvidia_cspmu.o
+obj-$(CONFIG_AMPERE_CORESIGHT_PMU_ARCH_SYSTEM_PMU) += ampere_cspmu.o
drivers/perf/arm_cspmu/ampere_cspmu.c new file +271 -0

271 lines not on this page · raw message

drivers/perf/arm_cspmu/arm_cspmu.c +8 -0
index 585ce96ac03f..d6c50e06c5bc 100644
@@ -383,6 +383,14 @@ static struct arm_cspmu_impl_match impl_match[] = {
 		.module		= NULL,
 		.impl_init_ops	= NULL,
 	},
+	{
+		.module_name	= "ampere_cspmu",
+		.pmiidr_val	= ARM_CSPMU_IMPL_ID_AMPERE,
+		.pmiidr_mask	= ARM_CSPMU_PMIIDR_IMPLEMENTER,
+		.module		= NULL,
+		.impl_init_ops	= NULL,
+	},
+
 	{0}
 };
 
drivers/perf/arm_cspmu/arm_cspmu.h +1 -0
index 05577f74b8a0..586441d4dba1 100644
@@ -71,6 +71,7 @@
 
 /* JEDEC-assigned JEP106 identification code */
 #define ARM_CSPMU_IMPL_ID_NVIDIA	0x36B
+#define ARM_CSPMU_IMPL_ID_AMPERE	0xA16
 
 struct arm_cspmu;
 
Signature · 7 lines
2.41.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel