18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci=====================================
48c2ecf20Sopenharmony_ciGeneric System Interconnect Subsystem
58c2ecf20Sopenharmony_ci=====================================
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ciIntroduction
88c2ecf20Sopenharmony_ci------------
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciThis framework is designed to provide a standard kernel interface to control
118c2ecf20Sopenharmony_cithe settings of the interconnects on an SoC. These settings can be throughput,
128c2ecf20Sopenharmony_cilatency and priority between multiple interconnected devices or functional
138c2ecf20Sopenharmony_ciblocks. This can be controlled dynamically in order to save power or provide
148c2ecf20Sopenharmony_cimaximum performance.
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ciThe interconnect bus is hardware with configurable parameters, which can be
178c2ecf20Sopenharmony_ciset on a data path according to the requests received from various drivers.
188c2ecf20Sopenharmony_ciAn example of interconnect buses are the interconnects between various
198c2ecf20Sopenharmony_cicomponents or functional blocks in chipsets. There can be multiple interconnects
208c2ecf20Sopenharmony_cion an SoC that can be multi-tiered.
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ciBelow is a simplified diagram of a real-world SoC interconnect bus topology.
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci::
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci +----------------+    +----------------+
278c2ecf20Sopenharmony_ci | HW Accelerator |--->|      M NoC     |<---------------+
288c2ecf20Sopenharmony_ci +----------------+    +----------------+                |
298c2ecf20Sopenharmony_ci                         |      |                    +------------+
308c2ecf20Sopenharmony_ci  +-----+  +-------------+      V       +------+     |            |
318c2ecf20Sopenharmony_ci  | DDR |  |                +--------+  | PCIe |     |            |
328c2ecf20Sopenharmony_ci  +-----+  |                | Slaves |  +------+     |            |
338c2ecf20Sopenharmony_ci    ^ ^    |                +--------+     |         |   C NoC    |
348c2ecf20Sopenharmony_ci    | |    V                               V         |            |
358c2ecf20Sopenharmony_ci +------------------+   +------------------------+   |            |   +-----+
368c2ecf20Sopenharmony_ci |                  |-->|                        |-->|            |-->| CPU |
378c2ecf20Sopenharmony_ci |                  |-->|                        |<--|            |   +-----+
388c2ecf20Sopenharmony_ci |     Mem NoC      |   |         S NoC          |   +------------+
398c2ecf20Sopenharmony_ci |                  |<--|                        |---------+    |
408c2ecf20Sopenharmony_ci |                  |<--|                        |<------+ |    |   +--------+
418c2ecf20Sopenharmony_ci +------------------+   +------------------------+       | |    +-->| Slaves |
428c2ecf20Sopenharmony_ci   ^  ^    ^    ^          ^                             | |        +--------+
438c2ecf20Sopenharmony_ci   |  |    |    |          |                             | V
448c2ecf20Sopenharmony_ci +------+  |  +-----+   +-----+  +---------+   +----------------+   +--------+
458c2ecf20Sopenharmony_ci | CPUs |  |  | GPU |   | DSP |  | Masters |-->|       P NoC    |-->| Slaves |
468c2ecf20Sopenharmony_ci +------+  |  +-----+   +-----+  +---------+   +----------------+   +--------+
478c2ecf20Sopenharmony_ci           |
488c2ecf20Sopenharmony_ci       +-------+
498c2ecf20Sopenharmony_ci       | Modem |
508c2ecf20Sopenharmony_ci       +-------+
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ciTerminology
538c2ecf20Sopenharmony_ci-----------
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ciInterconnect provider is the software definition of the interconnect hardware.
568c2ecf20Sopenharmony_ciThe interconnect providers on the above diagram are M NoC, S NoC, C NoC, P NoC
578c2ecf20Sopenharmony_ciand Mem NoC.
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ciInterconnect node is the software definition of the interconnect hardware
608c2ecf20Sopenharmony_ciport. Each interconnect provider consists of multiple interconnect nodes,
618c2ecf20Sopenharmony_ciwhich are connected to other SoC components including other interconnect
628c2ecf20Sopenharmony_ciproviders. The point on the diagram where the CPUs connect to the memory is
638c2ecf20Sopenharmony_cicalled an interconnect node, which belongs to the Mem NoC interconnect provider.
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ciInterconnect endpoints are the first or the last element of the path. Every
668c2ecf20Sopenharmony_ciendpoint is a node, but not every node is an endpoint.
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ciInterconnect path is everything between two endpoints including all the nodes
698c2ecf20Sopenharmony_cithat have to be traversed to reach from a source to destination node. It may
708c2ecf20Sopenharmony_ciinclude multiple master-slave pairs across several interconnect providers.
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ciInterconnect consumers are the entities which make use of the data paths exposed
738c2ecf20Sopenharmony_ciby the providers. The consumers send requests to providers requesting various
748c2ecf20Sopenharmony_cithroughput, latency and priority. Usually the consumers are device drivers, that
758c2ecf20Sopenharmony_cisend request based on their needs. An example for a consumer is a video decoder
768c2ecf20Sopenharmony_cithat supports various formats and image sizes.
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ciInterconnect providers
798c2ecf20Sopenharmony_ci----------------------
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ciInterconnect provider is an entity that implements methods to initialize and
828c2ecf20Sopenharmony_ciconfigure interconnect bus hardware. The interconnect provider drivers should
838c2ecf20Sopenharmony_cibe registered with the interconnect provider core.
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci.. kernel-doc:: include/linux/interconnect-provider.h
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ciInterconnect consumers
888c2ecf20Sopenharmony_ci----------------------
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ciInterconnect consumers are the clients which use the interconnect APIs to
918c2ecf20Sopenharmony_ciget paths between endpoints and set their bandwidth/latency/QoS requirements
928c2ecf20Sopenharmony_cifor these interconnect paths.  These interfaces are not currently
938c2ecf20Sopenharmony_cidocumented.
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ciInterconnect debugfs interfaces
968c2ecf20Sopenharmony_ci-------------------------------
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ciLike several other subsystems interconnect will create some files for debugging
998c2ecf20Sopenharmony_ciand introspection. Files in debugfs are not considered ABI so application
1008c2ecf20Sopenharmony_cisoftware shouldn't rely on format details change between kernel versions.
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci``/sys/kernel/debug/interconnect/interconnect_summary``:
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ciShow all interconnect nodes in the system with their aggregated bandwidth
1058c2ecf20Sopenharmony_cirequest. Indented under each node show bandwidth requests from each device.
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci``/sys/kernel/debug/interconnect/interconnect_graph``:
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ciShow the interconnect graph in the graphviz dot format. It shows all
1108c2ecf20Sopenharmony_ciinterconnect nodes and links in the system and groups together nodes from the
1118c2ecf20Sopenharmony_cisame provider as subgraphs. The format is human-readable and can also be piped
1128c2ecf20Sopenharmony_cithrough dot to generate diagrams in many graphical formats::
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci        $ cat /sys/kernel/debug/interconnect/interconnect_graph | \
1158c2ecf20Sopenharmony_ci                dot -Tsvg > interconnect_graph.svg
116