At run time when a user reads an event file the file system code
provides the enum resctrl_event_id for the event.
Create a lookup table indexed by event id to provide the telem_entry
structure and the event index into MMIO space.
Enable the events marked as readable from any CPU.
Signed-off-by: Tony Luck <tony.luck@intel.com>
---
arch/x86/kernel/cpu/resctrl/intel_aet.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/resctrl/intel_aet.c b/arch/x86/kernel/cpu/resctrl/intel_aet.c
index 37dd493df250..e1cb6bd4788d 100644
--- a/arch/x86/kernel/cpu/resctrl/intel_aet.c
+++ b/arch/x86/kernel/cpu/resctrl/intel_aet.c
@@ -97,6 +97,16 @@ static struct event_group *known_event_groups[] = {
#define NUM_KNOWN_GROUPS ARRAY_SIZE(known_event_groups)
+/**
+ * struct evtinfo - lookup table from resctrl_event_id to useful information
+ * @event_group: Pointer to the telem_entry structure for this event
+ * @idx: Counter index within each per-RMID block of counters
+ */
+static struct evtinfo {
+ struct event_group *event_group;
+ int idx;
+} evtinfo[QOS_NUM_EVENTS];
+
static void free_mmio_info(struct mmio_info **mmi)
{
int num_pkgs = topology_max_packages();
@@ -167,7 +177,16 @@ static bool configure_events(struct event_group *e, struct pmt_feature_group *p)
}
e->pkginfo = no_free_ptr(pkginfo);
- return false;
+ for (int i = 0; i < e->num_events; i++) {
+ enum resctrl_event_id evt;
+
+ evt = e->evts[i].evtid;
+ evtinfo[evt].event_group = e;
+ evtinfo[evt].idx = e->evts[i].evt_idx;
+ resctrl_enable_mon_event(evt, true);
+ }
+
+ return true;
}
DEFINE_FREE(intel_pmt_put_feature_group, struct pmt_feature_group *, \
--
2.48.1