]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86/svm/pmu: Direct access pmu->gp_counter[] to implement amd_*_to_pmc()
authorLike Xu <likexu@tencent.com>
Wed, 31 Aug 2022 08:53:27 +0000 (16:53 +0800)
committerSean Christopherson <seanjc@google.com>
Wed, 28 Sep 2022 19:47:22 +0000 (12:47 -0700)
commitc59893f2ac155060fbf7d6fa3edb685ab88dda69
tree8ecd65ff3bf918cc76550c03394f5faf2c67ef99
parent38d45a5e2695f33c53ebe272641867300a24ae1c
KVM: x86/svm/pmu: Direct access pmu->gp_counter[] to implement amd_*_to_pmc()

Access PMU counters on AMD by directly indexing the array of general
purpose counters instead of translating the PMC index to an MSR index.
AMD only supports gp counters, there's no need to translate a PMC index
to an MSR index and back to a PMC index.

Opportunistically apply array_index_nospec() to reduce the attack
surface for speculative execution and remove the dead code.

Signed-off-by: Like Xu <likexu@tencent.com>
Link: https://lore.kernel.org/r/20220831085328.45489-7-likexu@tencent.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/svm/pmu.c