KVM: x86/pmu: Don't truncate the PerfEvtSeln MSR when creating a perf event
authorJim Mattson <jmattson@google.com>
Thu, 3 Feb 2022 01:48:12 +0000 (17:48 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Feb 2022 11:01:04 +0000 (12:01 +0100)
commit0ee4bb8ce8b8279a2fa811efccc9422d0b6d9bff
treea9b39dbb7f3c9a715e7ed3f6f626ba34f62bbfe4
parent99cd2a043760e4fcf06fe3c67e9885a2d64c986d
KVM: x86/pmu: Don't truncate the PerfEvtSeln MSR when creating a perf event

[ Upstream commit b8bfee85f1307426e0242d654f3a14c06ef639c5 ]

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: ca724305a2b0 ("KVM: x86/vPMU: Implement AMD vPMU code for KVM")
Reported-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Jim Mattson <jmattson@google.com>
Message-Id: <20220203014813.2130559-1-jmattson@google.com>
Reviewed-by: David Dunn <daviddunn@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/kvm/pmu.c