Skip to content
Snippets Groups Projects
Commit fee3f3ba authored by David Hildenbrand's avatar David Hildenbrand Committed by Michael S. Tsirkin
Browse files

target/i386: sev: Use ram_block_discard_disable()


AMD SEV will pin all guest memory, mark discarding of RAM broken. At the
time this is called, we cannot have anyone active that relies on discards
to work properly - let's still implement error handling.

Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
Message-Id: <20200626072248.78761-8-david@redhat.com>
Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 06df2e69
No related branches found
No related tags found
No related merge requests found
......@@ -680,6 +680,12 @@ sev_guest_init(const char *id)
uint32_t host_cbitpos;
struct sev_user_data_status status = {};
ret = ram_block_discard_disable(true);
if (ret) {
error_report("%s: cannot disable RAM discard", __func__);
return NULL;
}
sev = lookup_sev_guest_info(id);
if (!sev) {
error_report("%s: '%s' is not a valid '%s' object",
......@@ -751,6 +757,7 @@ sev_guest_init(const char *id)
return sev;
err:
sev_guest = NULL;
ram_block_discard_disable(false);
return NULL;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment