From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZQOWm-0003KQ-Nh for qemu-devel@nongnu.org; Fri, 14 Aug 2015 19:36:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZQOWi-00043N-I3 for qemu-devel@nongnu.org; Fri, 14 Aug 2015 19:36:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60543) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZQOWi-00042t-AS for qemu-devel@nongnu.org; Fri, 14 Aug 2015 19:36:44 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 059069137F for ; Fri, 14 Aug 2015 23:36:42 +0000 (UTC) References: <1439547914-18249-1-git-send-email-dgilbert@redhat.com> From: Paolo Bonzini Message-ID: <55CE7B86.3070907@redhat.com> Date: Sat, 15 Aug 2015 01:36:38 +0200 MIME-Version: 1.0 In-Reply-To: <1439547914-18249-1-git-send-email-dgilbert@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] Move RAMBlock and ram_list to ram_addr.h List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Dr. David Alan Gilbert (git)" , qemu-devel@nongnu.org On 14/08/2015 12:25, Dr. David Alan Gilbert (git) wrote: > From: "Dr. David Alan Gilbert" > > Signed-off-by: Dr. David Alan Gilbert > --- > 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