* [Qemu-devel] [PATCH] Move RAMBlock and ram_list to ram_addr.h
@ 2015-08-14 10:25 Dr. David Alan Gilbert (git)
2015-08-14 23:36 ` Paolo Bonzini
2015-08-15 21:02 ` Peter Crosthwaite
0 siblings, 2 replies; 4+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2015-08-14 10:25 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
include/exec/cpu-all.h | 41 -----------------------------------------
include/exec/ram_addr.h | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 41 deletions(-)
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index ea6a9a6..175f376 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -273,44 +273,6 @@ CPUArchState *cpu_copy(CPUArchState *env);
#if !defined(CONFIG_USER_ONLY)
-/* memory API */
-
-typedef struct RAMBlock RAMBlock;
-
-struct RAMBlock {
- struct rcu_head rcu;
- struct MemoryRegion *mr;
- uint8_t *host;
- ram_addr_t offset;
- ram_addr_t used_length;
- ram_addr_t max_length;
- void (*resized)(const char*, uint64_t length, void *host);
- uint32_t flags;
- /* Protected by iothread lock. */
- char idstr[256];
- /* RCU-enabled, writes protected by the ramlist lock */
- QLIST_ENTRY(RAMBlock) next;
- int fd;
-};
-
-static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset)
-{
- assert(offset < block->used_length);
- assert(block->host);
- return (char *)block->host + offset;
-}
-
-typedef struct RAMList {
- QemuMutex mutex;
- /* Protected by the iothread lock. */
- unsigned long *dirty_memory[DIRTY_MEMORY_NUM];
- RAMBlock *mru_block;
- /* RCU-enabled, writes protected by the ramlist lock. */
- QLIST_HEAD(, RAMBlock) blocks;
- uint32_t version;
-} RAMList;
-extern RAMList ram_list;
-
/* Flags stored in the low bits of the TLB virtual address. These are
defined so that fast path ram access is all zeros. */
/* Zero if TLB entry is valid. */
@@ -323,9 +285,6 @@ extern RAMList ram_list;
void dump_exec_info(FILE *f, fprintf_function cpu_fprintf);
void dump_opcount_info(FILE *f, fprintf_function cpu_fprintf);
-ram_addr_t last_ram_offset(void);
-void qemu_mutex_lock_ramlist(void);
-void qemu_mutex_unlock_ramlist(void);
#endif /* !CONFIG_USER_ONLY */
int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h
index c113f21..c400a75 100644
--- a/include/exec/ram_addr.h
+++ b/include/exec/ram_addr.h
@@ -22,6 +22,46 @@
#ifndef CONFIG_USER_ONLY
#include "hw/xen/xen.h"
+typedef struct RAMBlock RAMBlock;
+
+struct RAMBlock {
+ struct rcu_head rcu;
+ struct MemoryRegion *mr;
+ uint8_t *host;
+ ram_addr_t offset;
+ ram_addr_t used_length;
+ ram_addr_t max_length;
+ void (*resized)(const char*, uint64_t length, void *host);
+ uint32_t flags;
+ /* Protected by iothread lock. */
+ char idstr[256];
+ /* RCU-enabled, writes protected by the ramlist lock */
+ QLIST_ENTRY(RAMBlock) next;
+ int fd;
+};
+
+static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset)
+{
+ assert(offset < block->used_length);
+ assert(block->host);
+ return (char *)block->host + offset;
+}
+
+typedef struct RAMList {
+ QemuMutex mutex;
+ /* Protected by the iothread lock. */
+ unsigned long *dirty_memory[DIRTY_MEMORY_NUM];
+ RAMBlock *mru_block;
+ /* RCU-enabled, writes protected by the ramlist lock. */
+ QLIST_HEAD(, RAMBlock) blocks;
+ uint32_t version;
+} RAMList;
+extern RAMList ram_list;
+
+ram_addr_t last_ram_offset(void);
+void qemu_mutex_lock_ramlist(void);
+void qemu_mutex_unlock_ramlist(void);
+
ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr,
bool share, const char *mem_path,
Error **errp);
--
2.4.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Move RAMBlock and ram_list to ram_addr.h
2015-08-14 10:25 [Qemu-devel] [PATCH] Move RAMBlock and ram_list to ram_addr.h Dr. David Alan Gilbert (git)
@ 2015-08-14 23:36 ` Paolo Bonzini
2015-08-15 21:02 ` Peter Crosthwaite
1 sibling, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2015-08-14 23:36 UTC (permalink / raw)
To: Dr. David Alan Gilbert (git), qemu-devel
On 14/08/2015 12:25, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> include/exec/cpu-all.h | 41 -----------------------------------------
> include/exec/ram_addr.h | 40 ++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 40 insertions(+), 41 deletions(-)
>
> diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
> index ea6a9a6..175f376 100644
> --- a/include/exec/cpu-all.h
> +++ b/include/exec/cpu-all.h
> @@ -273,44 +273,6 @@ CPUArchState *cpu_copy(CPUArchState *env);
>
> #if !defined(CONFIG_USER_ONLY)
>
> -/* memory API */
> -
> -typedef struct RAMBlock RAMBlock;
> -
> -struct RAMBlock {
> - struct rcu_head rcu;
> - struct MemoryRegion *mr;
> - uint8_t *host;
> - ram_addr_t offset;
> - ram_addr_t used_length;
> - ram_addr_t max_length;
> - void (*resized)(const char*, uint64_t length, void *host);
> - uint32_t flags;
> - /* Protected by iothread lock. */
> - char idstr[256];
> - /* RCU-enabled, writes protected by the ramlist lock */
> - QLIST_ENTRY(RAMBlock) next;
> - int fd;
> -};
> -
> -static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset)
> -{
> - assert(offset < block->used_length);
> - assert(block->host);
> - return (char *)block->host + offset;
> -}
> -
> -typedef struct RAMList {
> - QemuMutex mutex;
> - /* Protected by the iothread lock. */
> - unsigned long *dirty_memory[DIRTY_MEMORY_NUM];
> - RAMBlock *mru_block;
> - /* RCU-enabled, writes protected by the ramlist lock. */
> - QLIST_HEAD(, RAMBlock) blocks;
> - uint32_t version;
> -} RAMList;
> -extern RAMList ram_list;
> -
> /* Flags stored in the low bits of the TLB virtual address. These are
> defined so that fast path ram access is all zeros. */
> /* Zero if TLB entry is valid. */
> @@ -323,9 +285,6 @@ extern RAMList ram_list;
>
> void dump_exec_info(FILE *f, fprintf_function cpu_fprintf);
> void dump_opcount_info(FILE *f, fprintf_function cpu_fprintf);
> -ram_addr_t last_ram_offset(void);
> -void qemu_mutex_lock_ramlist(void);
> -void qemu_mutex_unlock_ramlist(void);
> #endif /* !CONFIG_USER_ONLY */
>
> int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
> diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h
> index c113f21..c400a75 100644
> --- a/include/exec/ram_addr.h
> +++ b/include/exec/ram_addr.h
> @@ -22,6 +22,46 @@
> #ifndef CONFIG_USER_ONLY
> #include "hw/xen/xen.h"
>
> +typedef struct RAMBlock RAMBlock;
> +
> +struct RAMBlock {
> + struct rcu_head rcu;
> + struct MemoryRegion *mr;
> + uint8_t *host;
> + ram_addr_t offset;
> + ram_addr_t used_length;
> + ram_addr_t max_length;
> + void (*resized)(const char*, uint64_t length, void *host);
> + uint32_t flags;
> + /* Protected by iothread lock. */
> + char idstr[256];
> + /* RCU-enabled, writes protected by the ramlist lock */
> + QLIST_ENTRY(RAMBlock) next;
> + int fd;
> +};
> +
> +static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset)
> +{
> + assert(offset < block->used_length);
> + assert(block->host);
> + return (char *)block->host + offset;
> +}
> +
> +typedef struct RAMList {
> + QemuMutex mutex;
> + /* Protected by the iothread lock. */
> + unsigned long *dirty_memory[DIRTY_MEMORY_NUM];
> + RAMBlock *mru_block;
> + /* RCU-enabled, writes protected by the ramlist lock. */
> + QLIST_HEAD(, RAMBlock) blocks;
> + uint32_t version;
> +} RAMList;
> +extern RAMList ram_list;
> +
> +ram_addr_t last_ram_offset(void);
> +void qemu_mutex_lock_ramlist(void);
> +void qemu_mutex_unlock_ramlist(void);
> +
> ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr,
> bool share, const char *mem_path,
> Error **errp);
>
Thanks!
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Move RAMBlock and ram_list to ram_addr.h
2015-08-14 10:25 [Qemu-devel] [PATCH] Move RAMBlock and ram_list to ram_addr.h Dr. David Alan Gilbert (git)
2015-08-14 23:36 ` Paolo Bonzini
@ 2015-08-15 21:02 ` Peter Crosthwaite
2015-08-17 8:19 ` Dr. David Alan Gilbert
1 sibling, 1 reply; 4+ messages in thread
From: Peter Crosthwaite @ 2015-08-15 21:02 UTC (permalink / raw)
To: Dr. David Alan Gilbert (git); +Cc: Paolo Bonzini, qemu-devel
Is there a functional reason for making this change, or pure
organisational? Either way the patch is ok, I'm just looking for the
motivation as this stuff did pop up in the multi-arch refactorings at
one stage and I did think about moving it. Can we add a one-liner to
commit message?
Regards,
Peter
On Fri, Aug 14, 2015 at 3:25 AM, Dr. David Alan Gilbert (git)
<dgilbert@redhat.com> wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> include/exec/cpu-all.h | 41 -----------------------------------------
> include/exec/ram_addr.h | 40 ++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 40 insertions(+), 41 deletions(-)
>
> diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
> index ea6a9a6..175f376 100644
> --- a/include/exec/cpu-all.h
> +++ b/include/exec/cpu-all.h
> @@ -273,44 +273,6 @@ CPUArchState *cpu_copy(CPUArchState *env);
>
> #if !defined(CONFIG_USER_ONLY)
>
> -/* memory API */
> -
> -typedef struct RAMBlock RAMBlock;
> -
> -struct RAMBlock {
> - struct rcu_head rcu;
> - struct MemoryRegion *mr;
> - uint8_t *host;
> - ram_addr_t offset;
> - ram_addr_t used_length;
> - ram_addr_t max_length;
> - void (*resized)(const char*, uint64_t length, void *host);
> - uint32_t flags;
> - /* Protected by iothread lock. */
> - char idstr[256];
> - /* RCU-enabled, writes protected by the ramlist lock */
> - QLIST_ENTRY(RAMBlock) next;
> - int fd;
> -};
> -
> -static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset)
> -{
> - assert(offset < block->used_length);
> - assert(block->host);
> - return (char *)block->host + offset;
> -}
> -
> -typedef struct RAMList {
> - QemuMutex mutex;
> - /* Protected by the iothread lock. */
> - unsigned long *dirty_memory[DIRTY_MEMORY_NUM];
> - RAMBlock *mru_block;
> - /* RCU-enabled, writes protected by the ramlist lock. */
> - QLIST_HEAD(, RAMBlock) blocks;
> - uint32_t version;
> -} RAMList;
> -extern RAMList ram_list;
> -
> /* Flags stored in the low bits of the TLB virtual address. These are
> defined so that fast path ram access is all zeros. */
> /* Zero if TLB entry is valid. */
> @@ -323,9 +285,6 @@ extern RAMList ram_list;
>
> void dump_exec_info(FILE *f, fprintf_function cpu_fprintf);
> void dump_opcount_info(FILE *f, fprintf_function cpu_fprintf);
> -ram_addr_t last_ram_offset(void);
> -void qemu_mutex_lock_ramlist(void);
> -void qemu_mutex_unlock_ramlist(void);
> #endif /* !CONFIG_USER_ONLY */
>
> int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
> diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h
> index c113f21..c400a75 100644
> --- a/include/exec/ram_addr.h
> +++ b/include/exec/ram_addr.h
> @@ -22,6 +22,46 @@
> #ifndef CONFIG_USER_ONLY
> #include "hw/xen/xen.h"
>
> +typedef struct RAMBlock RAMBlock;
> +
> +struct RAMBlock {
> + struct rcu_head rcu;
> + struct MemoryRegion *mr;
> + uint8_t *host;
> + ram_addr_t offset;
> + ram_addr_t used_length;
> + ram_addr_t max_length;
> + void (*resized)(const char*, uint64_t length, void *host);
> + uint32_t flags;
> + /* Protected by iothread lock. */
> + char idstr[256];
> + /* RCU-enabled, writes protected by the ramlist lock */
> + QLIST_ENTRY(RAMBlock) next;
> + int fd;
> +};
> +
> +static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset)
> +{
> + assert(offset < block->used_length);
> + assert(block->host);
> + return (char *)block->host + offset;
> +}
> +
> +typedef struct RAMList {
> + QemuMutex mutex;
> + /* Protected by the iothread lock. */
> + unsigned long *dirty_memory[DIRTY_MEMORY_NUM];
> + RAMBlock *mru_block;
> + /* RCU-enabled, writes protected by the ramlist lock. */
> + QLIST_HEAD(, RAMBlock) blocks;
> + uint32_t version;
> +} RAMList;
> +extern RAMList ram_list;
> +
> +ram_addr_t last_ram_offset(void);
> +void qemu_mutex_lock_ramlist(void);
> +void qemu_mutex_unlock_ramlist(void);
> +
> ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr,
> bool share, const char *mem_path,
> Error **errp);
> --
> 2.4.3
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Move RAMBlock and ram_list to ram_addr.h
2015-08-15 21:02 ` Peter Crosthwaite
@ 2015-08-17 8:19 ` Dr. David Alan Gilbert
0 siblings, 0 replies; 4+ messages in thread
From: Dr. David Alan Gilbert @ 2015-08-17 8:19 UTC (permalink / raw)
To: Peter Crosthwaite; +Cc: Paolo Bonzini, qemu-devel
* Peter Crosthwaite (crosthwaitepeter@gmail.com) wrote:
> Is there a functional reason for making this change, or pure
> organisational? Either way the patch is ok, I'm just looking for the
> motivation as this stuff did pop up in the multi-arch refactorings at
> one stage and I did think about moving it. Can we add a one-liner to
> commit message?
Purely organisational; Paolo asked for it in reply to one of my other
patches, and it was simple enough.
It also makes sense, cpu-all.h is a bit of a dumping ground.
Dave
> Regards,
> Peter
>
> On Fri, Aug 14, 2015 at 3:25 AM, Dr. David Alan Gilbert (git)
> <dgilbert@redhat.com> wrote:
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> >
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > ---
> > include/exec/cpu-all.h | 41 -----------------------------------------
> > include/exec/ram_addr.h | 40 ++++++++++++++++++++++++++++++++++++++++
> > 2 files changed, 40 insertions(+), 41 deletions(-)
> >
> > diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
> > index ea6a9a6..175f376 100644
> > --- a/include/exec/cpu-all.h
> > +++ b/include/exec/cpu-all.h
> > @@ -273,44 +273,6 @@ CPUArchState *cpu_copy(CPUArchState *env);
> >
> > #if !defined(CONFIG_USER_ONLY)
> >
> > -/* memory API */
> > -
> > -typedef struct RAMBlock RAMBlock;
> > -
> > -struct RAMBlock {
> > - struct rcu_head rcu;
> > - struct MemoryRegion *mr;
> > - uint8_t *host;
> > - ram_addr_t offset;
> > - ram_addr_t used_length;
> > - ram_addr_t max_length;
> > - void (*resized)(const char*, uint64_t length, void *host);
> > - uint32_t flags;
> > - /* Protected by iothread lock. */
> > - char idstr[256];
> > - /* RCU-enabled, writes protected by the ramlist lock */
> > - QLIST_ENTRY(RAMBlock) next;
> > - int fd;
> > -};
> > -
> > -static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset)
> > -{
> > - assert(offset < block->used_length);
> > - assert(block->host);
> > - return (char *)block->host + offset;
> > -}
> > -
> > -typedef struct RAMList {
> > - QemuMutex mutex;
> > - /* Protected by the iothread lock. */
> > - unsigned long *dirty_memory[DIRTY_MEMORY_NUM];
> > - RAMBlock *mru_block;
> > - /* RCU-enabled, writes protected by the ramlist lock. */
> > - QLIST_HEAD(, RAMBlock) blocks;
> > - uint32_t version;
> > -} RAMList;
> > -extern RAMList ram_list;
> > -
> > /* Flags stored in the low bits of the TLB virtual address. These are
> > defined so that fast path ram access is all zeros. */
> > /* Zero if TLB entry is valid. */
> > @@ -323,9 +285,6 @@ extern RAMList ram_list;
> >
> > void dump_exec_info(FILE *f, fprintf_function cpu_fprintf);
> > void dump_opcount_info(FILE *f, fprintf_function cpu_fprintf);
> > -ram_addr_t last_ram_offset(void);
> > -void qemu_mutex_lock_ramlist(void);
> > -void qemu_mutex_unlock_ramlist(void);
> > #endif /* !CONFIG_USER_ONLY */
> >
> > int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
> > diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h
> > index c113f21..c400a75 100644
> > --- a/include/exec/ram_addr.h
> > +++ b/include/exec/ram_addr.h
> > @@ -22,6 +22,46 @@
> > #ifndef CONFIG_USER_ONLY
> > #include "hw/xen/xen.h"
> >
> > +typedef struct RAMBlock RAMBlock;
> > +
> > +struct RAMBlock {
> > + struct rcu_head rcu;
> > + struct MemoryRegion *mr;
> > + uint8_t *host;
> > + ram_addr_t offset;
> > + ram_addr_t used_length;
> > + ram_addr_t max_length;
> > + void (*resized)(const char*, uint64_t length, void *host);
> > + uint32_t flags;
> > + /* Protected by iothread lock. */
> > + char idstr[256];
> > + /* RCU-enabled, writes protected by the ramlist lock */
> > + QLIST_ENTRY(RAMBlock) next;
> > + int fd;
> > +};
> > +
> > +static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset)
> > +{
> > + assert(offset < block->used_length);
> > + assert(block->host);
> > + return (char *)block->host + offset;
> > +}
> > +
> > +typedef struct RAMList {
> > + QemuMutex mutex;
> > + /* Protected by the iothread lock. */
> > + unsigned long *dirty_memory[DIRTY_MEMORY_NUM];
> > + RAMBlock *mru_block;
> > + /* RCU-enabled, writes protected by the ramlist lock. */
> > + QLIST_HEAD(, RAMBlock) blocks;
> > + uint32_t version;
> > +} RAMList;
> > +extern RAMList ram_list;
> > +
> > +ram_addr_t last_ram_offset(void);
> > +void qemu_mutex_lock_ramlist(void);
> > +void qemu_mutex_unlock_ramlist(void);
> > +
> > ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr,
> > bool share, const char *mem_path,
> > Error **errp);
> > --
> > 2.4.3
> >
> >
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-08-17 8:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-14 10:25 [Qemu-devel] [PATCH] Move RAMBlock and ram_list to ram_addr.h Dr. David Alan Gilbert (git)
2015-08-14 23:36 ` Paolo Bonzini
2015-08-15 21:02 ` Peter Crosthwaite
2015-08-17 8:19 ` Dr. David Alan Gilbert
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.