Skip to content

Commit 687eb3c

Browse files
committed
xtensa: PMU: fix base address for the newer hardware
With introduction of ERI access control in RG.0 base address of the PMU unit registers has changed. Add support for the new PMU configuration. Cc: stable@vger.kernel.org Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
1 parent 2dde18c commit 687eb3c

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

arch/xtensa/include/asm/core.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,13 @@
5252
#define XTENSA_STACK_ALIGNMENT 16
5353
#endif
5454

55+
#ifndef XCHAL_HW_MIN_VERSION
56+
#if defined(XCHAL_HW_MIN_VERSION_MAJOR) && defined(XCHAL_HW_MIN_VERSION_MINOR)
57+
#define XCHAL_HW_MIN_VERSION (XCHAL_HW_MIN_VERSION_MAJOR * 100 + \
58+
XCHAL_HW_MIN_VERSION_MINOR)
59+
#else
60+
#define XCHAL_HW_MIN_VERSION 0
61+
#endif
62+
#endif
63+
5564
#endif

arch/xtensa/kernel/perf_event.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,26 @@
1313
#include <linux/perf_event.h>
1414
#include <linux/platform_device.h>
1515

16+
#include <asm/core.h>
1617
#include <asm/processor.h>
1718
#include <asm/stacktrace.h>
1819

20+
#define XTENSA_HWVERSION_RG_2015_0 260000
21+
22+
#if XCHAL_HW_MIN_VERSION >= XTENSA_HWVERSION_RG_2015_0
23+
#define XTENSA_PMU_ERI_BASE 0x00101000
24+
#else
25+
#define XTENSA_PMU_ERI_BASE 0x00001000
26+
#endif
27+
1928
/* Global control/status for all perf counters */
20-
#define XTENSA_PMU_PMG 0x1000
29+
#define XTENSA_PMU_PMG XTENSA_PMU_ERI_BASE
2130
/* Perf counter values */
22-
#define XTENSA_PMU_PM(i) (0x1080 + (i) * 4)
31+
#define XTENSA_PMU_PM(i) (XTENSA_PMU_ERI_BASE + 0x80 + (i) * 4)
2332
/* Perf counter control registers */
24-
#define XTENSA_PMU_PMCTRL(i) (0x1100 + (i) * 4)
33+
#define XTENSA_PMU_PMCTRL(i) (XTENSA_PMU_ERI_BASE + 0x100 + (i) * 4)
2534
/* Perf counter status registers */
26-
#define XTENSA_PMU_PMSTAT(i) (0x1180 + (i) * 4)
35+
#define XTENSA_PMU_PMSTAT(i) (XTENSA_PMU_ERI_BASE + 0x180 + (i) * 4)
2736

2837
#define XTENSA_PMU_PMG_PMEN 0x1
2938

0 commit comments

Comments
 (0)