Commit b8bfee85 authored by Jim Mattson's avatar Jim Mattson Committed by Paolo Bonzini

KVM: x86/pmu: Don't truncate the PerfEvtSeln MSR when creating a perf event

AMD's event select is 3 nybbles, with the high nybble in bits 35:32 of
a PerfEvtSeln MSR. Don't drop the high nybble when setting up the
config field of a perf_event_attr structure for a call to
perf_event_create_kernel_counter().

Fixes: ca724305 ("KVM: x86/vPMU: Implement AMD vPMU code for KVM")
Reported-by: default avatarStephane Eranian <eranian@google.com>
Signed-off-by: default avatarJim Mattson <jmattson@google.com>
Message-Id: <20220203014813.2130559-1-jmattson@google.com>
Reviewed-by: default avatarDavid Dunn <daviddunn@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 66fa226c
...@@ -95,7 +95,7 @@ static void kvm_perf_overflow(struct perf_event *perf_event, ...@@ -95,7 +95,7 @@ static void kvm_perf_overflow(struct perf_event *perf_event,
} }
static void pmc_reprogram_counter(struct kvm_pmc *pmc, u32 type, static void pmc_reprogram_counter(struct kvm_pmc *pmc, u32 type,
unsigned config, bool exclude_user, u64 config, bool exclude_user,
bool exclude_kernel, bool intr, bool exclude_kernel, bool intr,
bool in_tx, bool in_tx_cp) bool in_tx, bool in_tx_cp)
{ {
...@@ -181,7 +181,8 @@ static int cmp_u64(const void *a, const void *b) ...@@ -181,7 +181,8 @@ static int cmp_u64(const void *a, const void *b)
void reprogram_gp_counter(struct kvm_pmc *pmc, u64 eventsel) void reprogram_gp_counter(struct kvm_pmc *pmc, u64 eventsel)
{ {
unsigned config, type = PERF_TYPE_RAW; u64 config;
u32 type = PERF_TYPE_RAW;
struct kvm *kvm = pmc->vcpu->kvm; struct kvm *kvm = pmc->vcpu->kvm;
struct kvm_pmu_event_filter *filter; struct kvm_pmu_event_filter *filter;
bool allow_event = true; bool allow_event = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment