Project

General

Profile

Qualcomm Kernel » History » Version 22

laforge, 12/27/2016 12:41 PM

1 6 laforge
{{>toc}}
2
3 1 laforge
h1. Qualcomm Kernel
4
5 13 laforge
Random notes about the Qualcomm Kernel as used on the MDM9615 and MDM9x07.  May also apply to other Qualcomm Linux based systems such as Android smartphones.
6 1 laforge
7 18 laforge
h2. remote_spinlock
8
9
You probably know the regular spinlocks inside the linux kernel: They protect you from multiple processors entering the same critical section of code in the kernel.  All but one processor core will be busy-waiting while the spinlock is held.
10
11
In the Qualcomm multi-CPU SoCs they have implemented a remote spinlock mechanism, in which e.g. the APPS processor can prevent the MODEM processor from entering a critical section (or rather, access critical shared data between the processors).
12
13 1 laforge
h2. SMD (shared memory)
14
15
See [[Qualcomm_Linux_SMD]]
16
17
h2. smem_log
18
19
This is some kidn of high speed shared memory based event log to which all processors can log events.
20
21
Userspace applications can use write() to @/dev/smem_log@ to add log entries.
22
23
Qualcomm uses a proprietary minimal shim layer offering SMEM_LOG_EVENT and SMEM_LOG_EVENT6 macros
24
that can be used to write events with an event ID plus three data words or six data words, respectively.
25
26
The shared memory log can be read from linux userspace via debugfs, see the devices in @/sys/kernel/debug/smem_log@
27
and simply use @cat@ on them. You will get lines like
28
<pre>
29
MODM: 3982377401 000d0000: 00000001: 03000019 01000028 01000015 53505041 00000061 5f696d71
30
MODM: 3982378159      QCSI: 00000004: 00040029 00240015 00000003 00000001 0000002b 00000000
31
MODM: 3982378619 000d0000: 00000001: 03000019 0100002b 01000015 53505041 00000061 5f696d71
32
APPS: 3982397356      QCCI: 00000005: 0004001d 0024000e 00000003 00000003 00000019 00000000
33
APPS: 3982400571      QCCI: 00000005: 00040029 0024000e 00000003 00000003 00000019 00000000
34
MODM: 1841235211      QCSI: 00000004: 0004001e 0024001c 00000003 00000001 00000028 00000000
35
MODM: 1841236665 000d0000: 00000001: 03000019 01000028 0101001c 53505041 00000061 5f696d71
36
MODM: 1841241411      QCSI: 00000004: 0004002a 0024001c 00000003 00000001 0000002b 00000000
37
MODM: 1841242246 000d0000: 00000001: 03000019 0100002b 0100001c 53505041 00000061 5f696d71
38
MODM: 1841243796      QCSI: 00000004: 0004002b 00660019 00000003 00000001 0000002b 00000000
39
MODM: 1841244286 000d0000: 00000001: 03000019 0100002b 01000019 53505041 00000061 5f696d71
40
APPS: 1841255456      QCCI: 00000005: 0004001e 00240015 00000003 00000003 00000019 00000000
41
MODM: 1841255335 000d0000: 00000002: 0100ffff 0300ffff 07000014 53505041 0000016c 74646d73
42
MODM: 1841255828 000d0000: 00000702: 00000001 00000028 00000007
43
APPS: 1841261430      QCCI: 00000005: 0004002a 00240015 00000003 00000003 00000019 00000000
44
</pre>
45
46
More information in @smem_log.h@
47
48 22 laforge
h2. rmnet (Remote Network)
49 1 laforge
50
* consists of control channel and data channel
51
* data channel carries IP data
52
* control channel carries QMI messages
53
54
* drivers/net/ethernet/msm/msm_rmnet_bam.c
55
** ioctl() to set ethernet or rawip (RMNET_IOCTL_SET_LLP_ETHERNET, RMNET_IOCTL_SET_LLP_IP, RMNET_IOCTL_GET_LLP), initial boot time config is ETHERNET
56
** use msm_bam_dmux_open() to attach
57
** use RMNET_IOCTL_GET_EPID to get the BAM_DMUX endpoint id
58
59
h2. bam (Bus Access Manager/Module)
60
61
* The Bus Access Manager/Module (BAM) can be
62
  considered as a distributed data mover (DM)
63
* some kind of DMA controller/engine
64
* A number of the on-chip devices have their own BAM DMA controller
65
  and use it to move data between system memory and peripherals or
66
  between two peripherals.
67
68
Files:
69
<pre>
70
./drivers/dma/qcom_bam_dma.c
71
./drivers/net/ethernet/msm/msm_rmnet_bam.c
72
./drivers/platform/msm/sps/bam.c
73
./drivers/platform/msm/sps/sps_bam.c
74
./drivers/platform/msm/usb_bam.c
75
</pre>
76
77
* channels (BAM_DMUX_)
78
** RMNET_0...7
79
** USB_RMNET_0
80
** DATA_REV_RMNET_0..8
81
** USB_DPL
82
83
seem to be be based on dmux ./drivers/soc/qcom/bam_dmux.c
84
85
h2. IPA (Internet Packet Accelerator)
86
87
Internet Packet Accelerator (IPA) is a programmable protocol
88
processor HW block. It is designed to support generic HW processing
89
of UL/DL IP packets for various use cases independent of radio
90
technology.
91
92
See drivers/platform/msm/ipa/
93
94
http://www.sumobrain.com/patents/wipo/Accelerator/WO2013063791A1.pdf
95
96
97
h2. bam2bam
98
99
maybe soem kind of direct connection between two peripherals by means of the BAM?
100
101
h2. Android USB Gadget
102
103
see [[Android_USB_Gadget]]
104
105 21 laforge
h2. IPC Router
106
107
IPC is a Qualcomm mechanism for Inter-Processor-Communications.
108
109
The IPC router binds to the the following SMD channels: @RPCRPY_CNTL@, @IPCRTR@
110
111 1 laforge
h2. IPC Logging
112
113 12 laforge
see [[IPC_Logging]]
114 20 laforge
115
h2. diag
116
117
Please see [[DIAG]] for more details on Qualcomm DIAG in the context of the modems we are documenting here.
118
119
h3. diag forwarding
120
121
<pre>
122
drivers/char/diag/diagfwd.[ch]
123
drivers/usb/gadget/f_diag.[ch]
124
drivers/usb/misc/diag_bridge.c
125
</pre>
126
127
* the usb diag gadget handles diag packet read/write over usb
128
* issues events like USB_DIAG_READ_DONE
129
* picked up by diagfwd.c
130
** can forward diag requests via SMD shared memory to other processors
131
132
h3. diag char
133
134
The kernel exports a /dev/diag char device which userspce processes can
135
use to register/listen for DIAG events from the system, or actually
136
register a DIAG 'subsystem' themselves which can then be controlled from
137
QXDM.
138
139
<pre>
140
drivers/char/diag/diagchar_core.c
141
</pre>
142
143
* ioctl()s for diag configuration
144
* supports several concurrent diag clients
145
* diag logging can be directed to USB/HSIC, character device and more
146
** {USB,CALLBACK,MEMORY_DEVICE,UART,NO_LOGGING}_MODE
147
148
drivers/char/diag/diag_dci.c
149
150
* DCI table is a routing table where pid/sockets can register for a
151
  given DCI.  socket close/cleanup code releases all DCI routes for
152
  that socket.
153
154
h4. DIAG_IOCTL_COMMAND_REG
155
156
* Register a new DIAG command so it can be used from the outside world (QXDM)
157
* use 'struct diag_cmd_reg_entry_t' per command
158
* driver keeps a driver->cmd_reg_list of registered commands
159
160
h4. DIAG_IOCTL_COMMAND_DEREG
161
162
* unregister debug command
163
164
h4. DIAG_IOCTL_GET_DELAYED_RSP_ID
165
166
h4. DIAG_IOCTL_DCI_REG
167
168
h4. DIAG_IOCTL_DCI_DEINIT
169
170
h4. DIAG_IOCTL_DCI_SUPPORT
171
172
h4. DIAG_IOCTL_DCI_HEALTH_STATS
173
174
h4. DIAG_IOCTL_DCI_LOG_STATUS
175
176
h4. DIAG_IOCTL_DCI_EVENT_STATUS
177
178
h4. DIAG_IOCTL_DCI_CLEAR_LOGS
179
180
h4. DIAG_IOCTL_DCI_CLEAR_EVENTS
181
182
h4. DIAG_IOCTL_LSM_DEINIT
183
184
h4. DIAG_IOCTL_SWITCH_LOGGING
185
186
* switch between USB and shared-memory diag
187
* 
188
189
h4. DIAG_IOCTL_REMOTE_DEV
190
191
h4. DIAG_IOCTL_VOTE_REAL_TIME
192
193
h4. DIAG_IOCTL_GET_REAL_TIME
194
195
h4. DIAG_IOCTL_PERIPHERAL_BUF_CONFIG
196
197
h4. DIAG_IOCTL_PERIPHERAL_BUF_DRAIN
198
199
h4. DIAG_IOCTL_REGISTER_CALLBACK
200
201
* doen't really do anything but checking arguments ?!?
202
203
h4. DIAG_IOCTL_HDLC_TOGGLE
204
205
enable or disable HDLC framing of /dev/diag
206
207
h2. IRSC (IPC Router Security Control)
208
209
FIXME
Add picture from clipboard (Maximum size: 48.8 MB)