[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c3a54990-9cd6-4d8a-baa0-11b4e8d4a23b@zytor.com>
Date: Sun, 27 Jul 2025 23:30:28 -0700
From: Xin Li <xin@...or.com>
To: Chao Gao <chao.gao@...el.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, x86@...nel.org, seanjc@...gle.com,
pbonzini@...hat.com, dave.hansen@...el.com
Cc: rick.p.edgecombe@...el.com, mlevitsk@...hat.com, john.allen@....com,
weijiang.yang@...el.com, minipli@...ecurity.net,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH v11 21/23] KVM: nVMX: Enable CET support for nested guest
> @@ -2515,6 +2537,30 @@ static void prepare_vmcs02_early(struct vcpu_vmx *vmx, struct loaded_vmcs *vmcs0
> }
> }
>
> +static inline void cet_vmcs_fields_get(struct kvm_vcpu *vcpu, u64 *ssp,
> + u64 *s_cet, u64 *ssp_tbl)
> +{
> + if (guest_cpu_cap_has(vcpu, X86_FEATURE_SHSTK)) {
> + *ssp = vmcs_readl(GUEST_SSP);
> + *ssp_tbl = vmcs_readl(GUEST_INTR_SSP_TABLE);
> + }
> + if (guest_cpu_cap_has(vcpu, X86_FEATURE_IBT) ||
> + guest_cpu_cap_has(vcpu, X86_FEATURE_SHSTK))
> + *s_cet = vmcs_readl(GUEST_S_CET);
> +}
> +
> +static inline void cet_vmcs_fields_set(struct kvm_vcpu *vcpu, u64 ssp,
> + u64 s_cet, u64 ssp_tbl)
> +{
> + if (guest_cpu_cap_has(vcpu, X86_FEATURE_SHSTK)) {
> + vmcs_writel(GUEST_SSP, ssp);
> + vmcs_writel(GUEST_INTR_SSP_TABLE, ssp_tbl);
> + }
> + if (guest_cpu_cap_has(vcpu, X86_FEATURE_IBT) ||
> + guest_cpu_cap_has(vcpu, X86_FEATURE_SHSTK))
> + vmcs_writel(GUEST_S_CET, s_cet);
> +}
> +
> static void prepare_vmcs02_rare(struct vcpu_vmx *vmx, struct vmcs12 *vmcs12)
> {
> struct hv_enlightened_vmcs *hv_evmcs = nested_vmx_evmcs(vmx);
The order of the arguments is a bit of weird to me, I would move s_cet
before ssp. Then it is consistent with the order in
https://lore.kernel.org/kvm/20250704085027.182163-13-chao.gao@intel.com/
> --- a/arch/x86/kvm/vmx/vmx.h
> +++ b/arch/x86/kvm/vmx/vmx.h
> @@ -181,6 +181,9 @@ struct nested_vmx {
> */
> u64 pre_vmenter_debugctl;
> u64 pre_vmenter_bndcfgs;
> + u64 pre_vmenter_ssp;
> + u64 pre_vmenter_s_cet;
> + u64 pre_vmenter_ssp_tbl;
>
> /* to migrate it to L1 if L2 writes to L1's CR8 directly */
> int l1_tpr_threshold;
Same here.
Powered by blists - more mailing lists