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..c2cc455 100644
--- a/exec.c
+++ b/exec.c
@@ -1560,6 +1560,11 @@ const char *qemu_ram_get_idstr(RAMBlock *rb)
return rb->idstr;
}
+bool qemu_ram_is_shared(RAMBlock *rb)
+{
+ return rb->flags & RAM_SHARED;
+}
+
/* Called with iothread lock held. */
void qemu_ram_set_idstr(RAMBlock *new_block, const char *name, DeviceState *dev)
{
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
On 03/07/2017 07:36 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>
> ---
> exec.c | 5 +++++
> include/exec/cpu-common.h | 1 +
> 2 files changed, 6 insertions(+)
>
> diff --git a/exec.c b/exec.c
> index aabb035..c2cc455 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -1560,6 +1560,11 @@ const char *qemu_ram_get_idstr(RAMBlock *rb)
> return rb->idstr;
> }
>
> +bool qemu_ram_is_shared(RAMBlock *rb)
> +{
> + return rb->flags & RAM_SHARED;
Hm, it appears to me RAM_SHARED is defined conditionally, that's within
#if !defined(CONFIG_USER_ONLY)
#endif
The function however seems to be defined and using RAM_SHARED
unconditionally. Either one or the other seems inappropriate to me.
Regards,
Halil
* Halil Pasic (pasic@linux.vnet.ibm.com) wrote:
>
>
> On 03/07/2017 07:36 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>
> > ---
> > exec.c | 5 +++++
> > include/exec/cpu-common.h | 1 +
> > 2 files changed, 6 insertions(+)
> >
> > diff --git a/exec.c b/exec.c
> > index aabb035..c2cc455 100644
> > --- a/exec.c
> > +++ b/exec.c
> > @@ -1560,6 +1560,11 @@ const char *qemu_ram_get_idstr(RAMBlock *rb)
> > return rb->idstr;
> > }
> >
> > +bool qemu_ram_is_shared(RAMBlock *rb)
> > +{
> > + return rb->flags & RAM_SHARED;
>
> Hm, it appears to me RAM_SHARED is defined conditionally, that's within
> #if !defined(CONFIG_USER_ONLY)
> #endif
>
> The function however seems to be defined and using RAM_SHARED
> unconditionally. Either one or the other seems inappropriate to me.
Oops! Thanks for spotting that; I'll go and fix that.
Dave
> Regards,
> Halil
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
© 2016 - 2026 Red Hat, Inc.