qualcomm subsystem


static const char * const restart_levels[] = {

restart level (0 – panic, 1 – related, 2 – independent, etc.)

static int subsystem_shutdown(struct subsys_device *dev, void *data)
static int subsystem_powerup(struct subsys_device *dev, void *data)
static int subsys_start(struct subsys_device *subsys)
static void subsys_stop(struct subsys_device *subsys)
int subsystem_set_fwname(const char *name, const char *fw_name)
int subsystem_restart_dev(struct subsys_device *dev)
int subsystem_restart(const char *name)

restart_level的设置为related, 就只重启该子系统,而不是重启整个系统


/vendor/bin/ssr_setup (binary exe)

[persist.vendor.ssr.restart_level]: [ALL_ENABLE] 应该设置为 modem

The Peripheral Image Loader (PIL) is a framework that allows services to load and reload firmware images for each subsystem of the chipset into DDR memory. Upon loading, TrustZone’s services are invoked to authenticate the content of the image file using a hash segment. Once the image is authenticated, the processor of that subsystem is taken out of reset, i.e., allowed to execute instructions.
外设映像加载器 (PIL) 是一个框架,它允许服务将芯片组每个子系统的固件映像加载和重新加载到 DDR 内存中。 加载后,将调用 TrustZone 的服务以使用哈希段来认证映像文件的内容。 一旦认证通过,该子系统的处理器就会脱离复位状态,也就是允许执行指令。

Firmware images are written in ELF (Executable and Linkable Format), which consists of a metadata portion and a program portion.
The program portion is further split up into multiple files. This splitting is done for several reasons:
1. If authentication information is found to be invalid, we do not need to load the entire image.
2. It is advantageous in low memory conditions since the amount of memory used at any given instance, when loading one segment at a time, is smaller than loading the whole image as one file.
3. Allows more flexibility for future changes to the loading procedure. The firmware image filenames all begin with a base name that matches the name of the peripheral, e.g., “modem”.

固件映像以 ELF(可执行和可链接格式)编写,由元数据部分和程序部分组成。
程序部分进一步分为多个文件。 进行这种拆分有几个原因:
2. 这在低内存条件下是有利的,因为在任何给定实例中,每次加载一个片段时使用的内存量小于将整个映像作为一个文件加载。
3. 为未来加载程序的更改提供更大的灵活性。 固件映像文件名均以与外围设备名称匹配的基本名称开头,例如“modem”。
modem.b01, modem.b02, ….

The metadata file has an extension of .mdt . This comprises the ELF header, program headers, hash, and signature.
The program segment files are named with numbered extensions in the form of .bXX, where XX is the index of the sengment beginning from 00, i.e., .b01, .b02, .b03, etc. Each of these files is referred to as a segment or a “blob”.Firmware files are expected to be placed under /etc/firmware. The PIL loads each segment of the ELF image from the firmware directory using generaic kernel method request_firmware().
This places the segment into the relevant memory hole. Once loaded, TrustZone is invoked to authenticate the segment. After all the firmware segments have been successfully loaded and authenticated, PIL resets the subsystem and initiate its boot sequence.

元数据文件的扩展名为 .mdt 。 这包括 ELF 标头、程序标头、哈希值和签名。

程序段文件以 .bXX 的形式以编号扩展名命名,其中 XX 是从 00 开始的段索引,即 .b01、.b02、.b03 等。
这些文件中的每一个都称为一个 段或“blob”。
固件文件应放置在 /etc/firmware (/vendor/firmware_mnt) 下。

PIL 使用通用内核方法 request_firmware() 从固件目录加载 ELF 映像的每个片段。
这会将段放入相关的内存孔中。 加载后,将调用 TrustZone 来认证该段。
所有固件段均已成功加载并经过认证后,PIL 会重置子系统并启动其引导序列。

PIL is implemented as a kernel driver at the following location: kernel root/drivers/soc/qcom/peripheral-loader.c
Generic PIL drivers: kernel root/drivers/soc/qcom/subsys-pil-tz.c
Drivers implement power up, shutdown, error handling, and RAM dump of the subsystem. Interfaces are encapsulated and registered to the SSR driver.

PIL被实现为一个内核中的驱动,位置在 kernel root/drivers/soc/qcom/peripheral-loader.c
通用的PIL驱动是:kernel root/drivers/soc/qcom/subsys-pil-tz.c
该驱动实现了子系统的power up, shutdown,err handing和RAM dump功能。接口被封装并注册到 SSR 驱动程序。

(SSR subsystem restart子系统重启)

PS: 在kernel/msm-5.4/drivers/remoteproc/qcom_q6v5_mss.c中会调用request_firmware()对modem.bxx进行加载

Device tree configurations
Device tree configs for subsystems are at the following locations:

子系统的设备树配置位于: kernel root/arch/arm64/boot/dts/qcom/sdm chipset.dtsi

PS: 在该dtsi文件中可以看到相应的compatible = “qcom,pil-tz-generic”的节点

Support for Modem Self-Authentication (MSA)
PIL loading of Modem Boot Authenticator (MBA)
PIL loading of Primary Modem Image (PMI)

Confidential and Proprietary – Qualcomm Technologies, Inc. | MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATIONPAGE 12 80-NC839-21 A Apr 2013
Reporting Failure Reasons
1 Subsystem should report failure reason to host driver
2 Subsystem software failure reason report should use a preallocated
shared memory location
3 Subsystem failure report should include information about source of
Line number
Program counter of instruction that generated the exceptio

1. 关闭子系统 Shutting down the subsystem
AP shall implement recommended subsystem shutdown procedures for the subsystem
AP should support both QXDM and AT power-down command
2. Powering up the subsystem
AP shall implement recommended subsystem power-up procedures for the subsystem
3. Processing the failure reasons
AP host driver on MSM shall record subsystem failure reasons in Kernel log
AP host driver shall erase subsystem failure reason from shared memory before restarting the system

Configuration Options
AP shall provide a runtime configurable option to select between Full Chip Restart or Independent Subsystem Restart handling
AP shall provide a runtime configurable option to enable RAM dump collections for the peripheral subsystem
AP shall provide configuration parameters for the maximum allowed number of restarts within a configurable time window, after which a full chip restart will occur

enable Subsystem Restart (SSR)
3 > restart_level
Phase-3 (Independent Restart)

Trigger Modem restart using the QXDM command: send_data 75 37 03 00 (致命错误) send_data 75 37 03 00 02(软件异常) 75 37 03 00 01( 看门狗复位)
Trigger WCNSS restart using the QXDM command: send_data 75 37 03 32
Trigger ADSP restart using the QXDM command: send_data 75 37 03 48

在qxdm command窗口发送send_data 75 37 03 48 00 (重启音频dsp)

在 Android手机的 属性中 开启/关闭 永久性的 SSR功能(SSR Persistent Flag Enable/Disable )

启用Independent SSR
setprop persist.sys.ssr.restart.level 3

关闭 Independent SSR
setprop persist.sys.ssr.restart_level 1

[persist.vendor.ssr.restart_level]: [ALL_ENABLE]

# enable all system restart_level to relative



cat /sys/class/remoteproc/remoteproc2/name

setprop persist.vendor.ssr.restart_level mss
setprop persist.vendor.ssr.restart_level “ALL_DISABLE”

setprop persist.vendor.ssr.enable_ramdumps 0
setprop persist.vendor.ssr.restart_level ALL_ENABLE

29 02 00 重启整个手机系统
29 01 00 offline
29 04 00 online


write /sys/module/subsystem_restart/parameters/enable_ramdumps 0

on property:persist.vendor.sys.ssr.restart_level=*
start vendor.ssr_setup
service vendor.ssr_setup /vendor/bin/ssr_setup

service vendor.ssr_diag /vendor/bin/ssr_diag




send_data 75 37 03 00 会被转成实际的命令
4B 25 03 00 Debug/Simulate Crash Request
4b 25 03 00 Debug/Simulate Crash Response


您的电子邮箱地址不会被公开。 必填项已用 * 标注