Saturday, July 27, 2013

[GSoC] libmm project updates

* Setup RTEM environment for libmm. This action includes :

  • libmm score API.
  • libcpu/mm.h Header file to serve as an interface for low-level libmm API.
  • Stubs for BSPs that do not implement libmm.
  • mmtest1 test case.
  •  Changes to all BSPs Makefiles to accommodate former files.

* libmm MPU implementation (not tested) : A simple implementation  that wraps ARMv7 MPU API.

* Change API prototypes and delete MME struct. Now low-level API takes base, size, attributes as args instead of MME struct pointer. 

* Adjust the current ARM MMU code and integrate it into Raspberry PI BSP (built successfully). The code is to be tested/debugged once I get the USB/TTL cable. 

Monday, July 8, 2013

[GSoC 2013] LIBMM for RTEMS

Introduction : 

libmm is memory management library for RTEMS. libmm aims is to centralize different memory management techniques supported by HW targets including MMU, MPU, Caches. Last year I worked on designing and implementing libmm and ported it for PSIM, gumstix BSPs [1] during GSoC 2012 program. This year I am working on enhancing libmm and port it for other targets and BSPs [2].

Till now, libmm has three major functions : 

  • _Memory_management_Initialize : used to initialize memory resources (MMU, MPU and/or Caches) and any other required data structures. Also this function creates a static mapping for memory sections like .text, .data, IO pages, and others with suitable memory attributes.  It's invoked at BSP startup.
  • _Memory_management_Install_entry : used to install entry into the target HW with supplied memory attributes flags representing cache policies, memory protection flags. It takes the start address for the area of memory to be installed, size, and flags. It can be used to dynamically install entries during application phase as well.
  • _Memory_management_Uninstall_entry : When a memory management entry is no longer needed, this function should be invoked to clean up HW/SW resources and revert back to the state before calling  _Memory_management_Install_entry.

 BSPs support for libmm:

Currently libmm is ported for :
  • PSIM : PowerPC/mpc6xx BSP (603e core).
  • Gumstix : ARM based board (arm920t core).
  • Realview_pbx_a9 : running on QEMU (Cortex-a9) new!
  • Xilinx_zynq : running on QEMU (Cortex-a9) new!
Raspberry Pi is to be supported soon on real hardware.

Added features for libmm :

To use libmm within SMP environment, smplock calls are added to _Memory_management_Install_entry, _Memory_management_Uninstall_entry

For ARM/Realview :
-new extension function is implemented to view more info about address caused data abort exception and which error caused the exception.
- As page tables are shared resource between cores and threads, It's mapped as "SHARED", thus, let the HW ensure caches/memory coherency for that area of memory.

Tests cases :

mmtest1: Simple tests that tries to install memory management entries.
  •  Install entries with specific memory attributes (e.g read only region) :
  •  Check for memory protection violations (writing to read only blocks)
  •  Reading from read only blocks.
  •  Write/Read to/from unmapped region (error!).
  •  Write to a valid entry that was installed and then uninstalled (error!).
mmtest3 (on-going): new!
Tests for libmm behavior on SMP environments.
  • Create tasks for each core and start it.
  • Check for memory consistency and page tables and memory attributes validity.

Snapshot for mmtest2 running on Realview/QEMU:

References :