Skip to content

Commit cdfed93

Browse files
Dapeng Misean-jc
authored andcommitted
KVM: x86/pmu: Move PMU_CAP_{FW_WRITES,LBR_FMT} into msr-index.h header
Move PMU_CAP_{FW_WRITES,LBR_FMT} into msr-index.h and rename them with PERF_CAP prefix to keep consistent with other perf capabilities macros. No functional change intended. Signed-off-by: Dapeng Mi <[email protected]> Signed-off-by: Mingwei Zhang <[email protected]> Tested-by: Xudong Hao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 1e24bec commit cdfed93

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

arch/x86/include/asm/msr-index.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,12 +315,15 @@
315315
#define PERF_CAP_PT_IDX 16
316316

317317
#define MSR_PEBS_LD_LAT_THRESHOLD 0x000003f6
318-
#define PERF_CAP_PEBS_TRAP BIT_ULL(6)
319-
#define PERF_CAP_ARCH_REG BIT_ULL(7)
320-
#define PERF_CAP_PEBS_FORMAT 0xf00
321-
#define PERF_CAP_PEBS_BASELINE BIT_ULL(14)
322-
#define PERF_CAP_PEBS_MASK (PERF_CAP_PEBS_TRAP | PERF_CAP_ARCH_REG | \
323-
PERF_CAP_PEBS_FORMAT | PERF_CAP_PEBS_BASELINE)
318+
319+
#define PERF_CAP_LBR_FMT 0x3f
320+
#define PERF_CAP_PEBS_TRAP BIT_ULL(6)
321+
#define PERF_CAP_ARCH_REG BIT_ULL(7)
322+
#define PERF_CAP_PEBS_FORMAT 0xf00
323+
#define PERF_CAP_FW_WRITES BIT_ULL(13)
324+
#define PERF_CAP_PEBS_BASELINE BIT_ULL(14)
325+
#define PERF_CAP_PEBS_MASK (PERF_CAP_PEBS_TRAP | PERF_CAP_ARCH_REG | \
326+
PERF_CAP_PEBS_FORMAT | PERF_CAP_PEBS_BASELINE)
324327

325328
#define MSR_IA32_RTIT_CTL 0x00000570
326329
#define RTIT_CTL_TRACEEN BIT(0)

arch/x86/kvm/vmx/capabilities.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ extern int __read_mostly pt_mode;
2020
#define PT_MODE_SYSTEM 0
2121
#define PT_MODE_HOST_GUEST 1
2222

23-
#define PMU_CAP_FW_WRITES (1ULL << 13)
24-
#define PMU_CAP_LBR_FMT 0x3f
25-
2623
struct nested_vmx_msrs {
2724
/*
2825
* We only store the "true" versions of the VMX capability MSRs. We

arch/x86/kvm/vmx/pmu_intel.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ static inline u64 vcpu_get_perf_capabilities(struct kvm_vcpu *vcpu)
138138

139139
static inline bool fw_writes_is_enabled(struct kvm_vcpu *vcpu)
140140
{
141-
return (vcpu_get_perf_capabilities(vcpu) & PMU_CAP_FW_WRITES) != 0;
141+
return (vcpu_get_perf_capabilities(vcpu) & PERF_CAP_FW_WRITES) != 0;
142142
}
143143

144144
static inline struct kvm_pmc *get_fw_gp_pmc(struct kvm_pmu *pmu, u32 msr)
@@ -588,7 +588,7 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu)
588588

589589
perf_capabilities = vcpu_get_perf_capabilities(vcpu);
590590
if (intel_pmu_lbr_is_compatible(vcpu) &&
591-
(perf_capabilities & PMU_CAP_LBR_FMT))
591+
(perf_capabilities & PERF_CAP_LBR_FMT))
592592
memcpy(&lbr_desc->records, &vmx_lbr_caps, sizeof(vmx_lbr_caps));
593593
else
594594
lbr_desc->records.nr = 0;

arch/x86/kvm/vmx/vmx.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@ u64 vmx_get_supported_debugctl(struct kvm_vcpu *vcpu, bool host_initiated)
21272127
(host_initiated || guest_cpu_cap_has(vcpu, X86_FEATURE_BUS_LOCK_DETECT)))
21282128
debugctl |= DEBUGCTLMSR_BUS_LOCK_DETECT;
21292129

2130-
if ((kvm_caps.supported_perf_cap & PMU_CAP_LBR_FMT) &&
2130+
if ((kvm_caps.supported_perf_cap & PERF_CAP_LBR_FMT) &&
21312131
(host_initiated || intel_pmu_lbr_is_enabled(vcpu)))
21322132
debugctl |= DEBUGCTLMSR_LBR | DEBUGCTLMSR_FREEZE_LBRS_ON_PMI;
21332133

@@ -2412,9 +2412,9 @@ int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
24122412
vmx->pt_desc.guest.addr_a[index / 2] = data;
24132413
break;
24142414
case MSR_IA32_PERF_CAPABILITIES:
2415-
if (data & PMU_CAP_LBR_FMT) {
2416-
if ((data & PMU_CAP_LBR_FMT) !=
2417-
(kvm_caps.supported_perf_cap & PMU_CAP_LBR_FMT))
2415+
if (data & PERF_CAP_LBR_FMT) {
2416+
if ((data & PERF_CAP_LBR_FMT) !=
2417+
(kvm_caps.supported_perf_cap & PERF_CAP_LBR_FMT))
24182418
return 1;
24192419
if (!cpuid_model_is_consistent(vcpu))
24202420
return 1;
@@ -7810,7 +7810,7 @@ void vmx_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu)
78107810

78117811
static __init u64 vmx_get_perf_capabilities(void)
78127812
{
7813-
u64 perf_cap = PMU_CAP_FW_WRITES;
7813+
u64 perf_cap = PERF_CAP_FW_WRITES;
78147814
u64 host_perf_cap = 0;
78157815

78167816
if (!enable_pmu)
@@ -7830,7 +7830,7 @@ static __init u64 vmx_get_perf_capabilities(void)
78307830
if (!vmx_lbr_caps.has_callstack)
78317831
memset(&vmx_lbr_caps, 0, sizeof(vmx_lbr_caps));
78327832
else if (vmx_lbr_caps.nr)
7833-
perf_cap |= host_perf_cap & PMU_CAP_LBR_FMT;
7833+
perf_cap |= host_perf_cap & PERF_CAP_LBR_FMT;
78347834
}
78357835

78367836
if (vmx_pebs_supported()) {

0 commit comments

Comments
 (0)