From: "Aithal, Srikanth" <sraithal@amd.com>
To: Ravi Bangoria <ravi.bangoria@amd.com>,
seanjc@google.com, pbonzini@redhat.com, nikunj.dadhania@amd.com
Cc: thomas.lendacky@amd.com, tglx@linutronix.de, mingo@redhat.com,
bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org,
hpa@zytor.com, michael.roth@amd.com, pankaj.gupta@amd.com,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
santosh.shukla@amd.com
Subject: Re: [PATCH] KVM: SNP: Fix LBR Virtualization for SNP guest
Date: Wed, 5 Jun 2024 17:22:55 +0530 [thread overview]
Message-ID: <fc6a2fb6-4762-4d5b-aa65-8588914221ce@amd.com> (raw)
In-Reply-To: <20240605114810.1304-1-ravi.bangoria@amd.com>
On 6/5/2024 5:18 PM, Ravi Bangoria wrote:
> SEV-ES and thus SNP guest mandates LBR Virtualization to be _always_ ON.
> Although commit b7e4be0a224f ("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: b7e4be0a224f ("KVM: SEV-ES: Delegate LBR virtualization to the processor")
> Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
> ---
> - SNP support was not present while I prepared the original patches and
> that lead to this confusion. Sorry about that.
>
> arch/x86/kvm/svm/sev.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> index 7d401f8a3001..57291525e084 100644
> --- a/arch/x86/kvm/svm/sev.c
> +++ b/arch/x86/kvm/svm/sev.c
> @@ -2395,6 +2395,14 @@ static int snp_launch_update_vmsa(struct kvm *kvm, struct kvm_sev_cmd *argp)
> }
>
> svm->vcpu.arch.guest_state_protected = true;
> + /*
> + * SEV-ES (and thus SNP) guest mandates LBR Virtualization to
> + * be _always_ ON. Enable it only after setting
> + * guest_state_protected because KVM_SET_MSRS allows dynamic
> + * toggling of LBRV (for performance reason) on write access to
> + * MSR_IA32_DEBUGCTLMSR when guest_state_protected is not set.
> + */
> + svm_enable_lbrv(vcpu);
> }
>
> return 0;
Tested-by: Srikanth Aithal <sraithal@amd.com>
next prev parent reply other threads:[~2024-06-05 11:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-31 4:46 [PATCH v4 0/3] KVM: SEV-ES: Fix KVM_{GET|SET}_MSRS and LBRV handling Ravi Bangoria
2024-05-31 4:46 ` [PATCH v4 1/3] KVM: SEV-ES: Prevent MSR access post VMSA encryption Ravi Bangoria
2024-05-31 4:46 ` [PATCH v4 2/3] KVM: SEV-ES: Disallow SEV-ES guests when X86_FEATURE_LBRV is absent Ravi Bangoria
2024-05-31 4:46 ` [PATCH v4 3/3] KVM: SEV-ES: Fix LBRV code Ravi Bangoria
2024-06-05 11:48 ` [PATCH] KVM: SNP: Fix LBR Virtualization for SNP guest Ravi Bangoria
2024-06-05 11:50 ` Paolo Bonzini
2024-06-05 11:52 ` Aithal, Srikanth [this message]
2024-06-03 17:05 ` [PATCH v4 0/3] KVM: SEV-ES: Fix KVM_{GET|SET}_MSRS and LBRV handling Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fc6a2fb6-4762-4d5b-aa65-8588914221ce@amd.com \
--to=sraithal@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.roth@amd.com \
--cc=mingo@redhat.com \
--cc=nikunj.dadhania@amd.com \
--cc=pankaj.gupta@amd.com \
--cc=pbonzini@redhat.com \
--cc=ravi.bangoria@amd.com \
--cc=santosh.shukla@amd.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox