File tree Expand file tree Collapse file tree 3 files changed +17
-11
lines changed Expand file tree Collapse file tree 3 files changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -469,11 +469,11 @@ static int reprogram_counter(struct kvm_pmc *pmc)
469
469
if (pmc_is_fixed (pmc )) {
470
470
fixed_ctr_ctrl = fixed_ctrl_field (pmu -> fixed_ctr_ctrl ,
471
471
pmc -> idx - KVM_FIXED_PMC_BASE_IDX );
472
- if (fixed_ctr_ctrl & 0x1 )
472
+ if (fixed_ctr_ctrl & INTEL_FIXED_0_KERNEL )
473
473
eventsel |= ARCH_PERFMON_EVENTSEL_OS ;
474
- if (fixed_ctr_ctrl & 0x2 )
474
+ if (fixed_ctr_ctrl & INTEL_FIXED_0_USER )
475
475
eventsel |= ARCH_PERFMON_EVENTSEL_USR ;
476
- if (fixed_ctr_ctrl & 0x8 )
476
+ if (fixed_ctr_ctrl & INTEL_FIXED_0_ENABLE_PMI )
477
477
eventsel |= ARCH_PERFMON_EVENTSEL_INT ;
478
478
new_config = (u64 )fixed_ctr_ctrl ;
479
479
}
@@ -846,8 +846,8 @@ static inline bool cpl_is_matched(struct kvm_pmc *pmc)
846
846
} else {
847
847
config = fixed_ctrl_field (pmc_to_pmu (pmc )-> fixed_ctr_ctrl ,
848
848
pmc -> idx - KVM_FIXED_PMC_BASE_IDX );
849
- select_os = config & 0x1 ;
850
- select_user = config & 0x2 ;
849
+ select_os = config & INTEL_FIXED_0_KERNEL ;
850
+ select_user = config & INTEL_FIXED_0_USER ;
851
851
}
852
852
853
853
/*
Original file line number Diff line number Diff line change 14
14
MSR_IA32_MISC_ENABLE_BTS_UNAVAIL)
15
15
16
16
/* retrieve the 4 bits for EN and PMI out of IA32_FIXED_CTR_CTRL */
17
- #define fixed_ctrl_field (ctrl_reg , idx ) (((ctrl_reg) >> ((idx)*4)) & 0xf)
17
+ #define fixed_ctrl_field (ctrl_reg , idx ) \
18
+ (((ctrl_reg) >> ((idx) * INTEL_FIXED_BITS_STRIDE)) & INTEL_FIXED_BITS_MASK)
18
19
19
20
#define VMWARE_BACKDOOR_PMC_HOST_TSC 0x10000
20
21
#define VMWARE_BACKDOOR_PMC_REAL_TIME 0x10001
@@ -170,7 +171,8 @@ static inline bool pmc_speculative_in_use(struct kvm_pmc *pmc)
170
171
171
172
if (pmc_is_fixed (pmc ))
172
173
return fixed_ctrl_field (pmu -> fixed_ctr_ctrl ,
173
- pmc -> idx - KVM_FIXED_PMC_BASE_IDX ) & 0x3 ;
174
+ pmc -> idx - KVM_FIXED_PMC_BASE_IDX ) &
175
+ (INTEL_FIXED_0_KERNEL | INTEL_FIXED_0_USER );
174
176
175
177
return pmc -> eventsel & ARCH_PERFMON_EVENTSEL_ENABLE ;
176
178
}
Original file line number Diff line number Diff line change @@ -502,7 +502,12 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu)
502
502
}
503
503
504
504
for (i = 0 ; i < pmu -> nr_arch_fixed_counters ; i ++ )
505
- pmu -> fixed_ctr_ctrl_rsvd &= ~(0xbull << (i * 4 ));
505
+ pmu -> fixed_ctr_ctrl_rsvd &=
506
+ ~intel_fixed_bits_by_idx (i ,
507
+ INTEL_FIXED_0_KERNEL |
508
+ INTEL_FIXED_0_USER |
509
+ INTEL_FIXED_0_ENABLE_PMI );
510
+
506
511
counter_rsvd = ~(((1ull << pmu -> nr_arch_gp_counters ) - 1 ) |
507
512
(((1ull << pmu -> nr_arch_fixed_counters ) - 1 ) << KVM_FIXED_PMC_BASE_IDX ));
508
513
pmu -> global_ctrl_rsvd = counter_rsvd ;
@@ -546,10 +551,9 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu)
546
551
if (perf_capabilities & PERF_CAP_PEBS_BASELINE ) {
547
552
pmu -> pebs_enable_rsvd = counter_rsvd ;
548
553
pmu -> reserved_bits &= ~ICL_EVENTSEL_ADAPTIVE ;
549
- for (i = 0 ; i < pmu -> nr_arch_fixed_counters ; i ++ ) {
554
+ for (i = 0 ; i < pmu -> nr_arch_fixed_counters ; i ++ )
550
555
pmu -> fixed_ctr_ctrl_rsvd &=
551
- ~(1ULL << (KVM_FIXED_PMC_BASE_IDX + i * 4 ));
552
- }
556
+ ~intel_fixed_bits_by_idx (i , ICL_FIXED_0_ADAPTIVE );
553
557
pmu -> pebs_data_cfg_rsvd = ~0xff00000full ;
554
558
} else {
555
559
pmu -> pebs_enable_rsvd =
You can’t perform that action at this time.
0 commit comments