Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) * virtio IOMMU PCI device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) When virtio-iommu uses the PCI transport, its programming interface is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) discovered dynamically by the PCI probing infrastructure. However the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) device tree statically describes the relation between IOMMU and DMA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) masters. Therefore, the PCI root complex that hosts the virtio-iommu
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) contains a child node representing the IOMMU device explicitly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) Required properties:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) - compatible:	Should be "virtio,pci-iommu"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) - reg:		PCI address of the IOMMU. As defined in the PCI Bus
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 		Binding reference [1], the reg property is a five-cell
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 		address encoded as (phys.hi phys.mid phys.lo size.hi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 		size.lo). phys.hi should contain the device's BDF as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 		0b00000000 bbbbbbbb dddddfff 00000000. The other cells
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 		should be zero.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) - #iommu-cells:	Each platform DMA master managed by the IOMMU is assigned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 		an endpoint ID, described by the "iommus" property [2].
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 		For virtio-iommu, #iommu-cells must be 1.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) Notes:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) - DMA from the IOMMU device isn't managed by another IOMMU. Therefore the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)   virtio-iommu node doesn't have an "iommus" property, and is omitted from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)   the iommu-map property of the root complex.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) Example:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) pcie@10000000 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	compatible = "pci-host-ecam-generic";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	/* The IOMMU programming interface uses slot 00:01.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	iommu0: iommu@0008 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 		compatible = "virtio,pci-iommu";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 		reg = <0x00000800 0 0 0 0>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 		#iommu-cells = <1>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	 * The IOMMU manages all functions in this PCI domain except
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	 * itself. Omit BDF 00:01.0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	iommu-map = <0x0 &iommu0 0x0 0x8>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 		    <0x9 &iommu0 0x9 0xfff7>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) pcie@20000000 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	compatible = "pci-host-ecam-generic";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	 * The IOMMU also manages all functions from this domain,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	 * with endpoint IDs 0x10000 - 0x1ffff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	iommu-map = <0x0 &iommu0 0x10000 0x10000>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) ethernet@fe001000 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	/* The IOMMU manages this platform device with endpoint ID 0x20000 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 	iommus = <&iommu0 0x20000>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) [1] Documentation/devicetree/bindings/pci/pci.txt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) [2] Documentation/devicetree/bindings/iommu/iommu.txt