perfmon: additional perf counters on icelake

The Intel Icelake uArch supports measuring up to 12 counters,
comprised of 4 fixed and 8 general counters.

Type: improvement

Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
Change-Id: I68369ea55a0c95d6a4a280a464e69502bbf5474f
diff --git a/src/plugins/perfmon/dispatch_wrapper.c b/src/plugins/perfmon/dispatch_wrapper.c
index f5972f6..5e53417 100644
--- a/src/plugins/perfmon/dispatch_wrapper.c
+++ b/src/plugins/perfmon/dispatch_wrapper.c
@@ -65,6 +65,16 @@
   switch (n_counters)
     {
     default:
+    case 12:
+      counters[11] = perfmon_mmap_read_pmc1 (mmap_pages[11]);
+    case 11:
+      counters[10] = perfmon_mmap_read_pmc1 (mmap_pages[10]);
+    case 10:
+      counters[9] = perfmon_mmap_read_pmc1 (mmap_pages[9]);
+    case 9:
+      counters[8] = perfmon_mmap_read_pmc1 (mmap_pages[8]);
+    case 8:
+      counters[7] = perfmon_mmap_read_pmc1 (mmap_pages[7]);
     case 7:
       counters[6] = perfmon_mmap_read_pmc1 (mmap_pages[6]);
     case 6:
@@ -123,6 +133,16 @@
   switch (n_counters)
     {
     default:
+    case 12:
+      counters[11] = _rdpmc (pmc_index[11]);
+    case 11:
+      counters[10] = _rdpmc (pmc_index[10]);
+    case 10:
+      counters[9] = _rdpmc (pmc_index[9]);
+    case 9:
+      counters[8] = _rdpmc (pmc_index[8]);
+    case 8:
+      counters[7] = _rdpmc (pmc_index[7]);
     case 7:
       counters[6] = _rdpmc (pmc_index[6]);
     case 6:
@@ -168,6 +188,16 @@
   switch (n_events)
     {
     default:
+    case 12:
+      pmc_index[11] = perfmon_metric_index (rt->bundle, 11);
+    case 11:
+      pmc_index[10] = perfmon_metric_index (rt->bundle, 10);
+    case 10:
+      pmc_index[9] = perfmon_metric_index (rt->bundle, 9);
+    case 9:
+      pmc_index[8] = perfmon_metric_index (rt->bundle, 8);
+    case 8:
+      pmc_index[7] = perfmon_metric_index (rt->bundle, 7);
     case 7:
       pmc_index[6] = perfmon_metric_index (rt->bundle, 6);
     case 6:
diff --git a/src/plugins/perfmon/perfmon.h b/src/plugins/perfmon/perfmon.h
index f9b9070..0b46e52 100644
--- a/src/plugins/perfmon/perfmon.h
+++ b/src/plugins/perfmon/perfmon.h
@@ -23,7 +23,7 @@
 #include <vppinfra/cpu.h>
 #include <vlib/vlib.h>
 
-#define PERF_MAX_EVENTS 8 /* 4 fixed and 8 programmable on ICX */
+#define PERF_MAX_EVENTS 12 /* 4 fixed and 8 programable on ICX */
 
 typedef enum
 {