455
455
#define ICX_NUMBER_IMC_CHN 2
456
456
#define ICX_IMC_MEM_STRIDE 0x4
457
457
458
+ /* SPR */
459
+ #define SPR_RAW_EVENT_MASK_EXT 0xffffff
460
+
461
+ /* SPR CHA */
462
+ #define SPR_CHA_PMON_CTL_TID_EN (1 << 16)
463
+ #define SPR_CHA_PMON_EVENT_MASK (SNBEP_PMON_RAW_EVENT_MASK | \
464
+ SPR_CHA_PMON_CTL_TID_EN)
465
+ #define SPR_CHA_PMON_BOX_FILTER_TID 0x3ff
466
+
467
+ #define SPR_C0_MSR_PMON_BOX_FILTER0 0x200e
468
+
458
469
DEFINE_UNCORE_FORMAT_ATTR (event , event , "config:0-7" );
459
470
DEFINE_UNCORE_FORMAT_ATTR (event2 , event , "config:0-6" );
460
471
DEFINE_UNCORE_FORMAT_ATTR (event_ext , event , "config:0-7,21" );
@@ -467,6 +478,7 @@ DEFINE_UNCORE_FORMAT_ATTR(umask_ext4, umask, "config:8-15,32-55");
467
478
DEFINE_UNCORE_FORMAT_ATTR (qor , qor , "config:16" );
468
479
DEFINE_UNCORE_FORMAT_ATTR (edge , edge , "config:18" );
469
480
DEFINE_UNCORE_FORMAT_ATTR (tid_en , tid_en , "config:19" );
481
+ DEFINE_UNCORE_FORMAT_ATTR (tid_en2 , tid_en , "config:16" );
470
482
DEFINE_UNCORE_FORMAT_ATTR (inv , inv , "config:23" );
471
483
DEFINE_UNCORE_FORMAT_ATTR (thresh9 , thresh , "config:24-35" );
472
484
DEFINE_UNCORE_FORMAT_ATTR (thresh8 , thresh , "config:24-31" );
@@ -5508,10 +5520,86 @@ void icx_uncore_mmio_init(void)
5508
5520
5509
5521
/* SPR uncore support */
5510
5522
5523
+ static void spr_uncore_msr_enable_event (struct intel_uncore_box * box ,
5524
+ struct perf_event * event )
5525
+ {
5526
+ struct hw_perf_event * hwc = & event -> hw ;
5527
+ struct hw_perf_event_extra * reg1 = & hwc -> extra_reg ;
5528
+
5529
+ if (reg1 -> idx != EXTRA_REG_NONE )
5530
+ wrmsrl (reg1 -> reg , reg1 -> config );
5531
+
5532
+ wrmsrl (hwc -> config_base , hwc -> config );
5533
+ }
5534
+
5535
+ static void spr_uncore_msr_disable_event (struct intel_uncore_box * box ,
5536
+ struct perf_event * event )
5537
+ {
5538
+ struct hw_perf_event * hwc = & event -> hw ;
5539
+ struct hw_perf_event_extra * reg1 = & hwc -> extra_reg ;
5540
+
5541
+ if (reg1 -> idx != EXTRA_REG_NONE )
5542
+ wrmsrl (reg1 -> reg , 0 );
5543
+
5544
+ wrmsrl (hwc -> config_base , 0 );
5545
+ }
5546
+
5547
+ static int spr_cha_hw_config (struct intel_uncore_box * box , struct perf_event * event )
5548
+ {
5549
+ struct hw_perf_event_extra * reg1 = & event -> hw .extra_reg ;
5550
+ bool tie_en = !!(event -> hw .config & SPR_CHA_PMON_CTL_TID_EN );
5551
+ struct intel_uncore_type * type = box -> pmu -> type ;
5552
+
5553
+ if (tie_en ) {
5554
+ reg1 -> reg = SPR_C0_MSR_PMON_BOX_FILTER0 +
5555
+ HSWEP_CBO_MSR_OFFSET * type -> box_ids [box -> pmu -> pmu_idx ];
5556
+ reg1 -> config = event -> attr .config1 & SPR_CHA_PMON_BOX_FILTER_TID ;
5557
+ reg1 -> idx = 0 ;
5558
+ }
5559
+
5560
+ return 0 ;
5561
+ }
5562
+
5563
+ static struct intel_uncore_ops spr_uncore_chabox_ops = {
5564
+ .init_box = intel_generic_uncore_msr_init_box ,
5565
+ .disable_box = intel_generic_uncore_msr_disable_box ,
5566
+ .enable_box = intel_generic_uncore_msr_enable_box ,
5567
+ .disable_event = spr_uncore_msr_disable_event ,
5568
+ .enable_event = spr_uncore_msr_enable_event ,
5569
+ .read_counter = uncore_msr_read_counter ,
5570
+ .hw_config = spr_cha_hw_config ,
5571
+ .get_constraint = uncore_get_constraint ,
5572
+ .put_constraint = uncore_put_constraint ,
5573
+ };
5574
+
5575
+ static struct attribute * spr_uncore_cha_formats_attr [] = {
5576
+ & format_attr_event .attr ,
5577
+ & format_attr_umask_ext4 .attr ,
5578
+ & format_attr_tid_en2 .attr ,
5579
+ & format_attr_edge .attr ,
5580
+ & format_attr_inv .attr ,
5581
+ & format_attr_thresh8 .attr ,
5582
+ & format_attr_filter_tid5 .attr ,
5583
+ NULL ,
5584
+ };
5585
+ static const struct attribute_group spr_uncore_chabox_format_group = {
5586
+ .name = "format" ,
5587
+ .attrs = spr_uncore_cha_formats_attr ,
5588
+ };
5589
+
5590
+ static struct intel_uncore_type spr_uncore_chabox = {
5591
+ .name = "cha" ,
5592
+ .event_mask = SPR_CHA_PMON_EVENT_MASK ,
5593
+ .event_mask_ext = SPR_RAW_EVENT_MASK_EXT ,
5594
+ .num_shared_regs = 1 ,
5595
+ .ops = & spr_uncore_chabox_ops ,
5596
+ .format_group = & spr_uncore_chabox_format_group ,
5597
+ };
5598
+
5511
5599
#define UNCORE_SPR_NUM_UNCORE_TYPES 12
5512
5600
5513
5601
static struct intel_uncore_type * spr_uncores [UNCORE_SPR_NUM_UNCORE_TYPES ] = {
5514
- NULL ,
5602
+ & spr_uncore_chabox ,
5515
5603
NULL ,
5516
5604
NULL ,
5517
5605
NULL ,
0 commit comments