Blame SOURCES/libpfm-tx2.patch

f8a042
commit 6c9e44b95a55b8bf62cbd64009c4c9b30964a66c
f8a042
Author: Steve Walk <steve.walk@cavium.com>
f8a042
Date:   Tue Mar 20 09:37:56 2018 -0700
f8a042
f8a042
    update Cavium ThunderX2 with now public events
f8a042
    
f8a042
    This patch adds new model specific events to the
f8a042
    Cavium Thunder X2 core PMU. The updated list is based
f8a042
    on publicly available documentation from Cavium which
f8a042
    is available at:
f8a042
        https://cavium.com/resources.html
f8a042
    
f8a042
    Signed-off-by: Steve Walk  <steve.walk@cavium.com>
f8a042
f8a042
diff --git a/lib/events/arm_cavium_tx2_events.h b/lib/events/arm_cavium_tx2_events.h
f8a042
index 67de9f8..198d33d 100644
f8a042
--- a/lib/events/arm_cavium_tx2_events.h
f8a042
+++ b/lib/events/arm_cavium_tx2_events.h
f8a042
@@ -23,6 +23,9 @@
f8a042
  *
f8a042
  * ARM Architecture Reference Manual, ARMv8, for ARMv8-A architecture profile,
f8a042
  * ARM DDI 0487B.a (ID033117)
f8a042
+ *
f8a042
+ * Cavium ThunderX2 C99XX PMU Events (Abridged), July 31, 2018
f8a042
+ * https://cavium.com/resources.html
f8a042
  */
f8a042
 
f8a042
 static const arm_entry_t arm_thunderx2_pe[]={
f8a042
@@ -161,6 +164,11 @@ static const arm_entry_t arm_thunderx2_pe[]={
f8a042
 	 .code = 0x1C,
f8a042
 	 .desc = "Instruction architecturally executed (condition check pass)  Write to translation table base"
f8a042
 	},
f8a042
+	{.name = "CHAIN",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x1E,
f8a042
+	 .desc = "For odd-numbered counters, increments the count by one for each overflow of the proceeding even counter"
f8a042
+	},
f8a042
 	{.name = "L1D_CACHE_ALLOCATE",
f8a042
 	 .modmsk = ARMV8_ATTRS,
f8a042
 	 .code = 0x1F,
f8a042
@@ -556,6 +564,274 @@ static const arm_entry_t arm_thunderx2_pe[]={
f8a042
 	 .code = 0x91,
f8a042
 	 .desc = "Release consistency instruction speculatively executed (store-release)"
f8a042
 	},
f8a042
-
f8a042
-	/* END Cavium ThunderX2 specific events */
f8a042
+	{.name = "L1D_LHS_VANOTP",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xC1,
f8a042
+	 .desc = "A Load hit store retry"
f8a042
+	},
f8a042
+	{.name = "L1D_LHS_OVRLAP",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xC2,
f8a042
+	 .desc = "A Load hit store retry, VA match, PA mismatch"
f8a042
+	},
f8a042
+	{.name = "L1D_LHS_VANOSD",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xC3,
f8a042
+	 .desc = "A Load hit store retry, VA match, store data not issued"
f8a042
+	},
f8a042
+	{.name = "L1D_LHS_FWD",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xC4,
f8a042
+	 .desc = "A Load hit store forwarding. Load completes"
f8a042
+	},
f8a042
+	{.name = "L1D_BNKCFL",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xC6,
f8a042
+	 .desc = "Bank conflict load retry"
f8a042
+	},
f8a042
+	{.name = "L1D_LSMQ_FULL",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xC7,
f8a042
+	 .desc = "LSMQ retry"
f8a042
+	},
f8a042
+	{.name = "L1D_LSMQ_HIT",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xC8,
f8a042
+	 .desc = "LSMQ hit retry"
f8a042
+	},
f8a042
+	{.name = "L1D_EXPB_MISS",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xC9,
f8a042
+	 .desc = "An external probe missed the L1"
f8a042
+	},
f8a042
+	{.name = "L1D_L2EV_MISS",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xCA,
f8a042
+	 .desc = "An L2 evict operation missed the L1"
f8a042
+	},
f8a042
+	{.name = "L1D_EXPB_HITM",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xCB,
f8a042
+	 .desc = "An external probe hit a modified line in the L1"
f8a042
+	},
f8a042
+	{.name = "L1D_L2EV_HITM",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xCC,
f8a042
+	 .desc = "An L2 evict operation hit a modified line in the L1"
f8a042
+	},
f8a042
+	{.name = "L1D_EXPB_HIT",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xCD,
f8a042
+	 .desc = "An external probe hit in the L1"
f8a042
+	},
f8a042
+	{.name = "L1D_L2EV_HIT",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xCE,
f8a042
+	 .desc = "An L2 evict operation hit in the L1"
f8a042
+	},
f8a042
+	{.name = "L1D_EXPB_RETRY",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xCF,
f8a042
+	 .desc = "An external probe hit was retried"
f8a042
+	},
f8a042
+	{.name = "L1D_L2EV_RETRY",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xD0,
f8a042
+	 .desc = "An L2 evict operation was retried"
f8a042
+	},
f8a042
+	{.name = "L1D_ST_RMW",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xD1,
f8a042
+	 .desc = "A read modify write store was drained and updated the L1"
f8a042
+	},
f8a042
+	{.name = "L1D_LSMQ00_LDREQ",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xD2,
f8a042
+	 .desc = "A load has allocated LSMQ entry 0"
f8a042
+	},
f8a042
+	{.name = "L1D_LSMQ00_LDVLD",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xD3,
f8a042
+	 .desc = "LSMQ entry 0 was initiated by a load"
f8a042
+	},
f8a042
+	{.name = "L1D_LSMQ15_STREQ",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xD4,
f8a042
+	 .desc = "A store was allocated LSMQ entry 15"
f8a042
+	},
f8a042
+	{.name = "L1D_LSMQ15_STVLD",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xD5,
f8a042
+	 .desc = "LSMQ entry 15 was initiated by a store"
f8a042
+	},
f8a042
+	{.name = "L1D_PB_FLUSH",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xD6,
f8a042
+	 .desc = "LRQ ordering flush"
f8a042
+	},
f8a042
+	{.name = "BR_COND_MIS_PRED_RETIRED",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xE0,
f8a042
+	 .desc = "Conditional branch instruction executed, but mis-predicted"
f8a042
+	},
f8a042
+	{.name = "BR_IND_MIS_PRED_RETIRED",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xE1,
f8a042
+	 .desc = "Indirect branch instruction executed, but mis-predicted"
f8a042
+	},
f8a042
+	{.name = "BR_RETURN_MIS_PRED_RETIRED",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xE2,
f8a042
+	 .desc = "Return branch instruction executed, but mis-predicted"
f8a042
+	},
f8a042
+	{.name = "OP_RETIRED",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xE8,
f8a042
+	 .desc = "Uops executed"
f8a042
+	},
f8a042
+	{.name = "LD_OP_RETIRED",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xE9,
f8a042
+	 .desc = "Load uops executed"
f8a042
+	},
f8a042
+	{.name = "ST_OP_RETIRED",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xEA,
f8a042
+	 .desc = "Store uops executed"
f8a042
+	},
f8a042
+	{.name = "FUSED_OP_RETIRED",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xEB,
f8a042
+	 .desc = "Fused uops executed"
f8a042
+	},
f8a042
+	{.name = "IRQ_MASK",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xF8,
f8a042
+	 .desc = "Cumulative duration of a PSTATE.I interrupt mask set to 1"
f8a042
+	},
f8a042
+	{.name = "FIQ_MASK",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xF9,
f8a042
+	 .desc = "Cumulative duration of a PSTATE.F interrupt mask set to 1"
f8a042
+	},
f8a042
+	{.name = "SERROR_MASK",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0xFA,
f8a042
+	 .desc = "Cumulative duration of PSTATE.A interrupt mask set to 1"
f8a042
+	},
f8a042
+	{.name = "WFIWFE_SLEEP",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x108,
f8a042
+	 .desc = "Number of cycles in which CPU is in low power mode due to WFI/WFE instruction"
f8a042
+	},
f8a042
+	{.name = "L2TLB_4K_PAGE_MISS",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x127,
f8a042
+	 .desc = "L2 TLB lookup miss using 4K page size"
f8a042
+	},
f8a042
+	{.name = "L2TLB_64K_PAGE_MISS",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x128,
f8a042
+	 .desc = "L2 TLB lookup miss using 64K page size"
f8a042
+	},
f8a042
+	{.name = "L2TLB_2M_PAGE_MISS",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x129,
f8a042
+	 .desc = "L2 TLB lookup miss using 2M page size"
f8a042
+	},
f8a042
+	{.name = "L2TLB_512M_PAGE_MISS",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x12A,
f8a042
+	 .desc = "L2 TLB lookup miss using 512M page size"
f8a042
+	},
f8a042
+	{.name = "ISB_EMPTY",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x150,
f8a042
+	 .desc = "Number of cycles during which micro-op skid-buffer is empty"
f8a042
+	},
f8a042
+	{.name = "ISB_FULL",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x151,
f8a042
+	 .desc = "Number of cycles during which micro-op skid-buffer is back-pressuring decode"
f8a042
+	},
f8a042
+	{.name = "STALL_NOTSELECTED",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x152,
f8a042
+	 .desc = "Number of cycles during which thread was available for dispatch but not selected"
f8a042
+	},
f8a042
+	{.name = "ROB_RECYCLE",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x153,
f8a042
+	 .desc = "Number of cycles in which one or more valid micro-ops did not dispatch due to ROB full"
f8a042
+	},
f8a042
+	{.name = "ISSQ_RECYCLE",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x154,
f8a042
+	 .desc = "Number of cycles in which one or more valid micro-ops did not dispatch due to ISSQ full"
f8a042
+	},
f8a042
+	{.name = "GPR_RECYCLE",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x155,
f8a042
+	 .desc = "Number of cycles in which one or more valid micro-ops did not dispatch due to GPR full"
f8a042
+	},
f8a042
+	{.name = "FPR_RECYCLE",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x156,
f8a042
+	 .desc = "Number of cycles in which one or more valid micro-ops did not dispatch due to FPR full"
f8a042
+	},
f8a042
+	{.name = "LRQ_RECYCLE",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x158,
f8a042
+	 .desc = "Number of cycles in which one or more valid micro-ops did not dispatch due to LRQ full"
f8a042
+	},
f8a042
+	{.name = "SRQ_RECYCLE",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x159,
f8a042
+	 .desc = "Number of cycles in which one or more valid micro-ops did not dispatch due to SRQ full"
f8a042
+	},
f8a042
+	{.name = "BSR_RECYCLE",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x15B,
f8a042
+	 .desc = "Number of cycles in which one or more valid micro-ops did not dispatch due to BSR full"
f8a042
+	},
f8a042
+	{.name = "UOPSFUSED",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x164,
f8a042
+	 .desc = "Number of fused micro-ops dispatched"
f8a042
+	},
f8a042
+	{.name = "L2D_TLBI_INT",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x20B,
f8a042
+	 .desc = "Internal mmu tlbi cacheops"
f8a042
+	},
f8a042
+	{.name = "L2D_TLBI_EXT",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x20C,
f8a042
+	 .desc = "External mmu tlbi cacheops"
f8a042
+	},
f8a042
+	{.name = "L2D_HWPF_DMD_HIT",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x218,
f8a042
+	 .desc = "Scu ld/st requests that hit cache or msg for lines brought in by the hardware prefetcher"
f8a042
+	},
f8a042
+	{.name = "L2D_HWPF_REQ_VAL",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x219,
f8a042
+	 .desc = "Scu hwpf requests into the pipeline"
f8a042
+	},
f8a042
+	{.name = "L2D_HWPF_REQ_LD",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x21A,
f8a042
+	 .desc = "Scu hwpf ld requests into the pipeline"
f8a042
+	},
f8a042
+	{.name = "L2D_HWPF_REQ_MISS",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x21B,
f8a042
+	 .desc = "Scu hwpf ld requests that miss"
f8a042
+	},
f8a042
+	{.name = "L2D_HWPF_NEXT_LINE",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = 0x21C,
f8a042
+	 .desc = "Scu hwpf next line requests generated"
f8a042
+	},
f8a042
 };
f8a042
From 0b050ca9ba2a2bf74f87fa3a8b4ed8aec9d1dfa8 Mon Sep 17 00:00:00 2001
f8a042
From: Shay Gal-On <sgalon@marvell.com>
f8a042
Date: Wed, 23 Oct 2019 18:58:03 -0700
f8a042
Subject: [PATCH 1/4] ThunderX2 uncore support
f8a042
f8a042
This patch adds ThundeX2 uncore PMUs support.
f8a042
f8a042
The following uncore PMUs are added:
f8a042
- tx2_llc0, tx2_llc1 (last level cache)
f8a042
- tx2_dmc0, tx2_dmc1 (memory controller)
f8a042
f8a042
Based on documentation available at:
f8a042
https://www.marvell.com/documents/hrur6mybdvk5uki1w0z7/
f8a042
f8a042
Signed-off-by: Shay Gal-On <sgalon@marvell.com>
f8a042
---
f8a042
 include/perfmon/pfmlib.h           |   5 ++
f8a042
 lib/Makefile                       |   2 +-
f8a042
 lib/events/arm_cavium_tx2_events.h |  61 +++++++++++++
f8a042
 lib/pfmlib_arm_armv8.c             |  55 ++++++++++++
f8a042
 lib/pfmlib_common.c                |   4 +
f8a042
 lib/pfmlib_priv.h                  |   6 ++
f8a042
 lib/pfmlib_tx2_unc_perf_event.c    | 139 +++++++++++++++++++++++++++++
f8a042
 tests/validate_arm64.c             |   6 ++
f8a042
 8 files changed, 277 insertions(+), 1 deletion(-)
f8a042
 create mode 100644 lib/pfmlib_tx2_unc_perf_event.c
f8a042
f8a042
diff --git a/include/perfmon/pfmlib.h b/include/perfmon/pfmlib.h
f8a042
index 09c673d..20d5feb 100644
f8a042
--- a/include/perfmon/pfmlib.h
f8a042
+++ b/include/perfmon/pfmlib.h
f8a042
@@ -546,6 +546,11 @@ typedef enum {
f8a042
 	PFM_PMU_INTEL_KNM_UNC_UBOX,	/* Intel Knights Mill Ubox uncore */
f8a042
 	PFM_PMU_INTEL_KNM_UNC_M2PCIE,	/* Intel Knights Mill M2PCIe uncore */
f8a042
 	PFM_PMU_ARM_THUNDERX2,		/* Cavium ThunderX2 */
f8a042
+
f8a042
+	PFM_PMU_ARM_THUNDERX2_DMC0,	/* Cavium ThunderX2 DMC unit 0 uncore */
f8a042
+	PFM_PMU_ARM_THUNDERX2_DMC1,	/* Cavium ThunderX2 DMC unit 1 uncore */
f8a042
+	PFM_PMU_ARM_THUNDERX2_LLC0,	/* Cavium ThunderX2 LLC unit 0 uncore */
f8a042
+	PFM_PMU_ARM_THUNDERX2_LLC1,	/* Cavium ThunderX2 LLC unit 1 uncore */
f8a042
 	/* MUST ADD NEW PMU MODELS HERE */
f8a042
 
f8a042
 	PFM_PMU_MAX			/* end marker */
f8a042
diff --git a/lib/Makefile b/lib/Makefile
f8a042
index 2eb3ebb..f45515d 100644
f8a042
--- a/lib/Makefile
f8a042
+++ b/lib/Makefile
f8a042
@@ -188,7 +188,7 @@ SRCS += pfmlib_arm_perf_event.c
f8a042
 endif
f8a042
 
f8a042
 INCARCH = $(INC_ARM64)
f8a042
-SRCS   += pfmlib_arm.c pfmlib_arm_armv8.c
f8a042
+SRCS   += pfmlib_arm.c pfmlib_arm_armv8.c pfmlib_tx2_unc_perf_event.c
f8a042
 CFLAGS += -DCONFIG_PFMLIB_ARCH_ARM64
f8a042
 endif
f8a042
 
f8a042
diff --git a/lib/events/arm_cavium_tx2_events.h b/lib/events/arm_cavium_tx2_events.h
f8a042
index 198d33d..18d8931 100644
f8a042
--- a/lib/events/arm_cavium_tx2_events.h
f8a042
+++ b/lib/events/arm_cavium_tx2_events.h
f8a042
@@ -835,3 +835,64 @@ static const arm_entry_t arm_thunderx2_pe[]={
f8a042
 	 .desc = "Scu hwpf next line requests generated"
f8a042
 	},
f8a042
 };
f8a042
+
f8a042
+#define ARM_TX2_CORE_EVENT_COUNT	(sizeof(arm_thunderx2_pe)/sizeof(arm_entry_t))
f8a042
+
f8a042
+/* L3C event IDs */
f8a042
+#define L3_EVENT_READ_REQ               0xD
f8a042
+#define L3_EVENT_WRITEBACK_REQ          0xE
f8a042
+#define L3_EVENT_EVICT_REQ              0x13
f8a042
+#define L3_EVENT_READ_HIT               0x17
f8a042
+#define L3_EVENT_MAX                    0x18
f8a042
+
f8a042
+/* DMC event IDs */
f8a042
+#define DMC_EVENT_COUNT_CYCLES          0x1
f8a042
+#define DMC_EVENT_WRITE_TXNS            0xB
f8a042
+#define DMC_EVENT_DATA_TRANSFERS        0xD
f8a042
+#define DMC_EVENT_READ_TXNS             0xF
f8a042
+#define DMC_EVENT_MAX                   0x10
f8a042
+
f8a042
+static const arm_entry_t arm_thunderx2_unc_dmc_pe[]={
f8a042
+	{.name = "UNC_DMC_READS",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = DMC_EVENT_READ_TXNS,
f8a042
+	 .desc = "Memory read transactions"
f8a042
+	},
f8a042
+	{.name = "UNC_DMC_WRITES",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = DMC_EVENT_WRITE_TXNS,
f8a042
+	 .desc = "Memory write transactions"
f8a042
+	},
f8a042
+};
f8a042
+
f8a042
+#define ARM_TX2_CORE_DMC_COUNT	(sizeof(arm_thunderx2_unc_dmc_pe)/sizeof(arm_entry_t))
f8a042
+
f8a042
+static const arm_entry_t arm_thunderx2_unc_llc_pe[]={
f8a042
+	{.name = "UNC_LLC_READ",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = L3_EVENT_READ_REQ,
f8a042
+	 .desc = "Read requests to LLC"
f8a042
+	},
f8a042
+	{.name = "UNC_LLC_EVICT",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = L3_EVENT_EVICT_REQ,
f8a042
+	 .desc = "Evict requests to LLC"
f8a042
+	},
f8a042
+	{.name = "UNC_LLC_READ_HIT",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = L3_EVENT_READ_HIT,
f8a042
+	 .desc = "Read requests to LLC which hit"
f8a042
+	},
f8a042
+	{.name = "UNC_LLC_WB",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = L3_EVENT_WRITEBACK_REQ,
f8a042
+	 .desc = "Writeback requests to LLC"
f8a042
+	}
f8a042
+};
f8a042
+
f8a042
+#define ARM_TX2_CORE_LLC_COUNT	(sizeof(arm_thunderx2_unc_llc_pe)/sizeof(arm_entry_t))
f8a042
+//Uncore accessor functions
f8a042
+int
f8a042
+pfm_tx2_unc_get_event_encoding(void *this, pfmlib_event_desc_t *e);
f8a042
+int
f8a042
+pfm_tx2_unc_get_perf_encoding(void *this, pfmlib_event_desc_t *e);
f8a042
diff --git a/lib/pfmlib_arm_armv8.c b/lib/pfmlib_arm_armv8.c
f8a042
index 0a3313f..35ff70f 100644
f8a042
--- a/lib/pfmlib_arm_armv8.c
f8a042
+++ b/lib/pfmlib_arm_armv8.c
f8a042
@@ -203,3 +203,58 @@ pfmlib_pmu_t arm_thunderx2_support={
f8a042
 	.get_event_nattrs	= pfm_arm_get_event_nattrs,
f8a042
 };
f8a042
 
f8a042
+// For uncore, each socket has a separate perf name, otherwise they are the same, use macro
f8a042
+
f8a042
+#define DEFINE_TX2_DMC(n) \
f8a042
+pfmlib_pmu_t arm_thunderx2_dmc##n##_support={ \
f8a042
+	.desc			= "Cavium ThunderX2 Node"#n" DMC", \
f8a042
+	.name			= "tx2_dmc"#n, \
f8a042
+	.perf_name		= "uncore_dmc_"#n, \
f8a042
+	.pmu			= PFM_PMU_ARM_THUNDERX2_DMC##n, \
f8a042
+	.pme_count		= LIBPFM_ARRAY_SIZE(arm_thunderx2_unc_dmc_pe), \
f8a042
+	.type			= PFM_PMU_TYPE_UNCORE, \
f8a042
+	.pe			= arm_thunderx2_unc_dmc_pe, \
f8a042
+	.pmu_detect		= pfm_arm_detect_thunderx2, \
f8a042
+	.max_encoding		= 1, \
f8a042
+	.num_cntrs		= 4, \
f8a042
+	.get_event_encoding[PFM_OS_NONE] = pfm_tx2_unc_get_event_encoding, \
f8a042
+	 PFMLIB_ENCODE_PERF(pfm_tx2_unc_get_perf_encoding),		\
f8a042
+	.get_event_first	= pfm_arm_get_event_first, \
f8a042
+	.get_event_next		= pfm_arm_get_event_next,  \
f8a042
+	.event_is_valid		= pfm_arm_event_is_valid,  \
f8a042
+	.validate_table		= pfm_arm_validate_table,  \
f8a042
+	.get_event_info		= pfm_arm_get_event_info,  \
f8a042
+	.get_event_attr_info	= pfm_arm_get_event_attr_info,	\
f8a042
+	 PFMLIB_VALID_PERF_PATTRS(pfm_arm_perf_validate_pattrs),\
f8a042
+	.get_event_nattrs	= pfm_arm_get_event_nattrs, \
f8a042
+};
f8a042
+
f8a042
+DEFINE_TX2_DMC(0);
f8a042
+DEFINE_TX2_DMC(1);
f8a042
+
f8a042
+#define DEFINE_TX2_LLC(n) \
f8a042
+pfmlib_pmu_t arm_thunderx2_llc##n##_support={ \
f8a042
+	.desc			= "Cavium ThunderX2 node "#n" LLC", \
f8a042
+	.name			= "tx2_llc"#n, \
f8a042
+	.perf_name		= "uncore_l3c_"#n, \
f8a042
+	.pmu			= PFM_PMU_ARM_THUNDERX2_LLC##n, \
f8a042
+	.pme_count		= LIBPFM_ARRAY_SIZE(arm_thunderx2_unc_llc_pe), \
f8a042
+	.type			= PFM_PMU_TYPE_UNCORE, \
f8a042
+	.pe			= arm_thunderx2_unc_llc_pe, \
f8a042
+	.pmu_detect		= pfm_arm_detect_thunderx2, \
f8a042
+	.max_encoding		= 1, \
f8a042
+	.num_cntrs		= 4, \
f8a042
+	.get_event_encoding[PFM_OS_NONE] = pfm_tx2_unc_get_event_encoding, \
f8a042
+	 PFMLIB_ENCODE_PERF(pfm_tx2_unc_get_perf_encoding),		\
f8a042
+	.get_event_first	= pfm_arm_get_event_first, \
f8a042
+	.get_event_next		= pfm_arm_get_event_next,  \
f8a042
+	.event_is_valid		= pfm_arm_event_is_valid,  \
f8a042
+	.validate_table		= pfm_arm_validate_table,  \
f8a042
+	.get_event_info		= pfm_arm_get_event_info,  \
f8a042
+	.get_event_attr_info	= pfm_arm_get_event_attr_info,	\
f8a042
+	 PFMLIB_VALID_PERF_PATTRS(pfm_arm_perf_validate_pattrs),\
f8a042
+	.get_event_nattrs	= pfm_arm_get_event_nattrs, \
f8a042
+};
f8a042
+
f8a042
+DEFINE_TX2_LLC(0);
f8a042
+DEFINE_TX2_LLC(1);
f8a042
diff --git a/lib/pfmlib_common.c b/lib/pfmlib_common.c
f8a042
index 2b6cbb4..8314d4b 100644
f8a042
--- a/lib/pfmlib_common.c
f8a042
+++ b/lib/pfmlib_common.c
f8a042
@@ -490,6 +490,10 @@ static pfmlib_pmu_t *pfmlib_pmus[]=
f8a042
 	&arm_cortex_a53_support,
f8a042
 	&arm_xgene_support,
f8a042
 	&arm_thunderx2_support,
f8a042
+	&arm_thunderx2_dmc0_support,
f8a042
+	&arm_thunderx2_dmc1_support,
f8a042
+	&arm_thunderx2_llc0_support,
f8a042
+	&arm_thunderx2_llc1_support,
f8a042
 #endif
f8a042
 
f8a042
 #ifdef CONFIG_PFMLIB_ARCH_S390X
f8a042
diff --git a/lib/pfmlib_priv.h b/lib/pfmlib_priv.h
f8a042
index b0070a6..cb83f43 100644
f8a042
--- a/lib/pfmlib_priv.h
f8a042
+++ b/lib/pfmlib_priv.h
f8a042
@@ -644,7 +644,13 @@ extern pfmlib_pmu_t arm_qcom_krait_support;
f8a042
 extern pfmlib_pmu_t arm_cortex_a57_support;
f8a042
 extern pfmlib_pmu_t arm_cortex_a53_support;
f8a042
 extern pfmlib_pmu_t arm_xgene_support;
f8a042
+
f8a042
 extern pfmlib_pmu_t arm_thunderx2_support;
f8a042
+extern pfmlib_pmu_t arm_thunderx2_dmc0_support;
f8a042
+extern pfmlib_pmu_t arm_thunderx2_dmc1_support;
f8a042
+extern pfmlib_pmu_t arm_thunderx2_llc0_support;
f8a042
+extern pfmlib_pmu_t arm_thunderx2_llc1_support;
f8a042
+
f8a042
 extern pfmlib_pmu_t mips_74k_support;
f8a042
 extern pfmlib_pmu_t s390x_cpum_cf_support;
f8a042
 extern pfmlib_pmu_t s390x_cpum_sf_support;
f8a042
diff --git a/lib/pfmlib_tx2_unc_perf_event.c b/lib/pfmlib_tx2_unc_perf_event.c
f8a042
new file mode 100644
f8a042
index 0000000..1a04e1d
f8a042
--- /dev/null
f8a042
+++ b/lib/pfmlib_tx2_unc_perf_event.c
f8a042
@@ -0,0 +1,139 @@
f8a042
+#include <sys/types.h>
f8a042
+#include <string.h>
f8a042
+#include <stdlib.h>
f8a042
+#include <stdio.h>
f8a042
+#include <stdarg.h>
f8a042
+#include <limits.h>
f8a042
+
f8a042
+/* private headers */
f8a042
+#include "pfmlib_priv.h"
f8a042
+#include "pfmlib_perf_event_priv.h"
f8a042
+#include "pfmlib_arm_priv.h"
f8a042
+
f8a042
+typedef union {
f8a042
+	uint64_t val;
f8a042
+	struct {
f8a042
+		unsigned long unc_event:8;	/* event code */
f8a042
+		unsigned long unc_umask:8;	/* unit mask */
f8a042
+		unsigned long unc_res1:1;	/* reserved */
f8a042
+		unsigned long unc_rst:1;	/* reset */
f8a042
+		unsigned long unc_edge:1;	/* edge detect */
f8a042
+		unsigned long unc_res2:3;	/* reserved */
f8a042
+		unsigned long unc_en:1;		/* enable */
f8a042
+		unsigned long unc_inv:1;	/* invert counter mask */
f8a042
+		unsigned long unc_thres:8;	/* counter mask */
f8a042
+		unsigned long unc_res3:32;	/* reserved */
f8a042
+	} com; /* covers common fields for DMC/L3C */
f8a042
+} tx2_unc_data_t;
f8a042
+
f8a042
+static void
f8a042
+display_reg(void *this, pfmlib_event_desc_t *e, tx2_unc_data_t reg);
f8a042
+static void
f8a042
+display_com(void *this, pfmlib_event_desc_t *e, void *val);
f8a042
+static int
f8a042
+find_pmu_type_by_name(const char *name);
f8a042
+
f8a042
+int
f8a042
+pfm_tx2_unc_get_event_encoding(void *this, pfmlib_event_desc_t *e)
f8a042
+{
f8a042
+	//from pe field in for the uncore, get the array with all the event defs
f8a042
+	const arm_entry_t *event_list = this_pe(this);
f8a042
+	tx2_unc_data_t reg;
f8a042
+	//get code for the event from the table
f8a042
+	reg.val = event_list[e->event].code;
f8a042
+	//pass the data back to the caller
f8a042
+	e->codes[0] = reg.val;
f8a042
+	e->count = 1;
f8a042
+	evt_strcat(e->fstr, "%s", event_list[e->event].name);
f8a042
+	display_reg(this, e, reg);
f8a042
+	return PFM_SUCCESS;
f8a042
+}
f8a042
+
f8a042
+int
f8a042
+pfm_tx2_unc_get_perf_encoding(void *this, pfmlib_event_desc_t *e)
f8a042
+{
f8a042
+	pfmlib_pmu_t *pmu = this;
f8a042
+	struct perf_event_attr *attr = e->os_data;
f8a042
+	tx2_unc_data_t reg;
f8a042
+	int ret;
f8a042
+
f8a042
+	if (!pmu->get_event_encoding[PFM_OS_NONE])
f8a042
+		return PFM_ERR_NOTSUPP;
f8a042
+
f8a042
+	ret = pmu->get_event_encoding[PFM_OS_NONE](this, e);
f8a042
+	if (ret != PFM_SUCCESS)
f8a042
+		return ret;
f8a042
+	//get pmu type to probe
f8a042
+	ret = find_pmu_type_by_name(pmu->perf_name);
f8a042
+	if (ret < 0)
f8a042
+		return ret;
f8a042
+
f8a042
+	attr->type = ret;
f8a042
+	//get code to provide to the uncore pmu probe
f8a042
+	reg.val = e->codes[0];
f8a042
+	attr->config = reg.val;
f8a042
+
f8a042
+	// if needed, can use attr->config1 or attr->config2 for extra info from event structure defines e->codes[i]
f8a042
+
f8a042
+	// uncore measures at all priv levels
f8a042
+	attr->exclude_hv = 0;
f8a042
+	attr->exclude_kernel = 0;
f8a042
+	attr->exclude_user = 0;
f8a042
+
f8a042
+	return PFM_SUCCESS;
f8a042
+}
f8a042
+
f8a042
+
f8a042
+static void
f8a042
+display_reg(void *this, pfmlib_event_desc_t *e, tx2_unc_data_t reg)
f8a042
+{
f8a042
+	pfmlib_pmu_t *pmu = this;
f8a042
+	if (pmu->display_reg)
f8a042
+		pmu->display_reg(this, e, ®);
f8a042
+	else
f8a042
+		display_com(this, e, ®);
f8a042
+}
f8a042
+
f8a042
+static void
f8a042
+display_com(void *this, pfmlib_event_desc_t *e, void *val)
f8a042
+{
f8a042
+	const arm_entry_t *pe = this_pe(this);
f8a042
+	tx2_unc_data_t *reg = val;
f8a042
+
f8a042
+	__pfm_vbprintf("[UNC=0x%"PRIx64" event=0x%x umask=0x%x en=%d "
f8a042
+		       "inv=%d edge=%d thres=%d] %s\n",
f8a042
+			reg->val,
f8a042
+			reg->com.unc_event,
f8a042
+			reg->com.unc_umask,
f8a042
+			reg->com.unc_en,
f8a042
+			reg->com.unc_inv,
f8a042
+			reg->com.unc_edge,
f8a042
+			reg->com.unc_thres,
f8a042
+			pe[e->event].name);
f8a042
+}
f8a042
+
f8a042
+static int
f8a042
+find_pmu_type_by_name(const char *name)
f8a042
+{
f8a042
+	char filename[PATH_MAX];
f8a042
+	FILE *fp;
f8a042
+	int ret, type;
f8a042
+
f8a042
+	if (!name)
f8a042
+		return PFM_ERR_NOTSUPP;
f8a042
+
f8a042
+	sprintf(filename, "/sys/bus/event_source/devices/%s/type", name);
f8a042
+
f8a042
+	fp = fopen(filename, "r");
f8a042
+	if (!fp)
f8a042
+		return PFM_ERR_NOTSUPP;
f8a042
+
f8a042
+	ret = fscanf(fp, "%d", &type);
f8a042
+	if (ret != 1)
f8a042
+		type = PFM_ERR_NOTSUPP;
f8a042
+
f8a042
+	fclose(fp);
f8a042
+
f8a042
+	return type;
f8a042
+}
f8a042
+
f8a042
diff --git a/tests/validate_arm64.c b/tests/validate_arm64.c
f8a042
index f7f021a..35eb6ef 100644
f8a042
--- a/tests/validate_arm64.c
f8a042
+++ b/tests/validate_arm64.c
f8a042
@@ -177,6 +177,12 @@ static const test_event_t arm64_test_events[]={
f8a042
 	  .codes[0] = 0x8000008,
f8a042
 	  .fstr = "arm_thunderx2::INST_RETIRED:k=1:u=1:hv=0",
f8a042
 	},
f8a042
+	{ SRC_LINE,
f8a042
+	  .name = "tx2_dmc1::UNC_DMC_READS",
f8a042
+	  .ret  = PFM_SUCCESS,
f8a042
+	  .count = 1,
f8a042
+	  .codes[0] = 0xf,
f8a042
+	},
f8a042
 };
f8a042
 #define NUM_TEST_EVENTS (int)(sizeof(arm64_test_events)/sizeof(test_event_t))
f8a042
 
f8a042
-- 
f8a042
2.21.0
f8a042
f8a042
From 6641952170c23c5ab69c1af19197a9d8284c1e53 Mon Sep 17 00:00:00 2001
f8a042
From: Shay Gal-On <sgalon@cavium.com>
f8a042
Date: Thu, 21 Nov 2019 10:41:26 -0800
f8a042
Subject: [PATCH 2/4] Moved TX2 uncore event to separate file
f8a042
f8a042
To make event files cleaner.
f8a042
Also added link to marvell doc publishing the uncore event lists.
f8a042
f8a042
Signed-off-by: Shay Gal-On <sgalon@marvell.com>
f8a042
---
f8a042
 lib/Makefile                            |  8 ++-
f8a042
 lib/events/arm_cavium_tx2_events.h      | 61 -----------------
f8a042
 lib/events/arm_marvell_tx2_unc_events.h | 90 +++++++++++++++++++++++++
f8a042
 lib/pfmlib_arm_armv8.c                  |  3 +-
f8a042
 4 files changed, 97 insertions(+), 65 deletions(-)
f8a042
 create mode 100755 lib/events/arm_marvell_tx2_unc_events.h
f8a042
f8a042
diff --git a/lib/Makefile b/lib/Makefile
f8a042
index f45515d..686264b 100644
f8a042
--- a/lib/Makefile
f8a042
+++ b/lib/Makefile
f8a042
@@ -360,11 +360,13 @@ INC_ARM=pfmlib_arm_priv.h			\
f8a042
 	events/arm_cortex_a15_events.h		\
f8a042
 	events/arm_cortex_a57_events.h		\
f8a042
 	events/arm_cortex_a53_events.h		\
f8a042
-	events/arm_cavium_tx2_events.h
f8a042
+	events/arm_cavium_tx2_events.h		\
f8a042
+	events/arm_marvell_tx2_unc_events.h
f8a042
 
f8a042
 INC_ARM64=events/arm_cortex_a57_events.h	\
f8a042
-	  events/arm_cortex_a53_events.h	\
f8a042
-	  events/arm_cavium_tx2_events.h
f8a042
+	events/arm_cortex_a53_events.h	\
f8a042
+	events/arm_cavium_tx2_events.h	\
f8a042
+	events/arm_marvell_tx2_unc_events.h
f8a042
 
f8a042
 INCDEP=$(INC_COMMON) $(INCARCH)
f8a042
 
f8a042
diff --git a/lib/events/arm_cavium_tx2_events.h b/lib/events/arm_cavium_tx2_events.h
f8a042
index 18d8931..198d33d 100644
f8a042
--- a/lib/events/arm_cavium_tx2_events.h
f8a042
+++ b/lib/events/arm_cavium_tx2_events.h
f8a042
@@ -835,64 +835,3 @@ static const arm_entry_t arm_thunderx2_pe[]={
f8a042
 	 .desc = "Scu hwpf next line requests generated"
f8a042
 	},
f8a042
 };
f8a042
-
f8a042
-#define ARM_TX2_CORE_EVENT_COUNT	(sizeof(arm_thunderx2_pe)/sizeof(arm_entry_t))
f8a042
-
f8a042
-/* L3C event IDs */
f8a042
-#define L3_EVENT_READ_REQ               0xD
f8a042
-#define L3_EVENT_WRITEBACK_REQ          0xE
f8a042
-#define L3_EVENT_EVICT_REQ              0x13
f8a042
-#define L3_EVENT_READ_HIT               0x17
f8a042
-#define L3_EVENT_MAX                    0x18
f8a042
-
f8a042
-/* DMC event IDs */
f8a042
-#define DMC_EVENT_COUNT_CYCLES          0x1
f8a042
-#define DMC_EVENT_WRITE_TXNS            0xB
f8a042
-#define DMC_EVENT_DATA_TRANSFERS        0xD
f8a042
-#define DMC_EVENT_READ_TXNS             0xF
f8a042
-#define DMC_EVENT_MAX                   0x10
f8a042
-
f8a042
-static const arm_entry_t arm_thunderx2_unc_dmc_pe[]={
f8a042
-	{.name = "UNC_DMC_READS",
f8a042
-	 .modmsk = ARMV8_ATTRS,
f8a042
-	 .code = DMC_EVENT_READ_TXNS,
f8a042
-	 .desc = "Memory read transactions"
f8a042
-	},
f8a042
-	{.name = "UNC_DMC_WRITES",
f8a042
-	 .modmsk = ARMV8_ATTRS,
f8a042
-	 .code = DMC_EVENT_WRITE_TXNS,
f8a042
-	 .desc = "Memory write transactions"
f8a042
-	},
f8a042
-};
f8a042
-
f8a042
-#define ARM_TX2_CORE_DMC_COUNT	(sizeof(arm_thunderx2_unc_dmc_pe)/sizeof(arm_entry_t))
f8a042
-
f8a042
-static const arm_entry_t arm_thunderx2_unc_llc_pe[]={
f8a042
-	{.name = "UNC_LLC_READ",
f8a042
-	 .modmsk = ARMV8_ATTRS,
f8a042
-	 .code = L3_EVENT_READ_REQ,
f8a042
-	 .desc = "Read requests to LLC"
f8a042
-	},
f8a042
-	{.name = "UNC_LLC_EVICT",
f8a042
-	 .modmsk = ARMV8_ATTRS,
f8a042
-	 .code = L3_EVENT_EVICT_REQ,
f8a042
-	 .desc = "Evict requests to LLC"
f8a042
-	},
f8a042
-	{.name = "UNC_LLC_READ_HIT",
f8a042
-	 .modmsk = ARMV8_ATTRS,
f8a042
-	 .code = L3_EVENT_READ_HIT,
f8a042
-	 .desc = "Read requests to LLC which hit"
f8a042
-	},
f8a042
-	{.name = "UNC_LLC_WB",
f8a042
-	 .modmsk = ARMV8_ATTRS,
f8a042
-	 .code = L3_EVENT_WRITEBACK_REQ,
f8a042
-	 .desc = "Writeback requests to LLC"
f8a042
-	}
f8a042
-};
f8a042
-
f8a042
-#define ARM_TX2_CORE_LLC_COUNT	(sizeof(arm_thunderx2_unc_llc_pe)/sizeof(arm_entry_t))
f8a042
-//Uncore accessor functions
f8a042
-int
f8a042
-pfm_tx2_unc_get_event_encoding(void *this, pfmlib_event_desc_t *e);
f8a042
-int
f8a042
-pfm_tx2_unc_get_perf_encoding(void *this, pfmlib_event_desc_t *e);
f8a042
diff --git a/lib/events/arm_marvell_tx2_unc_events.h b/lib/events/arm_marvell_tx2_unc_events.h
f8a042
new file mode 100755
f8a042
index 0000000..9b0a1b4
f8a042
--- /dev/null
f8a042
+++ b/lib/events/arm_marvell_tx2_unc_events.h
f8a042
@@ -0,0 +1,90 @@
f8a042
+/*
f8a042
+ * Copyright (c) 2019 Marvell Technology Group Ltd
f8a042
+ * Contributed by Shay Gal-On <sgalon@marvell.com>
f8a042
+ *
f8a042
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
f8a042
+ * of this software and associated documentation files (the "Software"), to deal
f8a042
+ * in the Software without restriction, including without limitation the rights
f8a042
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
f8a042
+ * of the Software, and to permit persons to whom the Software is furnished to do so,
f8a042
+ * subject to the following conditions:
f8a042
+ *
f8a042
+ * The above copyright notice and this permission notice shall be included in all
f8a042
+ * copies or substantial portions of the Software.
f8a042
+ *
f8a042
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
f8a042
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
f8a042
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
f8a042
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
f8a042
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
f8a042
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
f8a042
+ *
f8a042
+ * Marvell ThunderX2
f8a042
+ *
f8a042
+ * ARM Architecture Reference Manual, ARMv8, for ARMv8-A architecture profile,
f8a042
+ * ARM DDI 0487B.a (ID033117)
f8a042
+ *
f8a042
+ * Marvell ThunderX2 C99XX Core and Uncore PMU Events (Abridged) can be found at
f8a042
+ * https://www.marvell.com/documents/hrur6mybdvk5uki1w0z7/
f8a042
+ *
f8a042
+ */
f8a042
+
f8a042
+
f8a042
+/* L3C event IDs */
f8a042
+#define L3_EVENT_READ_REQ               0xD
f8a042
+#define L3_EVENT_WRITEBACK_REQ          0xE
f8a042
+#define L3_EVENT_EVICT_REQ              0x13
f8a042
+#define L3_EVENT_READ_HIT               0x17
f8a042
+#define L3_EVENT_MAX                    0x18
f8a042
+
f8a042
+/* DMC event IDs */
f8a042
+#define DMC_EVENT_COUNT_CYCLES          0x1
f8a042
+#define DMC_EVENT_WRITE_TXNS            0xB
f8a042
+#define DMC_EVENT_DATA_TRANSFERS        0xD
f8a042
+#define DMC_EVENT_READ_TXNS             0xF
f8a042
+#define DMC_EVENT_MAX                   0x10
f8a042
+
f8a042
+static const arm_entry_t arm_thunderx2_unc_dmc_pe[]={
f8a042
+	{.name = "UNC_DMC_READS",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = DMC_EVENT_READ_TXNS,
f8a042
+	 .desc = "Memory read transactions"
f8a042
+	},
f8a042
+	{.name = "UNC_DMC_WRITES",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = DMC_EVENT_WRITE_TXNS,
f8a042
+	 .desc = "Memory write transactions"
f8a042
+	},
f8a042
+};
f8a042
+
f8a042
+#define ARM_TX2_CORE_DMC_COUNT	(sizeof(arm_thunderx2_unc_dmc_pe)/sizeof(arm_entry_t))
f8a042
+
f8a042
+static const arm_entry_t arm_thunderx2_unc_llc_pe[]={
f8a042
+	{.name = "UNC_LLC_READ",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = L3_EVENT_READ_REQ,
f8a042
+	 .desc = "Read requests to LLC"
f8a042
+	},
f8a042
+	{.name = "UNC_LLC_EVICT",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = L3_EVENT_EVICT_REQ,
f8a042
+	 .desc = "Evict requests to LLC"
f8a042
+	},
f8a042
+	{.name = "UNC_LLC_READ_HIT",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = L3_EVENT_READ_HIT,
f8a042
+	 .desc = "Read requests to LLC which hit"
f8a042
+	},
f8a042
+	{.name = "UNC_LLC_WB",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = L3_EVENT_WRITEBACK_REQ,
f8a042
+	 .desc = "Writeback requests to LLC"
f8a042
+	}
f8a042
+};
f8a042
+
f8a042
+#define ARM_TX2_CORE_LLC_COUNT	(sizeof(arm_thunderx2_unc_llc_pe)/sizeof(arm_entry_t))
f8a042
+//Uncore accessor functions
f8a042
+int
f8a042
+pfm_tx2_unc_get_event_encoding(void *this, pfmlib_event_desc_t *e);
f8a042
+int
f8a042
+pfm_tx2_unc_get_perf_encoding(void *this, pfmlib_event_desc_t *e);
f8a042
diff --git a/lib/pfmlib_arm_armv8.c b/lib/pfmlib_arm_armv8.c
f8a042
index 35ff70f..291ac60 100644
f8a042
--- a/lib/pfmlib_arm_armv8.c
f8a042
+++ b/lib/pfmlib_arm_armv8.c
f8a042
@@ -33,7 +33,8 @@
f8a042
 #include "events/arm_cortex_a57_events.h"    /* A57 event tables */
f8a042
 #include "events/arm_cortex_a53_events.h"    /* A53 event tables */
f8a042
 #include "events/arm_xgene_events.h"         /* Applied Micro X-Gene tables */
f8a042
-#include "events/arm_cavium_tx2_events.h"    /* Cavium ThunderX2 tables */
f8a042
+#include "events/arm_cavium_tx2_events.h"    	/* Marvell ThunderX2 tables */
f8a042
+#include "events/arm_marvell_tx2_unc_events.h" 	/* Marvell ThunderX2 PMU tables */
f8a042
 
f8a042
 static int
f8a042
 pfm_arm_detect_cortex_a57(void *this)
f8a042
-- 
f8a042
2.21.0
f8a042
f8a042
From dc1da4573eb8d24bdf64b9bb5e04ed956075d712 Mon Sep 17 00:00:00 2001
f8a042
From: Shay Gal-On <sgalon@cavium.com>
f8a042
Date: Mon, 25 Nov 2019 12:00:15 -0800
f8a042
Subject: [PATCH 3/4] Add ThunderX2 DMC events and CCPI events
f8a042
f8a042
This patch adds missing 2 DMC events for ThunderX2
f8a042
and adds support for the Cross Core Complex Interconnect
f8a042
(CCPI) PMU and events.
f8a042
f8a042
The following PMU models are added:
f8a042
 - tx2_ccpi0, tx2_ccpi1
f8a042
 - tx2_dmc0, tx2_dmc1
f8a042
f8a042
Signed-off-by: Shay Gal-On <sgalon@marvell.com>
f8a042
---
f8a042
 include/perfmon/pfmlib.h                |  12 +--
f8a042
 lib/Makefile                            |   2 +-
f8a042
 lib/events/arm_marvell_tx2_unc_events.h |  42 ++++++++++
f8a042
 lib/pfmlib_arm_armv8.c                  |  33 +++++++-
f8a042
 lib/pfmlib_common.c                     |   8 ++
f8a042
 lib/pfmlib_priv.h                       |   2 +
f8a042
 lib/pfmlib_tx2_unc_perf_event.c         | 101 ++++++++++--------------
f8a042
 tests/validate_arm64.c                  |  15 ++++
f8a042
 8 files changed, 148 insertions(+), 67 deletions(-)
f8a042
f8a042
diff --git a/include/perfmon/pfmlib.h b/include/perfmon/pfmlib.h
f8a042
index 20d5feb..3f1d2f5 100644
f8a042
--- a/include/perfmon/pfmlib.h
f8a042
+++ b/include/perfmon/pfmlib.h
f8a042
@@ -543,12 +543,14 @@ typedef enum {
f8a042
 
f8a042
 	PFM_PMU_INTEL_KNM_UNC_UBOX,	/* Intel Knights Mill Ubox uncore */
f8a042
 	PFM_PMU_INTEL_KNM_UNC_M2PCIE,	/* Intel Knights Mill M2PCIe uncore */
f8a042
-	PFM_PMU_ARM_THUNDERX2,		/* Cavium ThunderX2 */
f8a042
+	PFM_PMU_ARM_THUNDERX2,		/* Marvell ThunderX2 */
f8a042
 
f8a042
-	PFM_PMU_ARM_THUNDERX2_DMC0,	/* Cavium ThunderX2 DMC unit 0 uncore */
f8a042
-	PFM_PMU_ARM_THUNDERX2_DMC1,	/* Cavium ThunderX2 DMC unit 1 uncore */
f8a042
-	PFM_PMU_ARM_THUNDERX2_LLC0,	/* Cavium ThunderX2 LLC unit 0 uncore */
f8a042
-	PFM_PMU_ARM_THUNDERX2_LLC1,	/* Cavium ThunderX2 LLC unit 1 uncore */
f8a042
+	PFM_PMU_ARM_THUNDERX2_DMC0,	/* Marvell ThunderX2 DMC unit 0 uncore */
f8a042
+	PFM_PMU_ARM_THUNDERX2_DMC1,	/* Marvell ThunderX2 DMC unit 1 uncore */
f8a042
+	PFM_PMU_ARM_THUNDERX2_LLC0,	/* Marvell ThunderX2 LLC unit 0 uncore */
f8a042
+	PFM_PMU_ARM_THUNDERX2_LLC1,	/* Marvell ThunderX2 LLC unit 1 uncore */
f8a042
+	PFM_PMU_ARM_THUNDERX2_CCPI0,	/* Marvell ThunderX2 Cross-Socket Interconnect unit 0 uncore */
f8a042
+	PFM_PMU_ARM_THUNDERX2_CCPI1,	/* Marvell ThunderX2 Cross-Socket Interconnect unit 1 uncore */
f8a042
 	/* MUST ADD NEW PMU MODELS HERE */
f8a042
 
f8a042
 	PFM_PMU_MAX			/* end marker */
f8a042
diff --git a/lib/Makefile b/lib/Makefile
f8a042
index 686264b..4a4dc3b 100644
f8a042
--- a/lib/Makefile
f8a042
+++ b/lib/Makefile
f8a042
@@ -177,7 +177,7 @@ SRCS += pfmlib_arm_perf_event.c
f8a042
 endif
f8a042
 
f8a042
 INCARCH = $(INC_ARM)
f8a042
-SRCS   += pfmlib_arm.c pfmlib_arm_armv7_pmuv1.c pfmlib_arm_armv6.c pfmlib_arm_armv8.c
f8a042
+SRCS   += pfmlib_arm.c pfmlib_arm_armv7_pmuv1.c pfmlib_arm_armv6.c pfmlib_arm_armv8.c pfmlib_tx2_unc_perf_event.c
f8a042
 CFLAGS += -DCONFIG_PFMLIB_ARCH_ARM
f8a042
 endif
f8a042
 
f8a042
diff --git a/lib/events/arm_marvell_tx2_unc_events.h b/lib/events/arm_marvell_tx2_unc_events.h
f8a042
index 9b0a1b4..51e6b4d 100755
f8a042
--- a/lib/events/arm_marvell_tx2_unc_events.h
f8a042
+++ b/lib/events/arm_marvell_tx2_unc_events.h
f8a042
@@ -44,6 +44,13 @@
f8a042
 #define DMC_EVENT_READ_TXNS             0xF
f8a042
 #define DMC_EVENT_MAX                   0x10
f8a042
 
f8a042
+/* CCPI event IDs */
f8a042
+#define CCPI2_EVENT_REQ_PKT_SENT	0x3D
f8a042
+#define CCPI2_EVENT_SNOOP_PKT_SENT	0x65
f8a042
+#define CCPI2_EVENT_DATA_PKT_SENT	0x105
f8a042
+#define CCPI2_EVENT_GIC_PKT_SENT	0x12D
f8a042
+
f8a042
+
f8a042
 static const arm_entry_t arm_thunderx2_unc_dmc_pe[]={
f8a042
 	{.name = "UNC_DMC_READS",
f8a042
 	 .modmsk = ARMV8_ATTRS,
f8a042
@@ -55,10 +62,45 @@ static const arm_entry_t arm_thunderx2_unc_dmc_pe[]={
f8a042
 	 .code = DMC_EVENT_WRITE_TXNS,
f8a042
 	 .desc = "Memory write transactions"
f8a042
 	},
f8a042
+	{.name = "UNC_DMC_DATA_TRANSFERS",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = DMC_EVENT_DATA_TRANSFERS,
f8a042
+	 .desc = "Memory data transfers"
f8a042
+	},
f8a042
+	{.name = "UNC_DMC_CYCLES",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = DMC_EVENT_COUNT_CYCLES,
f8a042
+	 .desc = "Clocks at the DMC clock rate"
f8a042
+	}
f8a042
 };
f8a042
 
f8a042
 #define ARM_TX2_CORE_DMC_COUNT	(sizeof(arm_thunderx2_unc_dmc_pe)/sizeof(arm_entry_t))
f8a042
 
f8a042
+static const arm_entry_t arm_thunderx2_unc_ccpi_pe[]={
f8a042
+	{.name = "UNC_CCPI_REQ",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = CCPI2_EVENT_REQ_PKT_SENT,
f8a042
+	 .desc = "Request packets sent from this node"
f8a042
+	},
f8a042
+	{.name = "UNC_CCPI_SNOOP",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = CCPI2_EVENT_SNOOP_PKT_SENT,
f8a042
+	 .desc = "Snoop packets sent from this node"
f8a042
+	},
f8a042
+	{.name = "UNC_CCPI_DATA",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = CCPI2_EVENT_DATA_PKT_SENT ,
f8a042
+	 .desc = "Data packets sent from this node"
f8a042
+	},
f8a042
+	{.name = "UNC_CCPI_GIC",
f8a042
+	 .modmsk = ARMV8_ATTRS,
f8a042
+	 .code = CCPI2_EVENT_GIC_PKT_SENT,
f8a042
+	 .desc = "Interrupt related packets sent from this node"
f8a042
+	}
f8a042
+};
f8a042
+
f8a042
+#define ARM_TX2_CORE_CCPI_COUNT	(sizeof(arm_thunderx2_unc_ccpi_pe)/sizeof(arm_entry_t))
f8a042
+
f8a042
 static const arm_entry_t arm_thunderx2_unc_llc_pe[]={
f8a042
 	{.name = "UNC_LLC_READ",
f8a042
 	 .modmsk = ARMV8_ATTRS,
f8a042
diff --git a/lib/pfmlib_arm_armv8.c b/lib/pfmlib_arm_armv8.c
f8a042
index 291ac60..a252951 100644
f8a042
--- a/lib/pfmlib_arm_armv8.c
f8a042
+++ b/lib/pfmlib_arm_armv8.c
f8a042
@@ -179,7 +179,7 @@ pfmlib_pmu_t arm_xgene_support={
f8a042
 	.get_event_nattrs	= pfm_arm_get_event_nattrs,
f8a042
 };
f8a042
 
f8a042
-/* Cavium ThunderX2 support */
f8a042
+/* Marvell ThunderX2 support */
f8a042
 pfmlib_pmu_t arm_thunderx2_support={
f8a042
 	.desc			= "Cavium ThunderX2",
f8a042
 	.name			= "arm_thunderx2",
f8a042
@@ -208,7 +208,7 @@ pfmlib_pmu_t arm_thunderx2_support={
f8a042
 
f8a042
 #define DEFINE_TX2_DMC(n) \
f8a042
 pfmlib_pmu_t arm_thunderx2_dmc##n##_support={ \
f8a042
-	.desc			= "Cavium ThunderX2 Node"#n" DMC", \
f8a042
+	.desc			= "Marvell ThunderX2 Node"#n" DMC", \
f8a042
 	.name			= "tx2_dmc"#n, \
f8a042
 	.perf_name		= "uncore_dmc_"#n, \
f8a042
 	.pmu			= PFM_PMU_ARM_THUNDERX2_DMC##n, \
f8a042
@@ -235,7 +235,7 @@ DEFINE_TX2_DMC(1);
f8a042
 
f8a042
 #define DEFINE_TX2_LLC(n) \
f8a042
 pfmlib_pmu_t arm_thunderx2_llc##n##_support={ \
f8a042
-	.desc			= "Cavium ThunderX2 node "#n" LLC", \
f8a042
+	.desc			= "Marvell ThunderX2 node "#n" LLC", \
f8a042
 	.name			= "tx2_llc"#n, \
f8a042
 	.perf_name		= "uncore_l3c_"#n, \
f8a042
 	.pmu			= PFM_PMU_ARM_THUNDERX2_LLC##n, \
f8a042
@@ -259,3 +259,30 @@ pfmlib_pmu_t arm_thunderx2_llc##n##_support={ \
f8a042
 
f8a042
 DEFINE_TX2_LLC(0);
f8a042
 DEFINE_TX2_LLC(1);
f8a042
+
f8a042
+#define DEFINE_TX2_CCPI(n) \
f8a042
+pfmlib_pmu_t arm_thunderx2_ccpi##n##_support={ \
f8a042
+	.desc			= "Marvell ThunderX2 node "#n" Cross-Socket Interconnect", \
f8a042
+	.name			= "tx2_ccpi"#n, \
f8a042
+	.perf_name		= "uncore_ccpi_"#n, \
f8a042
+	.pmu			= PFM_PMU_ARM_THUNDERX2_CCPI##n, \
f8a042
+	.pme_count		= LIBPFM_ARRAY_SIZE(arm_thunderx2_unc_ccpi_pe), \
f8a042
+	.type			= PFM_PMU_TYPE_UNCORE, \
f8a042
+	.pe			= arm_thunderx2_unc_ccpi_pe, \
f8a042
+	.pmu_detect		= pfm_arm_detect_thunderx2, \
f8a042
+	.max_encoding		= 1, \
f8a042
+	.num_cntrs		= 4, \
f8a042
+	.get_event_encoding[PFM_OS_NONE] = pfm_tx2_unc_get_event_encoding, \
f8a042
+	 PFMLIB_ENCODE_PERF(pfm_tx2_unc_get_perf_encoding),		\
f8a042
+	.get_event_first	= pfm_arm_get_event_first, \
f8a042
+	.get_event_next		= pfm_arm_get_event_next,  \
f8a042
+	.event_is_valid		= pfm_arm_event_is_valid,  \
f8a042
+	.validate_table		= pfm_arm_validate_table,  \
f8a042
+	.get_event_info		= pfm_arm_get_event_info,  \
f8a042
+	.get_event_attr_info	= pfm_arm_get_event_attr_info,	\
f8a042
+	 PFMLIB_VALID_PERF_PATTRS(pfm_arm_perf_validate_pattrs),\
f8a042
+	.get_event_nattrs	= pfm_arm_get_event_nattrs, \
f8a042
+};
f8a042
+
f8a042
+DEFINE_TX2_CCPI(0);
f8a042
+DEFINE_TX2_CCPI(1);
f8a042
diff --git a/lib/pfmlib_common.c b/lib/pfmlib_common.c
f8a042
index 8314d4b..8cb8998 100644
f8a042
--- a/lib/pfmlib_common.c
f8a042
+++ b/lib/pfmlib_common.c
f8a042
@@ -484,6 +484,12 @@ static pfmlib_pmu_t *pfmlib_pmus[]=
f8a042
 	&arm_cortex_a53_support,
f8a042
 	&arm_xgene_support,
f8a042
 	&arm_thunderx2_support,
f8a042
+	&arm_thunderx2_dmc0_support,
f8a042
+	&arm_thunderx2_dmc1_support,
f8a042
+	&arm_thunderx2_llc0_support,
f8a042
+	&arm_thunderx2_llc1_support,
f8a042
+	&arm_thunderx2_ccpi0_support,
f8a042
+	&arm_thunderx2_ccpi1_support,
f8a042
 #endif
f8a042
 #ifdef CONFIG_PFMLIB_ARCH_ARM64
f8a042
 	&arm_cortex_a57_support,
f8a042
@@ -494,6 +500,8 @@ static pfmlib_pmu_t *pfmlib_pmus[]=
f8a042
 	&arm_thunderx2_dmc1_support,
f8a042
 	&arm_thunderx2_llc0_support,
f8a042
 	&arm_thunderx2_llc1_support,
f8a042
+	&arm_thunderx2_ccpi0_support,
f8a042
+	&arm_thunderx2_ccpi1_support,
f8a042
 #endif
f8a042
 
f8a042
 #ifdef CONFIG_PFMLIB_ARCH_S390X
f8a042
diff --git a/lib/pfmlib_priv.h b/lib/pfmlib_priv.h
f8a042
index cb83f43..1340a6b 100644
f8a042
--- a/lib/pfmlib_priv.h
f8a042
+++ b/lib/pfmlib_priv.h
f8a042
@@ -650,6 +650,8 @@ extern pfmlib_pmu_t arm_thunderx2_dmc0_support;
f8a042
 extern pfmlib_pmu_t arm_thunderx2_dmc1_support;
f8a042
 extern pfmlib_pmu_t arm_thunderx2_llc0_support;
f8a042
 extern pfmlib_pmu_t arm_thunderx2_llc1_support;
f8a042
+extern pfmlib_pmu_t arm_thunderx2_ccpi0_support;
f8a042
+extern pfmlib_pmu_t arm_thunderx2_ccpi1_support;
f8a042
 
f8a042
 extern pfmlib_pmu_t mips_74k_support;
f8a042
 extern pfmlib_pmu_t s390x_cpum_cf_support;
f8a042
diff --git a/lib/pfmlib_tx2_unc_perf_event.c b/lib/pfmlib_tx2_unc_perf_event.c
f8a042
index 1a04e1d..7dc2372 100644
f8a042
--- a/lib/pfmlib_tx2_unc_perf_event.c
f8a042
+++ b/lib/pfmlib_tx2_unc_perf_event.c
f8a042
@@ -27,11 +27,51 @@ typedef union {
f8a042
 } tx2_unc_data_t;
f8a042
 
f8a042
 static void
f8a042
-display_reg(void *this, pfmlib_event_desc_t *e, tx2_unc_data_t reg);
f8a042
+display_com(void *this, pfmlib_event_desc_t *e, void *val)
f8a042
+{
f8a042
+	const arm_entry_t *pe = this_pe(this);
f8a042
+	tx2_unc_data_t *reg = val;
f8a042
+
f8a042
+	__pfm_vbprintf("[UNC=0x%"PRIx64"] %s\n",
f8a042
+			reg->val,
f8a042
+			pe[e->event].name);
f8a042
+}
f8a042
+
f8a042
 static void
f8a042
-display_com(void *this, pfmlib_event_desc_t *e, void *val);
f8a042
+display_reg(void *this, pfmlib_event_desc_t *e, tx2_unc_data_t reg)
f8a042
+{
f8a042
+	pfmlib_pmu_t *pmu = this;
f8a042
+	if (pmu->display_reg)
f8a042
+		pmu->display_reg(this, e, ®);
f8a042
+	else
f8a042
+		display_com(this, e, ®);
f8a042
+}
f8a042
+
f8a042
+
f8a042
 static int
f8a042
-find_pmu_type_by_name(const char *name);
f8a042
+find_pmu_type_by_name(const char *name)
f8a042
+{
f8a042
+	char filename[PATH_MAX];
f8a042
+	FILE *fp;
f8a042
+	int ret, type;
f8a042
+
f8a042
+	if (!name)
f8a042
+		return PFM_ERR_NOTSUPP;
f8a042
+
f8a042
+	sprintf(filename, "/sys/bus/event_source/devices/%s/type", name);
f8a042
+
f8a042
+	fp = fopen(filename, "r");
f8a042
+	if (!fp)
f8a042
+		return PFM_ERR_NOTSUPP;
f8a042
+
f8a042
+	ret = fscanf(fp, "%d", &type);
f8a042
+	if (ret != 1)
f8a042
+		type = PFM_ERR_NOTSUPP;
f8a042
+
f8a042
+	fclose(fp);
f8a042
+
f8a042
+	return type;
f8a042
+}
f8a042
 
f8a042
 int
f8a042
 pfm_tx2_unc_get_event_encoding(void *this, pfmlib_event_desc_t *e)
f8a042
@@ -82,58 +122,3 @@ pfm_tx2_unc_get_perf_encoding(void *this, pfmlib_event_desc_t *e)
f8a042
 
f8a042
 	return PFM_SUCCESS;
f8a042
 }
f8a042
-
f8a042
-
f8a042
-static void
f8a042
-display_reg(void *this, pfmlib_event_desc_t *e, tx2_unc_data_t reg)
f8a042
-{
f8a042
-	pfmlib_pmu_t *pmu = this;
f8a042
-	if (pmu->display_reg)
f8a042
-		pmu->display_reg(this, e, ®);
f8a042
-	else
f8a042
-		display_com(this, e, ®);
f8a042
-}
f8a042
-
f8a042
-static void
f8a042
-display_com(void *this, pfmlib_event_desc_t *e, void *val)
f8a042
-{
f8a042
-	const arm_entry_t *pe = this_pe(this);
f8a042
-	tx2_unc_data_t *reg = val;
f8a042
-
f8a042
-	__pfm_vbprintf("[UNC=0x%"PRIx64" event=0x%x umask=0x%x en=%d "
f8a042
-		       "inv=%d edge=%d thres=%d] %s\n",
f8a042
-			reg->val,
f8a042
-			reg->com.unc_event,
f8a042
-			reg->com.unc_umask,
f8a042
-			reg->com.unc_en,
f8a042
-			reg->com.unc_inv,
f8a042
-			reg->com.unc_edge,
f8a042
-			reg->com.unc_thres,
f8a042
-			pe[e->event].name);
f8a042
-}
f8a042
-
f8a042
-static int
f8a042
-find_pmu_type_by_name(const char *name)
f8a042
-{
f8a042
-	char filename[PATH_MAX];
f8a042
-	FILE *fp;
f8a042
-	int ret, type;
f8a042
-
f8a042
-	if (!name)
f8a042
-		return PFM_ERR_NOTSUPP;
f8a042
-
f8a042
-	sprintf(filename, "/sys/bus/event_source/devices/%s/type", name);
f8a042
-
f8a042
-	fp = fopen(filename, "r");
f8a042
-	if (!fp)
f8a042
-		return PFM_ERR_NOTSUPP;
f8a042
-
f8a042
-	ret = fscanf(fp, "%d", &type);
f8a042
-	if (ret != 1)
f8a042
-		type = PFM_ERR_NOTSUPP;
f8a042
-
f8a042
-	fclose(fp);
f8a042
-
f8a042
-	return type;
f8a042
-}
f8a042
-
f8a042
diff --git a/tests/validate_arm64.c b/tests/validate_arm64.c
f8a042
index 35eb6ef..5cb1966 100644
f8a042
--- a/tests/validate_arm64.c
f8a042
+++ b/tests/validate_arm64.c
f8a042
@@ -182,6 +182,21 @@ static const test_event_t arm64_test_events[]={
f8a042
 	  .ret  = PFM_SUCCESS,
f8a042
 	  .count = 1,
f8a042
 	  .codes[0] = 0xf,
f8a042
+	  .fstr = "tx2_dmc1::UNC_DMC_READS",
f8a042
+	},
f8a042
+	{ SRC_LINE,
f8a042
+	  .name = "tx2_ccpi0::UNC_CCPI_GIC",
f8a042
+	  .ret  = PFM_SUCCESS,
f8a042
+	  .count = 1,
f8a042
+	  .codes[0] = 0x12d,
f8a042
+	  .fstr = "tx2_ccpi0::UNC_CCPI_GIC",
f8a042
+	},
f8a042
+	{ SRC_LINE,
f8a042
+	  .name = "tx2_llc0::UNC_LLC_READ",
f8a042
+	  .ret  = PFM_SUCCESS,
f8a042
+	  .count = 1,
f8a042
+	  .codes[0] = 0xd,
f8a042
+	  .fstr = "tx2_llc0::UNC_LLC_READ",
f8a042
 	},
f8a042
 };
f8a042
 #define NUM_TEST_EVENTS (int)(sizeof(arm64_test_events)/sizeof(test_event_t))
f8a042
-- 
f8a042
2.21.0
f8a042
f8a042
From e401d29e89b92e999615e11ea17808e90eda93fd Mon Sep 17 00:00:00 2001
f8a042
From: Shay Gal-On <sgalon@cavium.com>
f8a042
Date: Tue, 3 Dec 2019 09:54:37 -0800
f8a042
Subject: [PATCH 4/4] Removed extra fields from tx2_unc_data_t
f8a042
f8a042
Removed useless fields from tx2_unc_data_t.
f8a042
f8a042
Signed-off-by: Shay Gal-On <sgalon@marvell.com>
f8a042
---
f8a042
 lib/events/arm_marvell_tx2_unc_events.h |  0
f8a042
 lib/pfmlib_tx2_unc_perf_event.c         | 13 ++-----------
f8a042
 2 files changed, 2 insertions(+), 11 deletions(-)
f8a042
 mode change 100755 => 100644 lib/events/arm_marvell_tx2_unc_events.h
f8a042
f8a042
diff --git a/lib/events/arm_marvell_tx2_unc_events.h b/lib/events/arm_marvell_tx2_unc_events.h
f8a042
old mode 100755
f8a042
new mode 100644
f8a042
diff --git a/lib/pfmlib_tx2_unc_perf_event.c b/lib/pfmlib_tx2_unc_perf_event.c
f8a042
index 7dc2372..154cb0a 100644
f8a042
--- a/lib/pfmlib_tx2_unc_perf_event.c
f8a042
+++ b/lib/pfmlib_tx2_unc_perf_event.c
f8a042
@@ -13,17 +13,8 @@
f8a042
 typedef union {
f8a042
 	uint64_t val;
f8a042
 	struct {
f8a042
-		unsigned long unc_event:8;	/* event code */
f8a042
-		unsigned long unc_umask:8;	/* unit mask */
f8a042
-		unsigned long unc_res1:1;	/* reserved */
f8a042
-		unsigned long unc_rst:1;	/* reset */
f8a042
-		unsigned long unc_edge:1;	/* edge detect */
f8a042
-		unsigned long unc_res2:3;	/* reserved */
f8a042
-		unsigned long unc_en:1;		/* enable */
f8a042
-		unsigned long unc_inv:1;	/* invert counter mask */
f8a042
-		unsigned long unc_thres:8;	/* counter mask */
f8a042
-		unsigned long unc_res3:32;	/* reserved */
f8a042
-	} com; /* covers common fields for DMC/L3C */
f8a042
+		unsigned long unc_res1:32;	/* reserved */
f8a042
+	} com; /* reserved space for future extensions */
f8a042
 } tx2_unc_data_t;
f8a042
 
f8a042
 static void
f8a042
-- 
f8a042
2.21.0
f8a042