OSDN Git Service

KVM: x86/pmu: Add IA32_DS_AREA MSR emulation to support guest DS
authorLike Xu <like.xu@linux.intel.com>
Mon, 11 Apr 2022 10:19:39 +0000 (18:19 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 8 Jun 2022 08:48:03 +0000 (04:48 -0400)
commit8183a538cd95f72f11871b35726256ec3bcb9439
treebde33c5879f0678a88732c711db35f50c33c0c92
parent6ebe44366bdeaf3059f2b644bbd99824ae824228
KVM: x86/pmu: Add IA32_DS_AREA MSR emulation to support guest DS

When CPUID.01H:EDX.DS[21] is set, the IA32_DS_AREA MSR exists and points
to the linear address of the first byte of the DS buffer management area,
which is used to manage the PEBS records.

When guest PEBS is enabled, the MSR_IA32_DS_AREA MSR will be added to the
perf_guest_switch_msr() and switched during the VMX transitions just like
CORE_PERF_GLOBAL_CTRL MSR. The WRMSR to IA32_DS_AREA MSR brings a #GP(0)
if the source register contains a non-canonical address.

Originally-by: Andi Kleen <ak@linux.intel.com>
Co-developed-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Like Xu <like.xu@linux.intel.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Message-Id: <20220411101946.20262-11-likexu@tencent.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/events/intel/core.c
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/vmx/pmu_intel.c
arch/x86/kvm/x86.c