Re: [PATCH v1 15/23] KVM: nVMX: Add support for the secondary VM exit controls

Jeremi Piotrowski
2023-11-09T08:21:32Z

On 08/11/2023 19:29, Xin Li wrote:
> Enable the secondary VM exit controls to prepare for nested FRED.
>
> Tested-by: Shan Kang <shan.kang@intel.com>
> Signed-off-by: Xin Li <xin3.li@intel.com>
> ---
> Documentation/virt/kvm/x86/nested-vmx.rst | 1 +
> arch/x86/include/asm/hyperv-tlfs.h | 1 +
> arch/x86/kvm/vmx/capabilities.h | 1 +
> arch/x86/kvm/vmx/hyperv.c | 18 +++++++++++++++++-
> arch/x86/kvm/vmx/nested.c | 18 +++++++++++++++++-
> arch/x86/kvm/vmx/vmcs12.c | 1 +
> arch/x86/kvm/vmx/vmcs12.h | 2 ++
> arch/x86/kvm/x86.h | 2 +-
> 8 files changed, 41 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/virt/kvm/x86/nested-vmx.rst b/Documentation/virt/kvm/x86/nested-vmx.rst
> index ac2095d41f02..e64ef231f310 100644
> --- a/Documentation/virt/kvm/x86/nested-vmx.rst
> +++ b/Documentation/virt/kvm/x86/nested-vmx.rst
> @@ -217,6 +217,7 @@ struct shadow_vmcs is ever changed.
> u16 host_fs_selector;
> u16 host_gs_selector;
> u16 host_tr_selector;
> + u64 secondary_vm_exit_controls;
> };
>
>
> diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h
> index 2ff26f53cd62..299554708e37 100644
> --- a/arch/x86/include/asm/hyperv-tlfs.h
> +++ b/arch/x86/include/asm/hyperv-tlfs.h
> @@ -616,6 +616,7 @@ struct hv_enlightened_vmcs {
> u64 host_ssp;
> u64 host_ia32_int_ssp_table_addr;
> u64 padding64_6;
> + u64 secondary_vm_exit_controls;
> } __packed;
> > #define HV_VMX_ENLIGHTENED_CLEAN_FIELD_NONE 0

Hi Xin Li,

The comment at the top of hyperv-tlfs.h says:
"This file contains definitions from Hyper-V Hypervisor Top-Level Functional Specification (TLFS)"

These struct definitions are shared with the hypervisor, so you can't just add fields to it.
Same comment for patch 16.

Would FRED work in nested virtualization if the L0 hypervisor does not support it (or doesn't know
about it)?

Thanks,
Jeremi