[RFC][PATCH 10/34] x86/cpu/amd: Use new "address configuration" infrastructure

From: Dave Hansen
Date: Thu Feb 22 2024 - 13:45:09 EST



From: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>

The AMD memory encryption code is currently one of the 'boot_cpu_data'
field twiddlers. This has led to all kinds of interesting ordering
bugs at boot.

Move it away from random fiddling and over to 'bsp_addr_config'.

Signed-off-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
---

b/arch/x86/kernel/cpu/amd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff -puN arch/x86/kernel/cpu/amd.c~amd-phys_addr_reduction_bits arch/x86/kernel/cpu/amd.c
--- a/arch/x86/kernel/cpu/amd.c~amd-phys_addr_reduction_bits 2024-02-22 10:08:53.340644930 -0800
+++ b/arch/x86/kernel/cpu/amd.c 2024-02-22 10:08:53.344645087 -0800
@@ -622,7 +622,8 @@ static void early_detect_mem_encrypt(str
* will be a value above 32-bits this is still done for
* CONFIG_X86_32 so that accurate values are reported.
*/
- c->x86_phys_bits -= (cpuid_ebx(0x8000001f) >> 6) & 0x3f;
+ bsp_addr_config.phys_addr_reduction_bits =
+ (cpuid_ebx(0x8000001f) >> 6) & 0x3f;

if (IS_ENABLED(CONFIG_X86_32))
goto clear_all;
_