git: e14f57ffa6c9 - stable/13 - libpmc: Allow specifying explicit EVENT_xxH events on armv7 and arm64

From: Jessica Clarke <jrtc27_at_FreeBSD.org>
Date: Wed, 09 Mar 2022 21:04:24 UTC
The branch stable/13 has been updated by jrtc27:

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

commit e14f57ffa6c9d628b191af0c2b5425c223f47ef3
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2022-02-15 16:10:34 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2022-03-09 21:04:10 +0000

    libpmc: Allow specifying explicit EVENT_xxH events on armv7 and arm64
    
    This is useful for processors where we don't have an event table; in
    those cases we default to a Cortex A8 (armv7) or Cortex A53 (arm64) in
    order to attempt to provide something useful, but you're then limited to
    the counters in those tables, some of which may also not be implemented
    (e.g. LD/ST_RETIRED are no longer implemented in more recent cores,
    replaced by LD/ST_SPEC).
    
    Adding the raw EVENT_xxH event lists to each table ensures that you can
    always request the exact events you want, regardless of what has been
    detected or is known.
    
    Reviewed by:    mhorne
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D33805
    
    (cherry picked from commit 9f22e0959b1e2e3c9450f8b495d2c0c86699eb18)
---
 lib/libpmc/libpmc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c
index 78fde0ed1f2c..d36648ee6b89 100644
--- a/lib/libpmc/libpmc.c
+++ b/lib/libpmc/libpmc.c
@@ -152,29 +152,39 @@ static struct pmc_event_descr soft_event_table[PMC_EV_DYN_COUNT];
 #undef	__PMC_EV_ALIAS
 #define	__PMC_EV_ALIAS(N,CODE) 	{ N, PMC_EV_##CODE },
 
+/*
+ * TODO: Factor out the __PMC_EV_ARMV7/8 list into a single separate table
+ * rather than duplicating for each core.
+ */
+
 static const struct pmc_event_descr cortex_a8_event_table[] = 
 {
 	__PMC_EV_ALIAS_ARMV7_CORTEX_A8()
+	__PMC_EV_ARMV7()
 };
 
 static const struct pmc_event_descr cortex_a9_event_table[] = 
 {
 	__PMC_EV_ALIAS_ARMV7_CORTEX_A9()
+	__PMC_EV_ARMV7()
 };
 
 static const struct pmc_event_descr cortex_a53_event_table[] = 
 {
 	__PMC_EV_ALIAS_ARMV8_CORTEX_A53()
+	__PMC_EV_ARMV8()
 };
 
 static const struct pmc_event_descr cortex_a57_event_table[] = 
 {
 	__PMC_EV_ALIAS_ARMV8_CORTEX_A57()
+	__PMC_EV_ARMV8()
 };
 
 static const struct pmc_event_descr cortex_a76_event_table[] =
 {
 	__PMC_EV_ALIAS_ARMV8_CORTEX_A76()
+	__PMC_EV_ARMV8()
 };
 
 static const struct pmc_event_descr tsc_event_table[] =