Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

x86/startup/sev: Document the CPUID flow in the boot #VC handler

Document the CPUID reading the different SEV guest types do - the SNP
one which relies on the presence of a CPUID table and the SEV-ES one,
which reads the CPUID supplied by the hypervisor.

The intent being to clarify the two back-to-back, similar CPUID
invocations.

No functional changes.

[ bp: Turn into a proper patch. ]

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/fbb24767-0e06-d1d6-36e0-1757d98aca66@amd.com

authored by

Tom Lendacky and committed by
Borislav Petkov (AMD)
8d73829b 26a9f90b

+11
+11
arch/x86/boot/startup/sev-shared.c
··· 458 458 leaf.fn = fn; 459 459 leaf.subfn = subfn; 460 460 461 + /* 462 + * If SNP is active, then snp_cpuid() uses the CPUID table to obtain the 463 + * CPUID values (with possible HV interaction during post-processing of 464 + * the values). But if SNP is not active (no CPUID table present), then 465 + * snp_cpuid() returns -EOPNOTSUPP so that an SEV-ES guest can call the 466 + * HV to obtain the CPUID information. 467 + */ 461 468 ret = snp_cpuid(snp_cpuid_hv_msr, NULL, &leaf); 462 469 if (!ret) 463 470 goto cpuid_done; ··· 472 465 if (ret != -EOPNOTSUPP) 473 466 goto fail; 474 467 468 + /* 469 + * This is reached by a SEV-ES guest and needs to invoke the HV for 470 + * the CPUID data. 471 + */ 475 472 if (__sev_cpuid_hv_msr(&leaf)) 476 473 goto fail; 477 474