On Wed, Jul 22, 2026 at 11:13:21PM +0000, Lisa Wang wrote:
> From: Sagi Shahar <[email protected]>
> 
> Allocate a guest stack for each vCPU and record the GVA in the TDX boot
> parameters region to allow proper vCPU initialization.
> 
> Co-developed-by: Ackerley Tng <[email protected]>
> Signed-off-by: Ackerley Tng <[email protected]>
> Signed-off-by: Sagi Shahar <[email protected]>
> Signed-off-by: Lisa Wang <[email protected]>
> Reviewed-by: Binbin Wu <[email protected]>
> ---
>  tools/testing/selftests/kvm/include/x86/tdx/tdx_util.h |  1 +
>  tools/testing/selftests/kvm/lib/x86/processor.c        |  2 ++
>  tools/testing/selftests/kvm/lib/x86/tdx/tdx_util.c     | 10 ++++++++++
>  3 files changed, 13 insertions(+)
> 

[ ... ]

>  
> +void tdx_vcpu_load_boot_parameters(struct kvm_vm *vm, struct kvm_vcpu *vcpu)
> +{
> +     struct td_boot_parameters *params =
> +             addr_gpa2hva(vm, TD_BOOT_PARAMETERS_GPA);
> +     struct td_per_vcpu_parameters *vcpu_params =
> +             &params->per_vcpu[vcpu->id];
> +
> +     vcpu_params->esp_gva = kvm_allocate_vcpu_stack(vm);

Just flagging that there is a subtle truncation here. The TDX boot code
sets esp in 32-bit mode so it has the same visibility constraint as CR3,
which has an explicit check ("vm->mmu.pgd < (1ULL << 32)").

> +}
> +
>  static struct kvm_tdx_capabilities *tdx_read_capabilities(struct kvm_vm *vm)
>  {
>       static struct kvm_tdx_capabilities *tdx_cap;
> 
> -- 
> 2.55.0.229.g6434b31f56-goog
> 
> 

Reply via email to