|
62 | 62 | #define PCI_DEVICE_ID_INTEL_TGL_H_IMC 0x9a36 |
63 | 63 | #define PCI_DEVICE_ID_INTEL_RKL_1_IMC 0x4c43 |
64 | 64 | #define PCI_DEVICE_ID_INTEL_RKL_2_IMC 0x4c53 |
| 65 | +#define PCI_DEVICE_ID_INTEL_ADL_1_IMC 0x4660 |
| 66 | +#define PCI_DEVICE_ID_INTEL_ADL_2_IMC 0x4641 |
65 | 67 |
|
66 | 68 | /* SNB event control */ |
67 | 69 | #define SNB_UNC_CTL_EV_SEL_MASK 0x000000ff |
|
131 | 133 | #define ICL_UNC_ARB_PER_CTR 0x3b1 |
132 | 134 | #define ICL_UNC_ARB_PERFEVTSEL 0x3b3 |
133 | 135 |
|
| 136 | +/* ADL uncore global control */ |
| 137 | +#define ADL_UNC_PERF_GLOBAL_CTL 0x2ff0 |
| 138 | +#define ADL_UNC_FIXED_CTR_CTRL 0x2fde |
| 139 | +#define ADL_UNC_FIXED_CTR 0x2fdf |
| 140 | + |
| 141 | +/* ADL Cbo register */ |
| 142 | +#define ADL_UNC_CBO_0_PER_CTR0 0x2002 |
| 143 | +#define ADL_UNC_CBO_0_PERFEVTSEL0 0x2000 |
| 144 | +#define ADL_UNC_CTL_THRESHOLD 0x3f000000 |
| 145 | +#define ADL_UNC_RAW_EVENT_MASK (SNB_UNC_CTL_EV_SEL_MASK | \ |
| 146 | + SNB_UNC_CTL_UMASK_MASK | \ |
| 147 | + SNB_UNC_CTL_EDGE_DET | \ |
| 148 | + SNB_UNC_CTL_INVERT | \ |
| 149 | + ADL_UNC_CTL_THRESHOLD) |
| 150 | + |
| 151 | +/* ADL ARB register */ |
| 152 | +#define ADL_UNC_ARB_PER_CTR0 0x2FD2 |
| 153 | +#define ADL_UNC_ARB_PERFEVTSEL0 0x2FD0 |
| 154 | +#define ADL_UNC_ARB_MSR_OFFSET 0x8 |
| 155 | + |
134 | 156 | DEFINE_UNCORE_FORMAT_ATTR(event, event, "config:0-7"); |
135 | 157 | DEFINE_UNCORE_FORMAT_ATTR(umask, umask, "config:8-15"); |
136 | 158 | DEFINE_UNCORE_FORMAT_ATTR(edge, edge, "config:18"); |
137 | 159 | DEFINE_UNCORE_FORMAT_ATTR(inv, inv, "config:23"); |
138 | 160 | DEFINE_UNCORE_FORMAT_ATTR(cmask5, cmask, "config:24-28"); |
139 | 161 | DEFINE_UNCORE_FORMAT_ATTR(cmask8, cmask, "config:24-31"); |
| 162 | +DEFINE_UNCORE_FORMAT_ATTR(threshold, threshold, "config:24-29"); |
140 | 163 |
|
141 | 164 | /* Sandy Bridge uncore support */ |
142 | 165 | static void snb_uncore_msr_enable_event(struct intel_uncore_box *box, struct perf_event *event) |
@@ -422,6 +445,106 @@ void tgl_uncore_cpu_init(void) |
422 | 445 | skl_uncore_msr_ops.init_box = rkl_uncore_msr_init_box; |
423 | 446 | } |
424 | 447 |
|
| 448 | +static void adl_uncore_msr_init_box(struct intel_uncore_box *box) |
| 449 | +{ |
| 450 | + if (box->pmu->pmu_idx == 0) |
| 451 | + wrmsrl(ADL_UNC_PERF_GLOBAL_CTL, SNB_UNC_GLOBAL_CTL_EN); |
| 452 | +} |
| 453 | + |
| 454 | +static void adl_uncore_msr_enable_box(struct intel_uncore_box *box) |
| 455 | +{ |
| 456 | + wrmsrl(ADL_UNC_PERF_GLOBAL_CTL, SNB_UNC_GLOBAL_CTL_EN); |
| 457 | +} |
| 458 | + |
| 459 | +static void adl_uncore_msr_disable_box(struct intel_uncore_box *box) |
| 460 | +{ |
| 461 | + if (box->pmu->pmu_idx == 0) |
| 462 | + wrmsrl(ADL_UNC_PERF_GLOBAL_CTL, 0); |
| 463 | +} |
| 464 | + |
| 465 | +static void adl_uncore_msr_exit_box(struct intel_uncore_box *box) |
| 466 | +{ |
| 467 | + if (box->pmu->pmu_idx == 0) |
| 468 | + wrmsrl(ADL_UNC_PERF_GLOBAL_CTL, 0); |
| 469 | +} |
| 470 | + |
| 471 | +static struct intel_uncore_ops adl_uncore_msr_ops = { |
| 472 | + .init_box = adl_uncore_msr_init_box, |
| 473 | + .enable_box = adl_uncore_msr_enable_box, |
| 474 | + .disable_box = adl_uncore_msr_disable_box, |
| 475 | + .exit_box = adl_uncore_msr_exit_box, |
| 476 | + .disable_event = snb_uncore_msr_disable_event, |
| 477 | + .enable_event = snb_uncore_msr_enable_event, |
| 478 | + .read_counter = uncore_msr_read_counter, |
| 479 | +}; |
| 480 | + |
| 481 | +static struct attribute *adl_uncore_formats_attr[] = { |
| 482 | + &format_attr_event.attr, |
| 483 | + &format_attr_umask.attr, |
| 484 | + &format_attr_edge.attr, |
| 485 | + &format_attr_inv.attr, |
| 486 | + &format_attr_threshold.attr, |
| 487 | + NULL, |
| 488 | +}; |
| 489 | + |
| 490 | +static const struct attribute_group adl_uncore_format_group = { |
| 491 | + .name = "format", |
| 492 | + .attrs = adl_uncore_formats_attr, |
| 493 | +}; |
| 494 | + |
| 495 | +static struct intel_uncore_type adl_uncore_cbox = { |
| 496 | + .name = "cbox", |
| 497 | + .num_counters = 2, |
| 498 | + .perf_ctr_bits = 44, |
| 499 | + .perf_ctr = ADL_UNC_CBO_0_PER_CTR0, |
| 500 | + .event_ctl = ADL_UNC_CBO_0_PERFEVTSEL0, |
| 501 | + .event_mask = ADL_UNC_RAW_EVENT_MASK, |
| 502 | + .msr_offset = ICL_UNC_CBO_MSR_OFFSET, |
| 503 | + .ops = &adl_uncore_msr_ops, |
| 504 | + .format_group = &adl_uncore_format_group, |
| 505 | +}; |
| 506 | + |
| 507 | +static struct intel_uncore_type adl_uncore_arb = { |
| 508 | + .name = "arb", |
| 509 | + .num_counters = 2, |
| 510 | + .num_boxes = 2, |
| 511 | + .perf_ctr_bits = 44, |
| 512 | + .perf_ctr = ADL_UNC_ARB_PER_CTR0, |
| 513 | + .event_ctl = ADL_UNC_ARB_PERFEVTSEL0, |
| 514 | + .event_mask = SNB_UNC_RAW_EVENT_MASK, |
| 515 | + .msr_offset = ADL_UNC_ARB_MSR_OFFSET, |
| 516 | + .constraints = snb_uncore_arb_constraints, |
| 517 | + .ops = &adl_uncore_msr_ops, |
| 518 | + .format_group = &snb_uncore_format_group, |
| 519 | +}; |
| 520 | + |
| 521 | +static struct intel_uncore_type adl_uncore_clockbox = { |
| 522 | + .name = "clock", |
| 523 | + .num_counters = 1, |
| 524 | + .num_boxes = 1, |
| 525 | + .fixed_ctr_bits = 48, |
| 526 | + .fixed_ctr = ADL_UNC_FIXED_CTR, |
| 527 | + .fixed_ctl = ADL_UNC_FIXED_CTR_CTRL, |
| 528 | + .single_fixed = 1, |
| 529 | + .event_mask = SNB_UNC_CTL_EV_SEL_MASK, |
| 530 | + .format_group = &icl_uncore_clock_format_group, |
| 531 | + .ops = &adl_uncore_msr_ops, |
| 532 | + .event_descs = icl_uncore_events, |
| 533 | +}; |
| 534 | + |
| 535 | +static struct intel_uncore_type *adl_msr_uncores[] = { |
| 536 | + &adl_uncore_cbox, |
| 537 | + &adl_uncore_arb, |
| 538 | + &adl_uncore_clockbox, |
| 539 | + NULL, |
| 540 | +}; |
| 541 | + |
| 542 | +void adl_uncore_cpu_init(void) |
| 543 | +{ |
| 544 | + adl_uncore_cbox.num_boxes = icl_get_cbox_num(); |
| 545 | + uncore_msr_uncores = adl_msr_uncores; |
| 546 | +} |
| 547 | + |
425 | 548 | enum { |
426 | 549 | SNB_PCI_UNCORE_IMC, |
427 | 550 | }; |
@@ -1203,6 +1326,14 @@ static const struct pci_device_id tgl_uncore_pci_ids[] = { |
1203 | 1326 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_TGL_H_IMC), |
1204 | 1327 | .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), |
1205 | 1328 | }, |
| 1329 | + { /* IMC */ |
| 1330 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ADL_1_IMC), |
| 1331 | + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), |
| 1332 | + }, |
| 1333 | + { /* IMC */ |
| 1334 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ADL_2_IMC), |
| 1335 | + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), |
| 1336 | + }, |
1206 | 1337 | { /* end: all zeroes */ } |
1207 | 1338 | }; |
1208 | 1339 |
|
|
0 commit comments