diff options
author | David Gibson | 2021-01-12 01:58:04 +0100 |
---|---|---|
committer | David Gibson | 2021-02-08 06:57:38 +0100 |
commit | aacdb8441376de05d9e21e93799d5a37b81f0f38 (patch) | |
tree | 54a4ee4f459f74e19f139211a430b8fdfbb04eb8 /include/sysemu/sev.h | |
parent | confidential guest support: Introduce new confidential guest support class (diff) | |
download | qemu-aacdb8441376de05d9e21e93799d5a37b81f0f38.tar.gz qemu-aacdb8441376de05d9e21e93799d5a37b81f0f38.tar.xz qemu-aacdb8441376de05d9e21e93799d5a37b81f0f38.zip |
sev: Remove false abstraction of flash encryption
When AMD's SEV memory encryption is in use, flash memory banks (which are
initialed by pc_system_flash_map()) need to be encrypted with the guest's
key, so that the guest can read them.
That's abstracted via the kvm_memcrypt_encrypt_data() callback in the KVM
state.. except, that it doesn't really abstract much at all.
For starters, the only call site is in code specific to the 'pc'
family of machine types, so it's obviously specific to those and to
x86 to begin with. But it makes a bunch of further assumptions that
need not be true about an arbitrary confidential guest system based on
memory encryption, let alone one based on other mechanisms:
* it assumes that the flash memory is defined to be encrypted with the
guest key, rather than being shared with hypervisor
* it assumes that that hypervisor has some mechanism to encrypt data into
the guest, even though it can't decrypt it out, since that's the whole
point
* the interface assumes that this encrypt can be done in place, which
implies that the hypervisor can write into a confidential guests's
memory, even if what it writes isn't meaningful
So really, this "abstraction" is actually pretty specific to the way SEV
works. So, this patch removes it and instead has the PC flash
initialization code call into a SEV specific callback.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Diffstat (limited to 'include/sysemu/sev.h')
-rw-r--r-- | include/sysemu/sev.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/sysemu/sev.h b/include/sysemu/sev.h index 7ab6e3e31d..7335e59867 100644 --- a/include/sysemu/sev.h +++ b/include/sysemu/sev.h @@ -16,8 +16,8 @@ #include "sysemu/kvm.h" -void *sev_guest_init(const char *id); -int sev_encrypt_data(void *handle, uint8_t *ptr, uint64_t len); +int sev_guest_init(const char *id); +int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp); int sev_inject_launch_secret(const char *hdr, const char *secret, uint64_t gpa, Error **errp); #endif |