Skip to contentSkip to conversation

xtensa: report trax and perf counters in cpuinfo

PATCH New Max Filippov 1 participant 1 message Jun 9, 2023 Tensilica Xtensa port (xtensa)

lore
Share & tools
lore

Max Filippov

author maintainer
#0 lore raw

PATCH 1/1 xtensa: report trax and perf counters in cpuinfo

Add 'trax' to the list of CPU features when xtensa core is configured with TRAX.
Add 'perf' to the list of CPU features when xtensa core is configured with perf counters and show the number of configured perf counters.

---
 arch/xtensa/include/asm/core.h |  8 ++++++++
 arch/xtensa/kernel/setup.c     | 12 ++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)
arch/xtensa/include/asm/core.h +8 -0
index f856d2bcb9f3..0e1bb6f019d6 100644
@@ -26,6 +26,14 @@
 #define XCHAL_SPANNING_WAY 0
 #endif
 
+#ifndef XCHAL_HAVE_TRAX
+#define XCHAL_HAVE_TRAX 0
+#endif
+
+#ifndef XCHAL_NUM_PERF_COUNTERS
+#define XCHAL_NUM_PERF_COUNTERS 0
+#endif
+
 #if XCHAL_HAVE_WINDOWED
 #if defined(CONFIG_USER_ABI_DEFAULT) || defined(CONFIG_USER_ABI_CALL0_PROBE)
 /* Whether windowed ABI is supported in userspace. */
arch/xtensa/kernel/setup.c +10 -2
index ba20c6800fd4..357e7b0dff09 100644
@@ -587,6 +587,12 @@ c_show(struct seq_file *f, void *slot)
 # if XCHAL_HAVE_OCD
 		     "ocd "
 # endif
+#if XCHAL_HAVE_TRAX
+		     "trax "
+#endif
+#if XCHAL_NUM_PERF_COUNTERS
+		     "perf "
+#endif
 #endif
 #if XCHAL_HAVE_DENSITY
 	    	     "density "
@@ -636,11 +642,13 @@ c_show(struct seq_file *f, void *slot)
 	seq_printf(f,"physical aregs\t: %d\n"
 		     "misc regs\t: %d\n"
 		     "ibreak\t\t: %d\n"
-		     "dbreak\t\t: %d\n",
+		     "dbreak\t\t: %d\n"
+		     "perf counters\t: %d\n",
 		     XCHAL_NUM_AREGS,
 		     XCHAL_NUM_MISC_REGS,
 		     XCHAL_NUM_IBREAK,
-		     XCHAL_NUM_DBREAK);
+		     XCHAL_NUM_DBREAK,
+		     XCHAL_NUM_PERF_COUNTERS);
 
 
 	/* Interrupt. */
Signature · 1 line
2.30.2