Messages in this thread | | | Date | Wed, 3 Apr 2024 18:15:45 -0700 | From | Isaku Yamahata <> | Subject | Re: [PATCH v19 104/130] KVM: TDX: Add a place holder for handler of TDX hypercalls (TDG.VP.VMCALL) |
| |
On Mon, Apr 01, 2024 at 05:59:35PM +0800, Chao Gao <chao.gao@intel.com> wrote:
> > static inline bool is_td_vcpu_created(struct vcpu_tdx *tdx) > > { > > return tdx->td_vcpu_created; > >@@ -897,6 +932,11 @@ fastpath_t tdx_vcpu_run(struct kvm_vcpu *vcpu) > > > > tdx_complete_interrupts(vcpu); > > > >+ if (tdx->exit_reason.basic == EXIT_REASON_TDCALL) > >+ tdx->tdvmcall.rcx = vcpu->arch.regs[VCPU_REGS_RCX]; > > kvm_rcx_read()? > > > >+ else > >+ tdx->tdvmcall.rcx = 0; > > RCX on TDVMCALL exit is supposed to be consumed by TDX module. I don't get why > caching it is necessary. Can tdx->tdvmcall be simply dropped?
Now it's not used. Will drop tdvmcall.
It was originally used to remember a original register mask of TDVMCALL, and tdx_complete_vp_vmcall() used it as a valid value to copy back the output values. The current tdx_complete_vp_vmcall() uses kvm_rcx_read() because even if the user space changes rcx, it doesn't harm to KVM. KVM does what the user space tells. -- Isaku Yamahata <isaku.yamahata@intel.com>
| |