Skip to contentSkip to conversation

Removing unused macros in arch/powerpc/perf

PATCH New Likhitha Korrapati 1 participant 8 messages Apr 26, 2025 PowerPC

lore
Share & tools
lore
#0 lore raw

cover Removing unused macros in arch/powerpc/perf

The patch set below is work done to list all macros defined in c files that are not in use anymore. Thereby categorising these macros as dead macros. Use scripts to identify these macros along with commit-ids. Patch set consists of patches targeting a file in arch/powerpc/perf which has unused macros.

Likhitha Korrapati (7):
arch/powerpc/perf : Removing unused macros from power5+-pmu.c arch/powerpc/perf : Removing unused macros from power5-pmu.c arch/powerpc/perf : Removing unused macros from ppc970-pmu.c arch/powerpc/perf : Removing unused macros from power7-pmu.c arch/powerpc/perf : Removing unused macros from power6-pmu.c arch/powerpc/perf : Removing unused macros from power8-pmu.c arch/powerpc/perf : Removing unused macros from power9-pmu.c

 arch/powerpc/perf/power5+-pmu.c | 16 ----------------
 arch/powerpc/perf/power5-pmu.c  | 16 ----------------
 arch/powerpc/perf/power6-pmu.c  |  2 --
 arch/powerpc/perf/power7-pmu.c  | 14 --------------
 arch/powerpc/perf/power8-pmu.c  |  2 --
 arch/powerpc/perf/power9-pmu.c  |  2 --
 arch/powerpc/perf/ppc970-pmu.c  | 14 --------------
 7 files changed, 66 deletions(-)
Signature · 1 line
2.43.5
#1 lore raw

PATCH 1/7 arch/powerpc/perf : Removing unused macros from power5+-pmu.c

The following macros were introduced in power5+-pmu via commit aabbaa6036fd ("perfcounters/powerpc: add support for POWER5+ processors")

MMCR1_TTM2SEL_SH, MMCR1_TTMSEL_MSK, MMCR1_TD_CP_DBG1SEL_SH, MMCR1_TD_CP_DBG2SEL_SH, MMCR1_TD_CP_DBG3SEL_SH, MMCR1_GRS_L2SEL_MSK, MMCR1_GRS_L3SEL_MSK, MMCR1_GRS_MCSEL_MSK, MMCR1_GRS_FABSEL_MSK MMCR1_PMC2_ADDER_SEL_SH, MMCR1_PMC3_ADDER_SEL_SH, MMCR1_PMC4_ADDER_SEL_SH MMCR1_PMC2SEL_SH, MMCR1_PMC3SEL_SH, MMCR1_PMC4SEL_SH, MMCR1_PMCSEL_MSK

Removing the above macros as they are defined but never used.

---
 arch/powerpc/perf/power5+-pmu.c | 16 ----------------
 1 file changed, 16 deletions(-)
arch/powerpc/perf/power5+-pmu.c +0 -16
index b4708ab73145..8ece241f8e48 100644
@@ -44,31 +44,15 @@
  */
 #define MMCR1_TTM0SEL_SH	62
 #define MMCR1_TTM1SEL_SH	60
-#define MMCR1_TTM2SEL_SH	58
 #define MMCR1_TTM3SEL_SH	56
-#define MMCR1_TTMSEL_MSK	3
 #define MMCR1_TD_CP_DBG0SEL_SH	54
-#define MMCR1_TD_CP_DBG1SEL_SH	52
-#define MMCR1_TD_CP_DBG2SEL_SH	50
-#define MMCR1_TD_CP_DBG3SEL_SH	48
 #define MMCR1_GRS_L2SEL_SH	46
-#define MMCR1_GRS_L2SEL_MSK	3
 #define MMCR1_GRS_L3SEL_SH	44
-#define MMCR1_GRS_L3SEL_MSK	3
 #define MMCR1_GRS_MCSEL_SH	41
-#define MMCR1_GRS_MCSEL_MSK	7
 #define MMCR1_GRS_FABSEL_SH	39
-#define MMCR1_GRS_FABSEL_MSK	3
 #define MMCR1_PMC1_ADDER_SEL_SH	35
-#define MMCR1_PMC2_ADDER_SEL_SH	34
-#define MMCR1_PMC3_ADDER_SEL_SH	33
-#define MMCR1_PMC4_ADDER_SEL_SH	32
 #define MMCR1_PMC1SEL_SH	25
-#define MMCR1_PMC2SEL_SH	17
-#define MMCR1_PMC3SEL_SH	9
-#define MMCR1_PMC4SEL_SH	1
 #define MMCR1_PMCSEL_SH(n)	(MMCR1_PMC1SEL_SH - (n) * 8)
-#define MMCR1_PMCSEL_MSK	0x7f
 
 /*
  * Layout of constraint bits:
Signature · 1 line
2.43.5
#2 lore raw

PATCH 2/7 arch/powerpc/perf : Removing unused macros from power5-pmu.c

In reply to Likhitha Korrapati

The following macros were introduced in power5-pmu via commit 742bd95ba96e ("perfcounters/powerpc: Add support for POWER5 processors")

MMCR1_TTM2SEL_SH, MMCR1_TTMSEL_MSK, MMCR1_TD_CP_DBG1SEL_SH MMCR1_TD_CP_DBG2SEL_SH, MMCR1_TD_CP_DBG3SEL_SH, MMCR1_GRS_L2SEL_MSK MMCR1_GRS_L3SEL_MSK, MMCR1_GRS_MCSEL_MSK, MMCR1_GRS_FABSEL_MSK MMCR1_PMC2_ADDER_SEL_SH, MMCR1_PMC3_ADDER_SEL_SH, MMCR1_PMC4_ADDER_SEL_SH MMCR1_PMC2SEL_SH, MMCR1_PMC3SEL_SH, MMCR1_PMC4SEL_SH, MMCR1_PMCSEL_MSK

Removing the above macros as they are defined but never used.

---
 arch/powerpc/perf/power5-pmu.c | 16 ----------------
 1 file changed, 16 deletions(-)
arch/powerpc/perf/power5-pmu.c +0 -16
index c6aefd0a1cc8..4fe4f16ae65f 100644
@@ -44,31 +44,15 @@
  */
 #define MMCR1_TTM0SEL_SH	62
 #define MMCR1_TTM1SEL_SH	60
-#define MMCR1_TTM2SEL_SH	58
 #define MMCR1_TTM3SEL_SH	56
-#define MMCR1_TTMSEL_MSK	3
 #define MMCR1_TD_CP_DBG0SEL_SH	54
-#define MMCR1_TD_CP_DBG1SEL_SH	52
-#define MMCR1_TD_CP_DBG2SEL_SH	50
-#define MMCR1_TD_CP_DBG3SEL_SH	48
 #define MMCR1_GRS_L2SEL_SH	46
-#define MMCR1_GRS_L2SEL_MSK	3
 #define MMCR1_GRS_L3SEL_SH	44
-#define MMCR1_GRS_L3SEL_MSK	3
 #define MMCR1_GRS_MCSEL_SH	41
-#define MMCR1_GRS_MCSEL_MSK	7
 #define MMCR1_GRS_FABSEL_SH	39
-#define MMCR1_GRS_FABSEL_MSK	3
 #define MMCR1_PMC1_ADDER_SEL_SH	35
-#define MMCR1_PMC2_ADDER_SEL_SH	34
-#define MMCR1_PMC3_ADDER_SEL_SH	33
-#define MMCR1_PMC4_ADDER_SEL_SH	32
 #define MMCR1_PMC1SEL_SH	25
-#define MMCR1_PMC2SEL_SH	17
-#define MMCR1_PMC3SEL_SH	9
-#define MMCR1_PMC4SEL_SH	1
 #define MMCR1_PMCSEL_SH(n)	(MMCR1_PMC1SEL_SH - (n) * 8)
-#define MMCR1_PMCSEL_MSK	0x7f
 
 /*
  * Layout of constraint bits:
Signature · 1 line
2.43.5
#3 lore raw

PATCH 3/7 arch/powerpc/perf : Removing unused macros from ppc970-pmu.c

In reply to Likhitha Korrapati

The following macros were introduced in ppc970-pmu via commit 16b067993dee ("powerpc/perf_counter: Add support for PPC970 family")

PM_NONE, PM_LSU1U, MMCR0_PMC2SEL_SH, MMCR_PMCSEL_MSK MMCR1_TTM0SEL_SH, MMCR1_TTMSEL_MSK, MMCR1_TD_CP_DBG1SEL_SH MMCR1_TD_CP_DBG2SEL_SH, MMCR1_TD_CP_DBG3SEL_SH, MMCR1_PMC4SEL_SH MMCR1_PMC5SEL_SH, MMCR1_PMC6SEL_SH, MMCR1_PMC7SEL_SH MMCR1_PMC8SEL_SH

Removing the above macros as they are defined but never used.

---
 arch/powerpc/perf/ppc970-pmu.c | 14 --------------
 1 file changed, 14 deletions(-)
arch/powerpc/perf/ppc970-pmu.c +0 -14
index 762676fb839e..eef55b6f78b2 100644
@@ -25,7 +25,6 @@
 #define PM_PMCSEL_MSK	0xf
 
 /* Values in PM_UNIT field */
-#define PM_NONE		0
 #define PM_FPU		1
 #define PM_VPU		2
 #define PM_ISU		3
@@ -33,7 +32,6 @@
 #define PM_IDU		5
 #define PM_STS		6
 #define PM_LSU0		7
-#define PM_LSU1U	8
 #define PM_LSU1L	9
 #define PM_LASTUNIT	9
 
@@ -41,20 +39,13 @@
  * Bits in MMCR0 for PPC970
  */
 #define MMCR0_PMC1SEL_SH	8
-#define MMCR0_PMC2SEL_SH	1
-#define MMCR_PMCSEL_MSK		0x1f
 
 /*
  * Bits in MMCR1 for PPC970
  */
-#define MMCR1_TTM0SEL_SH	62
 #define MMCR1_TTM1SEL_SH	59
 #define MMCR1_TTM3SEL_SH	53
-#define MMCR1_TTMSEL_MSK	3
 #define MMCR1_TD_CP_DBG0SEL_SH	50
-#define MMCR1_TD_CP_DBG1SEL_SH	48
-#define MMCR1_TD_CP_DBG2SEL_SH	46
-#define MMCR1_TD_CP_DBG3SEL_SH	44
 #define MMCR1_PMC1_ADDER_SEL_SH	39
 #define MMCR1_PMC2_ADDER_SEL_SH	38
 #define MMCR1_PMC6_ADDER_SEL_SH	37
@@ -64,11 +55,6 @@
 #define MMCR1_PMC3_ADDER_SEL_SH	33
 #define MMCR1_PMC4_ADDER_SEL_SH	32
 #define MMCR1_PMC3SEL_SH	27
-#define MMCR1_PMC4SEL_SH	22
-#define MMCR1_PMC5SEL_SH	17
-#define MMCR1_PMC6SEL_SH	12
-#define MMCR1_PMC7SEL_SH	7
-#define MMCR1_PMC8SEL_SH	2
 
 static short mmcr1_adder_bits[8] = {
 	MMCR1_PMC1_ADDER_SEL_SH,
Signature · 1 line
2.43.5
#4 lore raw

PATCH 4/7 arch/powerpc/perf : Removing unused macros from power7-pmu.c

In reply to Likhitha Korrapati

The following macros were introduced in power7-pmu via commit 4da52960fd1a ("perf_counters: powerpc: Add support for POWER7 processors")

PM_PMC_MSKS, PM_COMBINE_MSKS, MMCR1_TTM1SEL_SH, MMCR1_TTM2SEL_SH, MMCR1_TTM3SEL_SH, MMCR1_TTMSEL_MSK, MMCR1_L2SEL_MSK, MMCR1_PMC2_COMBINE_SH, MMCR1_PMC3_COMBINE_SH, MMCR1_PMC4_COMBINE_SH, MMCR1_PMC2SEL_SH, MMCR1_PMC3SEL_SH, MMCR1_PMC4SEL_SH, MMCR1_PMCSEL_MSK

Removing the above macros as they are defined but never used.

---
 arch/powerpc/perf/power7-pmu.c | 14 --------------
 1 file changed, 14 deletions(-)
arch/powerpc/perf/power7-pmu.c +0 -14
index c95ccf2e28da..b8f3028d3127 100644
@@ -17,12 +17,10 @@
  */
 #define PM_PMC_SH	16	/* PMC number (1-based) for direct events */
 #define PM_PMC_MSK	0xf
-#define PM_PMC_MSKS	(PM_PMC_MSK << PM_PMC_SH)
 #define PM_UNIT_SH	12	/* TTMMUX number and setting - unit select */
 #define PM_UNIT_MSK	0xf
 #define PM_COMBINE_SH	11	/* Combined event bit */
 #define PM_COMBINE_MSK	1
-#define PM_COMBINE_MSKS	0x800
 #define PM_L2SEL_SH	8	/* L2 event select */
 #define PM_L2SEL_MSK	7
 #define PM_PMCSEL_MSK	0xff
@@ -31,22 +29,10 @@
  * Bits in MMCR1 for POWER7
  */
 #define MMCR1_TTM0SEL_SH	60
-#define MMCR1_TTM1SEL_SH	56
-#define MMCR1_TTM2SEL_SH	52
-#define MMCR1_TTM3SEL_SH	48
-#define MMCR1_TTMSEL_MSK	0xf
 #define MMCR1_L2SEL_SH		45
-#define MMCR1_L2SEL_MSK		7
 #define MMCR1_PMC1_COMBINE_SH	35
-#define MMCR1_PMC2_COMBINE_SH	34
-#define MMCR1_PMC3_COMBINE_SH	33
-#define MMCR1_PMC4_COMBINE_SH	32
 #define MMCR1_PMC1SEL_SH	24
-#define MMCR1_PMC2SEL_SH	16
-#define MMCR1_PMC3SEL_SH	8
-#define MMCR1_PMC4SEL_SH	0
 #define MMCR1_PMCSEL_SH(n)	(MMCR1_PMC1SEL_SH - (n) * 8)
-#define MMCR1_PMCSEL_MSK	0xff
 
 /*
  * Power7 event codes.
Signature · 1 line
2.43.5
#5 lore raw

PATCH 5/7 arch/powerpc/perf : Removing unused macros from power6-pmu.c

In reply to Likhitha Korrapati

The macro MMCR1_PMCSEL_MSK was introduced in power6-pmu via commit f78628374a13 ("powerpc/perf_counter: Add support for POWER6") but never used.

The usage of macro PM_SUBUNIT_MSKS was removed in commit ab7ef2e50a55 ("perf_counter: powerpc: allow use of limited-function counters") and failed to remove its definition.

Removing both the macros as they are not in use.

---
 arch/powerpc/perf/power6-pmu.c | 2 --
 1 file changed, 2 deletions(-)
arch/powerpc/perf/power6-pmu.c +0 -2
index 9f720b522e17..ceb75235a6ef 100644
@@ -27,7 +27,6 @@
 #define PM_BYTE_MSK	3
 #define PM_SUBUNIT_SH	8	/* Subunit event comes from (NEST_SEL enc.) */
 #define PM_SUBUNIT_MSK	7
-#define PM_SUBUNIT_MSKS	(PM_SUBUNIT_MSK << PM_SUBUNIT_SH)
 #define PM_PMCSEL_MSK	0xff	/* PMCxSEL value */
 #define PM_BUSEVENT_MSK	0xf3700
 
@@ -46,7 +45,6 @@
 #define MMCR1_PMC1_ADDR_SEL	(1ul << 35)
 #define MMCR1_PMC1SEL_SH	24
 #define MMCR1_PMCSEL_SH(n)	(MMCR1_PMC1SEL_SH - (n) * 8)
-#define MMCR1_PMCSEL_MSK	0xff
 
 /*
  * Map of which direct events on which PMCs are marked instruction events.
Signature · 1 line
2.43.5
#6 lore raw

PATCH 6/7 arch/powerpc/perf : Removing unused macros from power8-pmu.c

In reply to Likhitha Korrapati

The following macros were introduced in power8-pmu via commit b1113557fb5f ("powerpc/perf: Define BHRB generic functions, data and flags for POWER8")

POWER8_MMCRA_IFM2, POWER8_MMCRA_IFM3

Removing the above macros as they are defined but never used.

---
 arch/powerpc/perf/power8-pmu.c | 2 --
 1 file changed, 2 deletions(-)
arch/powerpc/perf/power8-pmu.c +0 -2
index ef9685065aaf..6fcf5ddb0b54 100644
@@ -23,8 +23,6 @@ enum {
 
 /* MMCRA IFM bits - POWER8 */
 #define	POWER8_MMCRA_IFM1		0x0000000040000000UL
-#define	POWER8_MMCRA_IFM2		0x0000000080000000UL
-#define	POWER8_MMCRA_IFM3		0x00000000C0000000UL
 #define	POWER8_MMCRA_BHRB_MASK		0x00000000C0000000UL
 
 /*
Signature · 1 line
2.43.5
#7 lore raw

PATCH 7/7 arch/powerpc/perf : Removing unused macros from power9-pmu.c

In reply to Likhitha Korrapati

The following macros were introduced in power9-pmu via commit 8c002dbd05ee ("powerpc/perf: Power9 PMU support")

POWER9_MMCRA_IFM2, POWER9_MMCRA_IFM3

Removing the above macros as they are defined but never used.

---
 arch/powerpc/perf/power9-pmu.c | 2 --
 1 file changed, 2 deletions(-)
arch/powerpc/perf/power9-pmu.c +0 -2
index cb6a7dc02dd7..4d96830835cd 100644
@@ -86,8 +86,6 @@ enum {
 
 /* MMCRA IFM bits - POWER9 */
 #define POWER9_MMCRA_IFM1		0x0000000040000000UL
-#define POWER9_MMCRA_IFM2		0x0000000080000000UL
-#define POWER9_MMCRA_IFM3		0x00000000C0000000UL
 #define POWER9_MMCRA_BHRB_MASK		0x00000000C0000000UL
 
 extern u64 PERF_REG_EXTENDED_MASK;
Signature · 1 line
2.43.5