[PATCH] perf/x86/amd: Reject branch stack for IBS events

From: Namhyung Kim
Date: Fri Jun 02 2023 - 15:45:21 EST


The AMD IBS PMU doesn't handle branch stacks, so it should not accept
events with brstack.

Cc: Ravi Bangoria <ravi.bangoria@xxxxxxx>
Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
arch/x86/events/amd/ibs.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c
index 371014802191..607a692ba8ce 100644
--- a/arch/x86/events/amd/ibs.c
+++ b/arch/x86/events/amd/ibs.c
@@ -265,6 +265,9 @@ static int perf_ibs_init(struct perf_event *event)
if (config & ~perf_ibs->config_mask)
return -EINVAL;

+ if (has_branch_stack(event))
+ return -EOPNOTSUPP;
+
if (hwc->sample_period) {
if (config & perf_ibs->cnt_mask)
/* raw max_cnt may not be set */
--
2.41.0.rc2.161.g9c6817b8e7-goog