Skip to content

Commit 9623691

Browse files
committed
LoongArch: Fix perf event id calculation
LoongArch PMCFG has 10bit event id rather than 8 bit, so fix it. Cc: [email protected] Signed-off-by: Jun Yi <[email protected]> Signed-off-by: Huacai Chen <[email protected]>
1 parent 346dc92 commit 9623691

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/loongarch/kernel/perf_event.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ static void loongarch_pmu_enable_event(struct hw_perf_event *evt, int idx)
271271
WARN_ON(idx < 0 || idx >= loongarch_pmu.num_counters);
272272

273273
/* Make sure interrupt enabled. */
274-
cpuc->saved_ctrl[idx] = M_PERFCTL_EVENT(evt->event_base & 0xff) |
274+
cpuc->saved_ctrl[idx] = M_PERFCTL_EVENT(evt->event_base) |
275275
(evt->config_base & M_PERFCTL_CONFIG_MASK) | CSR_PERFCTRL_IE;
276276

277277
cpu = (event->cpu >= 0) ? event->cpu : smp_processor_id();
@@ -594,7 +594,7 @@ static struct pmu pmu = {
594594

595595
static unsigned int loongarch_pmu_perf_event_encode(const struct loongarch_perf_event *pev)
596596
{
597-
return (pev->event_id & 0xff);
597+
return M_PERFCTL_EVENT(pev->event_id);
598598
}
599599

600600
static const struct loongarch_perf_event *loongarch_pmu_map_general_event(int idx)
@@ -849,7 +849,7 @@ static void resume_local_counters(void)
849849

850850
static const struct loongarch_perf_event *loongarch_pmu_map_raw_event(u64 config)
851851
{
852-
raw_event.event_id = config & 0xff;
852+
raw_event.event_id = M_PERFCTL_EVENT(config);
853853

854854
return &raw_event;
855855
}

0 commit comments

Comments
 (0)