^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) * virtio memory mapped device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) See https://ozlabs.org/~rusty/virtio-spec/ for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) Required properties:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) - compatible: "virtio,mmio" compatibility string
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) - reg: control registers base address and size including configuration space
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) - interrupts: interrupt generated by the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) Required properties for virtio-iommu:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) - #iommu-cells: When the node corresponds to a virtio-iommu device, it is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) linked to DMA masters using the "iommus" or "iommu-map"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) properties [1][2]. #iommu-cells specifies the size of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) "iommus" property. For virtio-iommu #iommu-cells must be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 1, each cell describing a single endpoint ID.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) Optional properties:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) - iommus: If the device accesses memory through an IOMMU, it should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) have an "iommus" property [1]. Since virtio-iommu itself
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) does not access memory through an IOMMU, the "virtio,mmio"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) node cannot have both an "#iommu-cells" and an "iommus"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) property.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) Example:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) virtio_block@3000 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) compatible = "virtio,mmio";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) reg = <0x3000 0x100>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) interrupts = <41>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /* Device has endpoint ID 23 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) iommus = <&viommu 23>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) viommu: iommu@3100 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) compatible = "virtio,mmio";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) reg = <0x3100 0x100>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) interrupts = <42>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #iommu-cells = <1>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) [1] Documentation/devicetree/bindings/iommu/iommu.txt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) [2] Documentation/devicetree/bindings/pci/pci-iommu.txt