Project

General

Profile

Qualcomm Kernel » History » Version 19

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