[PATCH] powerpc: Remove more traces of bootmem

David Laight David.Laight at ACULAB.COM
Tue Nov 18 21:26:34 AEDT 2014


From: Michael Ellerman
> Although we are now selecting NO_BOOTMEM, we still have some traces of
> bootmem lying around. That is because even with NO_BOOTMEM there is
> still a shim that converts bootmem calls into memblock calls, but
> ultimately we want to remove all traces of bootmem.
> 
> Most of the patch is conversions from alloc_bootmem() to
> memblock_alloc(). In general a call such as:
> 
>   p = (struct foo *)alloc_bootmem(x);
> 
> Becomes:
> 
>   p = __va(memblock_alloc(x, 0));
> 
> We need __va() because memblock returns a physical address. We don't
> need the cast because __va() returns a void *. The alignment value of
> zero tells memblock to use the default alignment, which is
> SMP_CACHE_BYTES, the same value alloc_bootmem() uses.

It doesn't seem right to me to replicate __va(memblock_alloc(x, 0))
that many times. I can imagine that the required code will change
again at to future time, and then all the same places would need changing.

Wouldn't it be better to use:
#define alloc_bootmem(x) __va(memblock_alloc(x, 0))
possibly with a rename, or as a static inline.
If __va() is non-trivial you want a real function.

	David



More information about the Linuxppc-dev mailing list