KVM: VMX: Define VMCS-to-EVMCS conversion for the new fields
authorVitaly Kuznetsov <vkuznets@redhat.com>
Tue, 30 Aug 2022 13:37:13 +0000 (15:37 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 26 Sep 2022 16:02:42 +0000 (12:02 -0400)
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.

Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20220830133737.1539624-10-vkuznets@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/evmcs.c

index b620880..c3a5309 100644 (file)
@@ -30,6 +30,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,
@@ -80,6 +82,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,
@@ -128,6 +132,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,