[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z6r0Q/zzjrDaHfXi@yzhao56-desk.sh.intel.com>
Date: Tue, 11 Feb 2025 14:54:59 +0800
From: Yan Zhao <yan.y.zhao@...el.com>
To: Binbin Wu <binbin.wu@...ux.intel.com>
CC: <pbonzini@...hat.com>, <seanjc@...gle.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>, <chao.gao@...el.com>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 5/8] KVM: TDX: Handle TDG.VP.VMCALL<MapGPA>
On Tue, Feb 11, 2025 at 10:54:39AM +0800, Binbin Wu wrote:
> +static int tdx_complete_vmcall_map_gpa(struct kvm_vcpu *vcpu)
> +{
> + struct vcpu_tdx *tdx = to_tdx(vcpu);
> +
> + if (vcpu->run->hypercall.ret) {
> + tdvmcall_set_return_code(vcpu, TDVMCALL_STATUS_INVALID_OPERAND);
> + tdx->vp_enter_args.r11 = tdx->map_gpa_next;
> + return 1;
> + }
> +
> + tdx->map_gpa_next += TDX_MAP_GPA_MAX_LEN;
> + if (tdx->map_gpa_next >= tdx->map_gpa_end)
> + return 1;
> +
> + /*
> + * Stop processing the remaining part if there is pending interrupt.
> + * Skip checking pending virtual interrupt (reflected by
> + * TDX_VCPU_STATE_DETAILS_INTR_PENDING bit) to save a seamcall because
> + * if guest disabled interrupt, it's OK not returning back to guest
> + * due to non-NMI interrupt. Also it's rare to TDVMCALL_MAP_GPA
> + * immediately after STI or MOV/POP SS.
> + */
> + if (pi_has_pending_interrupt(vcpu) ||
> + kvm_test_request(KVM_REQ_NMI, vcpu) || vcpu->arch.nmi_pending) {
Should here also use "kvm_vcpu_has_events()" to replace
"pi_has_pending_interrupt(vcpu) ||
kvm_test_request(KVM_REQ_NMI, vcpu) || vcpu->arch.nmi_pending" as Sean
suggested at [1]?
[1] https://lore.kernel.org/all/Z4rIGv4E7Jdmhl8P@google.com
> + tdvmcall_set_return_code(vcpu, TDVMCALL_STATUS_RETRY);
> + tdx->vp_enter_args.r11 = tdx->map_gpa_next;
> + return 1;
> + }
> +
> + __tdx_map_gpa(tdx);
> + return 0;
> +}
Powered by blists - more mailing lists