mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

It can be called from non-x86 platform so let's move it to the general util directory. Also add a new helper perf_env__is_x86_amd_cpu() so that it can be called with an existing perf_env as well. Reviewed-by: James Clark <james.clark@linaro.org> Reviewed-by: Ravi Bangoria <ravi.bangoria@amd.com> Acked-by: Kan Liang <kan.liang@linux.intel.com> Cc: James Clark <james.clark@arm.com> Cc: Atish Patra <atishp@atishpatra.org> Cc: Mingwei Zhang <mizhang@google.com> Cc: Kajol Jain <kjain@linux.ibm.com> Cc: Thomas Richter <tmricht@linux.ibm.com> Cc: Palmer Dabbelt <palmer@rivosinc.com> Link: https://lore.kernel.org/r/20241016062359.264929-7-namhyung@kernel.org Signed-off-by: Namhyung Kim <namhyung@kernel.org>
44 lines
1.1 KiB
C
44 lines
1.1 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
#include <sys/types.h>
|
|
#include <dirent.h>
|
|
#include <fcntl.h>
|
|
#include <linux/stddef.h>
|
|
#include <linux/perf_event.h>
|
|
#include <linux/zalloc.h>
|
|
#include <api/fs/fs.h>
|
|
#include <errno.h>
|
|
|
|
#include "../../../util/intel-pt.h"
|
|
#include "../../../util/intel-bts.h"
|
|
#include "../../../util/pmu.h"
|
|
#include "../../../util/fncache.h"
|
|
#include "../../../util/pmus.h"
|
|
#include "mem-events.h"
|
|
#include "util/env.h"
|
|
|
|
void perf_pmu__arch_init(struct perf_pmu *pmu __maybe_unused)
|
|
{
|
|
#ifdef HAVE_AUXTRACE_SUPPORT
|
|
if (!strcmp(pmu->name, INTEL_PT_PMU_NAME)) {
|
|
pmu->auxtrace = true;
|
|
pmu->selectable = true;
|
|
pmu->perf_event_attr_init_default = intel_pt_pmu_default_config;
|
|
}
|
|
if (!strcmp(pmu->name, INTEL_BTS_PMU_NAME)) {
|
|
pmu->auxtrace = true;
|
|
pmu->selectable = true;
|
|
}
|
|
#endif
|
|
|
|
if (x86__is_amd_cpu()) {
|
|
if (!strcmp(pmu->name, "ibs_op"))
|
|
pmu->mem_events = perf_mem_events_amd;
|
|
} else if (pmu->is_core) {
|
|
if (perf_pmu__have_event(pmu, "mem-loads-aux"))
|
|
pmu->mem_events = perf_mem_events_intel_aux;
|
|
else
|
|
pmu->mem_events = perf_mem_events_intel;
|
|
}
|
|
}
|