drivers: uncore_pmu: add event type check

Need to check if the event type matches the pmu type and return
ENOENT if there is a mismatch.

Bug 5035098

Change-Id: I3d1341efd1ad59dec011527a730d702ed6dfea4a
Signed-off-by: Eric Funsten <efunsten@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3279805
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Besar Wicaksono <bwicaksono@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Eric Funsten
2025-01-07 22:28:56 +00:00
committed by Jon Hunter
parent 188b622e75
commit 84bb75c788

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <nvidia/conftest.h>
@@ -500,6 +500,9 @@ static int scf_uncore_event_init(struct perf_event *event)
uncore_pmu = to_uncore_pmu(event->pmu);
pdev = uncore_pmu->pdev;
if (event->attr.type != event->pmu->type)
return -ENOENT;
/*
* The uncore counters are shared by all CPU cores. Therefore it does not
* support sampling mode or attach to a task (per-process mode).