On 10/2/2026 3:37 AM, Lisa Wang wrote:
> From: Sagi Shahar <[email protected]>
> 
> Allocate memory for TDX boot parameters and define the utility functions
> necessary to fill this memory with the boot parameters.
> 
> 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]>

One nit below and the issue pointed by the sashiko.

Otherwise,
Reviewed-by: Binbin Wu <[email protected]>

[...]

> +void tdx_vm_setup_boot_parameters_region(struct kvm_vm *vm, u32 
> nr_runnable_vcpus)
> +{
> +     size_t boot_params_size = sizeof(struct td_boot_parameters) +
> +             nr_runnable_vcpus * sizeof(struct td_per_vcpu_parameters);
> +     int npages = DIV_ROUND_UP(boot_params_size, PAGE_SIZE);
> +     const u64 gmem_flags = 0;
> +     gpa_t gpa;
> +
> +     vm_mem_add(vm, VM_MEM_SRC_SHMEM, TD_BOOT_PARAMETERS_GPA,
> +                TD_BOOT_PARAMETERS_SLOT, npages,
> +                KVM_MEM_GUEST_MEMFD, -1, 0, gmem_flags);
> +     gpa = vm_phy_pages_alloc(vm, npages, TD_BOOT_PARAMETERS_GPA, 
> TD_BOOT_PARAMETERS_SLOT);
> +     TEST_ASSERT(gpa == TD_BOOT_PARAMETERS_GPA, "Failed 
> vm_phy_pages_alloc\n");

Nit: the tailing newline can be dropped.

> +
> +     virt_map(vm, TD_BOOT_PARAMETERS_GPA, TD_BOOT_PARAMETERS_GPA, npages);
> +}
> +

Reply via email to