WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [Qemu-devel] [PATCH RFC V3 08/12] Intruduce qemu_ram_ptr

On Fri, 17 Sep 2010, Blue Swirl wrote:

> On Fri, Sep 17, 2010 at 11:15 AM,  <anthony.perard@xxxxxxxxxx> wrote:
> > From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
> >
> > This function allows to unlock a ram_ptr give by qemu_get_ram_ptr. After
> > a call to qemu_ram_ptr_unlock, the pointer may be unmap from QEMU when
> > used with Xen.
> >
> > Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
> > ---
> >  cpu-common.h   |    1 +
> >  exec.c         |   29 ++++++++++++++++++++++++++---
> >  xen_mapcache.c |   34 ++++++++++++++++++++++++++++++++++
> >  xen_mapcache.h |    1 +
> >  4 files changed, 62 insertions(+), 3 deletions(-)
> >
> > diff --git a/cpu-common.h b/cpu-common.h
> > index 0426bc8..378eea8 100644
> > --- a/cpu-common.h
> > +++ b/cpu-common.h
> > @@ -46,6 +46,7 @@ ram_addr_t qemu_ram_alloc(DeviceState *dev, const char 
> > *name, ram_addr_t size);
> >  void qemu_ram_free(ram_addr_t addr);
> >  /* This should only be used for ram local to a device.  */
> >  void *qemu_get_ram_ptr(ram_addr_t addr);
> > +void qemu_ram_ptr_unlock(void *addr);
> >  /* This should not be used by devices.  */
> >  ram_addr_t qemu_ram_addr_from_host(void *ptr);
> >
> > diff --git a/exec.c b/exec.c
> > index f5888eb..659db50 100644
> > --- a/exec.c
> > +++ b/exec.c
> > @@ -2959,6 +2959,13 @@ void *qemu_get_ram_ptr(ram_addr_t addr)
> >     return NULL;
> >  }
> >
> > +void qemu_ram_ptr_unlock(void *addr)
> > +{
> > +    if (xen_enabled()) {
> > +        qemu_map_cache_unlock(addr);
>
> I think there may be linkage problems without CONFIG_XEN, so there
> should be a stub for qemu_map_cache_unlock().
>
> > +    }
> > +}
> > +
> >  /* Some of the softmmu routines need to translate from a host pointer
> >    (typically a TLB entry) back to a ram offset.  */
> >  ram_addr_t qemu_ram_addr_from_host(void *ptr)
> > @@ -3064,6 +3071,7 @@ static void notdirty_mem_writeb(void *opaque, 
> > target_phys_addr_t ram_addr,
> >                                 uint32_t val)
> >  {
> >     int dirty_flags;
> > +    void *vaddr;
> >     dirty_flags = cpu_physical_memory_get_dirty_flags(ram_addr);
> >     if (!(dirty_flags & CODE_DIRTY_FLAG)) {
> >  #if !defined(CONFIG_USER_ONLY)
> > @@ -3071,19 +3079,21 @@ static void notdirty_mem_writeb(void *opaque, 
> > target_phys_addr_t ram_addr,
> >         dirty_flags = cpu_physical_memory_get_dirty_flags(ram_addr);
> >  #endif
> >     }
> > -    stb_p(qemu_get_ram_ptr(ram_addr), val);
> > +    stb_p(vaddr = qemu_get_ram_ptr(ram_addr), val);
>
> Perhaps 'vaddr = ...'  should be put on a separate line.

Ok, will do.

Thanks,

-- 
Anthony PERARD
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>