Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Jul 2021 17:57:21 GMT
From:      Leandro Lupori <luporl@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 95d619a8ea1f - main - hwpmc: remove static POWER8 definitions
Message-ID:  <202107291757.16THvLSG009260@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by luporl:

URL: https://cgit.FreeBSD.org/src/commit/?id=95d619a8ea1f410ecea58bc534af770a010069ab

commit 95d619a8ea1f410ecea58bc534af770a010069ab
Author:     Leandro Lupori <luporl@FreeBSD.org>
AuthorDate: 2021-07-29 17:37:32 +0000
Commit:     Leandro Lupori <luporl@FreeBSD.org>
CommitDate: 2021-07-29 17:52:00 +0000

    hwpmc: remove static POWER8 definitions
    
    After b48a2770d48b, static POWER8 definitions became unnecessary,
    as all of them (and much more) are already present in libpmc's
    PMU events.
    
    Submitted by:           Leonardo Bianconi <leonardo.bianconi@eldorado.org.br> (initial version)
    Reviewed by:            kbowling, mhorne
    Sponsored by:           Instituto de Pesquisas Eldorado (eldorado.org.br)
    Differential Revision:  https://reviews.freebsd.org/D31334
---
 lib/libpmc/libpmc.c          |  21 +------
 sys/dev/hwpmc/hwpmc_power8.c | 130 -------------------------------------------
 sys/dev/hwpmc/pmc_events.h   |  39 +------------
 3 files changed, 2 insertions(+), 188 deletions(-)

diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c
index e2422f167267..4ff7eb893959 100644
--- a/lib/libpmc/libpmc.c
+++ b/lib/libpmc/libpmc.c
@@ -144,7 +144,6 @@ PMC_CLASSDEP_TABLE(mips74k, MIPS74K);
 PMC_CLASSDEP_TABLE(octeon, OCTEON);
 PMC_CLASSDEP_TABLE(ppc7450, PPC7450);
 PMC_CLASSDEP_TABLE(ppc970, PPC970);
-PMC_CLASSDEP_TABLE(power8, POWER8);
 PMC_CLASSDEP_TABLE(e500, E500);
 
 static struct pmc_event_descr soft_event_table[PMC_EV_DYN_COUNT];
@@ -219,7 +218,6 @@ PMC_CLASS_TABLE_DESC(octeon, OCTEON, octeon, mips);
 #if defined(__powerpc__)
 PMC_CLASS_TABLE_DESC(ppc7450, PPC7450, ppc7450, powerpc);
 PMC_CLASS_TABLE_DESC(ppc970, PPC970, ppc970, powerpc);
-PMC_CLASS_TABLE_DESC(power8, POWER8, power8, powerpc);
 PMC_CLASS_TABLE_DESC(e500, E500, e500, powerpc);
 #endif
 
@@ -855,12 +853,6 @@ static struct pmc_event_alias ppc970_aliases[] = {
 	EV_ALIAS(NULL, NULL)
 };
 
-static struct pmc_event_alias power8_aliases[] = {
-	EV_ALIAS("instructions", "INSTR_COMPLETED"),
-	EV_ALIAS("cycles",       "CYCLES"),
-	EV_ALIAS(NULL, NULL)
-};
-
 static struct pmc_event_alias e500_aliases[] = {
 	EV_ALIAS("instructions", "INSTR_COMPLETED"),
 	EV_ALIAS("cycles",       "CYCLES"),
@@ -1243,10 +1235,6 @@ pmc_event_names_of_class(enum pmc_class cl, const char ***eventnames,
 		ev = ppc970_event_table;
 		count = PMC_EVENT_TABLE_SIZE(ppc970);
 		break;
-	case PMC_CLASS_POWER8:
-		ev = power8_event_table;
-		count = PMC_EVENT_TABLE_SIZE(power8);
-		break;
 	case PMC_CLASS_E500:
 		ev = e500_event_table;
 		count = PMC_EVENT_TABLE_SIZE(e500);
@@ -1465,10 +1453,6 @@ pmc_init(void)
 		PMC_MDEP_INIT(ppc970);
 		pmc_class_table[n] = &ppc970_class_table_descr;
 		break;
-	case PMC_CPU_PPC_POWER8:
-		PMC_MDEP_INIT(power8);
-		pmc_class_table[n] = &power8_class_table_descr;
-		break;
 	case PMC_CPU_PPC_E500:
 		PMC_MDEP_INIT(e500);
 		pmc_class_table[n] = &e500_class_table_descr;
@@ -1480,7 +1464,7 @@ pmc_init(void)
 		 * about.  This shouldn't happen since the abi version check
 		 * should have caught this.
 		 */
-#if defined(__amd64__) || defined(__i386__)
+#if defined(__amd64__) || defined(__i386__) || defined(__powerpc64__)
 		break;
 #endif
 		errno = ENXIO;
@@ -1604,9 +1588,6 @@ _pmc_name_of_event(enum pmc_event pe, enum pmc_cputype cpu)
 	} else if (pe >= PMC_EV_PPC970_FIRST && pe <= PMC_EV_PPC970_LAST) {
 		ev = ppc970_event_table;
 		evfence = ppc970_event_table + PMC_EVENT_TABLE_SIZE(ppc970);
-	} else if (pe >= PMC_EV_POWER8_FIRST && pe <= PMC_EV_POWER8_LAST) {
-		ev = power8_event_table;
-		evfence = power8_event_table + PMC_EVENT_TABLE_SIZE(power8);
 	} else if (pe >= PMC_EV_E500_FIRST && pe <= PMC_EV_E500_LAST) {
 		ev = e500_event_table;
 		evfence = e500_event_table + PMC_EVENT_TABLE_SIZE(e500);
diff --git a/sys/dev/hwpmc/hwpmc_power8.c b/sys/dev/hwpmc/hwpmc_power8.c
index ce063a57a10e..0d93e4ae2964 100644
--- a/sys/dev/hwpmc/hwpmc_power8.c
+++ b/sys/dev/hwpmc/hwpmc_power8.c
@@ -49,135 +49,6 @@ __FBSDID("$FreeBSD$");
 #define PM_CYC			0x1e
 #define PM_INST_CMPL		0x02
 
-static struct pmc_ppc_event power8_event_codes[] = {
-	{PMC_EV_POWER8_INSTR_COMPLETED,
-	    .pe_flags = PMC_FLAG_PMC5,
-	    .pe_code = 0x00
-	},
-	/*
-	 * PMC1 can also count cycles, but as PMC6 can only count cycles
-	 * it's better to always use it and leave PMC1 free to count
-	 * other events.
-	 */
-	{PMC_EV_POWER8_CYCLES,
-	    .pe_flags = PMC_FLAG_PMC6,
-	    .pe_code = 0xf0
-	},
-	{PMC_EV_POWER8_CYCLES_WITH_INSTRS_COMPLETED,
-	    .pe_flags = PMC_FLAG_PMC1,
-	    .pe_code = 0xf2
-	},
-	{PMC_EV_POWER8_FPU_INSTR_COMPLETED,
-	    .pe_flags = PMC_FLAG_PMC1,
-	    .pe_code = 0xf4
-	},
-	{PMC_EV_POWER8_ERAT_INSTR_MISS,
-	    .pe_flags = PMC_FLAG_PMC1,
-	    .pe_code = 0xf6
-	},
-	{PMC_EV_POWER8_CYCLES_IDLE,
-	    .pe_flags = PMC_FLAG_PMC1,
-	    .pe_code = 0xf8
-	},
-	{PMC_EV_POWER8_CYCLES_WITH_ANY_THREAD_RUNNING,
-	    .pe_flags = PMC_FLAG_PMC1,
-	    .pe_code = 0xfa
-	},
-	{PMC_EV_POWER8_STORE_COMPLETED,
-	    .pe_flags = PMC_FLAG_PMC2,
-	    .pe_code = 0xf0
-	},
-	{PMC_EV_POWER8_INSTR_DISPATCHED,
-	    .pe_flags = PMC_FLAG_PMC2 | PMC_FLAG_PMC3,
-	    .pe_code = 0xf2
-	},
-	{PMC_EV_POWER8_CYCLES_RUNNING,
-	    .pe_flags = PMC_FLAG_PMC2,
-	    .pe_code = 0xf4
-	},
-	{PMC_EV_POWER8_ERAT_DATA_MISS,
-	    .pe_flags = PMC_FLAG_PMC2,
-	    .pe_code = 0xf6
-	},
-	{PMC_EV_POWER8_EXTERNAL_INTERRUPT,
-	    .pe_flags = PMC_FLAG_PMC2,
-	    .pe_code = 0xf8
-	},
-	{PMC_EV_POWER8_BRANCH_TAKEN,
-	    .pe_flags = PMC_FLAG_PMC2,
-	    .pe_code = 0xfa
-	},
-	{PMC_EV_POWER8_L1_INSTR_MISS,
-	    .pe_flags = PMC_FLAG_PMC2,
-	    .pe_code = 0xfc
-	},
-	{PMC_EV_POWER8_L2_LOAD_MISS,
-	    .pe_flags = PMC_FLAG_PMC2,
-	    .pe_code = 0xfe
-	},
-	{PMC_EV_POWER8_STORE_NO_REAL_ADDR,
-	    .pe_flags = PMC_FLAG_PMC3,
-	    .pe_code = 0xf0
-	},
-	{PMC_EV_POWER8_INSTR_COMPLETED_WITH_ALL_THREADS_RUNNING,
-	    .pe_flags = PMC_FLAG_PMC3,
-	    .pe_code = 0xf4
-	},
-	{PMC_EV_POWER8_L1_LOAD_MISS,
-	    .pe_flags = PMC_FLAG_PMC3,
-	    .pe_code = 0xf6
-	},
-	{PMC_EV_POWER8_TIMEBASE_EVENT,
-	    .pe_flags = PMC_FLAG_PMC3,
-	    .pe_code = 0xf8
-	},
-	{PMC_EV_POWER8_L3_INSTR_MISS,
-	    .pe_flags = PMC_FLAG_PMC3,
-	    .pe_code = 0xfa
-	},
-	{PMC_EV_POWER8_TLB_DATA_MISS,
-	    .pe_flags = PMC_FLAG_PMC3,
-	    .pe_code = 0xfc
-	},
-	{PMC_EV_POWER8_L3_LOAD_MISS,
-	    .pe_flags = PMC_FLAG_PMC3,
-	    .pe_code = 0xfe
-	},
-	{PMC_EV_POWER8_LOAD_NO_REAL_ADDR,
-	    .pe_flags = PMC_FLAG_PMC4,
-	    .pe_code = 0xf0
-	},
-	{PMC_EV_POWER8_CYCLES_WITH_INSTRS_DISPATCHED,
-	    .pe_flags = PMC_FLAG_PMC4,
-	    .pe_code = 0xf2
-	},
-	{PMC_EV_POWER8_CYCLES_RUNNING_PURR_INC,
-	    .pe_flags = PMC_FLAG_PMC4,
-	    .pe_code = 0xf4
-	},
-	{PMC_EV_POWER8_BRANCH_MISPREDICTED,
-	    .pe_flags = PMC_FLAG_PMC4,
-	    .pe_code = 0xf6
-	},
-	{PMC_EV_POWER8_PREFETCHED_INSTRS_DISCARDED,
-	    .pe_flags = PMC_FLAG_PMC4,
-	    .pe_code = 0xf8
-	},
-	{PMC_EV_POWER8_INSTR_COMPLETED_RUNNING,
-	    .pe_flags = PMC_FLAG_PMC4,
-	    .pe_code = 0xfa
-	},
-	{PMC_EV_POWER8_TLB_INSTR_MISS,
-	    .pe_flags = PMC_FLAG_PMC4,
-	    .pe_code = 0xfc
-	},
-	{PMC_EV_POWER8_CACHE_LOAD_MISS,
-	    .pe_flags = PMC_FLAG_PMC4,
-	    .pe_code = 0xfe
-	}
-};
-static size_t power8_event_codes_size = nitems(power8_event_codes);
-
 static void
 power8_set_pmc(int cpu, int ri, int config)
 {
@@ -358,7 +229,6 @@ pmc_power8_initialize(struct pmc_mdep *pmc_mdep)
 	pmc_mdep->pmd_npmc     += POWER8_MAX_PMCS;
 	pmc_mdep->pmd_intr      = powerpc_pmc_intr;
 
-	ppc_event_codes_size = power8_event_codes_size;
 	ppc_max_pmcs = POWER8_MAX_PMCS;
 
 	powerpc_set_pmc = power8_set_pmc;
diff --git a/sys/dev/hwpmc/pmc_events.h b/sys/dev/hwpmc/pmc_events.h
index df56d728907a..ae56685f5fc5 100644
--- a/sys/dev/hwpmc/pmc_events.h
+++ b/sys/dev/hwpmc/pmc_events.h
@@ -1640,41 +1640,6 @@ __PMC_EV_ALIAS("unhalted-core-cycles",		IAP_ARCH_UNH_COR_CYC)
 #define PMC_EV_PPC970_FIRST		PMC_EV_PPC970_INSTR_COMPLETED
 #define PMC_EV_PPC970_LAST		PMC_EV_PPC970_ADDER
 
-#define __PMC_EV_POWER8() \
-	__PMC_EV(POWER8, CYCLES) \
-	__PMC_EV(POWER8, CYCLES_WITH_INSTRS_COMPLETED) \
-	__PMC_EV(POWER8, FPU_INSTR_COMPLETED) \
-	__PMC_EV(POWER8, ERAT_INSTR_MISS) \
-	__PMC_EV(POWER8, CYCLES_IDLE) \
-	__PMC_EV(POWER8, CYCLES_WITH_ANY_THREAD_RUNNING) \
-	__PMC_EV(POWER8, STORE_COMPLETED) \
-	__PMC_EV(POWER8, INSTR_DISPATCHED) \
-	__PMC_EV(POWER8, CYCLES_RUNNING) \
-	__PMC_EV(POWER8, ERAT_DATA_MISS) \
-	__PMC_EV(POWER8, EXTERNAL_INTERRUPT) \
-	__PMC_EV(POWER8, BRANCH_TAKEN) \
-	__PMC_EV(POWER8, L1_INSTR_MISS) \
-	__PMC_EV(POWER8, L2_LOAD_MISS) \
-	__PMC_EV(POWER8, STORE_NO_REAL_ADDR) \
-	__PMC_EV(POWER8, INSTR_COMPLETED_WITH_ALL_THREADS_RUNNING) \
-	__PMC_EV(POWER8, L1_LOAD_MISS) \
-	__PMC_EV(POWER8, TIMEBASE_EVENT) \
-	__PMC_EV(POWER8, L3_INSTR_MISS) \
-	__PMC_EV(POWER8, TLB_DATA_MISS) \
-	__PMC_EV(POWER8, L3_LOAD_MISS) \
-	__PMC_EV(POWER8, LOAD_NO_REAL_ADDR) \
-	__PMC_EV(POWER8, CYCLES_WITH_INSTRS_DISPATCHED) \
-	__PMC_EV(POWER8, CYCLES_RUNNING_PURR_INC) \
-	__PMC_EV(POWER8, BRANCH_MISPREDICTED) \
-	__PMC_EV(POWER8, PREFETCHED_INSTRS_DISCARDED) \
-	__PMC_EV(POWER8, INSTR_COMPLETED_RUNNING) \
-	__PMC_EV(POWER8, TLB_INSTR_MISS) \
-	__PMC_EV(POWER8, CACHE_LOAD_MISS) \
-	__PMC_EV(POWER8, INSTR_COMPLETED)
-
-#define PMC_EV_POWER8_FIRST		PMC_EV_POWER8_CYCLES
-#define PMC_EV_POWER8_LAST		PMC_EV_POWER8_INSTR_COMPLETED
-
 #define __PMC_EV_E500() \
 	__PMC_EV(E500, CYCLES) \
 	__PMC_EV(E500, INSTR_COMPLETED) \
@@ -1860,7 +1825,7 @@ __PMC_EV_ALIAS("unhalted-core-cycles",		IAP_ARCH_UNH_COR_CYC)
  * 0x11600	0x00FF		BERI statcounters
  * 0x13000	0x00FF		MPC7450 events
  * 0x13100	0x00FF		IBM PPC970 events
- * 0x13200	0x00FF		IBM POWER8 events
+ * 0x13200	0x00FF		free (was IBM POWER8 events)
  * 0x13300	0x00FF		Freescale e500 events
  * 0x14000	0x0100		ARMv7 events
  * 0x14100	0x0100		ARMv8 events
@@ -1889,8 +1854,6 @@ __PMC_EV_ALIAS("unhalted-core-cycles",		IAP_ARCH_UNH_COR_CYC)
 	__PMC_EV_PPC7450()			\
 	__PMC_EV_BLOCK(PPC970,	0x13100)	\
 	__PMC_EV_PPC970()			\
-	__PMC_EV_BLOCK(POWER8,	0x13200)	\
-	__PMC_EV_POWER8()			\
 	__PMC_EV_BLOCK(E500,	0x13300)	\
 	__PMC_EV_E500()				\
 	__PMC_EV_BLOCK(ARMV7,	0x14000)	\



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107291757.16THvLSG009260>