Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers/perf: hisi: Relax the event number check of v2 PMUs

The supported event number range of each Uncore PMUs is provided by
each driver in hisi_pmu::check_event and out of range events
will be rejected. A later version with expanded event number range
needs to register the PMU with updated hisi_pmu::check_event
even if it's the only update, which means the expanded events
cannot be used unless the driver's updated. However the unsupported
events won't be counted by the hardware so we can relax the event
number check to allow the use the expanded events.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Junhao He <hejunhao3@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Link: https://lore.kernel.org/r/20250619125557.57372-6-yangyicong@huawei.com
Signed-off-by: Will Deacon <will@kernel.org>

authored by

Junhao He and committed by
Will Deacon
35f5b36e 1fd20ba0

+6 -6
+1 -1
drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c
··· 53 53 #define DDRC_V1_PERF_CTRL_EN 0x2 54 54 #define DDRC_V2_PERF_CTRL_EN 0x1 55 55 #define DDRC_V1_NR_EVENTS 0x7 56 - #define DDRC_V2_NR_EVENTS 0x90 56 + #define DDRC_V2_NR_EVENTS 0xFF 57 57 58 58 #define DDRC_EVENT_CNTn(base, n) ((base) + (n) * 8) 59 59 #define DDRC_EVENT_TYPEn(base, n) ((base) + (n) * 4)
+3 -3
drivers/perf/hisilicon/hisi_uncore_hha_pmu.c
··· 47 47 #define HHA_SRCID_CMD GENMASK(16, 6) 48 48 #define HHA_SRCID_MSK GENMASK(30, 20) 49 49 #define HHA_DATSRC_SKT_EN BIT(23) 50 - #define HHA_EVTYPE_NONE 0xff 50 + #define HHA_EVTYPE_MASK GENMASK(7, 0) 51 51 #define HHA_V1_NR_EVENT 0x65 52 - #define HHA_V2_NR_EVENT 0xCE 52 + #define HHA_V2_NR_EVENT 0xFF 53 53 54 54 HISI_PMU_EVENT_ATTR_EXTRACTOR(srcid_cmd, config1, 10, 0); 55 55 HISI_PMU_EVENT_ATTR_EXTRACTOR(srcid_msk, config1, 21, 11); ··· 197 197 198 198 /* Write event code to HHA_EVENT_TYPEx register */ 199 199 val = readl(hha_pmu->base + reg); 200 - val &= ~(HHA_EVTYPE_NONE << shift); 200 + val &= ~(HHA_EVTYPE_MASK << shift); 201 201 val |= (type << shift); 202 202 writel(val, hha_pmu->base + reg); 203 203 }
+1 -1
drivers/perf/hisilicon/hisi_uncore_pa_pmu.c
··· 440 440 pa_pmu->pmu_events.attr_groups = pa_pmu->dev_info->attr_groups; 441 441 pa_pmu->num_counters = PA_NR_COUNTERS; 442 442 pa_pmu->ops = &hisi_uncore_pa_ops; 443 - pa_pmu->check_event = 0xB0; 443 + pa_pmu->check_event = PA_EVTYPE_MASK; 444 444 pa_pmu->counter_bits = 64; 445 445 pa_pmu->dev = &pdev->dev; 446 446 pa_pmu->on_cpu = -1;
+1 -1
drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c
··· 58 58 #define SLLC_V3_SRCID_CMD_SHIFT 1 59 59 #define SLLC_V3_SRCID_MSK_SHIFT 10 60 60 61 - #define SLLC_NR_EVENTS 0x80 61 + #define SLLC_NR_EVENTS 0xff 62 62 #define SLLC_EVENT_CNTn(cnt0, n) ((cnt0) + (n) * 8) 63 63 64 64 HISI_PMU_EVENT_ATTR_EXTRACTOR(tgtid_min, config1, 10, 0);