qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-4.1] target/i386: sev: Do not unpin ram device memory region
@ 2019-07-15 14:28 Alex Williamson
  2019-07-15 15:53 ` Singh, Brijesh
  2019-07-15 18:29 ` Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Alex Williamson @ 2019-07-15 14:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, brijesh.singh, ehabkost, rth

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;



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH for-4.1] target/i386: sev: Do not unpin ram device memory region
  2019-07-15 14:28 [Qemu-devel] [PATCH for-4.1] target/i386: sev: Do not unpin ram device memory region Alex Williamson
@ 2019-07-15 15:53 ` Singh, Brijesh
  2019-07-15 18:29 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Singh, Brijesh @ 2019-07-15 15:53 UTC (permalink / raw)
  To: Alex Williamson, qemu-devel@nongnu.org
  Cc: pbonzini@redhat.com, Singh, Brijesh, ehabkost@redhat.com,
	rth@twiddle.net



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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH for-4.1] target/i386: sev: Do not unpin ram device memory region
  2019-07-15 14:28 [Qemu-devel] [PATCH for-4.1] target/i386: sev: Do not unpin ram device memory region Alex Williamson
  2019-07-15 15:53 ` Singh, Brijesh
@ 2019-07-15 18:29 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2019-07-15 18:29 UTC (permalink / raw)
  To: Alex Williamson, qemu-devel; +Cc: brijesh.singh, ehabkost, rth

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-15 18:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-15 14:28 [Qemu-devel] [PATCH for-4.1] target/i386: sev: Do not unpin ram device memory region Alex Williamson
2019-07-15 15:53 ` Singh, Brijesh
2019-07-15 18:29 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).