qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

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: Dr. 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: David Hildenbrand <david@redhat.com>
Message-Id: <20200626072248.78761-8-david@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

authored by

David Hildenbrand and committed by
Michael S. Tsirkin
fee3f3ba 06df2e69

+7
+7
target/i386/sev.c
··· 680 680 uint32_t host_cbitpos; 681 681 struct sev_user_data_status status = {}; 682 682 683 + ret = ram_block_discard_disable(true); 684 + if (ret) { 685 + error_report("%s: cannot disable RAM discard", __func__); 686 + return NULL; 687 + } 688 + 683 689 sev = lookup_sev_guest_info(id); 684 690 if (!sev) { 685 691 error_report("%s: '%s' is not a valid '%s' object", ··· 751 757 return sev; 752 758 err: 753 759 sev_guest = NULL; 760 + ram_block_discard_disable(false); 754 761 return NULL; 755 762 } 756 763