[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 01/22] memory: add memory_region_ram_resize
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] [PATCH 01/22] memory: add memory_region_ram_resize |
Date: |
Sat, 28 Mar 2015 19:58:18 +0100 |
On Thu, Mar 26, 2015 at 06:38:19PM +0100, Paolo Bonzini wrote:
> This is a simple MemoryRegion wrapper for qemu_ram_resize.
>
> Cc: Michael S. Tsirkin <address@hidden>
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
> include/exec/memory.h | 12 ++++++++++++
> memory.c | 7 +++++++
> 2 files changed, 19 insertions(+)
>
> diff --git a/include/exec/memory.h b/include/exec/memory.h
> index 06ffa1d..a2ea587 100644
> --- a/include/exec/memory.h
> +++ b/include/exec/memory.h
> @@ -605,6 +605,18 @@ int memory_region_get_fd(MemoryRegion *mr);
> */
> void *memory_region_get_ram_ptr(MemoryRegion *mr);
>
> +/* memory_region_ram_resize: Resize a RAM region.
> + *
> + * Only legal before guest might have detected the memory size: e.g. on
> + * incoming migration, or right after reset.
> + *
> + * @mr: a memory region created with @memory_region_init_resizeable_ram.
> + * @newsize: the new size the region
> + * @errp: pointer to Error*, to store an error if it happens.
> + */
> +void memory_region_ram_resize(MemoryRegion *mr, ram_addr_t newsize,
> + Error **errp);
> +
> /**
> * memory_region_set_log: Turn dirty logging on or off for a region.
> *
> diff --git a/memory.c b/memory.c
> index ee3f2a8..a11e9bf 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -1452,6 +1452,13 @@ void *memory_region_get_ram_ptr(MemoryRegion *mr)
> return qemu_get_ram_ptr(mr->ram_addr & TARGET_PAGE_MASK);
> }
>
> +void memory_region_ram_resize(MemoryRegion *mr, ram_addr_t newsize, Error
> **errp)
> +{
> + assert(mr->terminates);
Why? Does "terminates" guarantee that ram_addr
is valid? In any case, I think this needs a comment.
> +
> + qemu_ram_resize(mr->ram_addr, newsize, errp);
> +}
> +
> static void memory_region_update_coalesced_range_as(MemoryRegion *mr,
> AddressSpace *as)
> {
> FlatView *view;
> --
> 2.3.3
>
- [Qemu-devel] [PATCH 00/22] Dirty bitmap atomic access and optimizations, Paolo Bonzini, 2015/03/26
- [Qemu-devel] [PATCH 01/22] memory: add memory_region_ram_resize, Paolo Bonzini, 2015/03/26
- Re: [Qemu-devel] [PATCH 01/22] memory: add memory_region_ram_resize,
Michael S. Tsirkin <=
- [Qemu-devel] [PATCH 02/22] acpi-build: remove dependency from ram_addr.h, Paolo Bonzini, 2015/03/26
- [Qemu-devel] [PATCH 03/22] memory: the only dirty memory flag for users is DIRTY_MEMORY_VGA, Paolo Bonzini, 2015/03/26
- [Qemu-devel] [PATCH 04/22] display: enable DIRTY_MEMORY_VGA tracking explicitly, Paolo Bonzini, 2015/03/26
- [Qemu-devel] [PATCH 07/22] ui/console: check memory_region_is_logging, Paolo Bonzini, 2015/03/26
- [Qemu-devel] [PATCH 05/22] memory: return bitmap from memory_region_is_logging, Paolo Bonzini, 2015/03/26