[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YqsOcSWRuuigIY6N@worktop.programming.kicks-ass.net>
Date: Thu, 16 Jun 2022 13:05:21 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Yang Weijiang <weijiang.yang@...el.com>
Cc: pbonzini@...hat.com, seanjc@...gle.com, x86@...nel.org,
kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
rick.p.edgecombe@...el.com
Subject: Re: [PATCH 19/19] KVM: x86: Enable supervisor IBT support for guest
On Thu, Jun 16, 2022 at 04:46:43AM -0400, Yang Weijiang wrote:
> Mainline kernel now supports supervisor IBT for kernel code,
> to make s-IBT work in guest(nested guest), pass through
> MSR_IA32_S_CET to guest(nested guest) if host kernel and KVM
> enabled IBT. Note, s-IBT can work independent to host xsaves
> support because guest MSR_IA32_S_CET can be stored/loaded from
> specific VMCS field.
>
> Signed-off-by: Yang Weijiang <weijiang.yang@...el.com>
> ---
> arch/x86/kvm/cpuid.h | 5 +++++
> arch/x86/kvm/vmx/nested.c | 3 +++
> arch/x86/kvm/vmx/vmx.c | 27 ++++++++++++++++++++++++---
> arch/x86/kvm/x86.c | 13 ++++++++++++-
> 4 files changed, 44 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h
> index ac72aabba981..c67c1e2fc11a 100644
> --- a/arch/x86/kvm/cpuid.h
> +++ b/arch/x86/kvm/cpuid.h
> @@ -230,4 +230,9 @@ static __always_inline bool guest_pv_has(struct kvm_vcpu *vcpu,
> return vcpu->arch.pv_cpuid.features & (1u << kvm_feature);
> }
>
> +static __always_inline bool cet_kernel_ibt_supported(void)
> +{
> + return HAS_KERNEL_IBT && kvm_cpu_cap_has(X86_FEATURE_IBT);
> +}
As stated before; I would much rather it expose S_CET unconditional of
host kernel config.
Powered by blists - more mailing lists