Re: [PATCH v4] x86/boot: Don't return encryption mask from __startup_64()

From: Huang, Kai
Date: Mon Jun 23 2025 - 07:26:30 EST


On Thu, 2025-06-19 at 07:36 +0000, Khalid Ali wrote:
> Avoid returning the SME encryption mask from __startup_64(), and instead
> let the function handle encryption directly as needed. 
>

Some nits below:

"the function" here is confusing, since it sounds like you are referring to
__startup_64(), but I think you actually meant its caller.

So, "the function" -> "the caller".


> The encryption
> mask is already available to callers and can be accessed via

"callers" -> "users", since only functions can have callers?

Or just:

The encryption mask is already available after sme_enable() and ...

?

> sme_get_me_mask() in C code, or directly through the sme_me_mask symbol
> in assembly, if CONFIG_AMD_MEM_ENCRYPT is enabled.
>
> This change aligns with how secondary_startup_64_no_verify handles SME
> and keeps the behavior consistent. For Intel CPUs, SME is not relevant,
> so there is no need to retrieve the mask unless CONFIG_AMD_MEM_ENCRYPT
> is enabled.
>
> Signed-off-by: Khalid Ali <khaliidcaliy@xxxxxxxxx>

Overall I think this patch makes code logic clearer, so:

Acked-by: Kai Huang <kai.huang@xxxxxxxxx>