[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <488553b9a51b5c0f7f20dae5857278f38da01226.camel@redhat.com>
Date: Tue, 12 Jul 2022 14:50:51 +0300
From: Maxim Levitsky <mlevitsk@...hat.com>
To: Vitaly Kuznetsov <vkuznets@...hat.com>, kvm@...r.kernel.org,
Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <seanjc@...gle.com>
Cc: Anirudh Rayabharam <anrayabh@...ux.microsoft.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
linux-hyperv@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 04/25] KVM: VMX: Define VMCS-to-EVMCS conversion for
the new fields
On Fri, 2022-07-08 at 16:42 +0200, Vitaly Kuznetsov wrote:
> Enlightened VMCS v1 definition was updated with new fields, support
> them in KVM by defining VMCS-to-EVMCS conversion.
>
> Note: SSP, CET and Guest LBR features are not supported by KVM yet and
> the corresponding fields are not defined in 'enum vmcs_field', leave
> them commented out for now.
>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@...hat.com>
> ---
> arch/x86/kvm/vmx/evmcs.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/arch/x86/kvm/vmx/evmcs.c b/arch/x86/kvm/vmx/evmcs.c
> index 6a61b1ae7942..8bea5dea0341 100644
> --- a/arch/x86/kvm/vmx/evmcs.c
> +++ b/arch/x86/kvm/vmx/evmcs.c
> @@ -28,6 +28,8 @@ const struct evmcs_field vmcs_field_to_evmcs_1[] = {
> HV_VMX_ENLIGHTENED_CLEAN_FIELD_HOST_GRP1),
> EVMCS1_FIELD(HOST_IA32_EFER, host_ia32_efer,
> HV_VMX_ENLIGHTENED_CLEAN_FIELD_HOST_GRP1),
> + EVMCS1_FIELD(HOST_IA32_PERF_GLOBAL_CTRL, host_ia32_perf_global_ctrl,
> + HV_VMX_ENLIGHTENED_CLEAN_FIELD_HOST_GRP1),
> EVMCS1_FIELD(HOST_CR0, host_cr0,
> HV_VMX_ENLIGHTENED_CLEAN_FIELD_HOST_GRP1),
> EVMCS1_FIELD(HOST_CR3, host_cr3,
> @@ -78,6 +80,8 @@ const struct evmcs_field vmcs_field_to_evmcs_1[] = {
> HV_VMX_ENLIGHTENED_CLEAN_FIELD_GUEST_GRP1),
> EVMCS1_FIELD(GUEST_IA32_EFER, guest_ia32_efer,
> HV_VMX_ENLIGHTENED_CLEAN_FIELD_GUEST_GRP1),
> + EVMCS1_FIELD(GUEST_IA32_PERF_GLOBAL_CTRL, guest_ia32_perf_global_ctrl,
> + HV_VMX_ENLIGHTENED_CLEAN_FIELD_GUEST_GRP1),
> EVMCS1_FIELD(GUEST_PDPTR0, guest_pdptr0,
> HV_VMX_ENLIGHTENED_CLEAN_FIELD_GUEST_GRP1),
> EVMCS1_FIELD(GUEST_PDPTR1, guest_pdptr1,
> @@ -126,6 +130,28 @@ const struct evmcs_field vmcs_field_to_evmcs_1[] = {
> HV_VMX_ENLIGHTENED_CLEAN_FIELD_GUEST_GRP1),
> EVMCS1_FIELD(XSS_EXIT_BITMAP, xss_exit_bitmap,
> HV_VMX_ENLIGHTENED_CLEAN_FIELD_CONTROL_GRP2),
> + EVMCS1_FIELD(ENCLS_EXITING_BITMAP, encls_exiting_bitmap,
> + HV_VMX_ENLIGHTENED_CLEAN_FIELD_CONTROL_GRP2),
> + EVMCS1_FIELD(TSC_MULTIPLIER, tsc_multiplier,
> + HV_VMX_ENLIGHTENED_CLEAN_FIELD_CONTROL_GRP2),
> + /*
> + * Not used by KVM:
> + *
> + * EVMCS1_FIELD(0x00006828, guest_ia32_s_cet,
> + * HV_VMX_ENLIGHTENED_CLEAN_FIELD_GUEST_GRP1),
> + * EVMCS1_FIELD(0x0000682A, guest_ssp,
> + * HV_VMX_ENLIGHTENED_CLEAN_FIELD_GUEST_BASIC),
> + * EVMCS1_FIELD(0x0000682C, guest_ia32_int_ssp_table_addr,
> + * HV_VMX_ENLIGHTENED_CLEAN_FIELD_GUEST_GRP1),
> + * EVMCS1_FIELD(0x00002816, guest_ia32_lbr_ctl,
> + * HV_VMX_ENLIGHTENED_CLEAN_FIELD_GUEST_GRP1),
> + * EVMCS1_FIELD(0x00006C18, host_ia32_s_cet,
> + * HV_VMX_ENLIGHTENED_CLEAN_FIELD_HOST_GRP1),
> + * EVMCS1_FIELD(0x00006C1A, host_ssp,
> + * HV_VMX_ENLIGHTENED_CLEAN_FIELD_HOST_GRP1),
> + * EVMCS1_FIELD(0x00006C1C, host_ia32_int_ssp_table_addr,
> + * HV_VMX_ENLIGHTENED_CLEAN_FIELD_HOST_GRP1),
> + */
>
> /* 64 bit read only */
> EVMCS1_FIELD(GUEST_PHYSICAL_ADDRESS, guest_physical_address,
I checked the Intel's SDM for encodings of the unused fields,
and checked the [1] for the clean bits.
All look good but as usual I could have missed something.
[1] https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/tlfs/datatypes/hv_vmx_enlightened_vmcs
Reviewed-by: Maxim Levitsky <mlevitsk@...hat.com>
Best regards,
Maxim Levitsky
Powered by blists - more mailing lists