aboutsummaryrefslogtreecommitdiff
path: root/accel
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2020-12-04 12:51:51 +1100
committerDavid Gibson <david@gibson.dropbear.id.au>2021-02-08 16:57:38 +1100
commite0292d7c62673546c01d5c6b245735fdfef81840 (patch)
tree299d7c5c221b67eede72de51c7c7ec6a83b90d08 /accel
parent6e6a6ca7d9097d1aa68089379cdaa7553dad7a25 (diff)
confidential guest support: Rework the "memory-encryption" property
Currently the "memory-encryption" property is only looked at once we get to kvm_init(). Although protection of guest memory from the hypervisor isn't something that could really ever work with TCG, it's not conceptually tied to the KVM accelerator. In addition, the way the string property is resolved to an object is almost identical to how a QOM link property is handled. So, create a new "confidential-guest-support" link property which sets this QOM interface link directly in the machine. For compatibility we keep the "memory-encryption" property, but now implemented in terms of the new property. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Greg Kurz <groug@kaod.org> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Diffstat (limited to 'accel')
-rw-r--r--accel/kvm/kvm-all.c5
-rw-r--r--accel/kvm/sev-stub.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 3526e88b6c..88a6b8c19e 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -2184,8 +2184,9 @@ static int kvm_init(MachineState *ms)
* if memory encryption object is specified then initialize the memory
* encryption context.
*/
- if (ms->memory_encryption) {
- ret = sev_guest_init(ms->memory_encryption);
+ if (ms->cgs) {
+ /* FIXME handle mechanisms other than SEV */
+ ret = sev_kvm_init(ms->cgs);
if (ret < 0) {
goto err;
}
diff --git a/accel/kvm/sev-stub.c b/accel/kvm/sev-stub.c
index 5db9ab8f00..3d4787ae4a 100644
--- a/accel/kvm/sev-stub.c
+++ b/accel/kvm/sev-stub.c
@@ -15,7 +15,8 @@
#include "qemu-common.h"
#include "sysemu/sev.h"
-int sev_guest_init(const char *id)
+int sev_kvm_init(ConfidentialGuestSupport *cgs)
{
- return -1;
+ /* SEV can't be selected if it's not compiled */
+ g_assert_not_reached();
}