Re: [Qemu-devel] [RFC PATCH 2/6] ram_blocks: Convert to a QLIST

Alex Williamson
2010-06-09T20:55:37Z

On Wed, 2010-06-09 at 14:11 -0600, Cam Macdonell wrote:
> On Tue, Jun 8, 2010 at 1:15 PM, Alex Williamson
> > diff --git a/cpu-all.h b/cpu-all.h
> > index 77eaf85..458cb4b 100644
> > --- a/cpu-all.h
> > +++ b/cpu-all.h
> > @@ -859,9 +859,21 @@ target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr);
> > /* memory API */
> >
> > extern int phys_ram_fd;
> > -extern uint8_t *phys_ram_dirty;
> > extern ram_addr_t ram_size;
> > -extern ram_addr_t last_ram_offset;
> > +
> > +typedef struct RAMBlock {
> > + uint8_t *host;
> > + ram_addr_t offset;
> > + ram_addr_t length;
> > + QLIST_ENTRY(RAMBlock) next;
> > +} RAMBlock;
>
> For my shared memory device I need a way to mark device memory as not
> to be migrated. Can a flag to be added to this struct to accomplish
> this?

Yep, it should be easy to skip blocks during migration based on a flag
here. I guess that probably means you'd also want a flag when you alloc
the block, so maybe it should be:

qemu_ram_alloc(DeviceState *dev, const char *name, ram_addr_t size, int flags)

Best to make that change now, then we can add it to the RAMBlock as we need.

Alex