diff options
author | Alex Williamson <alex.williamson@redhat.com> | 2019-07-15 08:28:39 -0600 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2019-07-15 20:58:37 +0200 |
commit | 56e2ec9488b3b281130e064929f8ae5595d6ac39 (patch) | |
tree | 2abe53f05963f8e3eed2b91e68deb185026e39c8 /target | |
parent | 874acb6f838a659cd010d0db4176e3f52d8f7a57 (diff) | |
download | qemu-56e2ec9488b3b281130e064929f8ae5595d6ac39.zip qemu-56e2ec9488b3b281130e064929f8ae5595d6ac39.tar.gz qemu-56e2ec9488b3b281130e064929f8ae5595d6ac39.tar.bz2 |
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: cedc0ad539af ("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>
Diffstat (limited to 'target')
-rw-r--r-- | target/i386/sev.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/target/i386/sev.c b/target/i386/sev.c index 6dbdc3c..5ba1384 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -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; |