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

To: anthony.perard@xxxxxxxxxx
Subject: [Xen-devel] Re: [Qemu-devel] [PATCH RFC V3 08/12] Intruduce qemu_ram_ptr_unlock.
From: Blue Swirl <blauwirbel@xxxxxxxxx>
Date: Fri, 17 Sep 2010 19:42:02 +0000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, qemu-devel@xxxxxxxxxx, Stefano.Stabellini@xxxxxxxxxxxxx
Delivery-date: Fri, 17 Sep 2010 12:43:11 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=AZfX9Lvotvh4TPHT4bG9cCvlInbUaL04202NscCG4mw=; b=t1hAymawrrW3rYoT9c79L4oLqXG3Y0pBg+/uiPTEJyq2Dm+w05kx4L3fjpdxljJrep ziA1TVkzDZn9+q3tHip1hxllLoBSiRR0cmDVp5TRHZakQ+SZ2HpSXwq/PCuITpWM/97z 74SRKHD7fzqKEUNO8GXLD6SsnS4ABDJwZ676Q=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=nsYeskrXHlOAjUa057dWH3tkIHPmkdxghJ10N38zLBrpn/ITApyTnTEYE/1JFy6hG3 0FDMFtpsZTiOj06OzYkXboMnJcuEw+HZf0pKXbfcJ/Lk6qZZvze0PbOTuimbch9uWi8H 7boykgWwssDgf1voqqddcTQ89VZn2jW/uEJ7A=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1284722107-28550-9-git-send-email-anthony.perard@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1284722107-28550-1-git-send-email-anthony.perard@xxxxxxxxxx> <1284722107-28550-9-git-send-email-anthony.perard@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>