]> git.proxmox.com Git - mirror_qemu.git/commit - target/i386/cpu.c
target/i386: Add lbr-fmt vPMU option to support guest LBR
authorYang Weijiang <weijiang.yang@intel.com>
Tue, 15 Feb 2022 19:52:52 +0000 (14:52 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 14 May 2022 10:32:41 +0000 (12:32 +0200)
commitf06d8a18abc9d29d052f628eefd1d4a86c99fcea
tree95aef9015ab6a2f345b4cc10ee926baee43c61fe
parent18c22d7112a76fabeee5022a3bdd9e8c3a37c8d2
target/i386: Add lbr-fmt vPMU option to support guest LBR

The Last Branch Recording (LBR) is a performance monitor unit (PMU)
feature on Intel processors which records a running trace of the most
recent branches taken by the processor in the LBR stack. This option
indicates the LBR format to enable for guest perf.

The LBR feature is enabled if below conditions are met:
1) KVM is enabled and the PMU is enabled.
2) msr-based-feature IA32_PERF_CAPABILITIES is supporterd on KVM.
3) Supported returned value for lbr_fmt from above msr is non-zero.
4) Guest vcpu model does support FEAT_1_ECX.CPUID_EXT_PDCM.
5) User-provided lbr-fmt value doesn't violate its bitmask (0x3f).
6) Target guest LBR format matches that of host.

Co-developed-by: Like Xu <like.xu@linux.intel.com>
Signed-off-by: Like Xu <like.xu@linux.intel.com>
Signed-off-by: Yang Weijiang <weijiang.yang@intel.com>
Message-Id: <20220215195258.29149-3-weijiang.yang@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target/i386/cpu.c
target/i386/cpu.h