16ec2392cSMark RutlandThis document describes the generic device tree binding for describing the 26ec2392cSMark Rutlandrelationship between PCI(e) devices and IOMMU(s). 36ec2392cSMark Rutland 46ec2392cSMark RutlandEach PCI(e) device under a root complex is uniquely identified by its Requester 56ec2392cSMark RutlandID (AKA RID). A Requester ID is a triplet of a Bus number, Device number, and 66ec2392cSMark RutlandFunction number. 76ec2392cSMark Rutland 86ec2392cSMark RutlandFor the purpose of this document, when treated as a numeric value, a RID is 96ec2392cSMark Rutlandformatted such that: 106ec2392cSMark Rutland 116ec2392cSMark Rutland* Bits [15:8] are the Bus number. 126ec2392cSMark Rutland* Bits [7:3] are the Device number. 136ec2392cSMark Rutland* Bits [2:0] are the Function number. 146ec2392cSMark Rutland* Any other bits required for padding must be zero. 156ec2392cSMark Rutland 166ec2392cSMark RutlandIOMMUs may distinguish PCI devices through sideband data derived from the 176ec2392cSMark RutlandRequester ID. While a given PCI device can only master through one IOMMU, a 186ec2392cSMark Rutlandroot complex may split masters across a set of IOMMUs (e.g. with one IOMMU per 196ec2392cSMark Rutlandbus). 206ec2392cSMark Rutland 216ec2392cSMark RutlandThe generic 'iommus' property is insufficient to describe this relationship, 226ec2392cSMark Rutlandand a mechanism is required to map from a PCI device to its IOMMU and sideband 236ec2392cSMark Rutlanddata. 246ec2392cSMark Rutland 256ec2392cSMark RutlandFor generic IOMMU bindings, see 266ec2392cSMark RutlandDocumentation/devicetree/bindings/iommu/iommu.txt. 276ec2392cSMark Rutland 286ec2392cSMark Rutland 296ec2392cSMark RutlandPCI root complex 306ec2392cSMark Rutland================ 316ec2392cSMark Rutland 326ec2392cSMark RutlandOptional properties 336ec2392cSMark Rutland------------------- 346ec2392cSMark Rutland 35*5bb61d14SStuart Yoder- iommu-map: Maps a Requester ID to an IOMMU and associated IOMMU specifier 366ec2392cSMark Rutland data. 376ec2392cSMark Rutland 386ec2392cSMark Rutland The property is an arbitrary number of tuples of 396ec2392cSMark Rutland (rid-base,iommu,iommu-base,length). 406ec2392cSMark Rutland 416ec2392cSMark Rutland Any RID r in the interval [rid-base, rid-base + length) is associated with 42*5bb61d14SStuart Yoder the listed IOMMU, with the IOMMU specifier (r - rid-base + iommu-base). 436ec2392cSMark Rutland 446ec2392cSMark Rutland- iommu-map-mask: A mask to be applied to each Requester ID prior to being 45*5bb61d14SStuart Yoder mapped to an IOMMU specifier per the iommu-map property. 466ec2392cSMark Rutland 476ec2392cSMark Rutland 486ec2392cSMark RutlandExample (1) 496ec2392cSMark Rutland=========== 506ec2392cSMark Rutland 516ec2392cSMark Rutland/ { 526ec2392cSMark Rutland #address-cells = <1>; 536ec2392cSMark Rutland #size-cells = <1>; 546ec2392cSMark Rutland 556ec2392cSMark Rutland iommu: iommu@a { 566ec2392cSMark Rutland reg = <0xa 0x1>; 576ec2392cSMark Rutland compatible = "vendor,some-iommu"; 586ec2392cSMark Rutland #iommu-cells = <1>; 596ec2392cSMark Rutland }; 606ec2392cSMark Rutland 616ec2392cSMark Rutland pci: pci@f { 626ec2392cSMark Rutland reg = <0xf 0x1>; 636ec2392cSMark Rutland compatible = "vendor,pcie-root-complex"; 646ec2392cSMark Rutland device_type = "pci"; 656ec2392cSMark Rutland 666ec2392cSMark Rutland /* 676ec2392cSMark Rutland * The sideband data provided to the IOMMU is the RID, 686ec2392cSMark Rutland * identity-mapped. 696ec2392cSMark Rutland */ 706ec2392cSMark Rutland iommu-map = <0x0 &iommu 0x0 0x10000>; 716ec2392cSMark Rutland }; 726ec2392cSMark Rutland}; 736ec2392cSMark Rutland 746ec2392cSMark Rutland 756ec2392cSMark RutlandExample (2) 766ec2392cSMark Rutland=========== 776ec2392cSMark Rutland 786ec2392cSMark Rutland/ { 796ec2392cSMark Rutland #address-cells = <1>; 806ec2392cSMark Rutland #size-cells = <1>; 816ec2392cSMark Rutland 826ec2392cSMark Rutland iommu: iommu@a { 836ec2392cSMark Rutland reg = <0xa 0x1>; 846ec2392cSMark Rutland compatible = "vendor,some-iommu"; 856ec2392cSMark Rutland #iommu-cells = <1>; 866ec2392cSMark Rutland }; 876ec2392cSMark Rutland 886ec2392cSMark Rutland pci: pci@f { 896ec2392cSMark Rutland reg = <0xf 0x1>; 906ec2392cSMark Rutland compatible = "vendor,pcie-root-complex"; 916ec2392cSMark Rutland device_type = "pci"; 926ec2392cSMark Rutland 936ec2392cSMark Rutland /* 946ec2392cSMark Rutland * The sideband data provided to the IOMMU is the RID with the 956ec2392cSMark Rutland * function bits masked out. 966ec2392cSMark Rutland */ 976ec2392cSMark Rutland iommu-map = <0x0 &iommu 0x0 0x10000>; 986ec2392cSMark Rutland iommu-map-mask = <0xfff8>; 996ec2392cSMark Rutland }; 1006ec2392cSMark Rutland}; 1016ec2392cSMark Rutland 1026ec2392cSMark Rutland 1036ec2392cSMark RutlandExample (3) 1046ec2392cSMark Rutland=========== 1056ec2392cSMark Rutland 1066ec2392cSMark Rutland/ { 1076ec2392cSMark Rutland #address-cells = <1>; 1086ec2392cSMark Rutland #size-cells = <1>; 1096ec2392cSMark Rutland 1106ec2392cSMark Rutland iommu: iommu@a { 1116ec2392cSMark Rutland reg = <0xa 0x1>; 1126ec2392cSMark Rutland compatible = "vendor,some-iommu"; 1136ec2392cSMark Rutland #iommu-cells = <1>; 1146ec2392cSMark Rutland }; 1156ec2392cSMark Rutland 1166ec2392cSMark Rutland pci: pci@f { 1176ec2392cSMark Rutland reg = <0xf 0x1>; 1186ec2392cSMark Rutland compatible = "vendor,pcie-root-complex"; 1196ec2392cSMark Rutland device_type = "pci"; 1206ec2392cSMark Rutland 1216ec2392cSMark Rutland /* 1226ec2392cSMark Rutland * The sideband data provided to the IOMMU is the RID, 1236ec2392cSMark Rutland * but the high bits of the bus number are flipped. 1246ec2392cSMark Rutland */ 1256ec2392cSMark Rutland iommu-map = <0x0000 &iommu 0x8000 0x8000>, 1266ec2392cSMark Rutland <0x8000 &iommu 0x0000 0x8000>; 1276ec2392cSMark Rutland }; 1286ec2392cSMark Rutland}; 1296ec2392cSMark Rutland 1306ec2392cSMark Rutland 1316ec2392cSMark RutlandExample (4) 1326ec2392cSMark Rutland=========== 1336ec2392cSMark Rutland 1346ec2392cSMark Rutland/ { 1356ec2392cSMark Rutland #address-cells = <1>; 1366ec2392cSMark Rutland #size-cells = <1>; 1376ec2392cSMark Rutland 1386ec2392cSMark Rutland iommu_a: iommu@a { 1396ec2392cSMark Rutland reg = <0xa 0x1>; 1406ec2392cSMark Rutland compatible = "vendor,some-iommu"; 1416ec2392cSMark Rutland #iommu-cells = <1>; 1426ec2392cSMark Rutland }; 1436ec2392cSMark Rutland 1446ec2392cSMark Rutland iommu_b: iommu@b { 1456ec2392cSMark Rutland reg = <0xb 0x1>; 1466ec2392cSMark Rutland compatible = "vendor,some-iommu"; 1476ec2392cSMark Rutland #iommu-cells = <1>; 1486ec2392cSMark Rutland }; 1496ec2392cSMark Rutland 1506ec2392cSMark Rutland iommu_c: iommu@c { 1516ec2392cSMark Rutland reg = <0xc 0x1>; 1526ec2392cSMark Rutland compatible = "vendor,some-iommu"; 1536ec2392cSMark Rutland #iommu-cells = <1>; 1546ec2392cSMark Rutland }; 1556ec2392cSMark Rutland 1566ec2392cSMark Rutland pci: pci@f { 1576ec2392cSMark Rutland reg = <0xf 0x1>; 1586ec2392cSMark Rutland compatible = "vendor,pcie-root-complex"; 1596ec2392cSMark Rutland device_type = "pci"; 1606ec2392cSMark Rutland 1616ec2392cSMark Rutland /* 1626ec2392cSMark Rutland * Devices with bus number 0-127 are mastered via IOMMU 1636ec2392cSMark Rutland * a, with sideband data being RID[14:0]. 1646ec2392cSMark Rutland * Devices with bus number 128-255 are mastered via 1656ec2392cSMark Rutland * IOMMU b, with sideband data being RID[14:0]. 1666ec2392cSMark Rutland * No devices master via IOMMU c. 1676ec2392cSMark Rutland */ 1686ec2392cSMark Rutland iommu-map = <0x0000 &iommu_a 0x0000 0x8000>, 1696ec2392cSMark Rutland <0x8000 &iommu_b 0x0000 0x8000>; 1706ec2392cSMark Rutland }; 1716ec2392cSMark Rutland}; 172