Re: [RFC PATCH 12/15] KVM: TDX: Add in-kernel Quote generation

From: Dan Williams (nvidia)

Date: Fri Jun 12 2026 - 20:20:44 EST


Xu Yilun wrote:
> From: Peter Fang <peter.fang@xxxxxxxxx>
>
> Provide an in-kernel path for TDX Quote generation when handling
> TDG.VP.VMCALL<GetQuote>, without requiring an exit to userspace.
>
> Use the core TDX API when the TDX Quoting extension is available. For
> simplicity, each KVM guest checks for availability only once during
> initialization. KVM does not handle Quoting service disruptions.
>
> Signed-off-by: Peter Fang <peter.fang@xxxxxxxxx>
> Signed-off-by: Xu Yilun <yilun.xu@xxxxxxxxxxxxxxx>
> ---
[..]
> +static u64 __get_quote_kernel(struct kvm_vcpu *vcpu, struct tdx_quote_req *req,
> + size_t req_len, gpa_t req_gpa, size_t total_len)
> +{
> + struct tdx_td *td = &to_kvm_tdx(vcpu->kvm)->td;
> +
> + /* Only support version 1 as defined in the GHCI spec */
> + if (req->version != 1)
> + return TDX_QUOTE_STATUS_ERROR;
> +
> + if ((size_t)req->in_len + TDX_QUOTE_REQ_HDR_SIZE > req_len)
> + return TDX_QUOTE_STATUS_ERROR;
> +
> + /* The caller frees the quote data */

No, it is freed by cleanup as far as I can see

> + void *quote_data __free(kvfree) =

...this shadows the global "quote_data". A global really should be
properly namespaced.