cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

pmu.c (523B)


      1// SPDX-License-Identifier: GPL-2.0
      2
      3#include "../../../util/cpumap.h"
      4#include "../../../util/pmu.h"
      5
      6const struct pmu_events_map *pmu_events_map__find(void)
      7{
      8	struct perf_pmu *pmu = NULL;
      9
     10	while ((pmu = perf_pmu__scan(pmu))) {
     11		if (!is_pmu_core(pmu->name))
     12			continue;
     13
     14		/*
     15		 * The cpumap should cover all CPUs. Otherwise, some CPUs may
     16		 * not support some events or have different event IDs.
     17		 */
     18		if (pmu->cpus->nr != cpu__max_cpu().cpu)
     19			return NULL;
     20
     21		return perf_pmu__find_map(pmu);
     22	}
     23
     24	return NULL;
     25}