Commit aa613601 authored by Ian Rogers's avatar Ian Rogers Committed by Namhyung Kim

perf pmu: Rename perf_pmu__get_default_config to perf_pmu__arch_init

Assign default_config as part of the init. perf_pmu__get_default_config
was doing more than just getting the default config and so this is
intended to better align with the code.
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: James Clark <james.clark@arm.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Yang Jihong <yangjihong1@huawei.com>
Cc: Will Deacon <will@kernel.org>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: John Garry <john.g.garry@oracle.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: coresight@lists.linaro.org
Link: https://lore.kernel.org/r/20231012175645.1849503-2-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
parent 661ce781
...@@ -14,22 +14,20 @@ ...@@ -14,22 +14,20 @@
#include "../../../util/pmu.h" #include "../../../util/pmu.h"
#include "../../../util/cs-etm.h" #include "../../../util/cs-etm.h"
struct perf_event_attr void perf_pmu__arch_init(struct perf_pmu *pmu __maybe_unused)
*perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused)
{ {
#ifdef HAVE_AUXTRACE_SUPPORT #ifdef HAVE_AUXTRACE_SUPPORT
if (!strcmp(pmu->name, CORESIGHT_ETM_PMU_NAME)) { if (!strcmp(pmu->name, CORESIGHT_ETM_PMU_NAME)) {
/* add ETM default config here */ /* add ETM default config here */
pmu->selectable = true; pmu->selectable = true;
return cs_etm_get_default_config(pmu); pmu->default_config = cs_etm_get_default_config(pmu);
#if defined(__aarch64__) #if defined(__aarch64__)
} else if (strstarts(pmu->name, ARM_SPE_PMU_NAME)) { } else if (strstarts(pmu->name, ARM_SPE_PMU_NAME)) {
return arm_spe_pmu_default_config(pmu); pmu->default_config = arm_spe_pmu_default_config(pmu);
} else if (strstarts(pmu->name, HISI_PTT_PMU_NAME)) { } else if (strstarts(pmu->name, HISI_PTT_PMU_NAME)) {
pmu->selectable = true; pmu->selectable = true;
#endif #endif
} }
#endif #endif
return NULL;
} }
...@@ -13,11 +13,10 @@ ...@@ -13,11 +13,10 @@
#define S390_PMUPAI_EXT "pai_ext" #define S390_PMUPAI_EXT "pai_ext"
#define S390_PMUCPUM_CF "cpum_cf" #define S390_PMUCPUM_CF "cpum_cf"
struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu) void perf_pmu__arch_init(struct perf_pmu *pmu)
{ {
if (!strcmp(pmu->name, S390_PMUPAI_CRYPTO) || if (!strcmp(pmu->name, S390_PMUPAI_CRYPTO) ||
!strcmp(pmu->name, S390_PMUPAI_EXT) || !strcmp(pmu->name, S390_PMUPAI_EXT) ||
!strcmp(pmu->name, S390_PMUCPUM_CF)) !strcmp(pmu->name, S390_PMUCPUM_CF))
pmu->selectable = true; pmu->selectable = true;
return NULL;
} }
...@@ -17,19 +17,18 @@ ...@@ -17,19 +17,18 @@
#include "../../../util/pmus.h" #include "../../../util/pmus.h"
#include "env.h" #include "env.h"
struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused) void perf_pmu__arch_init(struct perf_pmu *pmu __maybe_unused)
{ {
#ifdef HAVE_AUXTRACE_SUPPORT #ifdef HAVE_AUXTRACE_SUPPORT
if (!strcmp(pmu->name, INTEL_PT_PMU_NAME)) { if (!strcmp(pmu->name, INTEL_PT_PMU_NAME)) {
pmu->auxtrace = true; pmu->auxtrace = true;
return intel_pt_pmu_default_config(pmu); pmu->default_config = intel_pt_pmu_default_config(pmu);
} }
if (!strcmp(pmu->name, INTEL_BTS_PMU_NAME)) { if (!strcmp(pmu->name, INTEL_BTS_PMU_NAME)) {
pmu->auxtrace = true; pmu->auxtrace = true;
pmu->selectable = true; pmu->selectable = true;
} }
#endif #endif
return NULL;
} }
int perf_pmus__num_mem_pmus(void) int perf_pmus__num_mem_pmus(void)
......
...@@ -954,12 +954,6 @@ void pmu_add_sys_aliases(struct perf_pmu *pmu) ...@@ -954,12 +954,6 @@ void pmu_add_sys_aliases(struct perf_pmu *pmu)
pmu_for_each_sys_event(pmu_add_sys_aliases_iter_fn, pmu); pmu_for_each_sys_event(pmu_add_sys_aliases_iter_fn, pmu);
} }
struct perf_event_attr * __weak
perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused)
{
return NULL;
}
static char *pmu_find_alias_name(struct perf_pmu *pmu, int dirfd) static char *pmu_find_alias_name(struct perf_pmu *pmu, int dirfd)
{ {
FILE *file = perf_pmu__open_file_at(pmu, dirfd, "alias"); FILE *file = perf_pmu__open_file_at(pmu, dirfd, "alias");
...@@ -991,6 +985,11 @@ static int pmu_max_precise(int dirfd, struct perf_pmu *pmu) ...@@ -991,6 +985,11 @@ static int pmu_max_precise(int dirfd, struct perf_pmu *pmu)
return max_precise; return max_precise;
} }
void __weak
perf_pmu__arch_init(struct perf_pmu *pmu __maybe_unused)
{
}
struct perf_pmu *perf_pmu__lookup(struct list_head *pmus, int dirfd, const char *name) struct perf_pmu *perf_pmu__lookup(struct list_head *pmus, int dirfd, const char *name)
{ {
struct perf_pmu *pmu; struct perf_pmu *pmu;
...@@ -1037,7 +1036,7 @@ struct perf_pmu *perf_pmu__lookup(struct list_head *pmus, int dirfd, const char ...@@ -1037,7 +1036,7 @@ struct perf_pmu *perf_pmu__lookup(struct list_head *pmus, int dirfd, const char
pmu_add_sys_aliases(pmu); pmu_add_sys_aliases(pmu);
list_add_tail(&pmu->list, pmus); list_add_tail(&pmu->list, pmus);
pmu->default_config = perf_pmu__get_default_config(pmu); perf_pmu__arch_init(pmu);
return pmu; return pmu;
err: err:
......
...@@ -233,7 +233,7 @@ bool perf_pmu__file_exists(struct perf_pmu *pmu, const char *name); ...@@ -233,7 +233,7 @@ bool perf_pmu__file_exists(struct perf_pmu *pmu, const char *name);
int perf_pmu__test(void); int perf_pmu__test(void);
struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu); void perf_pmu__arch_init(struct perf_pmu *pmu);
void pmu_add_cpu_aliases_table(struct perf_pmu *pmu, void pmu_add_cpu_aliases_table(struct perf_pmu *pmu,
const struct pmu_events_table *table); const struct pmu_events_table *table);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment