MMU: force identity mapping without pages?

hi,

on a cortex a53, I would like to get the best of both worlds. Having dcache enabled but no page walk in case of a miss.

I want no memory protection because we manage the whole system ( kind of baremetal processes)

Is there a way to tell the mmu controller that we are in identity mapping for the whole memory available, so that a page walk is not triggered?

thanks

Parents
  • AFAIK, a single bit which informs the MMU to identity-map the physical memory may not exist on any prevalent CPU architectures.

    But the MMU framework has elements (page tables, configuration registers) which allow one to setup the mapping of one's choice, under the restriction of the actual features implemented.

    Those features include the # translation stages, the VA range a translation stage supports, the size of granule, and other armv8.x features, as described in the reference manual.

    Solving this situation would require one to map the physical memory in the largest unit of blocks supported, but the way the MMU needs to be configured is now severely restricted by the way the PA range is arranged.

    The memory map of a SOC contains physical memory regions which are not RAM. When mapping the physical memory, one still needs to (typically) setup at least certain regions as Device memory, and a few others as Normal, to allow correct and efficient memory operations.

    It may also not always be possible to identity-map an entire PA range, if none of the VA ranges supported by the MMU happens to cover that PA range in its entirety.


    As an alternative to an identity-map, one can select a VA range which is large enough to map the entire PA range, but which is still a linear function of the PA range.

    This is not an identity-map, but the va_to_pa and pa_to_va functions are as simple as they are found under an identity-map.

    Assume that a SOC has a PA range of 4GB, [0, 0xffffffff] (or a range such as [0x80000000,0x180000000)). One can map the VA range [0xffffffff00000000,0xffffffffffffffff] (or any other supported range) to it, in largest units of block supported, while taking care of keeping the properties of the individual regions consistent with the SOC's requirements.

    The va_to_pa and pa_to_va functions are:

    va_to_pa(va) = va - VA_BASE + PA_BASE
    pa_to_va(pa) = pa - PA_BASE + VA_BASE

    One may also have to see if there are holes in the PA range; a straightforward map as described above may expose it to the processes, and may result in exceptions being triggered when accessed.

Reply Children
More questions in this forum