From 71bdd26333b3bf81c2705aa44d24558e5cf69eed Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 27 Dec 2016 16:11:36 +0100 Subject: 33c3: add Linux kernel / system level slides + diagram --- 2016/33c3/33c3-modems.adoc | 72 +++++-- 2016/33c3/images/diag.dot | 8 +- 2016/33c3/images/qualcomm_le.svg | 394 ++++++++++++++------------------------- 3 files changed, 202 insertions(+), 272 deletions(-) diff --git a/2016/33c3/33c3-modems.adoc b/2016/33c3/33c3-modems.adoc index dc4070d..815ec96 100644 --- a/2016/33c3/33c3-modems.adoc +++ b/2016/33c3/33c3-modems.adoc @@ -207,35 +207,79 @@ image:images/legato_flash.png[width="80%"] // Show it is a highly complex SoC... with even more things // that are unknown.. device tree file, periperhal, etc -== MDM SW Overview +== MDM 9615 AP SW Overview image:images/gandroid_logo.png[height=200,role="gimmick_right"] -* GNU libc, busybox userland -* Android Debug Bridge (adb) -* Android Linux kernel +The software stack seems to be called *Qualcomm LE* + * Android Bootloader +* Android Linux kernel +* Android Debug Bridge (adb) +* but: GNU libc, busybox userland * Using OpenEmbedded to build images * Developed and maintained by Qualcomm +== Qualcomm Linux kernel overview + +* Qualcomm Android Linux kernel +* Huge changes compared to mainline `git diff -w | wc -l` +** `v3.0.21` in EC20: 1.5 million lines +** `v3.18.20` in EC25: 1.9 million lines +* Expected: CPU + peripheral drivers +* Less expected: +** smem_log, ipc_log, remote spinlocks, etc. +== Qualcomm Linux kernel subsystems -== Linux kernel overview +[cols="20%,80%"] +|=== +|SMD|Shared Memory Device +|IPC|Inter Processor Communications +|RMNET|Remote Network +|BAM|Bus Access Manager +|IPA|Internet Packet Accelerator +|DIAGFWD|DIAG Forwarding +|=== -* Qualcomm Android Linux kernel -* Huge changes compared to mainline -* CPU and peripheral support -* +== Qualcomm LE System Architecture + +image:images/qualcomm_le.svg[width="50%",role="gimmick_right"] + +* simplified block diagram +* USB interface fully controlled by Linux AP +** very complex Qualcomm Android USB Gadget +** some endpoints mapped to SMD queues +** other endpoints handled by _regular_ Linux +** GPS NMEA takes completely different path than AT commands, despite +both being serial ports? +** DIAG and QMI handled in more complex ways + +== DIAG in Qualcomm LE + +* DIAG interface of Modem exposed on SMD +* diagfwd distributes messages between USB, SMD and `/dev/diagchar` +* Linux userspace processes don't use syslog, but diag msg for logging via `libdiag.so` + +image:images/diag.svg[width="100%"] + +== QMI in Qualcomm LE + +every `rmnet` data device has associated QMI control + +* on your Linux PC: `qmi_wwan` and `/dev/cdc-wdm` +* on Qualcomm LE modem: `/dev/smdcntlN`, multiplexed by `qmuxd` -== ... +image:images/qmi_smd_qmuxd.svg[width="100%"] == Funny commands -* AT+QLINUXCMD, e.g. switch usb config to get adb -* AT+QFASTBOOT, switch to the bootloader -* AT+QPRINT, print dmesg -* AT for system("echo mem > /sys/power/state") +* `AT+QLINUXCMD`, e.g. switch usb config to get adb +** arbitrary shell commands executed as root on r/w rootfs! +* `AT+QFASTBOOT`, switch to the bootloader +* `AT+QPRINT`, print dmesg +* AT for `system("echo mem > /sys/power/state")` diff --git a/2016/33c3/images/diag.dot b/2016/33c3/images/diag.dot index 66dcec8..4114e52 100644 --- a/2016/33c3/images/diag.dot +++ b/2016/33c3/images/diag.dot @@ -3,9 +3,9 @@ digraph G { graph [ dpi = 50 ]; rankdir = RL; - MDSP[ label = "Modem DSP" ]; + MDSP [ label = "Modem DSP" ]; - SMD [ label = "Shared Memory Devices" ]; + SMD diagfwd f_diag USB @@ -21,8 +21,8 @@ digraph G { subgraph cluster_userspace { label = "Linux Userspace" qmuxd -> diagchar [ label = "/dev/diag" ]; - atfwd_daemon -> qmuxd [ label = "/dev/diagt" ] - QCMAP -> qmuxd [ label = "/dev/diagt" ] + atfwd_daemon -> qmuxd [ label = "/dev/diag" ] + QCMAP -> qmuxd [ label = "/dev/diag" ] quectel_daemon -> qmuxd [ label = "/dev/diag" ] } Host -> USB diff --git a/2016/33c3/images/qualcomm_le.svg b/2016/33c3/images/qualcomm_le.svg index 051cd7a..a1c76ba 100644 --- a/2016/33c3/images/qualcomm_le.svg +++ b/2016/33c3/images/qualcomm_le.svg @@ -9,9 +9,9 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="210mm" - height="297mm" - viewBox="0 0 744.09448819 1052.3622047" + width="156.46683mm" + height="180.56444mm" + viewBox="0 0 554.41002 639.79525" id="svg2" version="1.1" inkscape:version="0.91 r13725" @@ -20,329 +20,191 @@ id="defs4"> + transform="matrix(-0.8,0,0,-0.8,-10,0)" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1" + d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z" + id="path8077" + inkscape:connector-curvature="0" /> + transform="matrix(0.8,0,0,0.8,10,0)" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1" + d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z" + id="path7923" + inkscape:connector-curvature="0" /> - - - + id="path7773" + d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1" + transform="matrix(-0.8,0,0,-0.8,-10,0)" + inkscape:connector-curvature="0" /> + d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1" + transform="matrix(-0.8,0,0,-0.8,-10,0)" + inkscape:connector-curvature="0" /> - - - - - - - - - - - - + transform="matrix(-0.8,0,0,-0.8,-10,0)" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1" + d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z" + id="path7237" + inkscape:connector-curvature="0" /> + d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1" + transform="matrix(-0.8,0,0,-0.8,-10,0)" + inkscape:connector-curvature="0" /> + d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1" + transform="matrix(-0.8,0,0,-0.8,-10,0)" + inkscape:connector-curvature="0" /> + transform="matrix(-0.8,0,0,-0.8,-10,0)" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1" + d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z" + id="path5699" + inkscape:connector-curvature="0" /> - - - - - - + transform="matrix(-0.8,0,0,-0.8,-10,0)" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1" + d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z" + id="path5353" + inkscape:connector-curvature="0" /> - - - + id="path5217" + d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1" + transform="matrix(-0.8,0,0,-0.8,-10,0)" + inkscape:connector-curvature="0" /> - - - - - - + transform="matrix(-0.8,0,0,-0.8,-10,0)" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1" + d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z" + id="path5105" + inkscape:connector-curvature="0" /> + d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1" + transform="matrix(-0.8,0,0,-0.8,-10,0)" + inkscape:connector-curvature="0" /> + inkscape:window-maximized="0" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0"> + id="grid3336" + originx="-34.43307" + originy="-176.16536" /> @@ -380,13 +248,31 @@ + + + + + + + + + + id="layer1" + transform="translate(-34.433071,-236.40158)"> USB Gadget Linux Kernel @@ -1030,37 +916,37 @@ sodipodi:role="line">fwd -- cgit v1.2.3