Qualcomm Linux SMD » History » Version 12
laforge, 12/26/2016 10:27 PM
s/pipe/channel/g
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 | 5 | laforge | * smd_open() / smd_named_open_on_edge() |
25 | 1 | laforge | * 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 | 11 | laforge | Used to forward data of certain USB endpoints (of USB serial devices) towards other processors (mainly MDSP). |
47 | |||
48 | 12 | laforge | The SMD channels used differ from device to device. In the [[EC20]] case, it looks like DATA2, DS and DATA3 channels are exposed via USB. |
49 | 11 | laforge | |
50 | 12 | laforge | The classic usb serial devices for AT command ports are implemented this way. Their data is passed from USB endpoints to SMD channels and vice-versa. |
51 | 11 | laforge | |
52 | In difference to the BAM2BAM ports used for user (IP) data, the u_smd serial data still is received by the Linux serial gadget driver and then passed on towards the SMD devices, i.e. the buffers go throug the linux kernel (and can be interpreted/modified). |
||
53 | 1 | laforge | |
54 | 3 | laforge | h3. packet ports |
55 | 1 | laforge | |
56 | 3 | laforge | * Some kind of packet oriented interface towards the SMD |
57 | * msm_smd_pkt.c contains driver |
||
58 | ** smdpkt0..7+smd22 devices, 2048 byte buffer |
||
59 | ** open/release/read/write/poll syscalls implemented |
||
60 | |||
61 | 12 | laforge | |_.SMD Channel|_.Device| |
62 | 8 | laforge | |DATA5_CNTL|smdcntl0| |
63 | |DATA6_CNTL|smdcntl1| |
||
64 | |DATA7_CNTL|smdcntl2| |
||
65 | |DATA8_CNTL|smdcntl3| |
||
66 | |DATA9_CNTL|smdcntl4| |
||
67 | |DATA12_CNTL|smdcntl5| |
||
68 | |DATA13_CNTL|smdcntl6| |
||
69 | |DATA14_CNTL|smdcntl7| |
||
70 | |DATA22|smd22| |
||
71 | |||
72 | |||
73 | |||
74 | 4 | laforge | h3. hci_smd |
75 | |||
76 | Apparently used to talk HCI to a bluetooth chip on a different processor. Not used in the modem devices we've seen. |
||
77 | |||
78 | 6 | laforge | h3. smd_qmi |
79 | |||
80 | Binds to the following channels and exposes the related devices: |
||
81 | |||
82 | 12 | laforge | |_.SMD Channels|_.QMI Device| |
83 | 6 | laforge | |SMD_DATA5_CNTL|/dev/qmi0| |
84 | |SMD_DATA6_CNTL|/dev/qmi1| |
||
85 | |SMD_DATA7_CNTL|/dev/qmi2| |
||
86 | |||
87 | 7 | laforge | It seems this is an older generation of accessing [[QMI]] from the Linux application processor, which has now been replaced by qmuxd which opens @/dev/smdcntl@ devices and thus bypasses any QMI message parsing/interpretation inside the kernel? |
88 | 4 | laforge | |
89 | 9 | laforge | h3. msm_rmnet |
90 | |||
91 | 12 | laforge | Implements a Linux kernel network device based on a SMD Cannels. |
92 | 1 | laforge | |
93 | 12 | laforge | The default SMD channels used by the msm_rmnet driver are listed below. There is no static mapping to a rmnetN device, as the numbers of the network devices are dynamically allocated. |
94 | 10 | laforge | |
95 | 12 | laforge | |_.SMD Channel| |
96 | 10 | laforge | |DATA5| |
97 | |DATA6| |
||
98 | |DATA7| |
||
99 | |DATA8| |
||
100 | |DATA9| |
||
101 | |DATA12| |
||
102 | |DATA13| |
||
103 | |DATA14| |
||
104 | |||
105 | 12 | laforge | Comparing this with the table from /sys/kernel/debug/smd/tbl on the [[EC20]] seems to suggest that DATA8 is the only SMD channel used for msm_rmnet and thus the rmnet0 device. |
106 | 9 | laforge | |
107 | 1 | laforge | h2. MSM IPC (Inter Process Communications) socket |
108 | |||
109 | Qualcomm implements a socket-based inter process communication on Linux. It is implemented using a new address family, @AF_MSM_IPC@ (27). |
||
110 | |||
111 | The socket is used as datagram type socket (SOCK_DGRAM). |
||
112 | |||
113 | The socket address of a related socket consists of: |
||
114 | |||
115 | * the socket family (AF_MSM_IPC) |
||
116 | * a @struct msm_ipc_addr@, consisting of |
||
117 | ** a single address type byte |
||
118 | ** a port address (node_id, port_id) |
||
119 | ** a port name (service, instance) |
||
120 | |||
121 | * arch/arm/mach-msm/ipc_socket.c |
||
122 | * AF_MSM_IPC |
||
123 | |||
124 | |||
125 | 12 | laforge | h2. available SMD channels |
126 | 1 | laforge | |
127 | 12 | laforge | h3. SMD channels on an [[EC25]] |
128 | 1 | laforge | |
129 | <pre> |
||
130 | Primary allocation table: |
||
131 | root@mdm9607-perf:~# cat /sys/kernel/debug/smd/ch |
||
132 | ID|CHANNEL NAME |T|PROC |STATE |FIFO SZ|RDPTR |WRPTR |FLAGS |DATAPEN |
||
133 | ------------------------------------------------------------------------------- |
||
134 | 4|rpm_requests |P|APPS |OPENED |0x00400|0x001E0|0x001E0|DCCiwRsB|0x00000 |
||
135 | | | |RPM |OPENED |0x00400|0x00118|0x00118|DCCiwrsB|0x00000 |
||
136 | ------------------------------------------------------------------------------- |
||
137 | 5|rpm_requests |P|MDMSW| Access Restricted |
||
138 | | | |RPM | Access Restricted |
||
139 | ------------------------------------------------------------------------------- |
||
140 | 6|rpm_requests |P|WCNSS| Access Restricted |
||
141 | | | |RPM | Access Restricted |
||
142 | ------------------------------------------------------------------------------- |
||
143 | 7|rpm_requests |P|TZ | Access Restricted |
||
144 | | | |RPM | Access Restricted |
||
145 | ------------------------------------------------------------------------------- |
||
146 | 8|rpm_requests |P|ADSP | Access Restricted |
||
147 | | | |RPM | Access Restricted |
||
148 | ------------------------------------------------------------------------------- |
||
149 | |||
150 | |||
151 | APPS <-> MDMSW Primary allocation table: |
||
152 | ID|CHANNEL NAME |T|PROC |STATE |FIFO SZ|RDPTR |WRPTR |FLAGS |DATAPEN |
||
153 | ------------------------------------------------------------------------------- |
||
154 | 0|DS |S|APPS |OPENED |0x02000|0x00000|0x00000|dcCiwrsb|0x00000 |
||
155 | | | |MDMSW|OPENED |0x02000|0x00000|0x00000|dCciwrsb|0x00000 |
||
156 | ------------------------------------------------------------------------------- |
||
157 | 1|IPCRTR |P|APPS |OPENED |0x02000|0x012E4|0x012E4|DCCiwrsB|0x00000 |
||
158 | | | |MDMSW|OPENED |0x02000|0x011F8|0x011F8|DCCiwrsB|0x00000 |
||
159 | ------------------------------------------------------------------------------- |
||
160 | 2|SSM_RTR_MODEM_APPS |P|APPS |CLOSED |0x02000|0x00000|0x00000|dcciwrsb|0x00000 |
||
161 | | | |MDMSW|OPENING|0x02000|0x00000|0x00000|DCCiwrSb|0x00000 |
||
162 | ------------------------------------------------------------------------------- |
||
163 | 3|DIAG_2_CMD |P|APPS |OPENED |0x02000|0x00000|0x00000|DCCiwrsb|0x00000 |
||
164 | | | |MDMSW|OPENED |0x02000|0x00000|0x00000|DCCiwrsb|0x00000 |
||
165 | ------------------------------------------------------------------------------- |
||
166 | 4|DIAG_2 |P|APPS |OPENED |0x02000|0x00000|0x00000|DCCiwrsb|0x00000 |
||
167 | | | |MDMSW|OPENED |0x02000|0x00000|0x00000|DCCiwrsb|0x00000 |
||
168 | ------------------------------------------------------------------------------- |
||
169 | 5|DIAG_CNTL |P|APPS |OPENED |0x02000|0x00062|0x00062|DCCiwrsb|0x00000 |
||
170 | | | |MDMSW|OPENED |0x02000|0x007F5|0x007F5|DCCiwrsB|0x00000 |
||
171 | ------------------------------------------------------------------------------- |
||
172 | 6|DIAG_CMD |P|APPS |OPENED |0x02000|0x00000|0x00000|DCCiwrsb|0x00000 |
||
173 | | | |MDMSW|OPENED |0x02000|0x00000|0x00000|DCCiwrsb|0x00000 |
||
174 | ------------------------------------------------------------------------------- |
||
175 | 7|DIAG |P|APPS |OPENED |0x02000|0x00000|0x00000|DCCiwrsb|0x00000 |
||
176 | | | |MDMSW|OPENED |0x02000|0x00026|0x00026|DCCiwrsB|0x00000 |
||
177 | ------------------------------------------------------------------------------- |
||
178 | 8|apr_audio_svc |P|APPS |OPENED |0x02000|0x002F0|0x002F0|DCCiwrsB|0x00000 |
||
179 | | | |MDMSW|OPENED |0x02000|0x00248|0x00248|DCCiwrsB|0x00000 |
||
180 | ------------------------------------------------------------------------------- |
||
181 | 9|apr_apps2 |P|APPS |CLOSED |0x02000|0x00000|0x00000|dcciwrsb|0x00000 |
||
182 | | | |MDMSW|OPENING|0x02000|0x00000|0x00000|DCCiwrSb|0x00000 |
||
183 | ------------------------------------------------------------------------------- |
||
184 | 10|DATA1 |P|APPS |OPENED |0x02000|0x00000|0x00000|DCCiwrsB|0x00000 |
||
185 | | | |MDMSW|OPENED |0x02000|0x00000|0x00000|dCciwrsb|0x00000 |
||
186 | ------------------------------------------------------------------------------- |
||
187 | 11|DATA2 |P|APPS |CLOSED |0x02000|0x00000|0x00000|dcciwrsb|0x00000 |
||
188 | | | |MDMSW|OPENING|0x02000|0x00000|0x00000|dCciwrSb|0x00000 |
||
189 | ------------------------------------------------------------------------------- |
||
190 | 12|DATA3 |P|APPS |OPENED |0x02000|0x00000|0x00000|dcCiwrsb|0x00000 |
||
191 | | | |MDMSW|OPENED |0x02000|0x00000|0x00000|dCciwrsb|0x00000 |
||
192 | ------------------------------------------------------------------------------- |
||
193 | 13|DATA4 |P|APPS |OPENED |0x02000|0x00000|0x00000|DCCiwrsB|0x00000 |
||
194 | | | |MDMSW|OPENED |0x02000|0x00000|0x00000|dCciwrsb|0x00000 |
||
195 | ------------------------------------------------------------------------------- |
||
196 | 14|DATA11 |S|APPS |OPENED |0x02000|0x00089|0x00089|dcCiwRsb|0x00000 |
||
197 | | | |MDMSW|OPENED |0x02000|0x0012B|0x0012B|dCciwrsB|0x00000 |
||
198 | ------------------------------------------------------------------------------- |
||
199 | 15|DATA40 |P|APPS |CLOSED |0x02000|0x00000|0x00000|dcciwrsb|0x00000 |
||
200 | | | |MDMSW|OPENING|0x02000|0x00000|0x00000|dcciwrSb|0x00000 |
||
201 | ------------------------------------------------------------------------------- |
||
202 | 16|DATA5_CNTL |P|APPS |CLOSED |0x00400|0x00000|0x00000|dcciwrsb|0x00000 |
||
203 | | | |MDMSW|OPENING|0x00400|0x00000|0x00000|DCCiwrSb|0x00000 |
||
204 | ------------------------------------------------------------------------------- |
||
205 | 17|DATA40_CNTL |P|APPS |OPENED |0x02000|0x00000|0x00000|DCCiwrsB|0x00000 |
||
206 | | | |MDMSW|OPENED |0x02000|0x00100|0x00100|DCCiwrsB|0x00000 |
||
207 | ------------------------------------------------------------------------------- |
||
208 | </pre> |
||
209 | |||
210 | 12 | laforge | h3. SMD channels on an [[EC20]]: |
211 | 1 | laforge | |
212 | <pre> |
||
213 | /sys/kernel/debug/smd # cat ch |
||
214 | ch00: OPENED(0000/0000) dcCiwrsb <-> OPENED(0000/0000) dCciwrsB : 2000 |
||
215 | ch04: OPENED(27336/27336) DCCiwrsB <-> OPENED(6552/6552) DCCiwrsB : 8000 |
||
216 | ch05: OPENED(0000/0000) DCCiwrsb <-> OPENED(12568/12568) DCCiwrsB : 10000 |
||
217 | ch06: OPENED(1872/1872) DCCiwrsB <-> OPENED(0216/0216) DCCiwrsB : 2000 |
||
218 | ch07: CLOSED(0000/0000) dcciwrsb <-> OPENING(0000/0000) DCCiwrSb : 2000 |
||
219 | ch08: CLOSED(0000/0000) dcciwrsb <-> OPENING(0000/0000) DCCiwrSb : 400 |
||
220 | ch09: OPENED(0952/0952) DCCiwrsb <-> OPENED(0438/0438) DCCiwrsB : 400 |
||
221 | ch10: OPENED(0000/0000) DCCiwrsb <-> OPENED(0000/0000) DCCiwrsb : 2000 |
||
222 | ch11: CLOSED(0000/0000) dcciwrsb <-> OPENING(0000/0000) DCCiwrSb : 2000 |
||
223 | ch12: OPENED(0000/0000) DCCiwrsb <-> OPENED(0000/0000) DCCiwrsb : 2000 |
||
224 | ch13: CLOSED(0000/0000) dcciwrsb <-> OPENING(0000/0000) DCCiwrSb : 2000 |
||
225 | ch14: OPENED(0480/0480) DCCiwrsB <-> OPENED(0376/0376) DCCiwrsB : 400 |
||
226 | ch15: CLOSED(0000/0000) dcciwrsb <-> OPENING(0000/0000) DCCiwrSb : 2000 |
||
227 | ch16: CLOSED(0000/0000) dcciwrsb <-> OPENING(0000/0000) DCCiwrSb : 2000 |
||
228 | ch17: CLOSED(0000/0000) dcciwrsb <-> OPENING(0000/0000) DCCiwrSb : 400 |
||
229 | ch18: OPENED(0000/0000) DCCiwrsb <-> OPENED(0000/0000) DCCiwrsb : 2000 |
||
230 | ch19: OPENED(0952/0952) DCCiwrsb <-> OPENED(0370/0370) DCCiwrsB : 400 |
||
231 | ch20: OPENED(0021/0021) DCCiwrsb <-> OPENED(0078/0078) DCCiwrsB : 2000 |
||
232 | ch21: CLOSED(0000/0000) dcciwrsb <-> OPENING(0000/0000) DCCiwrSb : 2000 |
||
233 | ch22: CLOSED(0000/0000) dcciwrsb <-> OPENING(0000/0000) dCciwrSb : 2000 |
||
234 | ch23: OPENED(0000/0000) dcCiwrsb <-> OPENED(0000/0000) dCciwrsB : 2000 |
||
235 | ch24: OPENED(0000/0000) DCCiwrsb <-> OPENED(0000/0000) dCciwrsb : 2000 |
||
236 | ch25: CLOSED(0000/0000) dcciwrsb <-> OPENING(0000/0000) dCciwrSb : 2000 |
||
237 | ch26: CLOSED(0000/0000) dcciwrsb <-> OPENING(0000/0000) dCciwrSb : 2000 |
||
238 | ch27: CLOSED(0000/0000) dcciwrsb <-> OPENING(0000/0000) dcciwrSb : 2000 |
||
239 | ch28: OPENED(0000/0000) DCCiwrsb <-> OPENED(0000/0000) DCCiwrsB : 2000 |
||
240 | ch29: CLOSED(0000/0000) dcciwrsb <-> OPENING(0000/0000) dcciwrSb : 2000 |
||
241 | ch30: OPENED(0295/0295) DCCiwrsB <-> OPENED(0563/0563) DCCiwrsB : 400 |
||
242 | ch31: OPENED(0237/0237) DCCiwrsB <-> OPENED(0415/0415) DCCiwrsB : 400 |
||
243 | ch32: OPENED(0237/0237) DCCiwrsB <-> OPENED(0415/0415) DCCiwrsB : 400 |
||
244 | ch33: OPENED(0237/0237) DCCiwrsB <-> OPENED(0415/0415) DCCiwrsB : 400 |
||
245 | ch34: OPENED(0000/0000) DCCiwrsb <-> OPENED(0000/0000) dCciwrsb : 2000 |
||
246 | </pre> |
||
247 | |||
248 | <pre> |
||
249 | /sys/kernel/debug/smd # cat tbl |
||
250 | name=DS cid=0 ch type=0 xfer type=1 ref_count=2 |
||
251 | name= cid=0 ch type=0 xfer type=0 ref_count=0 |
||
252 | name= cid=0 ch type=0 xfer type=0 ref_count=0 |
||
253 | name= cid=0 ch type=0 xfer type=0 ref_count=0 |
||
254 | name=MSGR_SMD_P1 cid=4 ch type=11 xfer type=2 ref_count=2 |
||
255 | name=MSGR_SMD_P0 cid=5 ch type=11 xfer type=2 ref_count=2 |
||
256 | name=IPCRTR cid=6 ch type=1 xfer type=2 ref_count=1 |
||
257 | name=IPCRTR cid=7 ch type=2 xfer type=2 ref_count=1 |
||
258 | name=sys_mon cid=8 ch type=1 xfer type=2 ref_count=1 |
||
259 | name=DIAG_CNTL cid=9 ch type=1 xfer type=2 ref_count=2 |
||
260 | name=DIAG cid=10 ch type=1 xfer type=2 ref_count=2 |
||
261 | name=apr_audio_svc cid=11 ch type=1 xfer type=2 ref_count=1 |
||
262 | name=apr_voice_svc cid=12 ch type=2 xfer type=2 ref_count=2 |
||
263 | name=apr_apps2 cid=13 ch type=1 xfer type=2 ref_count=1 |
||
264 | name=RPCRPY_CNTL cid=14 ch type=0 xfer type=2 ref_count=2 |
||
265 | name=IPCROUTER cid=15 ch type=0 xfer type=0 ref_count=1 |
||
266 | name=SSM_RTR cid=16 ch type=0 xfer type=2 ref_count=1 |
||
267 | name=sys_mon cid=17 ch type=0 xfer type=2 ref_count=1 |
||
268 | name=DIAG_2 cid=18 ch type=0 xfer type=2 ref_count=2 |
||
269 | name=DIAG_CNTL cid=19 ch type=0 xfer type=2 ref_count=2 |
||
270 | name=DIAG cid=20 ch type=0 xfer type=2 ref_count=2 |
||
271 | name=apr_voice_svc cid=21 ch type=0 xfer type=2 ref_count=1 |
||
272 | name=DATA1 cid=22 ch type=0 xfer type=2 ref_count=2 |
||
273 | name=DATA2 cid=23 ch type=0 xfer type=2 ref_count=2 |
||
274 | name=DATA3 cid=24 ch type=0 xfer type=2 ref_count=2 |
||
275 | name=DATA4 cid=25 ch type=0 xfer type=2 ref_count=2 |
||
276 | name=DATA11 cid=26 ch type=0 xfer type=1 ref_count=2 |
||
277 | name=DATA40 cid=27 ch type=0 xfer type=2 ref_count=2 |
||
278 | name=DATA40_CNTL cid=28 ch type=0 xfer type=2 ref_count=2 |
||
279 | name=DATA8 cid=29 ch type=0 xfer type=2 ref_count=2 |
||
280 | name=DATA5_CNTL cid=30 ch type=0 xfer type=2 ref_count=2 |
||
281 | name=DATA6_CNTL cid=31 ch type=0 xfer type=2 ref_count=2 |
||
282 | name=DATA7_CNTL cid=32 ch type=0 xfer type=2 ref_count=2 |
||
283 | name=DATA8_CNTL cid=33 ch type=0 xfer type=2 ref_count=2 |
||
284 | name=GPSNMEA cid=34 ch type=0 xfer type=2 ref_count=2 |
||
285 | </pre> |