Re: [PATCH v8 20/40] x86/sev: Use SEV-SNP AP creation to start secondary CPUs

From: Brijesh Singh
Date: Wed Jan 12 2022 - 11:17:57 EST




On 12/10/21 12:50 PM, Dave Hansen wrote:
On 12/10/21 7:43 AM, Brijesh Singh wrote:
+ vmsa->efer = 0x1000; /* Must set SVME bit */
+ vmsa->cr4 = cr4;
+ vmsa->cr0 = 0x60000010;
+ vmsa->dr7 = 0x400;
+ vmsa->dr6 = 0xffff0ff0;
+ vmsa->rflags = 0x2;
+ vmsa->g_pat = 0x0007040600070406ULL;
+ vmsa->xcr0 = 0x1;
+ vmsa->mxcsr = 0x1f80;
+ vmsa->x87_ftw = 0x5555;
+ vmsa->x87_fcw = 0x0040;

This is a big fat pile of magic numbers. We also have nice macros for a
non-zero number of these, like:

#define MXCSR_DEFAULT 0x1f80

I understand that this probably _works_ as-is, but it doesn't look very
friendly if someone else needs to go hack on it.


APM documents the default value for the AP following the RESET or INIT, I will define macros and use them accordingly.

thx