2018-04-18 16:05:18 -06:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2016-09-16 09:49:59 -06:00
|
|
|
/*
|
|
|
|
* Copyright(C) 2015 Linaro Limited. All rights reserved.
|
|
|
|
* Author: Mathieu Poirier <mathieu.poirier@linaro.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <linux/coresight-pmu.h>
|
|
|
|
#include <linux/perf_event.h>
|
2019-02-05 13:51:16 -03:00
|
|
|
#include <linux/string.h>
|
2016-09-16 09:49:59 -06:00
|
|
|
|
2018-01-14 13:28:50 -06:00
|
|
|
#include "arm-spe.h"
|
2022-09-27 16:13:59 +08:00
|
|
|
#include "hisi-ptt.h"
|
2024-06-06 23:53:43 -07:00
|
|
|
#include "../../../util/cpumap.h"
|
2021-09-23 08:42:54 -07:00
|
|
|
#include "../../../util/pmu.h"
|
2023-05-15 09:50:39 -07:00
|
|
|
#include "../../../util/cs-etm.h"
|
2024-01-23 10:50:30 -08:00
|
|
|
#include "../../arm64/util/mem-events.h"
|
2016-09-16 09:49:59 -06:00
|
|
|
|
2024-06-06 23:53:43 -07:00
|
|
|
void perf_pmu__arch_init(struct perf_pmu *pmu)
|
2016-09-16 09:49:59 -06:00
|
|
|
{
|
2025-03-18 10:19:14 -07:00
|
|
|
struct perf_cpu_map *intersect, *online = cpu_map__online();
|
2024-06-06 23:53:43 -07:00
|
|
|
|
2016-09-16 09:49:59 -06:00
|
|
|
#ifdef HAVE_AUXTRACE_SUPPORT
|
|
|
|
if (!strcmp(pmu->name, CORESIGHT_ETM_PMU_NAME)) {
|
|
|
|
/* add ETM default config here */
|
2024-07-15 19:07:04 +03:00
|
|
|
pmu->auxtrace = true;
|
2016-09-16 09:49:59 -06:00
|
|
|
pmu->selectable = true;
|
2023-10-12 10:56:45 -07:00
|
|
|
pmu->perf_event_attr_init_default = cs_etm_get_default_config;
|
2018-01-14 13:28:50 -06:00
|
|
|
#if defined(__aarch64__)
|
|
|
|
} else if (strstarts(pmu->name, ARM_SPE_PMU_NAME)) {
|
2024-07-15 19:07:04 +03:00
|
|
|
pmu->auxtrace = true;
|
2023-10-12 10:56:41 -07:00
|
|
|
pmu->selectable = true;
|
|
|
|
pmu->is_uncore = false;
|
2023-10-12 10:56:45 -07:00
|
|
|
pmu->perf_event_attr_init_default = arm_spe_pmu_default_config;
|
2024-07-06 16:20:34 +01:00
|
|
|
if (strstarts(pmu->name, "arm_spe_"))
|
2024-01-23 10:50:30 -08:00
|
|
|
pmu->mem_events = perf_mem_events_arm;
|
2022-09-27 16:13:59 +08:00
|
|
|
} else if (strstarts(pmu->name, HISI_PTT_PMU_NAME)) {
|
2024-07-15 19:07:04 +03:00
|
|
|
pmu->auxtrace = true;
|
2022-09-27 16:13:59 +08:00
|
|
|
pmu->selectable = true;
|
2018-01-14 13:28:50 -06:00
|
|
|
#endif
|
2016-09-16 09:49:59 -06:00
|
|
|
}
|
|
|
|
#endif
|
2024-06-06 23:53:43 -07:00
|
|
|
/* Workaround some ARM PMU's failing to correctly set CPU maps for online processors. */
|
2025-03-18 10:19:14 -07:00
|
|
|
intersect = perf_cpu_map__intersect(online, pmu->cpus);
|
|
|
|
perf_cpu_map__put(online);
|
2024-06-06 23:53:43 -07:00
|
|
|
perf_cpu_map__put(pmu->cpus);
|
|
|
|
pmu->cpus = intersect;
|
2016-09-16 09:49:59 -06:00
|
|
|
}
|