Re: [PATCH v2 04/21] x86/virt/tdx: Prepare to support P-SEAMLDR SEAMCALLs
From: Chao Gao
Date: Tue Dec 02 2025 - 02:23:50 EST
>> +static inline bool is_seamldr_call(u64 fn)
>> +{
>> + return fn & SEAMLDR_SEAMCALL_MASK;
>> +}
>> +
>> +static inline bool sc_need_retry(u64 fn, u64 error_code)
>> +{
>> + if (is_seamldr_call(fn))
>
>Comparing to TDX module seamcall, seamldr seamcall should be much less.
>Maybe unlikely()?
Makes sense.
>
>> + return error_code == SEAMLDR_RND_NO_ENTROPY;
>> + else
>> + return error_code == TDX_RND_NO_ENTROPY;
>> +}
>> +
>> static __always_inline u64 sc_retry(sc_func_t func, u64 fn,
>> struct tdx_module_args *args)
>> {
>> @@ -22,7 +35,7 @@ static __always_inline u64 sc_retry(sc_func_t func, u64 fn,
>> do {
>> ret = func(fn, args);
>> - } while (ret == TDX_RND_NO_ENTROPY && --retry);
>> + } while (sc_need_retry(fn, ret) && --retry);
>> return ret;
>> }
>> @@ -48,6 +61,17 @@ static inline void seamcall_err_ret(u64 fn, u64 err,
>> args->r9, args->r10, args->r11);
>> }
>> +static inline void seamldr_err(u64 fn, u64 err, struct tdx_module_args *args)
>> +{
>> + /*
>> + * Get the actual leaf number. No need to print the bit used to
>> + * differentiate between P-SEAMLDR and TDX module as the "P-SEAMLDR"
>> + * string in the error message already provides that information.
>> + */
>> + fn &= ~SEAMLDR_SEAMCALL_MASK;
>> + pr_err("P-SEAMLDR (%lld) failed: 0x%016llx\n", fn, err);
>
>%lld -> %llu ?
>
>And 0x% -> %# to align with seamcall_err().
Sure. Will Do.