On Wed, Oct 20, 2021 at 07:35:35PM -0500, Michael Roth wrote: > Fortunately, all the code makes use of sev_status to get at the SEV MSR > bits, so breaking the appropriate bits out of sme_enable() into an earlier > sev_init() routine that's the exclusive writer of sev_status sounds like a > promising approach. Ack. > It makes sense to do it immediately after the first #VC handler is set > up, so CPUID is available, and since that's where SNP CPUID table > initialization would need to happen if it's to be made available in > #VC handler. Right, and you can do all your init/CPUID prep there. > It may even be similar enough between boot/compressed and run-time kernel > that it could be a shared routine in sev-shared.c. Uuh, bonus points! :-) > But then again it also sounds like the appropriate place to move the > snp_cpuid_init*() calls, and locating the cc_blob, and since there's > differences there it might make sense to keep the boot/compressed and > kernel proper sev_init() routines separate to avoid #ifdeffery). > > Not to get ahead of myself though. Just seems like a good starting point > for how to consolidate the various users. I like how you're thinking. :) > Got it, and my apologies if I've given you that impression as it's > certainly not my intent. (though I'm sure you've heard that before.) Nothing to apologize - all good. > Agreed, if we need to check SEV MSR early for the purposes of SNP it makes > sense to move the overall SEV feature detection code earlier as well. I > should have looked into that aspect more closely before introducing the > changes. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette