Skip to content

Commit c532f29

Browse files
sean-jcbonzini
authored andcommitted
KVM: SVM: Explicitly require DECODEASSISTS to enable SEV support
Add a sanity check on DECODEASSIST being support if SEV is supported, as KVM cannot read guest private memory and thus relies on the CPU to provide the instruction byte stream on #NPF for emulation. The intent of the check is to document the dependency, it should never fail in practice as producing hardware that supports SEV but not DECODEASSISTS would be non-sensical. Signed-off-by: Sean Christopherson <[email protected]> Reviewed-by: Liam Merwick <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 0b0be06 commit c532f29

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

arch/x86/kvm/svm/sev.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2100,8 +2100,13 @@ void __init sev_hardware_setup(void)
21002100
if (!sev_enabled || !npt_enabled)
21012101
goto out;
21022102

2103-
/* Does the CPU support SEV? */
2104-
if (!boot_cpu_has(X86_FEATURE_SEV))
2103+
/*
2104+
* SEV must obviously be supported in hardware. Sanity check that the
2105+
* CPU supports decode assists, which is mandatory for SEV guests to
2106+
* support instruction emulation.
2107+
*/
2108+
if (!boot_cpu_has(X86_FEATURE_SEV) ||
2109+
WARN_ON_ONCE(!boot_cpu_has(X86_FEATURE_DECODEASSISTS)))
21052110
goto out;
21062111

21072112
/* Retrieve SEV CPUID information */

0 commit comments

Comments
 (0)