xref: /OK3568_Linux_fs/kernel/Documentation/driver-api/interconnect.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun=====================================
4*4882a593SmuzhiyunGeneric System Interconnect Subsystem
5*4882a593Smuzhiyun=====================================
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunIntroduction
8*4882a593Smuzhiyun------------
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunThis framework is designed to provide a standard kernel interface to control
11*4882a593Smuzhiyunthe settings of the interconnects on an SoC. These settings can be throughput,
12*4882a593Smuzhiyunlatency and priority between multiple interconnected devices or functional
13*4882a593Smuzhiyunblocks. This can be controlled dynamically in order to save power or provide
14*4882a593Smuzhiyunmaximum performance.
15*4882a593Smuzhiyun
16*4882a593SmuzhiyunThe interconnect bus is hardware with configurable parameters, which can be
17*4882a593Smuzhiyunset on a data path according to the requests received from various drivers.
18*4882a593SmuzhiyunAn example of interconnect buses are the interconnects between various
19*4882a593Smuzhiyuncomponents or functional blocks in chipsets. There can be multiple interconnects
20*4882a593Smuzhiyunon an SoC that can be multi-tiered.
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunBelow is a simplified diagram of a real-world SoC interconnect bus topology.
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun::
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun +----------------+    +----------------+
27*4882a593Smuzhiyun | HW Accelerator |--->|      M NoC     |<---------------+
28*4882a593Smuzhiyun +----------------+    +----------------+                |
29*4882a593Smuzhiyun                         |      |                    +------------+
30*4882a593Smuzhiyun  +-----+  +-------------+      V       +------+     |            |
31*4882a593Smuzhiyun  | DDR |  |                +--------+  | PCIe |     |            |
32*4882a593Smuzhiyun  +-----+  |                | Slaves |  +------+     |            |
33*4882a593Smuzhiyun    ^ ^    |                +--------+     |         |   C NoC    |
34*4882a593Smuzhiyun    | |    V                               V         |            |
35*4882a593Smuzhiyun +------------------+   +------------------------+   |            |   +-----+
36*4882a593Smuzhiyun |                  |-->|                        |-->|            |-->| CPU |
37*4882a593Smuzhiyun |                  |-->|                        |<--|            |   +-----+
38*4882a593Smuzhiyun |     Mem NoC      |   |         S NoC          |   +------------+
39*4882a593Smuzhiyun |                  |<--|                        |---------+    |
40*4882a593Smuzhiyun |                  |<--|                        |<------+ |    |   +--------+
41*4882a593Smuzhiyun +------------------+   +------------------------+       | |    +-->| Slaves |
42*4882a593Smuzhiyun   ^  ^    ^    ^          ^                             | |        +--------+
43*4882a593Smuzhiyun   |  |    |    |          |                             | V
44*4882a593Smuzhiyun +------+  |  +-----+   +-----+  +---------+   +----------------+   +--------+
45*4882a593Smuzhiyun | CPUs |  |  | GPU |   | DSP |  | Masters |-->|       P NoC    |-->| Slaves |
46*4882a593Smuzhiyun +------+  |  +-----+   +-----+  +---------+   +----------------+   +--------+
47*4882a593Smuzhiyun           |
48*4882a593Smuzhiyun       +-------+
49*4882a593Smuzhiyun       | Modem |
50*4882a593Smuzhiyun       +-------+
51*4882a593Smuzhiyun
52*4882a593SmuzhiyunTerminology
53*4882a593Smuzhiyun-----------
54*4882a593Smuzhiyun
55*4882a593SmuzhiyunInterconnect provider is the software definition of the interconnect hardware.
56*4882a593SmuzhiyunThe interconnect providers on the above diagram are M NoC, S NoC, C NoC, P NoC
57*4882a593Smuzhiyunand Mem NoC.
58*4882a593Smuzhiyun
59*4882a593SmuzhiyunInterconnect node is the software definition of the interconnect hardware
60*4882a593Smuzhiyunport. Each interconnect provider consists of multiple interconnect nodes,
61*4882a593Smuzhiyunwhich are connected to other SoC components including other interconnect
62*4882a593Smuzhiyunproviders. The point on the diagram where the CPUs connect to the memory is
63*4882a593Smuzhiyuncalled an interconnect node, which belongs to the Mem NoC interconnect provider.
64*4882a593Smuzhiyun
65*4882a593SmuzhiyunInterconnect endpoints are the first or the last element of the path. Every
66*4882a593Smuzhiyunendpoint is a node, but not every node is an endpoint.
67*4882a593Smuzhiyun
68*4882a593SmuzhiyunInterconnect path is everything between two endpoints including all the nodes
69*4882a593Smuzhiyunthat have to be traversed to reach from a source to destination node. It may
70*4882a593Smuzhiyuninclude multiple master-slave pairs across several interconnect providers.
71*4882a593Smuzhiyun
72*4882a593SmuzhiyunInterconnect consumers are the entities which make use of the data paths exposed
73*4882a593Smuzhiyunby the providers. The consumers send requests to providers requesting various
74*4882a593Smuzhiyunthroughput, latency and priority. Usually the consumers are device drivers, that
75*4882a593Smuzhiyunsend request based on their needs. An example for a consumer is a video decoder
76*4882a593Smuzhiyunthat supports various formats and image sizes.
77*4882a593Smuzhiyun
78*4882a593SmuzhiyunInterconnect providers
79*4882a593Smuzhiyun----------------------
80*4882a593Smuzhiyun
81*4882a593SmuzhiyunInterconnect provider is an entity that implements methods to initialize and
82*4882a593Smuzhiyunconfigure interconnect bus hardware. The interconnect provider drivers should
83*4882a593Smuzhiyunbe registered with the interconnect provider core.
84*4882a593Smuzhiyun
85*4882a593Smuzhiyun.. kernel-doc:: include/linux/interconnect-provider.h
86*4882a593Smuzhiyun
87*4882a593SmuzhiyunInterconnect consumers
88*4882a593Smuzhiyun----------------------
89*4882a593Smuzhiyun
90*4882a593SmuzhiyunInterconnect consumers are the clients which use the interconnect APIs to
91*4882a593Smuzhiyunget paths between endpoints and set their bandwidth/latency/QoS requirements
92*4882a593Smuzhiyunfor these interconnect paths.  These interfaces are not currently
93*4882a593Smuzhiyundocumented.
94*4882a593Smuzhiyun
95*4882a593SmuzhiyunInterconnect debugfs interfaces
96*4882a593Smuzhiyun-------------------------------
97*4882a593Smuzhiyun
98*4882a593SmuzhiyunLike several other subsystems interconnect will create some files for debugging
99*4882a593Smuzhiyunand introspection. Files in debugfs are not considered ABI so application
100*4882a593Smuzhiyunsoftware shouldn't rely on format details change between kernel versions.
101*4882a593Smuzhiyun
102*4882a593Smuzhiyun``/sys/kernel/debug/interconnect/interconnect_summary``:
103*4882a593Smuzhiyun
104*4882a593SmuzhiyunShow all interconnect nodes in the system with their aggregated bandwidth
105*4882a593Smuzhiyunrequest. Indented under each node show bandwidth requests from each device.
106*4882a593Smuzhiyun
107*4882a593Smuzhiyun``/sys/kernel/debug/interconnect/interconnect_graph``:
108*4882a593Smuzhiyun
109*4882a593SmuzhiyunShow the interconnect graph in the graphviz dot format. It shows all
110*4882a593Smuzhiyuninterconnect nodes and links in the system and groups together nodes from the
111*4882a593Smuzhiyunsame provider as subgraphs. The format is human-readable and can also be piped
112*4882a593Smuzhiyunthrough dot to generate diagrams in many graphical formats::
113*4882a593Smuzhiyun
114*4882a593Smuzhiyun        $ cat /sys/kernel/debug/interconnect/interconnect_graph | \
115*4882a593Smuzhiyun                dot -Tsvg > interconnect_graph.svg
116