Re: [PATCH v3 3/6] KVM: VMX: Detect Tertiary VM-Execution control when setup VMCS config

Sean Christopherson
2021-08-05T22:35:50Z

On Thu, Aug 05, 2021, Zeng Guang wrote:
> +u64 vmx_tertiary_exec_control(struct vcpu_vmx *vmx)

Make this static and drop the declaration from vmx.h, there's no nested user (yet),
and I'm also working on a patch to rework how prepare_vmcs02_early() gets KVMs
desires without having to call these heleprs, i.e. I want to bury all of these in
vmx.c.

> +{
> + return vmcs_config.cpu_based_3rd_exec_ctrl;
> +}
> +
> /*
> * Adjust a single secondary execution control bit to intercept/allow an
> * instruction in the guest. This is usually done based on whether or not a
> @@ -4319,6 +4354,9 @@ static void init_vmcs(struct vcpu_vmx *vmx)
> secondary_exec_controls_set(vmx, vmx->secondary_exec_control);
> }
>
> + if (cpu_has_tertiary_exec_ctrls())
> + tertiary_exec_controls_set(vmx, vmx_tertiary_exec_control(vmx));
> +
> if (kvm_vcpu_apicv_active(&vmx->vcpu)) {
> vmcs_write64(EOI_EXIT_BITMAP0, 0);
> vmcs_write64(EOI_EXIT_BITMAP1, 0);
> diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h
> index 945c6639ce24..448006bd8fa7 100644
> --- a/arch/x86/kvm/vmx/vmx.h
> +++ b/arch/x86/kvm/vmx/vmx.h
> @@ -478,6 +478,7 @@ static inline u32 vmx_vmexit_ctrl(void)
>
> u32 vmx_exec_control(struct vcpu_vmx *vmx);
> u32 vmx_pin_based_exec_ctrl(struct vcpu_vmx *vmx);
> +u64 vmx_tertiary_exec_control(struct vcpu_vmx *vmx);
>
> static inline struct kvm_vmx *to_kvm_vmx(struct kvm *kvm)
> {
> --
> 2.25.1
>