mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-09-21 20:22:13 +08:00
arm: pmu: Move error message and -EOPNOTSUPP to individual PMUs
-EPERM or -EINVAL always get converted to -EOPNOTSUPP, so replace them. This will allow __hw_perf_event_init() to return a different code or not print that particular message for a different error in the next commit. Signed-off-by: James Clark <james.clark@arm.com> Link: https://lore.kernel.org/r/20231211161331.1277825-10-james.clark@arm.com Signed-off-by: Will Deacon <will@kernel.org>
This commit is contained in:
parent
c7b98bf0fc
commit
186c91aaf5
@ -1052,8 +1052,10 @@ static int armv7pmu_set_event_filter(struct hw_perf_event *event,
|
||||
{
|
||||
unsigned long config_base = 0;
|
||||
|
||||
if (attr->exclude_idle)
|
||||
return -EPERM;
|
||||
if (attr->exclude_idle) {
|
||||
pr_debug("ARM performance counters do not support mode exclusion\n");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
if (attr->exclude_user)
|
||||
config_base |= ARMV7_EXCLUDE_USER;
|
||||
if (attr->exclude_kernel)
|
||||
|
@ -524,8 +524,10 @@ static int m1_pmu_set_event_filter(struct hw_perf_event *event,
|
||||
{
|
||||
unsigned long config_base = 0;
|
||||
|
||||
if (!attr->exclude_guest)
|
||||
return -EINVAL;
|
||||
if (!attr->exclude_guest) {
|
||||
pr_debug("ARM performance counters do not support mode exclusion\n");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
if (!attr->exclude_kernel)
|
||||
config_base |= M1_PMU_CFG_COUNT_KERNEL;
|
||||
if (!attr->exclude_user)
|
||||
|
@ -445,7 +445,7 @@ __hw_perf_event_init(struct perf_event *event)
|
||||
{
|
||||
struct arm_pmu *armpmu = to_arm_pmu(event->pmu);
|
||||
struct hw_perf_event *hwc = &event->hw;
|
||||
int mapping;
|
||||
int mapping, ret;
|
||||
|
||||
hwc->flags = 0;
|
||||
mapping = armpmu->map_event(event);
|
||||
@ -470,11 +470,10 @@ __hw_perf_event_init(struct perf_event *event)
|
||||
/*
|
||||
* Check whether we need to exclude the counter from certain modes.
|
||||
*/
|
||||
if (armpmu->set_event_filter &&
|
||||
armpmu->set_event_filter(hwc, &event->attr)) {
|
||||
pr_debug("ARM performance counters do not support "
|
||||
"mode exclusion\n");
|
||||
return -EOPNOTSUPP;
|
||||
if (armpmu->set_event_filter) {
|
||||
ret = armpmu->set_event_filter(hwc, &event->attr);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -936,8 +936,10 @@ static int armv8pmu_set_event_filter(struct hw_perf_event *event,
|
||||
{
|
||||
unsigned long config_base = 0;
|
||||
|
||||
if (attr->exclude_idle)
|
||||
return -EPERM;
|
||||
if (attr->exclude_idle) {
|
||||
pr_debug("ARM performance counters do not support mode exclusion\n");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we're running in hyp mode, then we *are* the hypervisor.
|
||||
|
Loading…
Reference in New Issue
Block a user