Intel's Virtualization for Directed I/O (a.k.a IOMMU) Part 1

IOMMU's or Input/Output Memory Management Unit is a new entrant to the x86 world. This is something which has existed in the risc based systems for quite some time. You can get a brief introduction on the concept of what an IOMMU is all about from the
http://en.wikipedia.org/wiki/IOMMU

Basically an IOMMU brokers any DMA request on behalf of an IO device translating IO virtual address much the same way as the processor MMU complex performs translation of a virtual address to physical address.

Modern IOMMU's are more sophisticated and offers much more protection in a native OS environment and also provides many benefits including performance in a virtualized world. Since there are many things to be told about, iam going break this into multiple sections... how many parts? I dont know myself!

Many of the advantages are well highlighted in the above mentioned Wiki. So i will try not to duplicate the same. Instead talk about how the Intel IOMMU is exposed in a platform, How the OS goes about locating and initializing them etc.

For starters here is a location to the spec.

Chapter 8 lists BIOS considerations that describes how the BIOS tables are structured.

You can use the acpi tools from http://blastwave.network.com/csw/unstable/i386/5.11/

Basically the list is a definition of each DMA remapping engine description, and a list of devices under the scope of this engine. Unlike some other vendor IOMMU's this remapping engine is not necessarily one per pci bus. In fact we could have a specific engine for a isoch device such as high definition audio in a mobile chipset like the mobile series 4.

Here is how you would get a asl dump.


#acpidump --table DMAR -b > dmar.out
#iasl -d dmar.out
#cat dmar.dsl
/*
* Intel ACPI Component Architecture
* AML Disassembler version 20080321
*
* Disassembly of toshiba-dmar.binary, Mon Feb 2 22:00:29 2009
*
* ACPI Data Table [DMAR]
*
* Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue
*/

[000h 000 4] Signature : "DMAR" /* DMA Remapping table */
[004h 004 4] Table Length : 000000C8
[008h 008 1] Revision : 01
[009h 009 1] Checksum : 86
[00Ah 010 6] Oem ID : "TOSHIB"
[010h 016 8] Oem Table ID : "A0066 "
[018h 024 4] Oem Revision : 20080603
[01Ch 028 4] Asl Compiler ID : "TASM"
[020h 032 4] Asl Compiler Revision : 04010000

[024h 036 1] Host Address Width : 23

[030h 048 2] Subtable Type : 0000
[032h 050 2] Length : 0018
[034h 052 1] Flags : 00
[035h 053 3] Reserved : 000000
[038h 056 8] Register Base Address : 00000000FED90000

[040h 064 1] Device Scope Entry Type : 01
[041h 065 1] Entry Length : 08
[042h 066 1] PCI Segment Number : 00
[043h 067 1] PCI Bus Number : 00
[044h 068 2] PCI Path : [00, 00]
[046h 070 2] PCI Path : [1B, 00]

[048h 072 2] Subtable Type : 0000
[04Ah 074 2] Length : 0018
[04Ch 076 1] Flags : 00
[04Dh 077 3] Reserved : 000000
[050h 080 8] Register Base Address : 00000000FED92000

[058h 088 1] Device Scope Entry Type : 01
[059h 089 1] Entry Length : 08
[05Ah 090 1] PCI Segment Number : 00
[05Bh 091 1] PCI Bus Number : 00
[05Ch 092 2] PCI Path : [00, 00]
[05Eh 094 2] PCI Path : [03, 00]

[060h 096 2] Subtable Type : 0000
[062h 098 2] Length : 0010
[064h 100 1] Flags : 01
[065h 101 3] Reserved : 000000
[068h 104 8] Register Base Address : 00000000FED93000

[070h 112 2] Subtable Type : 0001
[072h 114 2] Length : 0058
[074h 116 1] Flags : 00
[075h 117 3] Reserved : 000000
[078h 120 8] Base Address : 00000000BFBB0000
[080h 128 8] End Address (limit) : 00000000BFBBFFFF

[088h 136 1] Device Scope Entry Type : 01
[089h 137 1] Entry Length : 08
[08Ah 138 1] PCI Segment Number : 00
[08Bh 139 1] PCI Bus Number : 00
[08Ch 140 2] PCI Path : [00, 00]
[08Eh 142 2] PCI Path : [1D, 00]

[090h 144 1] Device Scope Entry Type : 01
[091h 145 1] Entry Length : 08
[092h 146 1] PCI Segment Number : 00
[093h 147 1] PCI Bus Number : 00
[094h 148 2] PCI Path : [00, 00]
[096h 150 2] PCI Path : [1D, 01]

[098h 152 1] Device Scope Entry Type : 01
[099h 153 1] Entry Length : 08
[09Ah 154 1] PCI Segment Number : 00
[09Bh 155 1] PCI Bus Number : 00
[09Ch 156 2] PCI Path : [00, 00]
[09Eh 158 2] PCI Path : [1D, 02]

[0A0h 160 1] Device Scope Entry Type : 01
[0A1h 161 1] Entry Length : 08
[0A2h 162 1] PCI Segment Number : 00
[0A3h 163 1] PCI Bus Number : 00
[0A4h 164 2] PCI Path : [00, 00]
[0A6h 166 2] PCI Path : [1D, 07]

[0A8h 168 1] Device Scope Entry Type : 01
[0A9h 169 1] Entry Length : 08
[0AAh 170 1] PCI Segment Number : 00
[0ABh 171 1] PCI Bus Number : 00
[0ACh 172 2] PCI Path : [00, 00]
[0AEh 174 2] PCI Path : [1A, 00]

[0B0h 176 1] Device Scope Entry Type : 01
[0B1h 177 1] Entry Length : 08
[0B2h 178 1] PCI Segment Number : 00
[0B3h 179 1] PCI Bus Number : 00
[0B4h 180 2] PCI Path : [00, 00]
[0B6h 182 2] PCI Path : [1A, 01]

[0B8h 184 1] Device Scope Entry Type : 01
[0B9h 185 1] Entry Length : 08
[0BAh 186 1] PCI Segment Number : 00
[0BBh 187 1] PCI Bus Number : 00
[0BCh 188 2] PCI Path : [00, 00]
[0BEh 190 2] PCI Path : [1A, 02]

[0C0h 192 1] Device Scope Entry Type : 01
[0C1h 193 1] Entry Length : 08
[0C2h 194 1] PCI Segment Number : 00
[0C3h 195 1] PCI Bus Number : 00
[0C4h 196 2] PCI Path : [00, 00]
[0C6h 198 2] PCI Path : [1A, 07]

Raw Table Data

0000: 44 4D 41 52 C8 00 00 00 01 86 54 4F 53 48 49 42 DMAR......TOSHIB
0010: 41 30 30 36 36 20 20 20 03 06 08 20 54 41 53 4D A0066 ... TASM
0020: 00 00 01 04 23 00 00 00 00 00 00 00 00 00 00 00 ....#...........
0030: 00 00 18 00 00 00 00 00 00 00 D9 FE 00 00 00 00 ................
0040: 01 08 00 00 00 00 1B 00 00 00 18 00 00 00 00 00 ................
0050: 00 20 D9 FE 00 00 00 00 01 08 00 00 00 00 03 00 . ..............
0060: 00 00 10 00 01 00 00 00 00 30 D9 FE 00 00 00 00 .........0......
0070: 01 00 58 00 00 00 00 00 00 00 BB BF 00 00 00 00 ..X.............
0080: FF FF BB BF 00 00 00 00 01 08 00 00 00 00 1D 00 ................
0090: 01 08 00 00 00 00 1D 01 01 08 00 00 00 00 1D 02 ................
00A0: 01 08 00 00 00 00 1D 07 01 08 00 00 00 00 1A 00 ................
00B0: 01 08 00 00 00 00 1A 01 01 08 00 00 00 00 1A 02 ................
00C0: 01 08 00 00 00 00 1A 07 ........

Thats it for this one. In part 2, we will cover some of the common mistakes BIOS vendors do that has been real tough to deal with including some errata that we came across recently why i spent 3 weeks of sheer torture!

We all love BIOS's dont we :).
Catégories:
Étiquettes:
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.