[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH RFC V3 08/12] Intruduce qemu_ram_ptr_unlock.
From: |
Blue Swirl |
Subject: |
Re: [Qemu-devel] [PATCH RFC V3 08/12] Intruduce qemu_ram_ptr_unlock. |
Date: |
Fri, 17 Sep 2010 19:42:02 +0000 |
On Fri, Sep 17, 2010 at 11:15 AM, <address@hidden> wrote:
> From: Anthony PERARD <address@hidden>
>
> 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 <address@hidden>
> ---
> 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.
- [Qemu-devel] [PATCH RFC V3 03/12] xen: Introduce --enable-xen command options., (continued)
- [Qemu-devel] [PATCH RFC V3 03/12] xen: Introduce --enable-xen command options., anthony . perard, 2010/09/17
- [Qemu-devel] [PATCH RFC V3 02/12] xen: Add xen_machine_fv, anthony . perard, 2010/09/17
- [Qemu-devel] [PATCH RFC V3 01/12] xen: Support new libxc calls from xen unstable., anthony . perard, 2010/09/17
- [Qemu-devel] [PATCH RFC V3 06/12] xen: add a 8259 Interrupt Controller, anthony . perard, 2010/09/17
- [Qemu-devel] [PATCH RFC V3 04/12] xen: Add the Xen platform pci device, anthony . perard, 2010/09/17
- [Qemu-devel] [PATCH RFC V3 08/12] Intruduce qemu_ram_ptr_unlock., anthony . perard, 2010/09/17
- Re: [Qemu-devel] [PATCH RFC V3 08/12] Intruduce qemu_ram_ptr_unlock.,
Blue Swirl <=
- [Qemu-devel] [PATCH RFC V3 07/12] xen: Introduce the Xen mapcache, anthony . perard, 2010/09/17
- [Qemu-devel] [PATCH RFC V3 09/12] vl.c: Introduce getter for shutdown_requested and reset_requested., anthony . perard, 2010/09/17
- [Qemu-devel] [PATCH RFC V3 05/12] piix_pci: Introduces Xen specific call for irq., anthony . perard, 2010/09/17
- [Qemu-devel] [PATCH RFC V3 11/12] xen: Set running state in xenstore., anthony . perard, 2010/09/17
- [Qemu-devel] [PATCH RFC V3 12/12] xen: Add a Xen specific ACPI Implementation to target-xen, anthony . perard, 2010/09/17
- [Qemu-devel] [PATCH RFC V3 10/12] xen: Initialize event channels and io rings, anthony . perard, 2010/09/17