Re: [PATCH v10 05/16] x86/virt/tdx: Add skeleton to enable TDX on demand

From: Dave Hansen
Date: Thu Mar 23 2023 - 09:49:46 EST


On 3/15/23 04:10, Huang, Kai wrote:
> I can do. Just want to make sure do you want to retry TDX_SYS_BUSY, or retry
> TDX_RND_NO_ENTROPY (if we want to ask TDX module guys to change to return this
> value)?

I'll put it this way:

Linux is going to treat TDX_SYS_BUSY like a Linux bug and assume
Linux is doing something wrong. It'll mostly mean that
users will see something nasty and may even cause Linux to give
up on TDX. In other words, the TDX module shouldn't use
TDX_SYS_BUSY for things that aren't Linux's fault.

> Also, even we retry either TDX_SYS_BUSY or TDX_RND_NO_ENTROPY in common
> seamcall() code, it doesn't handle the TDH.SYS.KEY.CONFIG, because sadly this
> SEAMCALL returns a different error code:
>
> TDX_KEY_GENERATION_FAILED Failed to generate a random key. This is
> typically caused by an entropy error of the
> CPU's random number generator, and may
> be impacted by RDSEED, RDRAND or PCONFIG
> executing on other LPs. The operation should be
> retried.

Sounds like we should just replace TDX_KEY_GENERATION_FAILED with
TDX_RND_NO_ENTROPY in cases where key generation fails because of a lack
of entropy.