linux-yocto/arch/x86/events
Ravi Bangoria 419988f4d0 perf/amd/ibs: Fix ->config to sample period calculation for OP PMU
[ Upstream commit 598bdf4fef ]

Instead of using standard perf_event_attr->freq=0 and ->sample_period
fields, IBS event in 'sample period mode' can also be opened by setting
period value directly in perf_event_attr->config in a MaxCnt bit-field
format.

IBS OP MaxCnt bits are defined as:

  (high bits) IbsOpCtl[26:20] = IbsOpMaxCnt[26:20]
  (low bits)  IbsOpCtl[15:0]  = IbsOpMaxCnt[19:4]

Perf event sample period can be derived from MaxCnt bits as:

  sample_period = (high bits) | ((low_bits) << 4);

However, current code just masks MaxCnt bits and shifts all of them,
including high bits, which is incorrect. Fix it.

Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/r/20250115054438.1021-4-ravi.bangoria@amd.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-06-04 14:42:14 +02:00
..
amd perf/amd/ibs: Fix ->config to sample period calculation for OP PMU 2025-06-04 14:42:14 +02:00
intel perf/x86/intel: KVM: Mask PEBS_ENABLE loaded for guest with vCPU's value. 2025-05-09 09:43:51 +02:00
zhaoxin x86/perf/zhaoxin: Add stepping check for ZXC 2023-02-11 11:18:12 +01:00
core.c perf/x86: Fix non-sampling (counting) events on certain x86 platforms 2025-05-02 07:50:45 +02:00
Kconfig perf/x86/Kconfig: Fix indentation in the Kconfig file 2022-05-25 15:54:26 +02:00
Makefile perf/x86: Move branch classifier 2022-08-27 00:05:44 +02:00
msr.c x86/cpu: Fix Gracemont uarch 2023-08-09 21:51:06 +02:00
perf_event_flags.h x86/perf: Assert all platform event flags are within PERF_EVENT_FLAG_ARCH 2022-09-07 21:54:01 +02:00
perf_event.h perf/x86/intel: Avoid disable PMU if !cpuc->enabled in sample read 2025-04-10 14:37:42 +02:00
probe.c perf/x86/rapl: Add msr mask support 2021-02-10 14:44:54 +01:00
probe.h perf/x86/rapl: Add msr mask support 2021-02-10 14:44:54 +01:00
rapl.c x86/cpu: Fix Gracemont uarch 2023-08-09 21:51:06 +02:00
utils.c perf/x86/lbr: Filter vsyscall addresses 2023-10-08 12:25:18 +02:00