[Qemu-devel] [PATCH v2 1/2] RAMBlocks: qemu_ram_is_shared

Dr. David Alan Gilbert (git) posted 2 patches 8 years, 11 months ago
[Qemu-devel] [PATCH v2 1/2] RAMBlocks: qemu_ram_is_shared
Posted by Dr. David Alan Gilbert (git) 8 years, 11 months ago
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Provide a helper to say whether a RAMBlock was created as a
shared mapping.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 exec.c                    | 5 +++++
 include/exec/cpu-common.h | 1 +
 2 files changed, 6 insertions(+)

diff --git a/exec.c b/exec.c
index aabb035..1f25a12 100644
--- a/exec.c
+++ b/exec.c
@@ -2593,6 +2593,11 @@ MemoryRegion *get_system_io(void)
     return system_io;
 }
 
+bool qemu_ram_is_shared(RAMBlock *rb)
+{
+    return rb->flags & RAM_SHARED;
+}
+
 #endif /* !defined(CONFIG_USER_ONLY) */
 
 /* physical memory access (slow version, mainly for debug) */
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index b62f0d8..4d45a72 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -69,6 +69,7 @@ RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
 void qemu_ram_set_idstr(RAMBlock *block, const char *name, DeviceState *dev);
 void qemu_ram_unset_idstr(RAMBlock *block);
 const char *qemu_ram_get_idstr(RAMBlock *rb);
+bool qemu_ram_is_shared(RAMBlock *rb);
 size_t qemu_ram_pagesize(RAMBlock *block);
 size_t qemu_ram_pagesize_largest(void);
 
-- 
2.9.3


Re: [Qemu-devel] [PATCH v2 1/2] RAMBlocks: qemu_ram_is_shared
Posted by Philippe Mathieu-Daudé 8 years, 11 months ago
On 03/09/2017 10:22 AM, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> Provide a helper to say whether a RAMBlock was created as a
> shared mapping.
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  exec.c                    | 5 +++++
>  include/exec/cpu-common.h | 1 +
>  2 files changed, 6 insertions(+)
>
> diff --git a/exec.c b/exec.c
> index aabb035..1f25a12 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -2593,6 +2593,11 @@ MemoryRegion *get_system_io(void)
>      return system_io;
>  }
>
> +bool qemu_ram_is_shared(RAMBlock *rb)
> +{
> +    return rb->flags & RAM_SHARED;
> +}
> +
>  #endif /* !defined(CONFIG_USER_ONLY) */
>
>  /* physical memory access (slow version, mainly for debug) */
> diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
> index b62f0d8..4d45a72 100644
> --- a/include/exec/cpu-common.h
> +++ b/include/exec/cpu-common.h
> @@ -69,6 +69,7 @@ RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
>  void qemu_ram_set_idstr(RAMBlock *block, const char *name, DeviceState *dev);
>  void qemu_ram_unset_idstr(RAMBlock *block);
>  const char *qemu_ram_get_idstr(RAMBlock *rb);
> +bool qemu_ram_is_shared(RAMBlock *rb);
>  size_t qemu_ram_pagesize(RAMBlock *block);
>  size_t qemu_ram_pagesize_largest(void);
>
>

Re: [Qemu-devel] [PATCH v2 1/2] RAMBlocks: qemu_ram_is_shared
Posted by Halil Pasic 8 years, 11 months ago

On 03/09/2017 02:22 PM, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> 
> Provide a helper to say whether a RAMBlock was created as a
> shared mapping.
> 
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com>

> ---
>  exec.c                    | 5 +++++
>  include/exec/cpu-common.h | 1 +
>  2 files changed, 6 insertions(+)
> 
> diff --git a/exec.c b/exec.c
> index aabb035..1f25a12 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -2593,6 +2593,11 @@ MemoryRegion *get_system_io(void)
>      return system_io;
>  }
> 
> +bool qemu_ram_is_shared(RAMBlock *rb)
> +{
> +    return rb->flags & RAM_SHARED;
> +}
> +
>  #endif /* !defined(CONFIG_USER_ONLY) */
> 
>  /* physical memory access (slow version, mainly for debug) */
> diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
> index b62f0d8..4d45a72 100644
> --- a/include/exec/cpu-common.h
> +++ b/include/exec/cpu-common.h
> @@ -69,6 +69,7 @@ RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
>  void qemu_ram_set_idstr(RAMBlock *block, const char *name, DeviceState *dev);
>  void qemu_ram_unset_idstr(RAMBlock *block);
>  const char *qemu_ram_get_idstr(RAMBlock *rb);
> +bool qemu_ram_is_shared(RAMBlock *rb);
>  size_t qemu_ram_pagesize(RAMBlock *block);
>  size_t qemu_ram_pagesize_largest(void);
>