SPEC
Device Table
IOMMU Register Interface
TLB 操作时才会用到下面这些寄存器
IOMMU EntryLo0 and EntryLo1 Register Format
physical frame number (物理地址页号) 35-6 共 30bit.
PFNX PFN[39:36] stored in EntryLo0/EntryLo1 bits 35:32
PFN PFN[35:12] stored in EntryLo0/EntryLo1 bits 29:6
IOMMU EntryHi Register
VPN 虚拟地址页号 39-13 共 27 bit
VPNU Bits 39:32 of vpn
VPN2 Bits 31:13 of vpn
PageMask Register
The PageMask register in the IOMMU is required to define the page size of a TLB entry.
指定 TLB entry 的 page size.
Mask 32:13 共 20 位
掩码字段是一个位掩码,其中逻辑“1”表示虚拟地址的对应位不参与 TLB 匹配。请注意,只有有限范围的 PageMask 值是合法的(即,用“1”从低位向上填充 PageMaskMask 字段,每次两个)。最大页面大小为4 GB。
mask 32-13 12-0 (page ) 为 0
0x11 16k 2^2 page 不参与地址匹配
0x1111 64k 2^4 page 不参与地址匹配
0x111111 256k
… …
0xFFFFF 4G
IOMMU Global Configuration Register
Global Configuration register (GCFG)
- DVNUM 一共多少个 device table entry
- VZEN 是否启用 iommu 的虚拟化
- IE 是否打开 iommu 的中断
- PW 是否实现了 Page Walker, 该字段总是 0, 表明 mips iommu 不支持 page walker
- EN 是否启用 iommui
TLB Commands
write
支持 TLB 的 Index 和 Random 写。EntryLo0, EntryLol, EntryHi 和 PageMask 数据寄存器必须在写命令本身执行之前写入。
Read
EntryLo0, EntryLol, EntryHi 和 PageMask 数据寄存器在执行 TLB 读命令时加载 TLB 表项的内容。对 EntryLo0, EntryLol, EntryHi 和 PageMask 寄存器的读取将数据返回到通用寄存器(GPRs)。
Probe
该命令探测是否存在与 EntryHi 和 PageMask 寄存器的内容匹配的条目。
Invalidate
Execution of the invalidate command invalidates any entry that matches EntryHi.GuestID.
Invalidate Flush.
Execution of the invalidate flush command invalidates all entries in the IOMMU TLB.
IOMMU Segmentation Control Register
包含 segctl0/segctl1/segctl2 寄存器
如果 cpu 是 64 位的, 则不会用到这三个寄存器
Configuration of the memory segmentation system when the P6600 core is in 32-bit EVA mode.