Re: [PATCH] ARM: allow, but warn, when issuing ioremap() on RAM

From: Felipe Contreras
Date: Thu Oct 14 2010 - 10:52:59 EST


On Mon, Oct 11, 2010 at 6:25 PM, Russell King - ARM Linux
<linux@xxxxxxxxxxxxxxxx> wrote:
> On Sun, Oct 10, 2010 at 04:52:36AM +0300, Felipe Contreras wrote:
>> At the time 'fixup' is called, 'meminfo' is empty; the tags haven't
>> been parsed. So my solution is to move the memblock_add() after
>> 'reserve', and pass 'meminfo' as an argument:
>
> Here's a different approach which will work. ÂThis pushes ARM further
> towards using memblock for everything relating to memory init (although
> we still have the old membank stuff around.)
>
> The advantage with this is that memblock is now used as the basis for
> determining where memory is, setting up the maps, freeing memory into
> the pools, etc.
>
> What this also means is that this code in the ->reserve callback:
>
> Â Â Â Âsize = min(size, SZ_2M);
> Â Â Â Âbase = memblock_alloc(size, min(align, SZ_2M));
> Â Â Â Âmemblock_free(base, size);
> Â Â Â Âmemblock_remove(base, size);

Why align to SZ_2M both the start and end?

> will result in [base+size] being removed from the available memory,
> using highmem if available, if not from lowmem and removing it from
> the lowmem memory map - which is exactly the behaviour we want.

Makes sense to me.

> Âarch/arm/mm/init.c | Â160 +++++++++++++++++++++++++++++++++++-----------------
> Âarch/arm/mm/mmu.c Â| Â 43 ++++++++------
> Âmm/memblock.c   Â|  Â4 +
> Â3 files changed, 138 insertions(+), 69 deletions(-)

This works fine:
Tested-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>

--
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/