]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86/pmu: Adjust precise_ip to emulate Ice Lake guest PDIR counter
authorLike Xu <like.xu@linux.intel.com>
Mon, 11 Apr 2022 10:19:38 +0000 (18:19 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 8 Jun 2022 08:48:00 +0000 (04:48 -0400)
commit5d3d9f6705a28876d4095db10c0fc330052ed66c
tree52f44a3c6b9d6892b9dc56c12a5ea233f1820771
parent757cd7d430ecf2e37081bac1714643086838de1f
KVM: x86/pmu: Adjust precise_ip to emulate Ice Lake guest PDIR counter

The PEBS-PDIR facility on Ice Lake server is supported on IA31_FIXED0 only.
If the guest configures counter 32 and PEBS is enabled, the PEBS-PDIR
facility is supposed to be used, in which case KVM adjusts attr.precise_ip
to 3 and request host perf to assign the exactly requested counter or fail.

The CPU model check is also required since some platforms may place the
PEBS-PDIR facility in another counter index.

Signed-off-by: Like Xu <like.xu@linux.intel.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Message-Id: <20220411101946.20262-10-likexu@tencent.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/events/intel/core.c
arch/x86/kvm/pmu.c
arch/x86/kvm/pmu.h