Introduce PAS based Secure Subsystem rproc driver
cover Introduce PAS based Secure Subsystem rproc driver
Qualcomm SOCs have a secure remote processor that provides secure execution environment for processing sensitive data and also performs cryptographic operations using protected keys stored in its secure storage. This patch series introduces a Peripheral Authentication based remoteproc driver that handles booting, shutdown and crash scenarios for SPSS. Also this driver can handle late attach usecase where remote processor is already booted even before linux. This patchset builds up on the skip firmware load patch "remoteproc: add support to skip firmware load when recovery" which is in review.
Rishabh Bhatnagar (2):
remoteproc: qcom: Add PAS based SPSS PIL driver
dt-bindings: remoteproc: Add documentation for SPSS remoteproc
.../devicetree/bindings/remoteproc/qcom,spss.txt | 114 +++++ drivers/remoteproc/Kconfig | 17 + drivers/remoteproc/Makefile | 1 + drivers/remoteproc/qcom_spss.c | 500 +++++++++++++++++++++ 4 files changed, 632 insertions(+) create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,spss.txt create mode 100644 drivers/remoteproc/qcom_spss.c
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH 1/2 remoteproc: qcom: Add PAS based SPSS PIL driver
This adds Peripheral Authentication System (PAS) based SPSS PIL driver for loading SPSS firmware and booting. The firmware is verified and booted with the help of the PAS in TrustZone. This driver also adds functionality to handle late attach feature for a remote processor. The driver queries the initial state of remote processor and is capable of handling successful bootup and crash scenarios.
--- drivers/remoteproc/Kconfig | 17 ++ drivers/remoteproc/Makefile | 1 + drivers/remoteproc/qcom_spss.c | 500 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 518 insertions(+) create mode 100644 drivers/remoteproc/qcom_spss.c
drivers/remoteproc/Kconfig +17 -0
@@ -151,6 +151,23 @@ config QCOM_Q6V5_PAS for the Qualcomm Hexagon v5 based remote processors. This is commonly used to control subsystems such as ADSP, Compute and Sensor. +config QCOM_SPSS + tristate "Qualcomm secure subsystem Peripheral loading support" + depends on OF && ARCH_QCOM + depends on QCOM_SMEM + depends on RPMSG_QCOM_SMD || (COMPILE_TEST && RPMSG_QCOM_SMD=n) + depends on RPMSG_QCOM_GLINK_SMEM || RPMSG_QCOM_GLINK_SMEM=n + depends on QCOM_SYSMON || QCOM_SYSMON=n + select MFD_SYSCON + select QCOM_MDT_LOADER + select QCOM_Q6V5_COMMON + select QCOM_RPROC_COMMON + select QCOM_SCM + help + Say y here to support the TrustZone based Peripheral Image Loader + for the Qualcomm secure subsystem remote processor. This also supports + remote processors that are booted before kernel comes up. + config QCOM_Q6V5_WCSS tristate "Qualcomm Hexagon based WCSS Peripheral Image Loader" depends on OF && ARCH_QCOM
drivers/remoteproc/Makefile +1 -0
@@ -15,6 +15,7 @@ obj-$(CONFIG_OMAP_REMOTEPROC) += omap_remoteproc.o obj-$(CONFIG_WKUP_M3_RPROC) += wkup_m3_rproc.o obj-$(CONFIG_DA8XX_REMOTEPROC) += da8xx_remoteproc.o obj-$(CONFIG_KEYSTONE_REMOTEPROC) += keystone_remoteproc.o +obj-$(CONFIG_QCOM_SPSS) += qcom_spss.o obj-$(CONFIG_QCOM_RPROC_COMMON) += qcom_common.o obj-$(CONFIG_QCOM_Q6V5_COMMON) += qcom_q6v5.o obj-$(CONFIG_QCOM_Q6V5_ADSP) += qcom_q6v5_adsp.o
drivers/remoteproc/qcom_spss.c new file +500 -0
500 lines not on this page · raw message
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH 2/2 dt-bindings: remoteproc: Add documentation for SPSS remoteproc
In reply to Rishabh BhatnagarAdd devicetree binding for Secure Subsystem remote processor support in remoteproc framework. This describes all the resources needed by SPSS to boot and handle crash and shutdown scenarios.
--- .../devicetree/bindings/remoteproc/qcom,spss.txt | 114 +++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,spss.txt
Documentation/devicetree/bindings/remoteproc/qcom,spss.txt new file +114 -0
@@ -0,0 +1,114 @@ +Qualcomm SPSS Peripheral Image Loader + +This document defines the binding for a component that loads and boots firmware +on the Qualcomm Secure Peripheral Processor. This processor is booted in the +bootloader stage and it attaches itself to linux later on in the boot process. + +- compatible: + Usage: required + Value type: <string> + Definition: must be one of: + "qcom,sm8250-spss-pas" + +- reg: + Should contain an entry for each value in 'reg-names'. Each entry + have memory region's start address and size of the region. + +- reg-names: + Should contain strings with the following names each representing + a specific region in memory. + "sp2soc_irq_status", "sp2soc_irq_clr", "sp2soc_irq_mask", "rmb_err", + "rmb_err_spare2" + +- interrupts: + Should contain the generic interrupt assigned to remote processor. + The values should follow the interrupt-specifier format as dictated + by the 'interrupt-parent' node. + +- clocks: + Usage: required + Value type: <prop-encoded-array> + Definition: reference to the xo clock and optionally aggre2 clock to be + held on behalf of the booting Hexagon core + +- clock-names: + Usage: required + Value type: <stringlist> + Definition: must be "xo" and optionally include "aggre2" + +- cx-supply: + Usage: required + Value type: <phandle> + Definition: reference to the regulator to be held on behalf of the + booting Hexagon core + +- px-supply: + Usage: required + Value type: <phandle> + Definition: reference to the px regulator to be held on behalf of the + booting Hexagon core + +- memory-region: + Usage: required + Value type: <phandle> + Definition: reference to the reserved-memory for the SPSS + +- qcom,spss-scsr-bits: + Usage: required + Value type: <array> + Definition: Bits that are set by remote processor in the irq status + register region to represent different states during + boot process + += SUBNODES +The spss node may have an subnode named either "smd-edge" or "glink-edge" that +describes the communication edge, channels and devices related to the SPSS. +See ../soc/qcom/qcom,smd.txt and ../soc/qcom/qcom,glink.txt for details on how +to describe these. + += EXAMPLE +The following example describes the resources needed to boot the +Secure Processor, as it is found on SM8250 boards. + + spss { + compatible = "qcom,sm8250-spss-pil"; + reg = <0x188101c 0x4>, + <0x1881024 0x4>, + <0x1881028 0x4>, + <0x188103c 0x4>, + <0x1882014 0x4>; + reg-names = "sp2soc_irq_status", "sp2soc_irq_clr", + "sp2soc_irq_mask", "rmb_err", "rmb_err_spare2"; + interrupts = <0 352 1>; + + cx-supply = <&VDD_CX_LEVEL>; + cx-uV-uA = <RPMH_REGULATOR_LEVEL_TURBO 100000>; + px-supply = <&VDD_MX_LEVEL>; + px-uV = <RPMH_REGULATOR_LEVEL_TURBO 100000>; + + clocks = <&clock_rpmh RPMH_CXO_CLK>; + clock-names = "xo"; + qcom,proxy-clock-names = "xo"; + status = "ok"; + + memory-region = <&pil_spss_mem>; + qcom,spss-scsr-bits = <24 25>; + + glink-edge { + qcom,remote-pid = <8>; + transport = "spss"; + mboxes = <&sp_scsr 0>; + mbox-names = "spss_spss"; + interrupt-parent = <&intsp>; + interrupts = <0 0 IRQ_TYPE_LEVEL_HIGH>; + + reg = <0x1885008 0x8>, + <0x1885010 0x4>; + reg-names = "qcom,spss-addr", + "qcom,spss-size"; + + label = "spss"; + qcom,glink-label = "spss"; + }; + }; +
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
kbuild test robot
build botRe: [PATCH 1/2] remoteproc: qcom: Add PAS based SPSS PIL driver
In reply to Rishabh BhatnagarThank you for the patch! Yet something to improve:
Hi Rishabh,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linux/master]
[also build test ERROR on robh/for-next linus/master v5.6-rc4 next-20200306] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Rishabh-Bhatnagar/Introduce-PAS-based-Secure-Subsystem-rproc-driver/20200307-062353 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git f5ae2ea6347a308cfe91f53b53682ce635497d0d config: arm64-allyesconfig (attached as .config) compiler: clang version 11.0.0 (git://gitmirror/llvm_project 0dfcb23b0507d57a30f313eed082f730bdc3ce3a)
reproduce:
# FIXME the reproduce steps for clang is not ready yet
If you fix the issue, kindly add following tag
All errors (new ones prefixed by >>):
>> drivers/remoteproc/qcom_spss.c:187:13: error: no member named 'skip_fw_load' in 'struct rproc'
if (rproc->skip_fw_load)
~~~~~ ^
drivers/remoteproc/qcom_spss.c:207:13: error: no member named 'skip_fw_load' in 'struct rproc'
if (rproc->skip_fw_load)
~~~~~ ^
drivers/remoteproc/qcom_spss.c:208:10: error: no member named 'skip_fw_load' in 'struct rproc'
rproc->skip_fw_load = false;
~~~~~ ^
drivers/remoteproc/qcom_spss.c:218:13: error: no member named 'skip_fw_load' in 'struct rproc'
if (rproc->skip_fw_load) {
~~~~~ ^
drivers/remoteproc/qcom_spss.c:414:9: error: no member named 'skip_fw_load' in 'struct rproc'
rproc->skip_fw_load = desc->skip_fw_load;
~~~~~ ^5 errors generated.
vim +187 drivers/remoteproc/qcom_spss.c
182
183 static int spss_load(struct rproc *rproc, const struct firmware *fw)
184 {
185 struct qcom_spss *spss = (struct qcom_spss *)rproc->priv;
186
> 187 if (rproc->skip_fw_load)
188 return 0;
189
190 return qcom_mdt_load(spss->dev, fw, rproc->firmware, spss->pas_id,
191 spss->mem_region, spss->mem_phys, spss->mem_size,
192 &spss->mem_reloc);
193
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
Mathieu Poirier
maintainerRe: [PATCH 2/2] dt-bindings: remoteproc: Add documentation for SPSS remoteproc
In reply to Rishabh BhatnagarHi Rishabh,
Quoted 4 lines · Rishabh Bhatnagar
Add devicetree binding for Secure Subsystem remote processor support in remoteproc framework. This describes all the resources needed by SPSS to boot and handle crash and shutdown scenarios.
Bindings in txt format are no longer accepted - everything needs to be in yaml Also, this needs to be reviewed by the DT brigade. As such you will have to CC the device tree mailing list and Rob Herring.
Quoted 129 lines
Signed-off-by Rishabh Bhatnagar <[email protected]>--- .../devicetree/bindings/remoteproc/qcom,spss.txt | 114 +++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,spss.txtDocumentation/devicetree/bindings/remoteproc/qcom,spss.txt new file +114
-0@@ -0,0 +1,114 @@ +Qualcomm SPSS Peripheral Image Loader + +This document defines the binding for a component that loads and boots firmware +on the Qualcomm Secure Peripheral Processor. This processor is booted in the +bootloader stage and it attaches itself to linux later on in the boot process. + +- compatible: + Usage: required + Value type: <string> + Definition: must be one of: + "qcom,sm8250-spss-pas" + +- reg: + Should contain an entry for each value in 'reg-names'. Each entry + have memory region's start address and size of the region. + +- reg-names: + Should contain strings with the following names each representing + a specific region in memory. + "sp2soc_irq_status", "sp2soc_irq_clr", "sp2soc_irq_mask", "rmb_err", + "rmb_err_spare2" + +- interrupts: + Should contain the generic interrupt assigned to remote processor. + The values should follow the interrupt-specifier format as dictated + by the 'interrupt-parent' node. + +- clocks: + Usage: required + Value type: <prop-encoded-array> + Definition: reference to the xo clock and optionally aggre2 clock to be + held on behalf of the booting Hexagon core + +- clock-names: + Usage: required + Value type: <stringlist> + Definition: must be "xo" and optionally include "aggre2" + +- cx-supply: + Usage: required + Value type: <phandle> + Definition: reference to the regulator to be held on behalf of the + booting Hexagon core + +- px-supply: + Usage: required + Value type: <phandle> + Definition: reference to the px regulator to be held on behalf of the + booting Hexagon core + +- memory-region: + Usage: required + Value type: <phandle> + Definition: reference to the reserved-memory for the SPSS + +- qcom,spss-scsr-bits: + Usage: required + Value type: <array> + Definition: Bits that are set by remote processor in the irq status + register region to represent different states during + boot process + += SUBNODES +The spss node may have an subnode named either "smd-edge" or "glink-edge" that +describes the communication edge, channels and devices related to the SPSS. +See ../soc/qcom/qcom,smd.txt and ../soc/qcom/qcom,glink.txt for details on how +to describe these. + += EXAMPLE +The following example describes the resources needed to boot the +Secure Processor, as it is found on SM8250 boards. + + spss { + compatible = "qcom,sm8250-spss-pil"; + reg = <0x188101c 0x4>, + <0x1881024 0x4>, + <0x1881028 0x4>, + <0x188103c 0x4>, + <0x1882014 0x4>; + reg-names = "sp2soc_irq_status", "sp2soc_irq_clr", + "sp2soc_irq_mask", "rmb_err", "rmb_err_spare2"; + interrupts = <0 352 1>; + + cx-supply = <&VDD_CX_LEVEL>; + cx-uV-uA = <RPMH_REGULATOR_LEVEL_TURBO 100000>; + px-supply = <&VDD_MX_LEVEL>; + px-uV = <RPMH_REGULATOR_LEVEL_TURBO 100000>; + + clocks = <&clock_rpmh RPMH_CXO_CLK>; + clock-names = "xo"; + qcom,proxy-clock-names = "xo"; + status = "ok"; + + memory-region = <&pil_spss_mem>; + qcom,spss-scsr-bits = <24 25>; + + glink-edge { + qcom,remote-pid = <8>; + transport = "spss"; + mboxes = <&sp_scsr 0>; + mbox-names = "spss_spss"; + interrupt-parent = <&intsp>; + interrupts = <0 0 IRQ_TYPE_LEVEL_HIGH>; + + reg = <0x1885008 0x8>, + <0x1885010 0x4>; + reg-names = "qcom,spss-addr", + "qcom,spss-size"; + + label = "spss"; + qcom,glink-label = "spss"; + }; + }; +Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project