KVM: selftests: Switch to updated eVMCSv1 definition
authorVitaly Kuznetsov <vkuznets@redhat.com>
Tue, 30 Aug 2022 13:37:17 +0000 (15:37 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 26 Sep 2022 16:02:46 +0000 (12:02 -0400)
Update Enlightened VMCS definition in selftests from KVM.

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-14-vkuznets@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/include/x86_64/evmcs.h

index 3c9260f..58db74f 100644 (file)
@@ -203,14 +203,25 @@ struct hv_enlightened_vmcs {
                u32 reserved:30;
        } hv_enlightenments_control;
        u32 hv_vp_id;
-
+       u32 padding32_2;
        u64 hv_vm_id;
        u64 partition_assist_page;
        u64 padding64_4[4];
        u64 guest_bndcfgs;
-       u64 padding64_5[7];
+       u64 guest_ia32_perf_global_ctrl;
+       u64 guest_ia32_s_cet;
+       u64 guest_ssp;
+       u64 guest_ia32_int_ssp_table_addr;
+       u64 guest_ia32_lbr_ctl;
+       u64 padding64_5[2];
        u64 xss_exit_bitmap;
-       u64 padding64_6[7];
+       u64 encls_exiting_bitmap;
+       u64 host_ia32_perf_global_ctrl;
+       u64 tsc_multiplier;
+       u64 host_ia32_s_cet;
+       u64 host_ssp;
+       u64 host_ia32_int_ssp_table_addr;
+       u64 padding64_6;
 };
 
 #define HV_VMX_ENLIGHTENED_CLEAN_FIELD_NONE                     0
@@ -656,6 +667,18 @@ static inline int evmcs_vmread(uint64_t encoding, uint64_t *value)
        case VIRTUAL_PROCESSOR_ID:
                *value = current_evmcs->virtual_processor_id;
                break;
+       case HOST_IA32_PERF_GLOBAL_CTRL:
+               *value = current_evmcs->host_ia32_perf_global_ctrl;
+               break;
+       case GUEST_IA32_PERF_GLOBAL_CTRL:
+               *value = current_evmcs->guest_ia32_perf_global_ctrl;
+               break;
+       case ENCLS_EXITING_BITMAP:
+               *value = current_evmcs->encls_exiting_bitmap;
+               break;
+       case TSC_MULTIPLIER:
+               *value = current_evmcs->tsc_multiplier;
+               break;
        default: return 1;
        }
 
@@ -1169,6 +1192,22 @@ static inline int evmcs_vmwrite(uint64_t encoding, uint64_t value)
                current_evmcs->virtual_processor_id = value;
                current_evmcs->hv_clean_fields &= ~HV_VMX_ENLIGHTENED_CLEAN_FIELD_CONTROL_XLAT;
                break;
+       case HOST_IA32_PERF_GLOBAL_CTRL:
+               current_evmcs->host_ia32_perf_global_ctrl = value;
+               current_evmcs->hv_clean_fields &= ~HV_VMX_ENLIGHTENED_CLEAN_FIELD_HOST_GRP1;
+               break;
+       case GUEST_IA32_PERF_GLOBAL_CTRL:
+               current_evmcs->guest_ia32_perf_global_ctrl = value;
+               current_evmcs->hv_clean_fields &= ~HV_VMX_ENLIGHTENED_CLEAN_FIELD_GUEST_GRP1;
+               break;
+       case ENCLS_EXITING_BITMAP:
+               current_evmcs->encls_exiting_bitmap = value;
+               current_evmcs->hv_clean_fields &= ~HV_VMX_ENLIGHTENED_CLEAN_FIELD_CONTROL_GRP2;
+               break;
+       case TSC_MULTIPLIER:
+               current_evmcs->tsc_multiplier = value;
+               current_evmcs->hv_clean_fields &= ~HV_VMX_ENLIGHTENED_CLEAN_FIELD_CONTROL_GRP2;
+               break;
        default: return 1;
        }