[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <930ca39f-41a6-44d4-85b1-552c56a417e8@intel.com>
Date: Wed, 16 Jul 2025 17:22:45 +0800
From: Xiaoyao Li <xiaoyao.li@...el.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: pbonzini@...hat.com, Adrian Hunter <adrian.hunter@...el.com>,
kvm@...r.kernel.org, rick.p.edgecombe@...el.com,
kirill.shutemov@...ux.intel.com, kai.huang@...el.com,
reinette.chatre@...el.com, tony.lindgren@...ux.intel.com,
binbin.wu@...ux.intel.com, isaku.yamahata@...el.com,
linux-kernel@...r.kernel.org, yan.y.zhao@...el.com, chao.gao@...el.com
Subject: Re: [PATCH V4 0/1] KVM: TDX: Decrease TDX VM shutdown time
On 7/11/2025 10:19 PM, Sean Christopherson wrote:
> On Fri, Jul 11, 2025, Xiaoyao Li wrote:
...
>>
>> I'm wondering if we need a TDX centralized enumeration interface, e.g., new
>> field in struct kvm_tdx_capabilities. I believe there will be more and more
>> TDX new features, and assigning each a KVM_CAP seems wasteful.
>
> Oh, yeah, that's a much better idea. In addition to not polluting KVM_CAP,
>
> LOL, and we certainly have the capacity in the structure:
>
> __u64 reserved[250];
>
> Sans documentation, something like so?
I suppose it will be squashed into the original patch, so just gave
Tested-by: Xiaoyao Li <xiaoyao.li@...el.com>
> --
> diff --git a/arch/x86/include/uapi/asm/kvm.h b/arch/x86/include/uapi/asm/kvm.h
> index 13da87c05098..70ffe6e8d216 100644
> --- a/arch/x86/include/uapi/asm/kvm.h
> +++ b/arch/x86/include/uapi/asm/kvm.h
> @@ -963,6 +963,8 @@ struct kvm_tdx_cmd {
> __u64 hw_error;
> };
>
> +#define KVM_TDX_CAP_TERMINATE_VM _BITULL(0)
> +
> struct kvm_tdx_capabilities {
> __u64 supported_attrs;
> __u64 supported_xfam;
> @@ -972,7 +974,9 @@ struct kvm_tdx_capabilities {
> __u64 kernel_tdvmcallinfo_1_r12;
> __u64 user_tdvmcallinfo_1_r12;
>
> - __u64 reserved[250];
> + __u64 supported_caps;
> +
> + __u64 reserved[249];
>
> /* Configurable CPUID bits for userspace */
> struct kvm_cpuid2 cpuid;
> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> index f4d4fd5cc6e8..783b1046f6c1 100644
> --- a/arch/x86/kvm/vmx/tdx.c
> +++ b/arch/x86/kvm/vmx/tdx.c
> @@ -189,6 +189,8 @@ static int init_kvm_tdx_caps(const struct tdx_sys_info_td_conf *td_conf,
> if (!caps->supported_xfam)
> return -EIO;
>
> + caps->supported_caps = KVM_TDX_CAP_TERMINATE_VM;
> +
> caps->cpuid.nent = td_conf->num_cpuid_config;
>
> caps->user_tdvmcallinfo_1_r11 =
Powered by blists - more mailing lists