Re: [PATCH v3 2/3] KVM: SEV-ES: Disallow SEV-ES guests when X86_FEATURE_LBRV is absent

Paolo Bonzini
2024-05-28T16:33:10Z

On 5/23/24 14:18, Ravi Bangoria wrote:
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index 489b0183f37d..dcb5eb00a4f5 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -5308,11 +5308,17 @@ static __init int svm_hardware_setup(void)
>
> nrips = nrips && boot_cpu_has(X86_FEATURE_NRIPS);
>
> + if (lbrv) {
> + if (!boot_cpu_has(X86_FEATURE_LBRV))
> + lbrv = false;
> + else
> + pr_info("LBR virtualization supported\n");
> + }
> /*
> * Note, SEV setup consumes npt_enabled and enable_mmio_caching (which
> * may be modified by svm_adjust_mmio_mask()), as well as nrips.
> */

Since it consumes nrips, just make lbrv non-static:

/* enable/disable Next RIP Save */
int nrips = true;
module_param(nrips, int, 0444);

Paolo