Skip to content

Commit 8d73829

Browse files
tlendackybp3tk0v
authored andcommitted
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
1 parent 26a9f90 commit 8d73829

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

arch/x86/boot/startup/sev-shared.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,13 +458,24 @@ void do_vc_no_ghcb(struct pt_regs *regs, unsigned long exit_code)
458458
leaf.fn = fn;
459459
leaf.subfn = subfn;
460460

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+
*/
461468
ret = snp_cpuid(snp_cpuid_hv_msr, NULL, &leaf);
462469
if (!ret)
463470
goto cpuid_done;
464471

465472
if (ret != -EOPNOTSUPP)
466473
goto fail;
467474

475+
/*
476+
* This is reached by a SEV-ES guest and needs to invoke the HV for
477+
* the CPUID data.
478+
*/
468479
if (__sev_cpuid_hv_msr(&leaf))
469480
goto fail;
470481

0 commit comments

Comments
 (0)