Skip to content

Commit f99b052

Browse files
Ravi Bangoriabonzini
authored andcommitted
KVM: SNP: Fix LBR Virtualization for SNP guest
SEV-ES and thus SNP guest mandates LBR Virtualization to be _always_ ON. Although commit b7e4be0 ("KVM: SEV-ES: Delegate LBR virtualization to the processor") did the correct change for SEV-ES guests, it missed the SNP. Fix it. Reported-by: Srikanth Aithal <sraithal@amd.com> Fixes: b7e4be0 ("KVM: SEV-ES: Delegate LBR virtualization to the processor") Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com> Message-ID: <20240605114810.1304-1-ravi.bangoria@amd.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent ab978c6 commit f99b052

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

arch/x86/kvm/svm/sev.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2402,6 +2402,14 @@ static int snp_launch_update_vmsa(struct kvm *kvm, struct kvm_sev_cmd *argp)
24022402
}
24032403

24042404
svm->vcpu.arch.guest_state_protected = true;
2405+
/*
2406+
* SEV-ES (and thus SNP) guest mandates LBR Virtualization to
2407+
* be _always_ ON. Enable it only after setting
2408+
* guest_state_protected because KVM_SET_MSRS allows dynamic
2409+
* toggling of LBRV (for performance reason) on write access to
2410+
* MSR_IA32_DEBUGCTLMSR when guest_state_protected is not set.
2411+
*/
2412+
svm_enable_lbrv(vcpu);
24052413
}
24062414

24072415
return 0;

0 commit comments

Comments
 (0)