iommu.rst 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. =================
  2. x86 IOMMU Support
  3. =================
  4. The architecture specs can be obtained from the below locations.
  5. - Intel: http://www.intel.com/content/dam/www/public/us/en/documents/product-specifications/vt-directed-io-spec.pdf
  6. - AMD: https://www.amd.com/system/files/TechDocs/48882_IOMMU.pdf
  7. This guide gives a quick cheat sheet for some basic understanding.
  8. Basic stuff
  9. -----------
  10. ACPI enumerates and lists the different IOMMUs on the platform, and
  11. device scope relationships between devices and which IOMMU controls
  12. them.
  13. Some ACPI Keywords:
  14. - DMAR - Intel DMA Remapping table
  15. - DRHD - Intel DMA Remapping Hardware Unit Definition
  16. - RMRR - Intel Reserved Memory Region Reporting Structure
  17. - IVRS - AMD I/O Virtualization Reporting Structure
  18. - IVDB - AMD I/O Virtualization Definition Block
  19. - IVHD - AMD I/O Virtualization Hardware Definition
  20. What is Intel RMRR?
  21. ^^^^^^^^^^^^^^^^^^^
  22. There are some devices the BIOS controls, for e.g USB devices to perform
  23. PS2 emulation. The regions of memory used for these devices are marked
  24. reserved in the e820 map. When we turn on DMA translation, DMA to those
  25. regions will fail. Hence BIOS uses RMRR to specify these regions along with
  26. devices that need to access these regions. OS is expected to setup
  27. unity mappings for these regions for these devices to access these regions.
  28. What is AMD IVRS?
  29. ^^^^^^^^^^^^^^^^^
  30. The architecture defines an ACPI-compatible data structure called an I/O
  31. Virtualization Reporting Structure (IVRS) that is used to convey information
  32. related to I/O virtualization to system software. The IVRS describes the
  33. configuration and capabilities of the IOMMUs contained in the platform as
  34. well as information about the devices that each IOMMU virtualizes.
  35. The IVRS provides information about the following:
  36. - IOMMUs present in the platform including their capabilities and proper configuration
  37. - System I/O topology relevant to each IOMMU
  38. - Peripheral devices that cannot be otherwise enumerated
  39. - Memory regions used by SMI/SMM, platform firmware, and platform hardware. These are generally exclusion ranges to be configured by system software.
  40. How is an I/O Virtual Address (IOVA) generated?
  41. -----------------------------------------------
  42. Well behaved drivers call dma_map_*() calls before sending command to device
  43. that needs to perform DMA. Once DMA is completed and mapping is no longer
  44. required, driver performs dma_unmap_*() calls to unmap the region.
  45. Intel Specific Notes
  46. --------------------
  47. Graphics Problems?
  48. ^^^^^^^^^^^^^^^^^^
  49. If you encounter issues with graphics devices, you can try adding
  50. option intel_iommu=igfx_off to turn off the integrated graphics engine.
  51. If this fixes anything, please ensure you file a bug reporting the problem.
  52. Some exceptions to IOVA
  53. ^^^^^^^^^^^^^^^^^^^^^^^
  54. Interrupt ranges are not address translated, (0xfee00000 - 0xfeefffff).
  55. The same is true for peer to peer transactions. Hence we reserve the
  56. address from PCI MMIO ranges so they are not allocated for IOVA addresses.
  57. AMD Specific Notes
  58. ------------------
  59. Graphics Problems?
  60. ^^^^^^^^^^^^^^^^^^
  61. If you encounter issues with integrated graphics devices, you can try adding
  62. option iommu=pt to the kernel command line use a 1:1 mapping for the IOMMU. If
  63. this fixes anything, please ensure you file a bug reporting the problem.
  64. Fault reporting
  65. ---------------
  66. When errors are reported, the IOMMU signals via an interrupt. The fault
  67. reason and device that caused it is printed on the console.
  68. Kernel Log Samples
  69. ------------------
  70. Intel Boot Messages
  71. ^^^^^^^^^^^^^^^^^^^
  72. Something like this gets printed indicating presence of DMAR tables
  73. in ACPI:
  74. ::
  75. ACPI: DMAR (v001 A M I OEMDMAR 0x00000001 MSFT 0x00000097) @ 0x000000007f5b5ef0
  76. When DMAR is being processed and initialized by ACPI, prints DMAR locations
  77. and any RMRR's processed:
  78. ::
  79. ACPI DMAR:Host address width 36
  80. ACPI DMAR:DRHD (flags: 0x00000000)base: 0x00000000fed90000
  81. ACPI DMAR:DRHD (flags: 0x00000000)base: 0x00000000fed91000
  82. ACPI DMAR:DRHD (flags: 0x00000001)base: 0x00000000fed93000
  83. ACPI DMAR:RMRR base: 0x00000000000ed000 end: 0x00000000000effff
  84. ACPI DMAR:RMRR base: 0x000000007f600000 end: 0x000000007fffffff
  85. When DMAR is enabled for use, you will notice:
  86. ::
  87. PCI-DMA: Using DMAR IOMMU
  88. Intel Fault reporting
  89. ^^^^^^^^^^^^^^^^^^^^^
  90. ::
  91. DMAR:[DMA Write] Request device [00:02.0] fault addr 6df084000
  92. DMAR:[fault reason 05] PTE Write access is not set
  93. DMAR:[DMA Write] Request device [00:02.0] fault addr 6df084000
  94. DMAR:[fault reason 05] PTE Write access is not set
  95. AMD Boot Messages
  96. ^^^^^^^^^^^^^^^^^
  97. Something like this gets printed indicating presence of the IOMMU:
  98. ::
  99. iommu: Default domain type: Translated
  100. iommu: DMA domain TLB invalidation policy: lazy mode
  101. AMD Fault reporting
  102. ^^^^^^^^^^^^^^^^^^^
  103. ::
  104. AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0007 address=0xffffc02000 flags=0x0000]
  105. AMD-Vi: Event logged [IO_PAGE_FAULT device=07:00.0 domain=0x0007 address=0xffffc02000 flags=0x0000]