[PATCH 0/3] Introduce Enhanced SMT Protection for SEV-SNP

From: Pratik R. Sampat

Date: Mon Sep 14 2026 - 13:24:09 EST


Enhanced SMT Protection (ESMTP) allows an SEV-SNP VM to require that,
while one of its vCPUs is in guest mode, every SMT sibling thread on
that physical core is either idle in host mode or running a vCPU the
guest itself has declared a legal sibling. This mitigates the
side-channel risk of sharing core resources with untrusted host threads
or with another guest.

Unlike core scheduling, where co-residency is a host kernel policy
expressed with cookies, ESMTP is enforced by hardware. The sibling mask
lives in the VMSA. The host is not trusted to run arbitrary kernel,
userspace, or interrupt-handling work on a sibling thread while an ESMTP
vCPU is active on that core.

Both KVM and the guest fully set the VCPU_SIBLING_MASK, which places
every vCPU of the guest in one group so that any two of them may be
co-resident. Combined with the ASID check, the sibling of a vCPU in
guest mode is then always either another vCPU of that same guest or a
thread idle in host mode.

Usage
-----
Requires patched OVMF [1] and QEMU [2] builds. Launch an SEV-SNP guest
with ESMTP enabled on the sev-snp-guest object:

-object sev-snp-guest,id=sev0,cbitpos=51,reduced-phys-bits=1,esmtp=on

ESMTP is opt-in because it carries a performance cost as VMRUN stalls
until the sibling runs work from a trusted vCPU or is in host idle.

The guest reports the feature in dmesg among the SNP feature names:

# dmesg | grep -i SEV
... SEV-SNP ... ESMTProt ...

Empirical test
--------------
* Identify siblings via:
cat /sys/devices/system/cpu/cpuX/topology/thread_siblings_list
* Pin the guest on the siblings
* Spawn a load in the guest e.g. via stress-ng --cpu 2 for SMT=2.
Expect the guest utilization % for both sibling CPUs to be at 100% as
the vCPU siblings are deemed trusted
* Spawn a load in the host latched onto one of the siblings.
E.g. taskset -C X stress-ng --cpu 1
* Expect CPU X's utilization to be shared between host and guest %.
Also expect drop in CPU utilization on the thread Sibling CPU as when
the host task runs the guest will be forced idle.

Patches based on cryptodev-2.6

[1]: https://github.com/tianocore/edk2/pull/13128
[2]: https://lore.kernel.org/kvm/cover.1789399242.git.prsampat@xxxxxxx/

Pratik R. Sampat (3):
KVM: SVM: Re-queue events that were never injected
KVM: SVM: Add host support for Enhanced SMT Protection
x86/sev: Add guest support for Enhanced SMT Protection

arch/x86/boot/compressed/sev.c | 2 +-
arch/x86/coco/sev/core.c | 13 ++++++++
arch/x86/include/asm/cpufeatures.h | 1 +
arch/x86/include/asm/msr-index.h | 5 +++-
arch/x86/include/asm/svm.h | 12 ++++++--
arch/x86/include/uapi/asm/svm.h | 9 +++++-
arch/x86/kernel/cpu/scattered.c | 1 +
arch/x86/kvm/svm/sev.c | 48 +++++++++++++++++++++++++++++-
arch/x86/kvm/svm/svm.c | 40 ++++++++++++++++++++++---
9 files changed, 121 insertions(+), 10 deletions(-)

--
2.43.0