Project

General

Profile

Qualcomm Kernel » History » Version 18

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