UAR
UAR(User Access Region),用户访问区域
a memory region that can be mapped directly to an un-trusted application by the OS and can be addressed by non-privileged code
The HCA provides a memory region that can be mapped directly to an un-trusted application by the OS and can be addressed by non-privileged code. This region is used to allow unprivileged applications to access needed HCA resources, such as ringing DoorBells, from userspace. Each process should get a distinct page mapped to this region to access HCA for data path operation, thereby isolating HCA access between the processes
Memory key
网卡设备将VA获取PA是使用memory key的地址空间标识符来处理。
The device translates the given virtual address to a physical address using the given memory key as an address space identifier. Memory protection checks are done in this stage.
Mkey用于在MTT表中根据VA查询PA,
地址转换流举例:
TPT
Translation and Protection (TPT)是网卡上的几个机制。传输和保护机制。
MPT表
Memory Protection Table(MPT)就是存的Mkey
Mkey创建流程
通过CREATE_MKEY的 cmd下发来创建。
Memory Key object is initialized (created) by the privileged SW entity using the CREATE_MKEY command.
这里的key本质就是键值对Key-value的key,不是钥匙,而是键值。
Mkey是用来地址转换查询的index。所以叫mkey。
为了注册一个内存区域,软件应该分配和配置MKey context,配置方式是下发ALLOC_MKEY命令给网卡,并且穿点MKey的参数,最后由硬件分配的Mkey的handle(一个数字)会传递给命令下发的返回接收数据里面。相反的,如果要de-register一个Memory Region,软件应该下发DEALLOC_MKEY,并且根据Mkey的handle来指定。
PTP相关的Mkey命令
创建Mkey
CREATE_MKEY – Create MKey Entry 创建MKey实体,用来生成新的Mkeys。
软件使用一个input mailbox来传递MKey object到硬件,硬件提供一个Mkey的index作为输出的参数给软件。这个index也就是Mkey的handle,软件用它作为后期访问这个object的index。
input struct
他的input struct格式:
可以看到代码中定义input mailbox的数据结构:
output struct
硬件返回给软件的output struct结构:
以及output mailbox的结构:其中关键点就是 mkey_index
删除Mkey
删除Mkey是下发DESTROY_MKEY的命令
input结构是关键点指定opcode之后,执行mkey_index
硬件的返回(output)的结构是:(可以看到关键点是status装填,以及syndrome的错误信息)