[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z6vh3ih37Xrmv4TJ@google.com>
Date: Tue, 11 Feb 2025 15:48:46 -0800
From: Sean Christopherson <seanjc@...gle.com>
To: Binbin Wu <binbin.wu@...ux.intel.com>
Cc: pbonzini@...hat.com, kvm@...r.kernel.org, rick.p.edgecombe@...el.com,
kai.huang@...el.com, adrian.hunter@...el.com, reinette.chatre@...el.com,
xiaoyao.li@...el.com, tony.lindgren@...el.com, isaku.yamahata@...el.com,
yan.y.zhao@...el.com, chao.gao@...el.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 4/8] KVM: TDX: Handle KVM hypercall with TDG.VP.VMCALL
On Tue, Feb 11, 2025, Binbin Wu wrote:
> ---
> arch/x86/kvm/vmx/tdx.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> index 420ee492e919..daa49f2ee2b3 100644
> --- a/arch/x86/kvm/vmx/tdx.c
> +++ b/arch/x86/kvm/vmx/tdx.c
> @@ -964,6 +964,23 @@ fastpath_t tdx_vcpu_run(struct kvm_vcpu *vcpu, bool force_immediate_exit)
> return tdx_exit_handlers_fastpath(vcpu);
> }
>
> +static int complete_hypercall_exit(struct kvm_vcpu *vcpu)
> +{
> + tdvmcall_set_return_code(vcpu, vcpu->run->hypercall.ret);
> + return 1;
> +}
> +
> +static int tdx_emulate_vmcall(struct kvm_vcpu *vcpu)
> +{
> + kvm_rax_write(vcpu, to_tdx(vcpu)->vp_enter_args.r10);
> + kvm_rbx_write(vcpu, to_tdx(vcpu)->vp_enter_args.r11);
> + kvm_rcx_write(vcpu, to_tdx(vcpu)->vp_enter_args.r12);
> + kvm_rdx_write(vcpu, to_tdx(vcpu)->vp_enter_args.r13);
> + kvm_rsi_write(vcpu, to_tdx(vcpu)->vp_enter_args.r14);
> +
> + return __kvm_emulate_hypercall(vcpu, 0, complete_hypercall_exit);
Thanks for persevering through all the ideas and churn, I like how this turned
out!
Powered by blists - more mailing lists