Project

General

Profile

Qualcomm Linux SMD » History » Version 4

laforge, 12/26/2016 07:46 PM

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