[Question] Memory attribute reserved by Device Tree?

Mark Rutland mark.rutland at arm.com
Wed Jul 6 02:34:58 PDT 2016


On Wed, Jul 06, 2016 at 07:34:58AM +0200, Ard Biesheuvel wrote:
> On 6 July 2016 at 06:10, Masahiro Yamada <yamada.masahiro at socionext.com> wrote:
> > My motivation is to try my own implementation of PSCI for my ARMv7 SoC.
> >
> > I put my PSCI firmware somewhere in the DRAM region and
> > protected it with /memreserve/, but I was not sure what kind of memory attribute
> > is used for the area.
> 
> As Mark implies, /memreserve/ entries are not suitable for this, and
> you should create an entry under /reserved-memory instead (please
> check the bindings under Documentation/ for details).

I'd strongly recommend that the memory in question was carved out of the
memory node, rather than using a reserved-memory node. The OS has
absolutely no reason to know about this memory in the first place.

This is more robust as other agents will similarly not poke the memory.

> This not only allows you to add a no-map attribute to prevent the
> kernel from mapping it (which allows you to map it any way you like),
> it also guarantees that the reservation is honoured even when booting
> via UEFI, as /memreserve/s are ignored in this case.

You'll still need to teach your UEFI implementation to reserve the
region (and to not give it cacheable attributes), to enable this, so
similarly I'd recommend that it is completely removed from the memory
map -- no agent other than the PSCI implementation has any reason to map
this memory.

Thanks,
Mark.



More information about the linux-arm-kernel mailing list