On Mon, Aug 29, 2022 at 12:07:55PM +0800, Binbin Wu <binbin.wu@xxxxxxxxxxxxxxx> wrote: > > diff --git a/arch/x86/kvm/vmx/main.c b/arch/x86/kvm/vmx/main.c > > index 7b497ed1f21c..067f5de56c53 100644 > > --- a/arch/x86/kvm/vmx/main.c > > +++ b/arch/x86/kvm/vmx/main.c > > @@ -73,6 +73,14 @@ static void vt_vm_free(struct kvm *kvm) > > return tdx_vm_free(kvm); > > } > > +static int vt_mem_enc_ioctl(struct kvm *kvm, void __user *argp) > > +{ > > + if (!is_td(kvm)) > > + return -ENOTTY; > > + > > + return tdx_vm_ioctl(kvm, argp); > > +} > > + > > struct kvm_x86_ops vt_x86_ops __initdata = { > > .name = "kvm_intel", > > @@ -214,6 +222,7 @@ struct kvm_x86_ops vt_x86_ops __initdata = { > > .vcpu_deliver_sipi_vector = kvm_vcpu_deliver_sipi_vector, > > .dev_mem_enc_ioctl = tdx_dev_ioctl, > > + .mem_enc_ioctl = vt_mem_enc_ioctl, > > suggeust to align the interafce/function name style with the scop. > > patch 21 and 27 have the scope in interafce names(dev / vcpu), may be > clearer to use vcpu_mem_enc_ioctl? This is a matter of preference. I intentionally chose to drop mem_enc part because actually KVM_MEMORY_ENCRYPT_OP is abused for TDX or SEV(-SNP) specific operation. Subcommand for KVM_MEMORY_ENCRYPT_OP is not directly related to memory encryption. It should be KVM_CONFIDENTIAL_OP or something. Unfortunately it's too late to rename it. -- Isaku Yamahata <isaku.yamahata@xxxxxxxxx>