[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/3] memory_region_init_ram_ptr: only allow n*TA
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH 3/3] memory_region_init_ram_ptr: only allow n*TARGET_PAGE_SIZE memory sizes |
Date: |
Sun, 10 Mar 2013 22:27:31 +0800 |
On 10 March 2013 22:21, Igor Mitsyanko <address@hidden> wrote:
> Registering memory regions using preallocated memory which size is not a
> multiple of
> target page size will result in inconsistency in QEMU memory system. Do not
> allow to do that at all by checking for that case (and asserting) in
> memory_region_init_ram_ptr().
This is too vague. What exactly is the problem and why can't we
just fix the memory system to correctly handle being passed
small preallocated memory areas?
> --- a/memory.c
> +++ b/memory.c
> @@ -949,6 +949,7 @@ void memory_region_init_ram_ptr(MemoryRegion *mr,
> uint64_t size,
> void *ptr)
> {
> + assert((size & (TARGET_PAGE_SIZE - 1)) == 0);
This in particular seems like a bad idea, because TARGET_PAGE_SIZE
is a per-CPU thing, and we shouldn't be adding more code to QEMU which
will need to be fixed if/when we ever support multiple CPU types in
a single binary. (Also TARGET_PAGE_SIZE isn't necessarily what you
think it is: for instance on ARM it's actually only 1K even though
the standard ARM setup is 4K pages.)
thanks
-- PMM