Project

General

Profile

Qualcomm Linux SMD » History » Version 1

laforge, 12/26/2016 07:25 PM

1 1 laforge
{{>toc}}
2
3
h1. Qualcomm Linux SMD (Shared Memory Device)
4
5
Indivudual processors / sub-systems in a multi-CPU SOC provide SMD channels.  This is basically a pipe abstraction over a shared memory protocol.
6
7
* SMD sub-systems:
8
** Modem (assumed to be hexagon with modem firmware?)
9
** Q6 (formerly known as LPASS == Low Power Audio SubSystem)
10
** DSPS
11
** WCNSS (Wireless Connectivity Sub System) aka 'riva'
12
** RPM (Resource Power Manager)
13
* inter-processor-interrupts for various 'edges'
14
15
h2. core driver
16
17
* arch/arm/mach-msm/smd.c
18
19
h3. api
20
21
* smd_open()
22
* smd_close()
23
* smd_write*()
24
* smd_read*()
25
* smsm_*()
26
27
h2. SMD based drivers
28
29
h3. smd_tty
30
31
Seems to expose tty devices (/dev/smdN) bound to SMD channels.
32
33
h3. smd_nmea
34
35
Exposes a tty device (/dev/nmea) bound to a SMD channel named "GPSNMEA".
36
37
h3. diagfwd
38
39
DIAG forwarding, see [[DIAG]]
40
41
h3. u_smd usb gadget
42
43
Used to forward data of certain USB endpoints towards other processors (mainly MDSP)
44
45
h3. 
46
47
h2. MSM IPC (Inter Process Communications) socket
48
49
Qualcomm implements a socket-based inter process communication on Linux.  It is implemented using a new address family, @AF_MSM_IPC@ (27).
50
51
The socket is used as datagram type socket (SOCK_DGRAM).
52
53
The socket address of a related socket consists of:
54
55
* the socket family (AF_MSM_IPC)
56
* a @struct msm_ipc_addr@, consisting of
57
** a single address type byte
58
** a port address (node_id, port_id)
59
** a port name (service, instance)
60
61
* arch/arm/mach-msm/ipc_socket.c
62
* AF_MSM_IPC
63
64
h3. packet ports
65
66
* Some kind of packet oriented interface towards the SMD
67
* msm_smd_pkt.c contains driver
68
** smdpkt0..7+smd22 devices, 2048 byte buffer
69
** open/release/read/write/poll syscalls implemented
70
71
h2. available SMD pipes
72
73
h3. SMD pipes on an [[EC25]]
74
75
<pre>
76
Primary allocation table:
77
root@mdm9607-perf:~# cat /sys/kernel/debug/smd/ch
78
ID|CHANNEL NAME       |T|PROC |STATE  |FIFO SZ|RDPTR  |WRPTR  |FLAGS   |DATAPEN
79
-------------------------------------------------------------------------------
80
 4|rpm_requests       |P|APPS |OPENED |0x00400|0x001E0|0x001E0|DCCiwRsB|0x00000
81
  |                   | |RPM  |OPENED |0x00400|0x00118|0x00118|DCCiwrsB|0x00000
82
-------------------------------------------------------------------------------
83
 5|rpm_requests       |P|MDMSW| Access Restricted
84
  |                   | |RPM  | Access Restricted
85
-------------------------------------------------------------------------------
86
 6|rpm_requests       |P|WCNSS| Access Restricted
87
  |                   | |RPM  | Access Restricted
88
-------------------------------------------------------------------------------
89
 7|rpm_requests       |P|TZ   | Access Restricted
90
  |                   | |RPM  | Access Restricted
91
-------------------------------------------------------------------------------
92
 8|rpm_requests       |P|ADSP | Access Restricted
93
  |                   | |RPM  | Access Restricted
94
-------------------------------------------------------------------------------
95
96
97
APPS <-> MDMSW Primary allocation table:
98
ID|CHANNEL NAME       |T|PROC |STATE  |FIFO SZ|RDPTR  |WRPTR  |FLAGS   |DATAPEN
99
-------------------------------------------------------------------------------
100
 0|DS                 |S|APPS |OPENED |0x02000|0x00000|0x00000|dcCiwrsb|0x00000
101
  |                   | |MDMSW|OPENED |0x02000|0x00000|0x00000|dCciwrsb|0x00000
102
-------------------------------------------------------------------------------
103
 1|IPCRTR             |P|APPS |OPENED |0x02000|0x012E4|0x012E4|DCCiwrsB|0x00000
104
  |                   | |MDMSW|OPENED |0x02000|0x011F8|0x011F8|DCCiwrsB|0x00000
105
-------------------------------------------------------------------------------
106
 2|SSM_RTR_MODEM_APPS |P|APPS |CLOSED |0x02000|0x00000|0x00000|dcciwrsb|0x00000
107
  |                   | |MDMSW|OPENING|0x02000|0x00000|0x00000|DCCiwrSb|0x00000
108
-------------------------------------------------------------------------------
109
 3|DIAG_2_CMD         |P|APPS |OPENED |0x02000|0x00000|0x00000|DCCiwrsb|0x00000
110
  |                   | |MDMSW|OPENED |0x02000|0x00000|0x00000|DCCiwrsb|0x00000
111
-------------------------------------------------------------------------------
112
 4|DIAG_2             |P|APPS |OPENED |0x02000|0x00000|0x00000|DCCiwrsb|0x00000
113
  |                   | |MDMSW|OPENED |0x02000|0x00000|0x00000|DCCiwrsb|0x00000
114
-------------------------------------------------------------------------------
115
 5|DIAG_CNTL          |P|APPS |OPENED |0x02000|0x00062|0x00062|DCCiwrsb|0x00000
116
  |                   | |MDMSW|OPENED |0x02000|0x007F5|0x007F5|DCCiwrsB|0x00000
117
-------------------------------------------------------------------------------
118
 6|DIAG_CMD           |P|APPS |OPENED |0x02000|0x00000|0x00000|DCCiwrsb|0x00000
119
  |                   | |MDMSW|OPENED |0x02000|0x00000|0x00000|DCCiwrsb|0x00000
120
-------------------------------------------------------------------------------
121
 7|DIAG               |P|APPS |OPENED |0x02000|0x00000|0x00000|DCCiwrsb|0x00000
122
  |                   | |MDMSW|OPENED |0x02000|0x00026|0x00026|DCCiwrsB|0x00000
123
-------------------------------------------------------------------------------
124
 8|apr_audio_svc      |P|APPS |OPENED |0x02000|0x002F0|0x002F0|DCCiwrsB|0x00000
125
  |                   | |MDMSW|OPENED |0x02000|0x00248|0x00248|DCCiwrsB|0x00000
126
-------------------------------------------------------------------------------
127
 9|apr_apps2          |P|APPS |CLOSED |0x02000|0x00000|0x00000|dcciwrsb|0x00000
128
  |                   | |MDMSW|OPENING|0x02000|0x00000|0x00000|DCCiwrSb|0x00000
129
-------------------------------------------------------------------------------
130
10|DATA1              |P|APPS |OPENED |0x02000|0x00000|0x00000|DCCiwrsB|0x00000
131
  |                   | |MDMSW|OPENED |0x02000|0x00000|0x00000|dCciwrsb|0x00000
132
-------------------------------------------------------------------------------
133
11|DATA2              |P|APPS |CLOSED |0x02000|0x00000|0x00000|dcciwrsb|0x00000
134
  |                   | |MDMSW|OPENING|0x02000|0x00000|0x00000|dCciwrSb|0x00000
135
-------------------------------------------------------------------------------
136
12|DATA3              |P|APPS |OPENED |0x02000|0x00000|0x00000|dcCiwrsb|0x00000
137
  |                   | |MDMSW|OPENED |0x02000|0x00000|0x00000|dCciwrsb|0x00000
138
-------------------------------------------------------------------------------
139
13|DATA4              |P|APPS |OPENED |0x02000|0x00000|0x00000|DCCiwrsB|0x00000
140
  |                   | |MDMSW|OPENED |0x02000|0x00000|0x00000|dCciwrsb|0x00000
141
-------------------------------------------------------------------------------
142
14|DATA11             |S|APPS |OPENED |0x02000|0x00089|0x00089|dcCiwRsb|0x00000
143
  |                   | |MDMSW|OPENED |0x02000|0x0012B|0x0012B|dCciwrsB|0x00000
144
-------------------------------------------------------------------------------
145
15|DATA40             |P|APPS |CLOSED |0x02000|0x00000|0x00000|dcciwrsb|0x00000
146
  |                   | |MDMSW|OPENING|0x02000|0x00000|0x00000|dcciwrSb|0x00000
147
-------------------------------------------------------------------------------
148
16|DATA5_CNTL         |P|APPS |CLOSED |0x00400|0x00000|0x00000|dcciwrsb|0x00000
149
  |                   | |MDMSW|OPENING|0x00400|0x00000|0x00000|DCCiwrSb|0x00000
150
-------------------------------------------------------------------------------
151
17|DATA40_CNTL        |P|APPS |OPENED |0x02000|0x00000|0x00000|DCCiwrsB|0x00000
152
  |                   | |MDMSW|OPENED |0x02000|0x00100|0x00100|DCCiwrsB|0x00000
153
-------------------------------------------------------------------------------
154
</pre>
155
156
h3. SMD pipes on an [[EC20]]:
157
158
<pre>
159
/sys/kernel/debug/smd # cat ch 
160
ch00:   OPENED(0000/0000) dcCiwrsb <->   OPENED(0000/0000) dCciwrsB :  2000
161
ch04:   OPENED(27336/27336) DCCiwrsB <->   OPENED(6552/6552) DCCiwrsB :  8000
162
ch05:   OPENED(0000/0000) DCCiwrsb <->   OPENED(12568/12568) DCCiwrsB : 10000
163
ch06:   OPENED(1872/1872) DCCiwrsB <->   OPENED(0216/0216) DCCiwrsB :  2000
164
ch07:   CLOSED(0000/0000) dcciwrsb <->  OPENING(0000/0000) DCCiwrSb :  2000
165
ch08:   CLOSED(0000/0000) dcciwrsb <->  OPENING(0000/0000) DCCiwrSb :   400
166
ch09:   OPENED(0952/0952) DCCiwrsb <->   OPENED(0438/0438) DCCiwrsB :   400
167
ch10:   OPENED(0000/0000) DCCiwrsb <->   OPENED(0000/0000) DCCiwrsb :  2000
168
ch11:   CLOSED(0000/0000) dcciwrsb <->  OPENING(0000/0000) DCCiwrSb :  2000
169
ch12:   OPENED(0000/0000) DCCiwrsb <->   OPENED(0000/0000) DCCiwrsb :  2000
170
ch13:   CLOSED(0000/0000) dcciwrsb <->  OPENING(0000/0000) DCCiwrSb :  2000
171
ch14:   OPENED(0480/0480) DCCiwrsB <->   OPENED(0376/0376) DCCiwrsB :   400
172
ch15:   CLOSED(0000/0000) dcciwrsb <->  OPENING(0000/0000) DCCiwrSb :  2000
173
ch16:   CLOSED(0000/0000) dcciwrsb <->  OPENING(0000/0000) DCCiwrSb :  2000
174
ch17:   CLOSED(0000/0000) dcciwrsb <->  OPENING(0000/0000) DCCiwrSb :   400
175
ch18:   OPENED(0000/0000) DCCiwrsb <->   OPENED(0000/0000) DCCiwrsb :  2000
176
ch19:   OPENED(0952/0952) DCCiwrsb <->   OPENED(0370/0370) DCCiwrsB :   400
177
ch20:   OPENED(0021/0021) DCCiwrsb <->   OPENED(0078/0078) DCCiwrsB :  2000
178
ch21:   CLOSED(0000/0000) dcciwrsb <->  OPENING(0000/0000) DCCiwrSb :  2000
179
ch22:   CLOSED(0000/0000) dcciwrsb <->  OPENING(0000/0000) dCciwrSb :  2000
180
ch23:   OPENED(0000/0000) dcCiwrsb <->   OPENED(0000/0000) dCciwrsB :  2000
181
ch24:   OPENED(0000/0000) DCCiwrsb <->   OPENED(0000/0000) dCciwrsb :  2000
182
ch25:   CLOSED(0000/0000) dcciwrsb <->  OPENING(0000/0000) dCciwrSb :  2000
183
ch26:   CLOSED(0000/0000) dcciwrsb <->  OPENING(0000/0000) dCciwrSb :  2000
184
ch27:   CLOSED(0000/0000) dcciwrsb <->  OPENING(0000/0000) dcciwrSb :  2000
185
ch28:   OPENED(0000/0000) DCCiwrsb <->   OPENED(0000/0000) DCCiwrsB :  2000
186
ch29:   CLOSED(0000/0000) dcciwrsb <->  OPENING(0000/0000) dcciwrSb :  2000
187
ch30:   OPENED(0295/0295) DCCiwrsB <->   OPENED(0563/0563) DCCiwrsB :   400
188
ch31:   OPENED(0237/0237) DCCiwrsB <->   OPENED(0415/0415) DCCiwrsB :   400
189
ch32:   OPENED(0237/0237) DCCiwrsB <->   OPENED(0415/0415) DCCiwrsB :   400
190
ch33:   OPENED(0237/0237) DCCiwrsB <->   OPENED(0415/0415) DCCiwrsB :   400
191
ch34:   OPENED(0000/0000) DCCiwrsb <->   OPENED(0000/0000) dCciwrsb :  2000
192
</pre>
193
194
<pre>
195
/sys/kernel/debug/smd # cat tbl
196
name=DS cid=0 ch type=0 xfer type=1 ref_count=2
197
name= cid=0 ch type=0 xfer type=0 ref_count=0
198
name= cid=0 ch type=0 xfer type=0 ref_count=0
199
name= cid=0 ch type=0 xfer type=0 ref_count=0
200
name=MSGR_SMD_P1 cid=4 ch type=11 xfer type=2 ref_count=2
201
name=MSGR_SMD_P0 cid=5 ch type=11 xfer type=2 ref_count=2
202
name=IPCRTR cid=6 ch type=1 xfer type=2 ref_count=1
203
name=IPCRTR cid=7 ch type=2 xfer type=2 ref_count=1
204
name=sys_mon cid=8 ch type=1 xfer type=2 ref_count=1
205
name=DIAG_CNTL cid=9 ch type=1 xfer type=2 ref_count=2
206
name=DIAG cid=10 ch type=1 xfer type=2 ref_count=2
207
name=apr_audio_svc cid=11 ch type=1 xfer type=2 ref_count=1
208
name=apr_voice_svc cid=12 ch type=2 xfer type=2 ref_count=2
209
name=apr_apps2 cid=13 ch type=1 xfer type=2 ref_count=1
210
name=RPCRPY_CNTL cid=14 ch type=0 xfer type=2 ref_count=2
211
name=IPCROUTER cid=15 ch type=0 xfer type=0 ref_count=1
212
name=SSM_RTR cid=16 ch type=0 xfer type=2 ref_count=1
213
name=sys_mon cid=17 ch type=0 xfer type=2 ref_count=1
214
name=DIAG_2 cid=18 ch type=0 xfer type=2 ref_count=2
215
name=DIAG_CNTL cid=19 ch type=0 xfer type=2 ref_count=2
216
name=DIAG cid=20 ch type=0 xfer type=2 ref_count=2
217
name=apr_voice_svc cid=21 ch type=0 xfer type=2 ref_count=1
218
name=DATA1 cid=22 ch type=0 xfer type=2 ref_count=2
219
name=DATA2 cid=23 ch type=0 xfer type=2 ref_count=2
220
name=DATA3 cid=24 ch type=0 xfer type=2 ref_count=2
221
name=DATA4 cid=25 ch type=0 xfer type=2 ref_count=2
222
name=DATA11 cid=26 ch type=0 xfer type=1 ref_count=2
223
name=DATA40 cid=27 ch type=0 xfer type=2 ref_count=2
224
name=DATA40_CNTL cid=28 ch type=0 xfer type=2 ref_count=2
225
name=DATA8 cid=29 ch type=0 xfer type=2 ref_count=2
226
name=DATA5_CNTL cid=30 ch type=0 xfer type=2 ref_count=2
227
name=DATA6_CNTL cid=31 ch type=0 xfer type=2 ref_count=2
228
name=DATA7_CNTL cid=32 ch type=0 xfer type=2 ref_count=2
229
name=DATA8_CNTL cid=33 ch type=0 xfer type=2 ref_count=2
230
name=GPSNMEA cid=34 ch type=0 xfer type=2 ref_count=2
231
</pre>
Add picture from clipboard (Maximum size: 48.8 MB)