From: Luigi Leonardi <leonardi@redhat.com>
To: Tommaso Califano <califano.tommaso@gmail.com>
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org,
"Eduardo Habkost" <eduardo@habkost.net>,
"Markus Armbruster" <armbru@redhat.com>,
"Zhao Liu" <zhao1.liu@intel.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Marcelo Tosatti" <mtosatti@redhat.com>,
"Eric Blake" <eblake@redhat.com>,
"Oliver Steffen" <osteffen@redhat.com>,
"Stefano Garzarella" <sgarzare@redhat.com>,
"Giuseppe Lettieri" <giuseppe.lettieri@unipi.it>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>
Subject: Re: [PATCH 0/5] i386/sev: Add TCG-emulated AMD SEV guest support
Date: Tue, 17 Mar 2026 14:01:59 +0100 [thread overview]
Message-ID: <ablPsAJl1k1raW7v@leonardi-redhat> (raw)
In-Reply-To: <20260317113840.33017-1-califano.tommaso@gmail.com>
On Tue, Mar 17, 2026 at 12:38:35PM +0100, Tommaso Califano wrote:
>From: Tommaso Califano <califano.tommaso@gmail.com>
>
>QEMU's AMD SEV support currently requires KVM on expensive AMD EPYC
>hardware, limiting development and testing of SEV-aware guest software to
>users with server-grade machines.
>
>This series introduces a TCG-emulated SEV guest mode that enables SEV
>validation without hardware dependencies, focusing on functional testing
>rather than reproducing the hardware’s cryptographic context.
>
>The emulation exposes SEV from the guest's perspective:
> - Exposed CPUID leaf 0x8000001F to indicate active support.
> - Active bit 0 in MSR 0xc0010131 to enable SEV on the guest.
> - C-bit manipulation in PTEs/CR3 for paging consistency with the host.
> - Complete SEV attestation workflow for injecting secrets into guest
> memory (including direct kernel boot support).
>
>The emulation uses a new QOM object "sev-emulated", derived from
>"sev-guest", to maximize reuse of the existing SEV infrastructure while
>maintaining a compiling dependency with KVM.
>Below are the pros and cons of this choice.
>
>In addition to inherited guest properties, two new ones are added (binary
>files; default all-zero):
> - tik: 16-byte Transport Integrity Key (TIK) for measurement HMAC.
> - tek: 16-byte Transport Encryption Key (TEK) for secret payload
> decryption.
>
>Code reuse benefits:
> - SEV detection via sev_enabled() and TYPE_SEV_COMMON object cast enables
> the required checks for emulation without adding new conditions to the
> codebase.
> - QAPI fields for query-sev/launch-measure inherited from SevCommonState
> and SevGuestState.
> - Identical QMP interface (query-sev, query-sev-launch-measure,
> sev-inject-launch-secret) as real SEV.
> - Shared state machine (sev_set_guest_state()); override backend vtable
> only (kvm_init → sev_emulated_init, launch_update_data, launch_finish,
> sev_launch_get_measure).
>
>Trade-offs:
> - KVM linkage: sev-guest is KVM-centric; even if KVM is not used at
> runtime, its code is required for compilation, so it is not possible to
> use emulation with --disable-kvm.
>
>Example usage:
>
> -cpu "EPYC-Milan" \
> -accel tcg \
> -object sev-emulated,id=sev0,cbitpos=47,reduced-phys-bits=1,\
> tik=/path/to/tik.bin,tek=/path/to/tek.bin \
> -machine memory-encryption=sev0
>
>Build requirements:
>
> ../qemu/configure --enable-gcrypt --enable-crypto-afalg
>
>These provide libgcrypt support for crypto/hmac.h, crypto/cipher.h, and
>crypto/random.h, used for:
> - HMAC-SHA256 launch measurement (TIK key).
> - Secret payload decryption (TEK key).
>Note: --disable-kvm unsupported due to sev-guest inheritance (KVM code
>linked, no runtime dependency).
>
>
To give maintainers some more context: this is part of an ongoing work to
enable SNP emulation in QEMU, which would be very useful for development
purposes (eg coconut-SVSM). However, it should not be used in a production
environment as it provides no security guarantees.
Please consider this as an RFC.
Luigi
prev parent reply other threads:[~2026-03-17 13:02 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-17 11:38 [PATCH 0/5] i386/sev: Add TCG-emulated AMD SEV guest support Tommaso Califano
2026-03-17 11:38 ` [PATCH 1/5] i386/sev: Add sev-emulated QOM object with TCG support Tommaso Califano
2026-03-19 12:31 ` Markus Armbruster
2026-03-20 14:25 ` Tommaso Califano
2026-03-20 14:48 ` Markus Armbruster
2026-03-20 15:34 ` Tommaso Califano
2026-03-19 17:49 ` Daniel P. Berrangé
2026-03-20 7:44 ` Markus Armbruster
2026-03-20 12:40 ` Daniel P. Berrangé
2026-03-20 15:23 ` Tommaso Califano
2026-03-23 7:24 ` Markus Armbruster
2026-03-20 12:39 ` Daniel P. Berrangé
2026-03-20 15:03 ` Tommaso Califano
2026-03-20 15:32 ` Tommaso Califano
2026-03-17 11:38 ` [PATCH 2/5] target/i386: Add MSR SEV support and C-bit reset on TCG Tommaso Califano
2026-03-17 11:38 ` [PATCH 3/5] i386/sev: Implement SEV launch state sequence and query-sev Tommaso Califano
2026-03-17 11:38 ` [PATCH 4/5] i386/sev: Add launch measurement emulation and TIK property Tommaso Califano
2026-03-19 12:33 ` Markus Armbruster
2026-03-20 14:31 ` Tommaso Califano
2026-03-17 11:38 ` [PATCH 5/5] i386/sev: Implement emulated launch secret injection and TEK property Tommaso Califano
2026-03-17 13:01 ` Luigi Leonardi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ablPsAJl1k1raW7v@leonardi-redhat \
--to=leonardi@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=califano.tommaso@gmail.com \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=giuseppe.lettieri@unipi.it \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=osteffen@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=sgarzare@redhat.com \
--cc=zhao1.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox