Re: [PATCH v2 05/15] KVM: vmx/pmu: Emulate MSR_ARCH_LBR_DEPTH for guest Arch LBR

From: Like Xu
Date: Thu Dec 22 2022 - 06:15:48 EST


On 25/11/2022 12:05 pm, Yang Weijiang wrote:
+static bool cpuid_enable_lbr(struct kvm_vcpu *vcpu)
+{
+ struct kvm_pmu *pmu = vcpu_to_pmu(vcpu);
+ struct kvm_cpuid_entry2 *entry;
+ int depth_bit;
+
+ if (!kvm_cpu_cap_has(X86_FEATURE_ARCH_LBR))
+ return !static_cpu_has(X86_FEATURE_ARCH_LBR) &&
+ cpuid_model_is_consistent(vcpu);

Please add selftests to cover this incompatibility.

And running the SPR vcpu model on a GNR host, the guest arch lbr
should be fully supported as long as both hosts have the same lbr_depth.