Message ID | 156320087103.2556.10983987500488190423.stgit@gimli.home |
---|---|
State | New |
Headers | show |
Series | [for-4.1] target/i386: sev: Do not unpin ram device memory region | expand |
On 7/15/19 9:28 AM, Alex Williamson wrote: > 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> > --- > target/i386/sev.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > thanks Reviewed-by: Brijesh Singh <brijesh.singh@amd.com>
On 15/07/19 16:28, Alex Williamson wrote: > 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> > --- > target/i386/sev.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/target/i386/sev.c b/target/i386/sev.c > index 6dbdc3cdf10f..5ba1384ea1f6 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; > Queued, thanks. Paolo
diff --git a/target/i386/sev.c b/target/i386/sev.c index 6dbdc3cdf10f..5ba1384ea1f6 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;
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> --- target/i386/sev.c | 11 +++++++++++ 1 file changed, 11 insertions(+)