Changes between Initial Version and Version 1 of kernel_pmem


Ignore:
Timestamp:
Oct 5, 2014, 1:18:29 PM (11 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • kernel_pmem

    v1 v1  
     1= Physical Memory Allocators ==
     2
     3The [source:soft/giet_vm/giet_common/pmem.c pmem.c] and [source:soft/giet_vm/giet_common/pmem.h pmem.h] files define the data structures and functions used by the boot-loader to allocate physical memory.
     4
     5The physical memory allocation is statically done by the boot-loader, and the functions defined here
     6should not be used by the kernel.
     7
     8The physical address format is 40 bits, structured in five fields:
     9| 4 | 4 |  11  |  9   |   12   |
     10| X | Y | BPPI | SPPI | OFFSET |
     11 * The (X,Y) fields define the cluster coordinates in the 2D mesh.
     12 * The BPPI field is the Big Physical Page Index
     13 * The SPPI field is the Small Physical Page Index
     14 * The |X|Y|BPPI|SPPI| concatenation is the PPN (Physical Page Number)
     15
     16As the physical memory can be distributed in all clusters, there is one physical memory allocator in each cluster, and the allocation state is defined by the boot_pmem_alloc[x][y] array (defined in the
     17boot.c file). As the allocated physical memory is never released, the allocator structure is very simple, and is defined in the pmem_alloc_t structure.
     18
     19As the boot-loader is executed by one single processor, this structure does not contain any lock protecting exclusive access.
     20
     21Both small pages allocator and big pages allocators allocate a variable number of CONTIGUOUS pages in the physical space. The first big page in cluster[0][0] is reserved for identity mapping vsegs, and is not allocated by the physical memory allocators.
     22
     23
     24=== void _pmem_alloc_init( unsigned int x, unsigned int y, unsigned int base, unsigned int size ) ===
     25
     26This function initialises the physical memory allocator in cluster (x,y).
     27The pseg base address and the pseg size must be multiple of 2 Mbytes (one big page).
     28 * base is the pseg local base address (no cluster extension)
     29 * size is the pseg length (bytes)
     30The first page in cluster[0][0] is reserved for the boot code identity mapping vsegs.
     31
     32=== unsigned int _get_small_ppn( pmem_alloc_t* p, unsigned int  n ) ===
     33
     34This function allocates n contiguous small pages (4 Kbytes),
     35from the physical memory allocator defined by the p pointer.
     36It returns the PPN (28 bits) of the first physical small page.
     37Exit if not enough free space.
     38
     39=== unsigned int _get_big_ppn( pmem_alloc_t* p, unsigned int  n ) ===
     40
     41This function allocates n contiguous big pages (2 Mbytes),
     42from the physical memory allocator defined by the p pointer.
     43It returns the PPN (28 bits) of the first physical big page (the SPPI field of the ppn is always 0).
     44Exit if not enough free space.
     45
     46