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)
469469 if (pmc_is_fixed (pmc )) {
470470 fixed_ctr_ctrl = fixed_ctrl_field (pmu -> fixed_ctr_ctrl ,
471471 pmc -> idx - KVM_FIXED_PMC_BASE_IDX );
472- if (fixed_ctr_ctrl & 0x1 )
472+ if (fixed_ctr_ctrl & INTEL_FIXED_0_KERNEL )
473473 eventsel |= ARCH_PERFMON_EVENTSEL_OS ;
474- if (fixed_ctr_ctrl & 0x2 )
474+ if (fixed_ctr_ctrl & INTEL_FIXED_0_USER )
475475 eventsel |= ARCH_PERFMON_EVENTSEL_USR ;
476- if (fixed_ctr_ctrl & 0x8 )
476+ if (fixed_ctr_ctrl & INTEL_FIXED_0_ENABLE_PMI )
477477 eventsel |= ARCH_PERFMON_EVENTSEL_INT ;
478478 new_config = (u64 )fixed_ctr_ctrl ;
479479 }
@@ -846,8 +846,8 @@ static inline bool cpl_is_matched(struct kvm_pmc *pmc)
846846 } else {
847847 config = fixed_ctrl_field (pmc_to_pmu (pmc )-> fixed_ctr_ctrl ,
848848 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 ;
851851 }
852852
853853 /*
Original file line number Diff line number Diff line change 1414 MSR_IA32_MISC_ENABLE_BTS_UNAVAIL)
1515
1616/* 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)
1819
1920#define VMWARE_BACKDOOR_PMC_HOST_TSC 0x10000
2021#define VMWARE_BACKDOOR_PMC_REAL_TIME 0x10001
@@ -170,7 +171,8 @@ static inline bool pmc_speculative_in_use(struct kvm_pmc *pmc)
170171
171172 if (pmc_is_fixed (pmc ))
172173 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 );
174176
175177 return pmc -> eventsel & ARCH_PERFMON_EVENTSEL_ENABLE ;
176178}
Original file line number Diff line number Diff line change @@ -502,7 +502,12 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu)
502502 }
503503
504504 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+
506511 counter_rsvd = ~(((1ull << pmu -> nr_arch_gp_counters ) - 1 ) |
507512 (((1ull << pmu -> nr_arch_fixed_counters ) - 1 ) << KVM_FIXED_PMC_BASE_IDX ));
508513 pmu -> global_ctrl_rsvd = counter_rsvd ;
@@ -546,10 +551,9 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu)
546551 if (perf_capabilities & PERF_CAP_PEBS_BASELINE ) {
547552 pmu -> pebs_enable_rsvd = counter_rsvd ;
548553 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 ++ )
550555 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 );
553557 pmu -> pebs_data_cfg_rsvd = ~0xff00000full ;
554558 } else {
555559 pmu -> pebs_enable_rsvd =
You can’t perform that action at this time.
0 commit comments