Re: [PATCH v11 21/23] KVM: nVMX: Enable CET support for nested guest
From: Chao Gao
Date: Mon Jul 28 2025 - 04:43:23 EST
On Sun, Jul 27, 2025 at 11:30:28PM -0700, Xin Li wrote:
>> @@ -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@xxxxxxxxx/
Sure. I can reorder the arguments.