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