[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e5ede906-0dd2-4f41-86e1-1364c8321774@intel.com>
Date: Sun, 11 May 2025 11:57:50 +0300
From: Adrian Hunter <adrian.hunter@...el.com>
To: <pbonzini@...hat.com>, <seanjc@...gle.com>
CC: <mlevitsk@...hat.com>, <kvm@...r.kernel.org>,
<rick.p.edgecombe@...el.com>, <kirill.shutemov@...ux.intel.com>,
<kai.huang@...el.com>, <reinette.chatre@...el.com>, <xiaoyao.li@...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 V3 1/1] KVM: TDX: Add sub-ioctl KVM_TDX_TERMINATE_VM
On 25/04/2025 10:57, Adrian Hunter wrote:
> +static int tdx_terminate_vm(struct kvm *kvm)
> +{
> + if (!kvm_trylock_all_vcpus(kvm))
Introduction of kvm_trylock_all_vcpus() is still in progress:
https://lore.kernel.org/r/20250430203013.366479-3-mlevitsk@redhat.com/
but it has kvm_trylock_all_vcpus(kvm) return value the other way around, so
this will instead need to be:
if (kvm_trylock_all_vcpus(kvm))
> + return -EBUSY;
> +
> + kvm_vm_dead(kvm);
> +
> + kvm_unlock_all_vcpus(kvm);
> +
> + tdx_mmu_release_hkid(kvm);
> +
> + return 0;
> +}
> +
> int tdx_vm_ioctl(struct kvm *kvm, void __user *argp)
> {
> struct kvm_tdx_cmd tdx_cmd;
> @@ -2817,6 +2825,9 @@ int tdx_vm_ioctl(struct kvm *kvm, void __user *argp)
> case KVM_TDX_FINALIZE_VM:
> r = tdx_td_finalize(kvm, &tdx_cmd);
> break;
> + case KVM_TDX_TERMINATE_VM:
> + r = tdx_terminate_vm(kvm);
> + break;
> default:
> r = -EINVAL;
> goto out;
Powered by blists - more mailing lists