Skip to content

Commit 1fd20ba

Browse files
Junhao Hewilldeacon
authored andcommitted
drivers/perf: hisi: Add support for HiSilicon SLLC v3 PMU driver
SLLC v3 PMU has the following changes compared to previous version: a) update the register layout b) update the definition of SRCID_CTRL and TGTID_CTRL registers. To be compatible with v2, we use maximum width (11 bits) and mask the extra length for themselves. c) remove latency events (driver does not need to be adapted). SLLC v3 PMU is identified with HID HISI0264. Signed-off-by: Junhao He <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Signed-off-by: Yicong Yang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 29614c5 commit 1fd20ba

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@
2828
#define SLLC_VERSION 0x1cf0
2929
#define SLLC_EVENT_CNT0_L 0x1d00
3030

31+
/* SLLC registers definition in v3 */
32+
#define SLLC_V3_INT_MASK 0x6834
33+
#define SLLC_V3_INT_STATUS 0x6838
34+
#define SLLC_V3_INT_CLEAR 0x683c
35+
#define SLLC_V3_VERSION 0x6c00
36+
#define SLLC_V3_PERF_CTRL 0x6d00
37+
#define SLLC_V3_SRCID_CTRL 0x6d04
38+
#define SLLC_V3_TGTID_CTRL 0x6d08
39+
#define SLLC_V3_EVENT_CTRL 0x6d14
40+
#define SLLC_V3_EVENT_TYPE0 0x6d18
41+
#define SLLC_V3_EVENT_CNT0_L 0x6e00
42+
3143
#define SLLC_EVTYPE_MASK 0xff
3244
#define SLLC_PERF_CTRL_EN BIT(0)
3345
#define SLLC_FILT_EN BIT(1)
@@ -40,6 +52,12 @@
4052
#define SLLC_TGTID_MAX_SHIFT 12
4153
#define SLLC_SRCID_CMD_SHIFT 1
4254
#define SLLC_SRCID_MSK_SHIFT 12
55+
56+
#define SLLC_V3_TGTID_MIN_SHIFT 1
57+
#define SLLC_V3_TGTID_MAX_SHIFT 10
58+
#define SLLC_V3_SRCID_CMD_SHIFT 1
59+
#define SLLC_V3_SRCID_MSK_SHIFT 10
60+
4361
#define SLLC_NR_EVENTS 0x80
4462
#define SLLC_EVENT_CNTn(cnt0, n) ((cnt0) + (n) * 8)
4563

@@ -404,6 +422,27 @@ static const struct hisi_pmu_dev_info hisi_sllc_v2 = {
404422
.private = &hisi_sllc_v2_pmu_regs,
405423
};
406424

425+
static struct hisi_sllc_pmu_regs hisi_sllc_v3_pmu_regs = {
426+
.int_mask = SLLC_V3_INT_MASK,
427+
.int_clear = SLLC_V3_INT_CLEAR,
428+
.int_status = SLLC_V3_INT_STATUS,
429+
.perf_ctrl = SLLC_V3_PERF_CTRL,
430+
.srcid_ctrl = SLLC_V3_SRCID_CTRL,
431+
.srcid_cmd_shift = SLLC_V3_SRCID_CMD_SHIFT,
432+
.srcid_mask_shift = SLLC_V3_SRCID_MSK_SHIFT,
433+
.tgtid_ctrl = SLLC_V3_TGTID_CTRL,
434+
.tgtid_min_shift = SLLC_V3_TGTID_MIN_SHIFT,
435+
.tgtid_max_shift = SLLC_V3_TGTID_MAX_SHIFT,
436+
.event_ctrl = SLLC_V3_EVENT_CTRL,
437+
.event_type0 = SLLC_V3_EVENT_TYPE0,
438+
.version = SLLC_V3_VERSION,
439+
.event_cnt0 = SLLC_V3_EVENT_CNT0_L,
440+
};
441+
442+
static const struct hisi_pmu_dev_info hisi_sllc_v3 = {
443+
.private = &hisi_sllc_v3_pmu_regs,
444+
};
445+
407446
static const struct hisi_uncore_ops hisi_uncore_sllc_ops = {
408447
.write_evtype = hisi_sllc_pmu_write_evtype,
409448
.get_event_idx = hisi_uncore_pmu_get_event_idx,
@@ -497,6 +536,7 @@ static void hisi_sllc_pmu_remove(struct platform_device *pdev)
497536

498537
static const struct acpi_device_id hisi_sllc_pmu_acpi_match[] = {
499538
{ "HISI0263", (kernel_ulong_t)&hisi_sllc_v2 },
539+
{ "HISI0264", (kernel_ulong_t)&hisi_sllc_v3 },
500540
{}
501541
};
502542
MODULE_DEVICE_TABLE(acpi, hisi_sllc_pmu_acpi_match);

0 commit comments

Comments
 (0)