Skip to content

Commit 862f7ad

Browse files
rmurphy-armwilldeacon
authored andcommitted
perf/arm_cspmu: Move register definitons to header
Implementations may occasionally want to refer to register offsets, so for the sake of consistency move all of the register definitions to join the PMIIDR fields in the private header where they can be shared. As an example nicety, we can then define Ampere's imp-def filters in terms of the architectural PMIMPDEF range rather than open-coded offsets. Signed-off-by: Robin Murphy <robin.murphy@arm.com> Reviewed-by: James Clark <james.clark@linaro.org> Reviewed-by: Ilkka Koskinen <ilkka@os.amperecomputing.com> Link: https://lore.kernel.org/r/5a3c796560665b51cb63fec0d473afd8f8d0a836.1741190362.git.robin.murphy@arm.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent 823437e commit 862f7ad

File tree

3 files changed

+50
-49
lines changed

3 files changed

+50
-49
lines changed

drivers/perf/arm_cspmu/ampere_cspmu.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
#include "arm_cspmu.h"
1212

13-
#define PMAUXR0 0xD80
14-
#define PMAUXR1 0xD84
15-
#define PMAUXR2 0xD88
16-
#define PMAUXR3 0xD8C
13+
#define PMAUXR0 PMIMPDEF
14+
#define PMAUXR1 (PMIMPDEF + 0x4)
15+
#define PMAUXR2 (PMIMPDEF + 0x8)
16+
#define PMAUXR3 (PMIMPDEF + 0xC)
1717

1818
#define to_ampere_cspmu_ctx(cspmu) ((struct ampere_cspmu_ctx *)(cspmu->impl.ctx))
1919

drivers/perf/arm_cspmu/arm_cspmu.c

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -40,51 +40,6 @@
4040
ARM_CSPMU_EXT_ATTR(_name, arm_cspmu_cpumask_show, \
4141
(unsigned long)_config)
4242

43-
/*
44-
* CoreSight PMU Arch register offsets.
45-
*/
46-
#define PMEVCNTR_LO 0x0
47-
#define PMEVCNTR_HI 0x4
48-
#define PMEVTYPER 0x400
49-
#define PMCCFILTR 0x47C
50-
#define PMEVFILTR 0xA00
51-
#define PMCNTENSET 0xC00
52-
#define PMCNTENCLR 0xC20
53-
#define PMINTENSET 0xC40
54-
#define PMINTENCLR 0xC60
55-
#define PMOVSCLR 0xC80
56-
#define PMOVSSET 0xCC0
57-
#define PMCFGR 0xE00
58-
#define PMCR 0xE04
59-
#define PMIIDR 0xE08
60-
61-
/* PMCFGR register field */
62-
#define PMCFGR_NCG GENMASK(31, 28)
63-
#define PMCFGR_HDBG BIT(24)
64-
#define PMCFGR_TRO BIT(23)
65-
#define PMCFGR_SS BIT(22)
66-
#define PMCFGR_FZO BIT(21)
67-
#define PMCFGR_MSI BIT(20)
68-
#define PMCFGR_UEN BIT(19)
69-
#define PMCFGR_NA BIT(17)
70-
#define PMCFGR_EX BIT(16)
71-
#define PMCFGR_CCD BIT(15)
72-
#define PMCFGR_CC BIT(14)
73-
#define PMCFGR_SIZE GENMASK(13, 8)
74-
#define PMCFGR_N GENMASK(7, 0)
75-
76-
/* PMCR register field */
77-
#define PMCR_TRO BIT(11)
78-
#define PMCR_HDBG BIT(10)
79-
#define PMCR_FZO BIT(9)
80-
#define PMCR_NA BIT(8)
81-
#define PMCR_DP BIT(5)
82-
#define PMCR_X BIT(4)
83-
#define PMCR_D BIT(3)
84-
#define PMCR_C BIT(2)
85-
#define PMCR_P BIT(1)
86-
#define PMCR_E BIT(0)
87-
8843
/* Each SET/CLR register supports up to 32 counters. */
8944
#define ARM_CSPMU_SET_CLR_COUNTER_SHIFT 5
9045
#define ARM_CSPMU_SET_CLR_COUNTER_NUM \

drivers/perf/arm_cspmu/arm_cspmu.h

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,52 @@
6565
/* The cycle counter, if implemented, is located at counter[31]. */
6666
#define ARM_CSPMU_CYCLE_CNTR_IDX 31
6767

68+
/*
69+
* CoreSight PMU Arch register offsets.
70+
*/
71+
#define PMEVCNTR_LO 0x0
72+
#define PMEVCNTR_HI 0x4
73+
#define PMEVTYPER 0x400
74+
#define PMCCFILTR 0x47C
75+
#define PMEVFILTR 0xA00
76+
#define PMCNTENSET 0xC00
77+
#define PMCNTENCLR 0xC20
78+
#define PMINTENSET 0xC40
79+
#define PMINTENCLR 0xC60
80+
#define PMOVSCLR 0xC80
81+
#define PMOVSSET 0xCC0
82+
#define PMIMPDEF 0xD80
83+
#define PMCFGR 0xE00
84+
#define PMCR 0xE04
85+
#define PMIIDR 0xE08
86+
87+
/* PMCFGR register field */
88+
#define PMCFGR_NCG GENMASK(31, 28)
89+
#define PMCFGR_HDBG BIT(24)
90+
#define PMCFGR_TRO BIT(23)
91+
#define PMCFGR_SS BIT(22)
92+
#define PMCFGR_FZO BIT(21)
93+
#define PMCFGR_MSI BIT(20)
94+
#define PMCFGR_UEN BIT(19)
95+
#define PMCFGR_NA BIT(17)
96+
#define PMCFGR_EX BIT(16)
97+
#define PMCFGR_CCD BIT(15)
98+
#define PMCFGR_CC BIT(14)
99+
#define PMCFGR_SIZE GENMASK(13, 8)
100+
#define PMCFGR_N GENMASK(7, 0)
101+
102+
/* PMCR register field */
103+
#define PMCR_TRO BIT(11)
104+
#define PMCR_HDBG BIT(10)
105+
#define PMCR_FZO BIT(9)
106+
#define PMCR_NA BIT(8)
107+
#define PMCR_DP BIT(5)
108+
#define PMCR_X BIT(4)
109+
#define PMCR_D BIT(3)
110+
#define PMCR_C BIT(2)
111+
#define PMCR_P BIT(1)
112+
#define PMCR_E BIT(0)
113+
68114
/* PMIIDR register field */
69115
#define ARM_CSPMU_PMIIDR_IMPLEMENTER GENMASK(11, 0)
70116
#define ARM_CSPMU_PMIIDR_PRODUCTID GENMASK(31, 20)

0 commit comments

Comments
 (0)