summaryrefslogtreecommitdiff
path: root/target/i386/sev.c
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 /target/i386/sev.c
parent6e6a6ca7d9097d1aa68089379cdaa7553dad7a25 (diff)
downloadqemu-e0292d7c62673546c01d5c6b245735fdfef81840.zip
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 'target/i386/sev.c')
-rw-r--r--target/i386/sev.c32
1 files changed, 2 insertions, 30 deletions
diff --git a/target/i386/sev.c b/target/i386/sev.c
index 8d4e1ea262..fa962d533c 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -335,26 +335,6 @@ static const TypeInfo sev_guest_info = {
}
};
-static SevGuestState *
-lookup_sev_guest_info(const char *id)
-{
- Object *obj;
- SevGuestState *info;
-
- obj = object_resolve_path_component(object_get_objects_root(), id);
- if (!obj) {
- return NULL;
- }
-
- info = (SevGuestState *)
- object_dynamic_cast(obj, TYPE_SEV_GUEST);
- if (!info) {
- return NULL;
- }
-
- return info;
-}
-
bool
sev_enabled(void)
{
@@ -682,10 +662,9 @@ sev_vm_state_change(void *opaque, int running, RunState state)
}
}
-int
-sev_guest_init(const char *id)
+int sev_kvm_init(ConfidentialGuestSupport *cgs)
{
- SevGuestState *sev;
+ SevGuestState *sev = SEV_GUEST(cgs);
char *devname;
int ret, fw_error;
uint32_t ebx;
@@ -698,13 +677,6 @@ sev_guest_init(const char *id)
return -1;
}
- sev = lookup_sev_guest_info(id);
- if (!sev) {
- error_report("%s: '%s' is not a valid '%s' object",
- __func__, id, TYPE_SEV_GUEST);
- goto err;
- }
-
sev_guest = sev;
sev->state = SEV_STATE_UNINIT;