target/i386: sev: Do not unpin ram device memory region

The commit referenced below skipped pinning ram device memory when
ram blocks are added, we need to do the same when they're removed.

Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Fixes: cedc0ad539 ("target/i386: sev: Do not pin the ram device memory region")
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Message-Id: <156320087103.2556.10983987500488190423.stgit@gimli.home>
Reviewed-by: Singh, Brijesh <brijesh.singh@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Alex Williamson 2019-07-15 08:28:39 -06:00 committed by Paolo Bonzini
parent 874acb6f83
commit 56e2ec9488
1 changed files with 11 additions and 0 deletions

View File

@ -161,6 +161,17 @@ sev_ram_block_removed(RAMBlockNotifier *n, void *host, size_t size)
{
int r;
struct kvm_enc_region range;
ram_addr_t offset;
MemoryRegion *mr;
/*
* The RAM device presents a memory region that should be treated
* as IO region and should not have been pinned.
*/
mr = memory_region_from_host(host, &offset);
if (mr && memory_region_is_ram_device(mr)) {
return;
}
range.addr = (__u64)(unsigned long)host;
range.size = size;