UMMU overview
--------------------
| user-mode process|
--------------------
|
--------------------------------------------------
| UMMU library |
| -------- ---------- --------- |
| | main | | segmng | | queue | |
| -------- ---------- --------- |
| -------- ------------ ---------------- |
| | mapt | | resource | | common utils | |
| -------- ------------ ---------------- |
--------------------------------------------------
| |
-------------------- |
| UMMU-CORE driver |-------- |
-------------------- | |
| | |
--------------- -------
| UMMU driver | | DDR |
--------------- -------
Below is the summary for submodules in UMMU library:
- main: initialize UMMU context and open /dev/ummu/tid device.
- segmng: manage memory segments for every TID, including add or remove segments.
- queue: manage the creation and destruction of ummu user-mode queues in UMMU, and provide interfaces to send commands to these queues.
- mapt: manage MAPT(Memory Address Permission Table) for each TID, including insert,update, and clear operations.
- resource: interact with UMMU driver, including allocate/free TID, initialize/uninit user-mode queues , allocate/free MAPT block etc.
- common utils: provide functions such as logging, memory mapping, bit manipulation, and other general-purpose helpers.
Introduction
The UMMU library manages serveral key resouces,including TID, MAPT, user-mode queues. The UMMU-CORE driver provides ioctl interface, enabling user-mode processes to allocate and manage these resources through the device file /dev/ummu/tid.
- tid: the UMMU-CORE driver allocates a unique token ID within a certain range, and return the TID.
- MAPT: the MAPT is stored in DDR. The UMMU-CORE driver allocates physical memory and returns its virtual address to the user-mode process.The user-mode process manages MAPT entries-inserting, updating, or clearing them—by accessing the virtual address with a specific offset.
- user-mode queues: these queues are implemented in fixed hardware registers. The UMMU-CORE driver maps physical address of the queue to a virtual address and return it to the user-mode process. The user-mode process sends commands by writing them to the mapped virtual address.
Ristrictions
- When allocating a TID in MAPT_MODE_TABLE mode, the start VA must be 4K-aligned.
- Partial ungrant of a memory segment is not supported.
- Within a single TID, memory segments must not overlap.Overlapping is strictly prohibited.
- Since UMMU does not support IOPF, user-mode process must manually pin allocated memory pages before sharing them. Mmeory pin unctioins(e.g. pin_user_pages_fast) can only be called from kernel space.Therefore, a dedicated kernel driver is typically used to manage memory allocation and pinning. The driver allocates memory, pins it, and returns a mapped virtual address via mmap to the user-mode process.