From nobody Tue Apr 7 07:07:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47B0DECAAD1 for ; Tue, 30 Aug 2022 13:39:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229995AbiH3NjS (ORCPT ); Tue, 30 Aug 2022 09:39:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230518AbiH3Nim (ORCPT ); Tue, 30 Aug 2022 09:38:42 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54429EC4FA for ; Tue, 30 Aug 2022 06:38:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661866690; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e+Q+YEfUkgOVSuw0G8qdju7poxRWKgzYe6gqmaV6CW0=; b=MdPh2CBCF9eV+DZYrqk/VNFLKbx7FiDDJYUtx6OxD/09h07IbAubzbrbIJFO+Ob6LrAKtV JYVNgJlIDK1UGTpHReXYajijIbuokzs9+uHFslWzSb6Q4oTQgRsRNuWh3wRPCVX/04MCpo vR+YTxyhkfuLaBdXsonOiVUaZPBe7WA= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-470-IL94irvBMEewilXpwdNkgg-1; Tue, 30 Aug 2022 09:38:06 -0400 X-MC-Unique: IL94irvBMEewilXpwdNkgg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1277C1C006AD; Tue, 30 Aug 2022 13:38:06 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.40.194.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id B0B7D2166B26; Tue, 30 Aug 2022 13:38:03 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org, Paolo Bonzini Cc: Sean Christopherson , Wanpeng Li , Jim Mattson , Michael Kelley , Yuan Yao , Maxim Levitsky , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 10/33] KVM: nVMX: Support several new fields in eVMCSv1 Date: Tue, 30 Aug 2022 15:37:14 +0200 Message-Id: <20220830133737.1539624-11-vkuznets@redhat.com> In-Reply-To: <20220830133737.1539624-1-vkuznets@redhat.com> References: <20220830133737.1539624-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Enlightened VMCS v1 definition was updated with new fields, add support for them for Hyper-V on KVM. Note: SSP, CET and Guest LBR features are not supported by KVM yet and 'struct vmcs12' has no corresponding fields. Reviewed-by: Maxim Levitsky Signed-off-by: Vitaly Kuznetsov Signed-off-by: Sean Christopherson --- arch/x86/kvm/vmx/nested.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index 28f9d64851b3..58821cd10603 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -1607,6 +1607,10 @@ static void copy_enlightened_to_vmcs12(struct vcpu_v= mx *vmx, u32 hv_clean_fields vmcs12->guest_rflags =3D evmcs->guest_rflags; vmcs12->guest_interruptibility_info =3D evmcs->guest_interruptibility_info; + /* + * Not present in struct vmcs12: + * vmcs12->guest_ssp =3D evmcs->guest_ssp; + */ } =20 if (unlikely(!(hv_clean_fields & @@ -1653,6 +1657,13 @@ static void copy_enlightened_to_vmcs12(struct vcpu_v= mx *vmx, u32 hv_clean_fields vmcs12->host_fs_selector =3D evmcs->host_fs_selector; vmcs12->host_gs_selector =3D evmcs->host_gs_selector; vmcs12->host_tr_selector =3D evmcs->host_tr_selector; + vmcs12->host_ia32_perf_global_ctrl =3D evmcs->host_ia32_perf_global_ctrl; + /* + * Not present in struct vmcs12: + * vmcs12->host_ia32_s_cet =3D evmcs->host_ia32_s_cet; + * vmcs12->host_ssp =3D evmcs->host_ssp; + * vmcs12->host_ia32_int_ssp_table_addr =3D evmcs->host_ia32_int_ssp_tab= le_addr; + */ } =20 if (unlikely(!(hv_clean_fields & @@ -1720,6 +1731,8 @@ static void copy_enlightened_to_vmcs12(struct vcpu_vm= x *vmx, u32 hv_clean_fields vmcs12->tsc_offset =3D evmcs->tsc_offset; vmcs12->virtual_apic_page_addr =3D evmcs->virtual_apic_page_addr; vmcs12->xss_exit_bitmap =3D evmcs->xss_exit_bitmap; + vmcs12->encls_exiting_bitmap =3D evmcs->encls_exiting_bitmap; + vmcs12->tsc_multiplier =3D evmcs->tsc_multiplier; } =20 if (unlikely(!(hv_clean_fields & @@ -1767,6 +1780,13 @@ static void copy_enlightened_to_vmcs12(struct vcpu_v= mx *vmx, u32 hv_clean_fields vmcs12->guest_bndcfgs =3D evmcs->guest_bndcfgs; vmcs12->guest_activity_state =3D evmcs->guest_activity_state; vmcs12->guest_sysenter_cs =3D evmcs->guest_sysenter_cs; + vmcs12->guest_ia32_perf_global_ctrl =3D evmcs->guest_ia32_perf_global_ct= rl; + /* + * Not present in struct vmcs12: + * vmcs12->guest_ia32_s_cet =3D evmcs->guest_ia32_s_cet; + * vmcs12->guest_ia32_lbr_ctl =3D evmcs->guest_ia32_lbr_ctl; + * vmcs12->guest_ia32_int_ssp_table_addr =3D evmcs->guest_ia32_int_ssp_t= able_addr; + */ } =20 /* @@ -1869,12 +1889,23 @@ static void copy_vmcs12_to_enlightened(struct vcpu_= vmx *vmx) * evmcs->vm_exit_msr_store_count =3D vmcs12->vm_exit_msr_store_count; * evmcs->vm_exit_msr_load_count =3D vmcs12->vm_exit_msr_load_count; * evmcs->vm_entry_msr_load_count =3D vmcs12->vm_entry_msr_load_count; + * evmcs->guest_ia32_perf_global_ctrl =3D vmcs12->guest_ia32_perf_global_= ctrl; + * evmcs->host_ia32_perf_global_ctrl =3D vmcs12->host_ia32_perf_global_ct= rl; + * evmcs->encls_exiting_bitmap =3D vmcs12->encls_exiting_bitmap; + * evmcs->tsc_multiplier =3D vmcs12->tsc_multiplier; * * Not present in struct vmcs12: * evmcs->exit_io_instruction_ecx =3D vmcs12->exit_io_instruction_ecx; * evmcs->exit_io_instruction_esi =3D vmcs12->exit_io_instruction_esi; * evmcs->exit_io_instruction_edi =3D vmcs12->exit_io_instruction_edi; * evmcs->exit_io_instruction_eip =3D vmcs12->exit_io_instruction_eip; + * evmcs->host_ia32_s_cet =3D vmcs12->host_ia32_s_cet; + * evmcs->host_ssp =3D vmcs12->host_ssp; + * evmcs->host_ia32_int_ssp_table_addr =3D vmcs12->host_ia32_int_ssp_tabl= e_addr; + * evmcs->guest_ia32_s_cet =3D vmcs12->guest_ia32_s_cet; + * evmcs->guest_ia32_lbr_ctl =3D vmcs12->guest_ia32_lbr_ctl; + * evmcs->guest_ia32_int_ssp_table_addr =3D vmcs12->guest_ia32_int_ssp_ta= ble_addr; + * evmcs->guest_ssp =3D vmcs12->guest_ssp; */ =20 evmcs->guest_es_selector =3D vmcs12->guest_es_selector; --=20 2.37.2