On Sat, Nov 04, 2023, Jim Mattson wrote: > On Fri, Nov 3, 2023 at 5:02 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote: > > +#define KVM_X86_PMU_FEATURE(__reg, __bit) \ > > +({ \ > > + struct kvm_x86_pmu_feature feature = { \ > > + .f = KVM_X86_CPU_FEATURE(0xa, 0, __reg, __bit), \ > > + }; \ > > + \ > > + kvm_static_assert(KVM_CPUID_##__reg == KVM_CPUID_EBX || \ > > + KVM_CPUID_##__reg == KVM_CPUID_ECX); \ > > + feature; \ > > }) > > > > -#define X86_PMU_FEATURE_BRANCH_INSNS_RETIRED KVM_X86_PMU_FEATURE(5) > > +#define X86_PMU_FEATURE_CPU_CYCLES KVM_X86_PMU_FEATURE(EBX, 0) > > +#define X86_PMU_FEATURE_INSNS_RETIRED KVM_X86_PMU_FEATURE(EBX, 1) > > +#define X86_PMU_FEATURE_REFERENCE_CYCLES KVM_X86_PMU_FEATURE(EBX, 2) > > +#define X86_PMU_FEATURE_LLC_REFERENCES KVM_X86_PMU_FEATURE(EBX, 3) > > +#define X86_PMU_FEATURE_LLC_MISSES KVM_X86_PMU_FEATURE(EBX, 4) > > +#define X86_PMU_FEATURE_BRANCH_INSNS_RETIRED KVM_X86_PMU_FEATURE(EBX, 5) > > +#define X86_PMU_FEATURE_BRANCHES_MISPREDICTED KVM_X86_PMU_FEATURE(EBX, 6) > > Why not add top down slots now? Laziness? > > +#define X86_PMU_FEATURE_INSNS_RETIRED_FIXED KVM_X86_PMU_FEATURE(ECX, 0) > > +#define X86_PMU_FEATURE_CPU_CYCLES_FIXED KVM_X86_PMU_FEATURE(ECX, 1) > > +#define X86_PMU_FEATURE_REFERENCE_CYCLES_FIXED KVM_X86_PMU_FEATURE(ECX, 2) > > Perhaps toss 'TSC' between CYCLES and FIXED? I think X86_PMU_FEATURE_REFERENCE_TSC_CYCLES_FIXED is more aligned with how the SDM (and English in general) talks about reference cycles. > And add top down slots now> Ya.