]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: x86/pmu: do not mask the value that is written to fixed PMUs
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 20 May 2019 15:34:30 +0000 (17:34 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Jun 2019 06:18:04 +0000 (08:18 +0200)
commit9d8f338c92cc37de3242149336cc00f1da327b57
treea351e67421f668748210681d02f7c52944c52489
parent04d2a113a283b0b42ec7060ef84afd135a13212c
KVM: x86/pmu: do not mask the value that is written to fixed PMUs

[ Upstream commit 2924b52117b2812e9633d5ea337333299166d373 ]

According to the SDM, for MSR_IA32_PERFCTR0/1 "the lower-order 32 bits of
each MSR may be written with any value, and the high-order 8 bits are
sign-extended according to the value of bit 31", but the fixed counters
in real hardware are limited to the width of the fixed counters ("bits
beyond the width of the fixed-function counter are reserved and must be
written as zeros").  Fix KVM to do the same.

Reported-by: Nadav Amit <nadav.amit@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/kvm/pmu_intel.c