Re: [PATCH v5 05/22] x86/virt/seamldr: Retrieve P-SEAMLDR information

From: Chao Gao

Date: Mon Mar 16 2026 - 21:10:05 EST


>> +
>> +int seamldr_get_info(struct seamldr_info *seamldr_info)
>> +{
>> + /*
>> + * Use slow_virt_to_phys() since @seamldr_info may be allocated on
>> + * the stack.
>> + */
>> + struct tdx_module_args args = { .rcx = slow_virt_to_phys(seamldr_info) };
>> +
>> + return seamldr_call(P_SEAMLDR_INFO, &args);
>
>On what condition this information can change?

After each update, the num_remaining_updates field will change.

>
>I see the next patch calls this on every _show operation. Would we
>benefit from caching the response?

Yes, caching would save a few cycles, but adds complexity. we'd need to keep
the cache synchronized and invalidate it when values change, likely requiring
additional state tracking.

Dave recommended allocating the structure on the stack [*] when I raised the
caching idea.

This isn't a hot path, so I prefer keeping it "simple and stupid".

[*]: https://lore.kernel.org/all/56a62e54-59f7-4423-9f01-4472d5c3815d@xxxxxxxxx/

>
>> +}
>> +EXPORT_SYMBOL_FOR_MODULES(seamldr_get_info, "tdx-host");
>> --
>> 2.47.3
>>
>
>--
> Kiryl Shutsemau / Kirill A. Shutemov