i386/sev: Allow measured direct kernel boot on SNP
authorDov Murik <dovmurik@linux.ibm.com>
Thu, 30 May 2024 11:16:35 +0000 (06:16 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 5 Jun 2024 09:01:06 +0000 (11:01 +0200)
commitc1996992cc882b00139f78067d6a64e2ec9cb0d8
treefbe4d7c72954e4d2fefc4705e1c9c50ae439d64a
parentcc483bf911931f405dea682c74a3d8b9b6c54369
i386/sev: Allow measured direct kernel boot on SNP

In SNP, the hashes page designated with a specific metadata entry
published in AmdSev OVMF.

Therefore, if the user enabled kernel hashes (for measured direct boot),
QEMU should prepare the content of hashes table, and during the
processing of the metadata entry it copy the content into the designated
page and encrypt it.

Note that in SNP (unlike SEV and SEV-ES) the measurements is done in
whole 4KB pages.  Therefore QEMU zeros the whole page that includes the
hashes table, and fills in the kernel hashes area in that page, and then
encrypts the whole page.  The rest of the page is reserved for SEV
launch secrets which are not usable anyway on SNP.

If the user disabled kernel hashes, QEMU pre-validates the kernel hashes
page as a zero page.

Signed-off-by: Dov Murik <dovmurik@linux.ibm.com>
Signed-off-by: Michael Roth <michael.roth@amd.com>
Signed-off-by: Pankaj Gupta <pankaj.gupta@amd.com>
Message-ID: <20240530111643.1091816-24-pankaj.gupta@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
include/hw/i386/pc.h
target/i386/sev.c