iaGuoZhi / paper-readnotes

1 stars 0 forks source link

vt-d DEVICE-TLB PRI/ATS #24

Open iaGuoZhi opened 2 years ago

iaGuoZhi commented 2 years ago

Translation caches at the remapping hardware is a finite resource that supports requests from multiple endpoint devices. As a result, efficiency of these translation caches in the platform can depend on number of simultaneously active DMA streams in the platform, and address locality of DMA accesses.

One approach to scaling translation caches is to enable endpoint devices to participate in the remapping process with translation caches implemented at the devices.

IOMMU上面的tlb不够用,设备上支持更好

iaGuoZhi commented 2 years ago

Additionally, Device-TLBs may be utilized by devices to support recoverable I/O page faults.

iaGuoZhi commented 2 years ago

Recoverable translation faults are detected at the Device-TLB on the device and require the device to support Address Translation Services (ATS) capability.

iaGuoZhi commented 2 years ago

一次DEVICE-TLB上recoverable page fault的流程:

  1. IOMMU 发现有一个地址翻译不了,它并不给软件报告这是个错误,而是发一个completion的消息给DEVICE-TLB
  2. Device-TLB能够检测出来这是个translation fault
  3. Device-TLB以某种方式向host上的软件报告错误(可能通过device driver特殊的方式或者是pci规范里面的PRI)
  4. host上的驱动处理好这个页的映射,之前导致错误的设备操作可以继续执行
iaGuoZhi commented 2 years ago

To enable page requests from an endpoint device, software must:

Initialize the Page Request Queue Head and Tail Registers (see Section 10.4.31 and Section 10.4.32) to zero. Set up the PRQ address and size through the Page Request Queue Address Register (see Section 10.4.33). Configure the scalable-mode context-entry used to process requests from the device, such that the Present (P), Device-TLB Enable (DTE), and Page Request Enable (PRE) fields are Set. Configure and enable page requests at the device through the PRS Capability Registers. (Refer to Address Translation Services (ATS) in PCI Express Base Specification Revision 4.0 or later for PRS Capability Register details).

iaGuoZhi commented 2 years ago

Software processes Page Request Descriptors written to the Page Request Queue by remapping hardware. Processing the descriptor involves resolving the page-fault condition, creating the translation with appropriate permission and privilege (if the page requested is legitimate), and issuing a response back to the device through the remapping hardware when required.

iaGuoZhi commented 2 years ago

image