* [PATCH V3 0/8] Add new driver for WCSS secure PIL loading
@ 2025-01-07 10:16 Gokul Sriram Palanisamy
2025-01-07 10:16 ` [PATCH V3 1/8] firmware: qcom_scm: ipq5332: add support to pass metadata size Gokul Sriram Palanisamy
` (8 more replies)
0 siblings, 9 replies; 28+ messages in thread
From: Gokul Sriram Palanisamy @ 2025-01-07 10:16 UTC (permalink / raw)
To: jassisinghbrar, robh, krzk+dt, conor+dt, andersson,
mathieu.poirier, konradybcio, quic_mmanikan, linux-arm-msm,
linux-kernel, devicetree, linux-remoteproc, dmitry.baryshkov
Cc: quic_gokulsri, quic_viswanat, quic_srichara
This series depends on Sricharan's tmel-qmp mailbox driver series v2 [1].
- Secure PIL is signed, split firmware images which only TrustZone (TZ)
can authenticate and load. Linux kernel will send a request to TZ to
authenticate and load the PIL images.
- When secure PIL support was added to the existing wcss PIL driver
earlier in [2], Bjorn suggested not to overload the existing WCSS
rproc driver, instead post a new driver for PAS based IPQ WCSS driver.
This series adds a new secure PIL driver for the same.
- Also adds changes to scm to pass metadata size as required for IPQ5332,
reposted from [3].
[1]
https://patchwork.kernel.org/project/linux-arm-msm/cover/20241231054900.2144961-1-quic_srichara@quicinc.com/
[2]
https://patchwork.kernel.org/project/linux-arm-msm/patch/1611984013-10201-3-git-send-email-gokulsri@codeaurora.org/
[3]
https://patchwork.kernel.org/project/linux-arm-msm/patch/20240820055618.267554-6-quic_gokulsri@quicinc.com/
changes in v3:
- fixed copyright years and markings based on Jeff's comments.
- replaced devm_ioremap_wc() with ioremap_wc() in
wcss_sec_copy_segment().
- replaced rproc_alloc() and rproc_add() with their devres
counterparts.
- added mailbox call to tmelcom for secure image authentication
as required for IPQ5424. Added ipq5424 APCS comatible required.
- added changes to scm call to pass metadata size as equired for
IPQ5332.
changes in v2:
- Removed dependency of this series to q6 clock removal series
as recommended by Krzysztof
Gokul Sriram Palanisamy (3):
dt-bindings: mailbox: qcom: Add IPQ5424 APCS compatible
mailbox: qcom: Add support for IPQ5424 APCS IPC
arm64: dts: qcom: ipq5424: add nodes to bring up q6
Manikanta Mylavarapu (4):
firmware: qcom_scm: ipq5332: add support to pass metadata size
dt-bindings: remoteproc: qcom: document hexagon based WCSS secure PIL
arm64: dts: qcom: ipq5332: add nodes to bringup q6
arm64: dts: qcom: ipq9574: add nodes to bring up q6
Vignesh Viswanathan (1):
remoteproc: qcom: add hexagon based WCSS secure PIL driver
.../mailbox/qcom,apcs-kpss-global.yaml | 1 +
.../remoteproc/qcom,wcss-sec-pil.yaml | 131 ++++++
arch/arm64/boot/dts/qcom/ipq5332.dtsi | 64 ++-
arch/arm64/boot/dts/qcom/ipq5424.dtsi | 80 +++-
arch/arm64/boot/dts/qcom/ipq9574.dtsi | 60 ++-
drivers/firmware/qcom/qcom_scm.c | 13 +-
drivers/firmware/qcom/qcom_scm.h | 1 +
drivers/mailbox/qcom-apcs-ipc-mailbox.c | 1 +
drivers/remoteproc/Kconfig | 22 +
drivers/remoteproc/Makefile | 1 +
drivers/remoteproc/qcom_q6v5_wcss_sec.c | 406 ++++++++++++++++++
11 files changed, 775 insertions(+), 5 deletions(-)
create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,wcss-sec-pil.yaml
create mode 100644 drivers/remoteproc/qcom_q6v5_wcss_sec.c
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH V3 1/8] firmware: qcom_scm: ipq5332: add support to pass metadata size
2025-01-07 10:16 [PATCH V3 0/8] Add new driver for WCSS secure PIL loading Gokul Sriram Palanisamy
@ 2025-01-07 10:16 ` Gokul Sriram Palanisamy
2025-01-08 4:15 ` Bjorn Andersson
2025-01-07 10:16 ` [PATCH V3 2/8] dt-bindings: remoteproc: qcom: document hexagon based WCSS secure PIL Gokul Sriram Palanisamy
` (7 subsequent siblings)
8 siblings, 1 reply; 28+ messages in thread
From: Gokul Sriram Palanisamy @ 2025-01-07 10:16 UTC (permalink / raw)
To: jassisinghbrar, robh, krzk+dt, conor+dt, andersson,
mathieu.poirier, konradybcio, quic_mmanikan, linux-arm-msm,
linux-kernel, devicetree, linux-remoteproc, dmitry.baryshkov
Cc: quic_gokulsri, quic_viswanat, quic_srichara
From: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
IPQ5332 security software running under trustzone requires metadata size.
With new command support added in TrustZone that includes a size parameter,
pass metadata size as well. This new command is specific to IPQ5332 SoC.
Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
Signed-off-by: Gokul Sriram Palanisamy <quic_gokulsri@quicinc.com>
---
drivers/firmware/qcom/qcom_scm.c | 13 +++++++++++--
drivers/firmware/qcom/qcom_scm.h | 1 +
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c
index 72bf87ddcd96..a713788926b0 100644
--- a/drivers/firmware/qcom/qcom_scm.c
+++ b/drivers/firmware/qcom/qcom_scm.c
@@ -580,8 +580,6 @@ int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size,
int ret;
struct qcom_scm_desc desc = {
.svc = QCOM_SCM_SVC_PIL,
- .cmd = QCOM_SCM_PIL_PAS_INIT_IMAGE,
- .arginfo = QCOM_SCM_ARGS(2, QCOM_SCM_VAL, QCOM_SCM_RW),
.args[0] = peripheral,
.owner = ARM_SMCCC_OWNER_SIP,
};
@@ -616,6 +614,17 @@ int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size,
desc.args[1] = mdata_phys;
+ if (__qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_PIL,
+ QCOM_SCM_PAS_INIT_IMAGE_V2)) {
+ desc.cmd = QCOM_SCM_PAS_INIT_IMAGE_V2;
+ desc.arginfo =
+ QCOM_SCM_ARGS(3, QCOM_SCM_VAL, QCOM_SCM_RW, QCOM_SCM_VAL);
+ desc.args[2] = size;
+ } else {
+ desc.cmd = QCOM_SCM_PIL_PAS_INIT_IMAGE;
+ desc.arginfo = QCOM_SCM_ARGS(2, QCOM_SCM_VAL, QCOM_SCM_RW);
+ }
+
ret = qcom_scm_call(__scm->dev, &desc, &res);
qcom_scm_bw_disable();
diff --git a/drivers/firmware/qcom/qcom_scm.h b/drivers/firmware/qcom/qcom_scm.h
index e36b2f67607f..9aad9f92517f 100644
--- a/drivers/firmware/qcom/qcom_scm.h
+++ b/drivers/firmware/qcom/qcom_scm.h
@@ -96,6 +96,7 @@ struct qcom_tzmem_pool *qcom_scm_get_tzmem_pool(void);
#define QCOM_SCM_SVC_PIL 0x02
#define QCOM_SCM_PIL_PAS_INIT_IMAGE 0x01
+#define QCOM_SCM_PAS_INIT_IMAGE_V2 0x1a
#define QCOM_SCM_PIL_PAS_MEM_SETUP 0x02
#define QCOM_SCM_PIL_PAS_AUTH_AND_RESET 0x05
#define QCOM_SCM_PIL_PAS_SHUTDOWN 0x06
--
2.34.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH V3 2/8] dt-bindings: remoteproc: qcom: document hexagon based WCSS secure PIL
2025-01-07 10:16 [PATCH V3 0/8] Add new driver for WCSS secure PIL loading Gokul Sriram Palanisamy
2025-01-07 10:16 ` [PATCH V3 1/8] firmware: qcom_scm: ipq5332: add support to pass metadata size Gokul Sriram Palanisamy
@ 2025-01-07 10:16 ` Gokul Sriram Palanisamy
2025-01-07 12:21 ` Dmitry Baryshkov
2025-01-07 10:16 ` [PATCH V3 3/8] dt-bindings: mailbox: qcom: Add IPQ5424 APCS compatible Gokul Sriram Palanisamy
` (6 subsequent siblings)
8 siblings, 1 reply; 28+ messages in thread
From: Gokul Sriram Palanisamy @ 2025-01-07 10:16 UTC (permalink / raw)
To: jassisinghbrar, robh, krzk+dt, conor+dt, andersson,
mathieu.poirier, konradybcio, quic_mmanikan, linux-arm-msm,
linux-kernel, devicetree, linux-remoteproc, dmitry.baryshkov
Cc: quic_gokulsri, quic_viswanat, quic_srichara
From: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
Add new binding document for hexagon based WCSS secure PIL remoteproc.
IPQ5332, IPQ5424 and IPQ9574 follows secure PIL remoteproc.
Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
Signed-off-by: Gokul Sriram Palanisamy <quic_gokulsri@quicinc.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
.../remoteproc/qcom,wcss-sec-pil.yaml | 131 ++++++++++++++++++
1 file changed, 131 insertions(+)
create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,wcss-sec-pil.yaml
diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,wcss-sec-pil.yaml b/Documentation/devicetree/bindings/remoteproc/qcom,wcss-sec-pil.yaml
new file mode 100644
index 000000000000..1db36d36e5e5
--- /dev/null
+++ b/Documentation/devicetree/bindings/remoteproc/qcom,wcss-sec-pil.yaml
@@ -0,0 +1,131 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/remoteproc/qcom,wcss-sec-pil.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm WCSS Secure Peripheral Image Loader
+
+maintainers:
+ - Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
+
+description:
+ Wireless Connectivity Subsystem (WCSS) Secure Peripheral Image Loader loads
+ firmware and power up QDSP6 remoteproc on the Qualcomm IPQ series SoC.
+
+properties:
+ compatible:
+ enum:
+ - qcom,ipq5332-wcss-sec-pil
+ - qcom,ipq5424-wcss-sec-pil
+ - qcom,ipq9574-wcss-sec-pil
+
+ reg:
+ maxItems: 1
+
+ firmware-name:
+ maxItems: 1
+ description: Firmware name for the Hexagon core
+
+ interrupts:
+ items:
+ - description: Watchdog interrupt
+ - description: Fatal interrupt
+ - description: Ready interrupt
+ - description: Handover interrupt
+ - description: Stop acknowledge interrupt
+
+ interrupt-names:
+ items:
+ - const: wdog
+ - const: fatal
+ - const: ready
+ - const: handover
+ - const: stop-ack
+
+ clocks:
+ items:
+ - description: sleep clock
+
+ clock-names:
+ items:
+ - const: sleep
+
+ mboxes:
+ maxItems: 1
+ description: A phandle for the TMECom mailbox driver
+
+ qcom,smem-states:
+ $ref: /schemas/types.yaml#/definitions/phandle-array
+ description: States used by the AP to signal the remote processor
+ items:
+ - description: Stop Q6
+ - description: Shutdown Q6
+
+ qcom,smem-state-names:
+ description:
+ Names of the states used by the AP to signal the remote processor
+ items:
+ - const: stop
+ - const: shutdown
+
+ memory-region:
+ items:
+ - description: Q6 reserved region
+
+ glink-edge:
+ $ref: /schemas/remoteproc/qcom,glink-edge.yaml#
+ description:
+ Qualcomm G-Link subnode which represents communication edge, channels
+ and devices related to the Modem.
+ unevaluatedProperties: false
+
+required:
+ - compatible
+ - reg
+ - firmware-name
+ - interrupts
+ - interrupt-names
+ - qcom,smem-states
+ - qcom,smem-state-names
+ - memory-region
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+ #include <dt-bindings/clock/qcom,ipq5332-gcc.h>
+ remoteproc@d100000 {
+ compatible = "qcom,ipq5332-wcss-sec-pil";
+ reg = <0xd100000 0x4040>;
+ firmware-name = "ath12k/IPQ5332/hw1.0/q6_fw0.mdt";
+ interrupts-extended = <&intc GIC_SPI 291 IRQ_TYPE_EDGE_RISING>,
+ <&wcss_smp2p_in 0 IRQ_TYPE_NONE>,
+ <&wcss_smp2p_in 1 IRQ_TYPE_NONE>,
+ <&wcss_smp2p_in 2 IRQ_TYPE_NONE>,
+ <&wcss_smp2p_in 3 IRQ_TYPE_NONE>;
+ interrupt-names = "wdog",
+ "fatal",
+ "ready",
+ "handover",
+ "stop-ack";
+
+ clocks = <&gcc GCC_IM_SLEEP_CLK>;
+ clock-names = "sleep";
+
+ mboxes = <&tmel_qmp 0>;
+ qcom,smem-states = <&wcss_smp2p_out 1>,
+ <&wcss_smp2p_out 0>;
+ qcom,smem-state-names = "stop",
+ "shutdown";
+
+ memory-region = <&q6_region>;
+
+ glink-edge {
+ interrupts = <GIC_SPI 417 IRQ_TYPE_EDGE_RISING>;
+ label = "rtr";
+ qcom,remote-pid = <1>;
+ mboxes = <&apcs_glb 8>;
+ };
+ };
--
2.34.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH V3 3/8] dt-bindings: mailbox: qcom: Add IPQ5424 APCS compatible
2025-01-07 10:16 [PATCH V3 0/8] Add new driver for WCSS secure PIL loading Gokul Sriram Palanisamy
2025-01-07 10:16 ` [PATCH V3 1/8] firmware: qcom_scm: ipq5332: add support to pass metadata size Gokul Sriram Palanisamy
2025-01-07 10:16 ` [PATCH V3 2/8] dt-bindings: remoteproc: qcom: document hexagon based WCSS secure PIL Gokul Sriram Palanisamy
@ 2025-01-07 10:16 ` Gokul Sriram Palanisamy
2025-01-08 8:32 ` Krzysztof Kozlowski
2025-01-07 10:16 ` [PATCH V3 4/8] remoteproc: qcom: add hexagon based WCSS secure PIL driver Gokul Sriram Palanisamy
` (5 subsequent siblings)
8 siblings, 1 reply; 28+ messages in thread
From: Gokul Sriram Palanisamy @ 2025-01-07 10:16 UTC (permalink / raw)
To: jassisinghbrar, robh, krzk+dt, conor+dt, andersson,
mathieu.poirier, konradybcio, quic_mmanikan, linux-arm-msm,
linux-kernel, devicetree, linux-remoteproc, dmitry.baryshkov
Cc: quic_gokulsri, quic_viswanat, quic_srichara
Add compatible for the Qualcomm IPQ5424 APCS block.
Signed-off-by: Gokul Sriram Palanisamy <quic_gokulsri@quicinc.com>
---
.../devicetree/bindings/mailbox/qcom,apcs-kpss-global.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.yaml b/Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.yaml
index 9d2dfd85b207..9b2438726303 100644
--- a/Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.yaml
+++ b/Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.yaml
@@ -20,6 +20,7 @@ properties:
- enum:
- qcom,ipq5018-apcs-apps-global
- qcom,ipq5332-apcs-apps-global
+ - qcom,ipq5424-apcs-apps-global
- qcom,ipq8074-apcs-apps-global
- qcom,ipq9574-apcs-apps-global
- const: qcom,ipq6018-apcs-apps-global
--
2.34.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH V3 4/8] remoteproc: qcom: add hexagon based WCSS secure PIL driver
2025-01-07 10:16 [PATCH V3 0/8] Add new driver for WCSS secure PIL loading Gokul Sriram Palanisamy
` (2 preceding siblings ...)
2025-01-07 10:16 ` [PATCH V3 3/8] dt-bindings: mailbox: qcom: Add IPQ5424 APCS compatible Gokul Sriram Palanisamy
@ 2025-01-07 10:16 ` Gokul Sriram Palanisamy
2025-01-08 4:09 ` Bjorn Andersson
2025-01-07 10:16 ` [PATCH V3 5/8] mailbox: qcom: Add support for IPQ5424 APCS IPC Gokul Sriram Palanisamy
` (4 subsequent siblings)
8 siblings, 1 reply; 28+ messages in thread
From: Gokul Sriram Palanisamy @ 2025-01-07 10:16 UTC (permalink / raw)
To: jassisinghbrar, robh, krzk+dt, conor+dt, andersson,
mathieu.poirier, konradybcio, quic_mmanikan, linux-arm-msm,
linux-kernel, devicetree, linux-remoteproc, dmitry.baryshkov
Cc: quic_gokulsri, quic_viswanat, quic_srichara
From: Vignesh Viswanathan <quic_viswanat@quicinc.com>
Add support to bring up hexagon based WCSS secure PIL remoteproc.
IPQ5332, IPQ9574 supports secure PIL remoteproc.
Signed-off-by: Vignesh Viswanathan <quic_viswanat@quicinc.com>
Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
Signed-off-by: Gokul Sriram Palanisamy <quic_gokulsri@quicinc.com>
---
drivers/remoteproc/Kconfig | 22 ++
drivers/remoteproc/Makefile | 1 +
drivers/remoteproc/qcom_q6v5_wcss_sec.c | 406 ++++++++++++++++++++++++
3 files changed, 429 insertions(+)
create mode 100644 drivers/remoteproc/qcom_q6v5_wcss_sec.c
diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
index 83962a114dc9..c4e94b15c538 100644
--- a/drivers/remoteproc/Kconfig
+++ b/drivers/remoteproc/Kconfig
@@ -255,6 +255,28 @@ config QCOM_Q6V5_WCSS
Hexagon V5 based WCSS remote processors on e.g. IPQ8074. This is
a non-TrustZone wireless subsystem.
+config QCOM_Q6V5_WCSS_SEC
+ tristate "Qualcomm Hexagon based WCSS Secure Peripheral Image Loader"
+ depends on OF && ARCH_QCOM
+ depends on QCOM_SMEM
+ depends on RPMSG_QCOM_SMD || RPMSG_QCOM_SMD=n
+ depends on RPMSG_QCOM_GLINK_SMEM || RPMSG_QCOM_GLINK_SMEM=n
+ depends on QCOM_SYSMON || QCOM_SYSMON=n
+ depends on RPMSG_QCOM_GLINK || RPMSG_QCOM_GLINK=n
+ depends on QCOM_AOSS_QMP || QCOM_AOSS_QMP=n
+ select QCOM_MDT_LOADER
+ select QCOM_PIL_INFO
+ select QCOM_Q6V5_COMMON
+ select QCOM_RPROC_COMMON
+ select QCOM_SCM
+ help
+ Say y here to support the Qualcomm Secure Peripheral Image Loader
+ for the Hexagon based remote processors on e.g. IPQ5332.
+
+ This is TrustZone wireless subsystem. The firmware is
+ verified and booted with the help of the Peripheral Authentication
+ System (PAS) in TrustZone.
+
config QCOM_SYSMON
tristate "Qualcomm sysmon driver"
depends on RPMSG
diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile
index 5ff4e2fee4ab..d4971b672812 100644
--- a/drivers/remoteproc/Makefile
+++ b/drivers/remoteproc/Makefile
@@ -28,6 +28,7 @@ obj-$(CONFIG_QCOM_Q6V5_ADSP) += qcom_q6v5_adsp.o
obj-$(CONFIG_QCOM_Q6V5_MSS) += qcom_q6v5_mss.o
obj-$(CONFIG_QCOM_Q6V5_PAS) += qcom_q6v5_pas.o
obj-$(CONFIG_QCOM_Q6V5_WCSS) += qcom_q6v5_wcss.o
+obj-$(CONFIG_QCOM_Q6V5_WCSS_SEC) += qcom_q6v5_wcss_sec.o
obj-$(CONFIG_QCOM_SYSMON) += qcom_sysmon.o
obj-$(CONFIG_QCOM_WCNSS_PIL) += qcom_wcnss_pil.o
qcom_wcnss_pil-y += qcom_wcnss.o
diff --git a/drivers/remoteproc/qcom_q6v5_wcss_sec.c b/drivers/remoteproc/qcom_q6v5_wcss_sec.c
new file mode 100644
index 000000000000..ef4e893e37c7
--- /dev/null
+++ b/drivers/remoteproc/qcom_q6v5_wcss_sec.c
@@ -0,0 +1,406 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2016-2018 Linaro Ltd.
+ * Copyright (C) 2014 Sony Mobile Communications AB
+ * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2024-2025 Qualcomm Innovation Center, Inc. All rights reserved.
+ */
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/firmware/qcom/qcom_scm.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/iopoll.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/of_reserved_mem.h>
+#include <linux/platform_device.h>
+#include <linux/reset.h>
+#include <linux/soc/qcom/mdt_loader.h>
+#include <linux/soc/qcom/smem.h>
+#include <linux/soc/qcom/smem_state.h>
+#include <linux/mailbox_client.h>
+#include <linux/mailbox/tmelcom-qmp.h>
+#include "qcom_common.h"
+#include "qcom_q6v5.h"
+
+#include "qcom_pil_info.h"
+#include "remoteproc_internal.h"
+
+#define WCSS_CRASH_REASON 421
+
+#define WCSS_PAS_ID 0x6
+#define MPD_WCSS_PAS_ID 0xD
+
+struct wcss_sec {
+ struct device *dev;
+ struct qcom_rproc_glink glink_subdev;
+ struct qcom_rproc_ssr ssr_subdev;
+ struct qcom_q6v5 q6;
+ phys_addr_t mem_phys;
+ phys_addr_t mem_reloc;
+ void *mem_region;
+ size_t mem_size;
+ const struct wcss_data *desc;
+ const char *fw_name;
+
+ struct clk *sleep_clk;
+
+ struct mbox_client mbox_client;
+ struct mbox_chan *mbox_chan;
+ void *metadata;
+ size_t metadata_len;
+};
+
+struct wcss_data {
+ u32 pasid;
+ const struct rproc_ops *ops;
+ bool auto_boot;
+ bool tmelcom;
+};
+
+static int wcss_sec_start(struct rproc *rproc)
+{
+ struct wcss_sec *wcss = rproc->priv;
+ struct device *dev = wcss->dev;
+ const struct wcss_data *desc = of_device_get_match_data(dev);
+ struct tmel_sec_auth tsa;
+ struct tmel_qmp_msg tqm;
+ int ret;
+
+ qcom_q6v5_prepare(&wcss->q6);
+
+ tsa.data = wcss->metadata;
+ tsa.size = wcss->metadata_len;
+ tsa.pas_id = desc->pasid;
+ tqm.msg = &tsa;
+ tqm.msg_id = TMEL_MSG_UID_SECBOOT_SEC_AUTH;
+
+ if (desc->tmelcom) {
+ mbox_send_message(wcss->mbox_chan, (void *)&tqm);
+ } else {
+ ret = qcom_scm_pas_auth_and_reset(desc->pasid);
+ if (ret) {
+ dev_err(dev, "wcss_reset failed\n");
+ return ret;
+ }
+ }
+
+ ret = qcom_q6v5_wait_for_start(&wcss->q6, 5 * HZ);
+ if (ret == -ETIMEDOUT)
+ dev_err(dev, "start timed out\n");
+
+ return ret;
+}
+
+static int wcss_sec_stop(struct rproc *rproc)
+{
+ struct wcss_sec *wcss = rproc->priv;
+ struct device *dev = wcss->dev;
+ const struct wcss_data *desc = of_device_get_match_data(dev);
+ struct tmel_sec_auth tsa;
+ struct tmel_qmp_msg tqm;
+ int ret;
+
+ tsa.pas_id = desc->pasid;
+ tqm.msg = &tsa;
+ tqm.msg_id = TMEL_MSG_UID_SECBOOT_SS_TEAR_DOWN;
+
+ if (desc->tmelcom) {
+ mbox_send_message(wcss->mbox_chan, (void *)&tqm);
+ } else {
+ ret = qcom_scm_pas_shutdown(desc->pasid);
+ if (ret) {
+ dev_err(dev, "not able to shutdown\n");
+ return ret;
+ }
+ }
+
+ qcom_q6v5_unprepare(&wcss->q6);
+
+ return 0;
+}
+
+static void *wcss_sec_da_to_va(struct rproc *rproc, u64 da, size_t len,
+ bool *is_iomem)
+{
+ struct wcss_sec *wcss = rproc->priv;
+ int offset;
+
+ offset = da - wcss->mem_reloc;
+ if (offset < 0 || offset + len > wcss->mem_size)
+ return NULL;
+
+ return wcss->mem_region + offset;
+}
+
+static int wcss_sec_load(struct rproc *rproc, const struct firmware *fw)
+{
+ struct wcss_sec *wcss = rproc->priv;
+ struct device *dev = wcss->dev;
+ const struct wcss_data *desc = of_device_get_match_data(dev);
+ int ret;
+
+ if (desc->tmelcom) {
+ wcss->metadata = qcom_mdt_read_metadata(fw, &wcss->metadata_len,
+ rproc->firmware, wcss->dev);
+ if (IS_ERR(wcss->metadata)) {
+ ret = PTR_ERR(wcss->metadata);
+ dev_err(wcss->dev, "error %d reading firmware %s metadata\n",
+ ret, rproc->firmware);
+ return ret;
+ }
+
+ ret = qcom_mdt_load_no_init(wcss->dev, fw, rproc->firmware, desc->pasid,
+ wcss->mem_region, wcss->mem_phys, wcss->mem_size,
+ &wcss->mem_reloc);
+ kfree(wcss->metadata);
+ } else {
+ ret = qcom_mdt_load(dev, fw, rproc->firmware, desc->pasid, wcss->mem_region,
+ wcss->mem_phys, wcss->mem_size, &wcss->mem_reloc);
+ }
+
+ if (ret)
+ return ret;
+
+ qcom_pil_info_store("wcss", wcss->mem_phys, wcss->mem_size);
+
+ return ret;
+}
+
+static unsigned long wcss_sec_panic(struct rproc *rproc)
+{
+ struct wcss_sec *wcss = rproc->priv;
+
+ return qcom_q6v5_panic(&wcss->q6);
+}
+
+static void wcss_sec_copy_segment(struct rproc *rproc,
+ struct rproc_dump_segment *segment,
+ void *dest, size_t offset, size_t size)
+{
+ struct wcss_sec *wcss = rproc->priv;
+ struct device *dev = wcss->dev;
+ void *ptr;
+
+ ptr = ioremap_wc(segment->da, segment->size);
+ if (!ptr) {
+ dev_err(dev, "Failed to ioremap segment %pad size %zx\n",
+ &segment->da, segment->size);
+ return;
+ }
+
+ if (size <= segment->size - offset)
+ memcpy(dest, ptr + offset, size);
+ else
+ dev_err(dev, "Copy size greater than segment size. Skipping\n");
+ iounmap(ptr);
+}
+
+static int wcss_sec_dump_segments(struct rproc *rproc,
+ const struct firmware *fw)
+{
+ struct device *dev = rproc->dev.parent;
+ struct reserved_mem *rmem = NULL;
+ struct device_node *node;
+ int num_segs, index = 0;
+ int ret;
+
+ /* Parse through additional reserved memory regions for the rproc
+ * and add them to the coredump segments
+ */
+ num_segs = of_count_phandle_with_args(dev->of_node,
+ "memory-region", NULL);
+ while (index < num_segs) {
+ node = of_parse_phandle(dev->of_node,
+ "memory-region", index);
+ if (!node)
+ return -EINVAL;
+
+ rmem = of_reserved_mem_lookup(node);
+ of_node_put(node);
+ if (!rmem) {
+ dev_err(dev, "unable to acquire memory-region index %d num_segs %d\n",
+ index, num_segs);
+ return -EINVAL;
+ }
+
+ dev_dbg(dev, "Adding segment 0x%pa size 0x%pa",
+ &rmem->base, &rmem->size);
+ ret = rproc_coredump_add_custom_segment(rproc,
+ rmem->base,
+ rmem->size,
+ wcss_sec_copy_segment,
+ NULL);
+ if (ret)
+ return ret;
+
+ index++;
+ }
+
+ return 0;
+}
+
+static const struct rproc_ops wcss_sec_ops = {
+ .start = wcss_sec_start,
+ .stop = wcss_sec_stop,
+ .da_to_va = wcss_sec_da_to_va,
+ .load = wcss_sec_load,
+ .get_boot_addr = rproc_elf_get_boot_addr,
+ .panic = wcss_sec_panic,
+ .parse_fw = wcss_sec_dump_segments,
+};
+
+static int wcss_sec_alloc_memory_region(struct wcss_sec *wcss)
+{
+ struct reserved_mem *rmem = NULL;
+ struct device_node *node;
+ struct device *dev = wcss->dev;
+
+ node = of_parse_phandle(dev->of_node, "memory-region", 0);
+ if (!node) {
+ dev_err(dev, "can't find phandle memory-region\n");
+ return -EINVAL;
+ }
+
+ rmem = of_reserved_mem_lookup(node);
+ of_node_put(node);
+
+ if (!rmem) {
+ dev_err(dev, "unable to acquire memory-region\n");
+ return -EINVAL;
+ }
+
+ wcss->mem_phys = rmem->base;
+ wcss->mem_reloc = rmem->base;
+ wcss->mem_size = rmem->size;
+ wcss->mem_region = devm_ioremap_wc(dev, wcss->mem_phys, wcss->mem_size);
+ if (!wcss->mem_region) {
+ dev_err(dev, "unable to map memory region: %pa+%pa\n",
+ &rmem->base, &rmem->size);
+ return -ENOMEM;
+ }
+
+ return 0;
+}
+
+static int wcss_sec_probe(struct platform_device *pdev)
+{
+ struct wcss_sec *wcss;
+ struct rproc *rproc;
+ const char *fw_name = NULL;
+ const struct wcss_data *desc = of_device_get_match_data(&pdev->dev);
+ int ret;
+
+ if (!desc)
+ return -EINVAL;
+
+ ret = of_property_read_string(pdev->dev.of_node, "firmware-name",
+ &fw_name);
+ if (ret < 0)
+ return ret;
+
+ rproc = devm_rproc_alloc(&pdev->dev, pdev->name, desc->ops, fw_name,
+ sizeof(*wcss));
+ if (!rproc) {
+ dev_err(&pdev->dev, "failed to allocate rproc\n");
+ return -ENOMEM;
+ }
+
+ wcss = rproc->priv;
+ wcss->dev = &pdev->dev;
+ wcss->desc = desc;
+ wcss->fw_name = fw_name;
+
+ ret = wcss_sec_alloc_memory_region(wcss);
+ if (ret)
+ return ret;
+
+ wcss->sleep_clk = devm_clk_get_optional_enabled(&pdev->dev, "sleep");
+ if (IS_ERR(wcss->sleep_clk))
+ return dev_err_probe(&pdev->dev, PTR_ERR(wcss->sleep_clk),
+ "Failed to get sleep clock\n");
+
+ ret = qcom_q6v5_init(&wcss->q6, pdev, rproc,
+ WCSS_CRASH_REASON, NULL, NULL);
+ if (ret)
+ return ret;
+
+ qcom_add_glink_subdev(rproc, &wcss->glink_subdev, "q6wcss");
+ qcom_add_ssr_subdev(rproc, &wcss->ssr_subdev, pdev->name);
+
+ rproc->auto_boot = desc->auto_boot;
+ rproc->dump_conf = RPROC_COREDUMP_INLINE;
+ rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE);
+
+ ret = devm_rproc_add(&pdev->dev, rproc);
+ if (ret)
+ return ret;
+
+ platform_set_drvdata(pdev, rproc);
+
+ wcss->mbox_client.dev = wcss->dev;
+ wcss->mbox_client.knows_txdone = true;
+ wcss->mbox_client.tx_block = true;
+ wcss->mbox_chan = mbox_request_channel(&wcss->mbox_client, 0);
+ if (IS_ERR(wcss->mbox_chan)) {
+ dev_err(wcss->dev, "mbox chan for IPC is missing\n");
+ return PTR_ERR(wcss->mbox_chan);
+ }
+
+ return 0;
+}
+
+static void wcss_sec_remove(struct platform_device *pdev)
+{
+ struct rproc *rproc = platform_get_drvdata(pdev);
+ struct wcss_sec *wcss = rproc->priv;
+
+ qcom_q6v5_deinit(&wcss->q6);
+ qcom_remove_glink_subdev(rproc, &wcss->glink_subdev);
+ qcom_remove_ssr_subdev(rproc, &wcss->ssr_subdev);
+}
+
+static const struct wcss_data wcss_sec_ipq5332_res_init = {
+ .pasid = MPD_WCSS_PAS_ID,
+ .auto_boot = true,
+ .ops = &wcss_sec_ops,
+ .tmelcom = false,
+};
+
+static const struct wcss_data wcss_sec_ipq9574_res_init = {
+ .pasid = WCSS_PAS_ID,
+ .auto_boot = true,
+ .ops = &wcss_sec_ops,
+ .tmelcom = false,
+};
+
+static const struct wcss_data wcss_sec_ipq5424_res_init = {
+ .pasid = MPD_WCSS_PAS_ID,
+ .auto_boot = true,
+ .ops = &wcss_sec_ops,
+ .tmelcom = true,
+};
+
+static const struct of_device_id wcss_sec_of_match[] = {
+ { .compatible = "qcom,ipq5332-wcss-sec-pil", .data = &wcss_sec_ipq5332_res_init },
+ { .compatible = "qcom,ipq9574-wcss-sec-pil", .data = &wcss_sec_ipq9574_res_init },
+ { .compatible = "qcom,ipq5424-wcss-sec-pil", .data = &wcss_sec_ipq5424_res_init },
+ { },
+};
+MODULE_DEVICE_TABLE(of, wcss_sec_of_match);
+
+static struct platform_driver wcss_sec_driver = {
+ .probe = wcss_sec_probe,
+ .remove = wcss_sec_remove,
+ .driver = {
+ .name = "qcom-wcss-secure-pil",
+ .of_match_table = wcss_sec_of_match,
+ },
+};
+module_platform_driver(wcss_sec_driver);
+
+MODULE_DESCRIPTION("Hexagon WCSS Secure Peripheral Image Loader");
+MODULE_LICENSE("GPL");
--
2.34.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH V3 5/8] mailbox: qcom: Add support for IPQ5424 APCS IPC
2025-01-07 10:16 [PATCH V3 0/8] Add new driver for WCSS secure PIL loading Gokul Sriram Palanisamy
` (3 preceding siblings ...)
2025-01-07 10:16 ` [PATCH V3 4/8] remoteproc: qcom: add hexagon based WCSS secure PIL driver Gokul Sriram Palanisamy
@ 2025-01-07 10:16 ` Gokul Sriram Palanisamy
2025-01-07 10:16 ` [PATCH V3 6/8] arm64: dts: qcom: ipq5332: add nodes to bringup q6 Gokul Sriram Palanisamy
` (3 subsequent siblings)
8 siblings, 0 replies; 28+ messages in thread
From: Gokul Sriram Palanisamy @ 2025-01-07 10:16 UTC (permalink / raw)
To: jassisinghbrar, robh, krzk+dt, conor+dt, andersson,
mathieu.poirier, konradybcio, quic_mmanikan, linux-arm-msm,
linux-kernel, devicetree, linux-remoteproc, dmitry.baryshkov
Cc: quic_gokulsri, quic_viswanat, quic_srichara
IPQ5424 mailbox do not have clock support and reuses msm8994_apcs_data.
Signed-off-by: Gokul Sriram Palanisamy <quic_gokulsri@quicinc.com>
---
drivers/mailbox/qcom-apcs-ipc-mailbox.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/mailbox/qcom-apcs-ipc-mailbox.c b/drivers/mailbox/qcom-apcs-ipc-mailbox.c
index f0d1fc0fb9ff..11c41e935a36 100644
--- a/drivers/mailbox/qcom-apcs-ipc-mailbox.c
+++ b/drivers/mailbox/qcom-apcs-ipc-mailbox.c
@@ -157,6 +157,7 @@ static const struct of_device_id qcom_apcs_ipc_of_match[] = {
{ .compatible = "qcom,sm6125-apcs-hmss-global", .data = &msm8994_apcs_data },
{ .compatible = "qcom,sm6115-apcs-hmss-global", .data = &msm8994_apcs_data },
{ .compatible = "qcom,ipq5332-apcs-apps-global", .data = &ipq6018_apcs_data },
+ { .compatible = "qcom,ipq5424-apcs-apps-global", .data = &msm8994_apcs_data },
{ .compatible = "qcom,ipq8074-apcs-apps-global", .data = &ipq6018_apcs_data },
{ .compatible = "qcom,sc7180-apss-shared", .data = &apps_shared_apcs_data },
{ .compatible = "qcom,sc8180x-apss-shared", .data = &apps_shared_apcs_data },
--
2.34.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH V3 6/8] arm64: dts: qcom: ipq5332: add nodes to bringup q6
2025-01-07 10:16 [PATCH V3 0/8] Add new driver for WCSS secure PIL loading Gokul Sriram Palanisamy
` (4 preceding siblings ...)
2025-01-07 10:16 ` [PATCH V3 5/8] mailbox: qcom: Add support for IPQ5424 APCS IPC Gokul Sriram Palanisamy
@ 2025-01-07 10:16 ` Gokul Sriram Palanisamy
2025-01-07 12:24 ` Dmitry Baryshkov
2025-01-09 13:11 ` Konrad Dybcio
2025-01-07 10:16 ` [PATCH V3 7/8] arm64: dts: qcom: ipq9574: add nodes to bring up q6 Gokul Sriram Palanisamy
` (2 subsequent siblings)
8 siblings, 2 replies; 28+ messages in thread
From: Gokul Sriram Palanisamy @ 2025-01-07 10:16 UTC (permalink / raw)
To: jassisinghbrar, robh, krzk+dt, conor+dt, andersson,
mathieu.poirier, konradybcio, quic_mmanikan, linux-arm-msm,
linux-kernel, devicetree, linux-remoteproc, dmitry.baryshkov
Cc: quic_gokulsri, quic_viswanat, quic_srichara
From: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
Enable nodes required for q6 remoteproc bring up.
Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
Signed-off-by: Gokul Sriram Palanisamy <quic_gokulsri@quicinc.com>
---
arch/arm64/boot/dts/qcom/ipq5332.dtsi | 64 ++++++++++++++++++++++++++-
1 file changed, 63 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq5332.dtsi b/arch/arm64/boot/dts/qcom/ipq5332.dtsi
index d3c3e215a15c..85e10b20342a 100644
--- a/arch/arm64/boot/dts/qcom/ipq5332.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq5332.dtsi
@@ -2,7 +2,7 @@
/*
* IPQ5332 device tree source
*
- * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2025 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <dt-bindings/clock/qcom,apss-ipq.h>
@@ -146,6 +146,11 @@ smem@4a800000 {
hwlocks = <&tcsr_mutex 3>;
};
+
+ q6_region: wcss@4a900000 {
+ reg = <0x0 0x4a900000 0x0 0x2b00000>;
+ no-map;
+ };
};
soc@0 {
@@ -479,6 +484,39 @@ frame@b128000 {
status = "disabled";
};
};
+
+ q6v5_wcss: remoteproc@d100000 {
+ compatible = "qcom,ipq5332-wcss-sec-pil";
+ reg = <0xd100000 0x4040>;
+ firmware-name = "ath12k/IPQ5332/hw1.0/q6_fw0.mdt";
+ interrupts-extended = <&intc GIC_SPI 421 IRQ_TYPE_EDGE_RISING>,
+ <&wcss_smp2p_in 0 IRQ_TYPE_NONE>,
+ <&wcss_smp2p_in 1 IRQ_TYPE_NONE>,
+ <&wcss_smp2p_in 2 IRQ_TYPE_NONE>,
+ <&wcss_smp2p_in 3 IRQ_TYPE_NONE>;
+ interrupt-names = "wdog",
+ "fatal",
+ "ready",
+ "handover",
+ "stop-ack";
+
+ clocks = <&gcc GCC_IM_SLEEP_CLK>;
+ clock-names = "sleep";
+
+ qcom,smem-states = <&wcss_smp2p_out 1>,
+ <&wcss_smp2p_out 0>;
+ qcom,smem-state-names = "stop",
+ "shutdown";
+
+ memory-region = <&q6_region>;
+
+ glink-edge {
+ interrupts = <GIC_SPI 417 IRQ_TYPE_EDGE_RISING>;
+ label = "rtr";
+ qcom,remote-pid = <1>;
+ mboxes = <&apcs_glb 8>;
+ };
+ };
};
timer {
@@ -488,4 +526,28 @@ timer {
<GIC_PPI 4 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
<GIC_PPI 1 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
};
+
+ wcss: wcss-smp2p {
+ compatible = "qcom,smp2p";
+ qcom,smem = <435>, <428>;
+
+ interrupt-parent = <&intc>;
+ interrupts = <GIC_SPI 418 IRQ_TYPE_EDGE_RISING>;
+
+ mboxes = <&apcs_glb 9>;
+
+ qcom,local-pid = <0>;
+ qcom,remote-pid = <1>;
+
+ wcss_smp2p_out: master-kernel {
+ qcom,entry-name = "master-kernel";
+ #qcom,smem-state-cells = <1>;
+ };
+
+ wcss_smp2p_in: slave-kernel {
+ qcom,entry-name = "slave-kernel";
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ };
+ };
};
--
2.34.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH V3 7/8] arm64: dts: qcom: ipq9574: add nodes to bring up q6
2025-01-07 10:16 [PATCH V3 0/8] Add new driver for WCSS secure PIL loading Gokul Sriram Palanisamy
` (5 preceding siblings ...)
2025-01-07 10:16 ` [PATCH V3 6/8] arm64: dts: qcom: ipq5332: add nodes to bringup q6 Gokul Sriram Palanisamy
@ 2025-01-07 10:16 ` Gokul Sriram Palanisamy
2025-01-09 13:12 ` Konrad Dybcio
2025-01-07 10:16 ` [PATCH V3 8/8] arm64: dts: qcom: ipq5424: " Gokul Sriram Palanisamy
2025-01-24 18:00 ` [PATCH V3 0/8] Add new driver for WCSS secure PIL loading Jeff Johnson
8 siblings, 1 reply; 28+ messages in thread
From: Gokul Sriram Palanisamy @ 2025-01-07 10:16 UTC (permalink / raw)
To: jassisinghbrar, robh, krzk+dt, conor+dt, andersson,
mathieu.poirier, konradybcio, quic_mmanikan, linux-arm-msm,
linux-kernel, devicetree, linux-remoteproc, dmitry.baryshkov
Cc: quic_gokulsri, quic_viswanat, quic_srichara
From: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
Enable nodes required for q6 remoteproc bring up.
Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
Signed-off-by: Gokul Sriram Palanisamy <quic_gokulsri@quicinc.com>
---
arch/arm64/boot/dts/qcom/ipq9574.dtsi | 60 ++++++++++++++++++++++++++-
1 file changed, 59 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq9574.dtsi b/arch/arm64/boot/dts/qcom/ipq9574.dtsi
index d1fd35ebc4a2..5ce7d55394bc 100644
--- a/arch/arm64/boot/dts/qcom/ipq9574.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq9574.dtsi
@@ -3,7 +3,7 @@
* IPQ9574 SoC device tree source
*
* Copyright (c) 2020-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2023-2025 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <dt-bindings/clock/qcom,apss-ipq.h>
@@ -213,6 +213,11 @@ smem@4aa00000 {
hwlocks = <&tcsr_mutex 3>;
no-map;
};
+
+ q6_region: wcnss@4ab00000 {
+ reg = <0x0 0x4ab00000 0x0 0x2b00000>;
+ no-map;
+ };
};
soc: soc@0 {
@@ -756,6 +761,35 @@ frame@b128000 {
status = "disabled";
};
};
+
+ q6v5_wcss: remoteproc@cd00000 {
+ compatible = "qcom,ipq9574-wcss-sec-pil";
+ reg = <0x0cd00000 0x4040>;
+ firmware-name = "ath11k/IPQ9574/hw1.0/q6_fw.mdt";
+ interrupts-extended = <&intc GIC_SPI 325 IRQ_TYPE_EDGE_RISING>,
+ <&wcss_smp2p_in 0 IRQ_TYPE_NONE>,
+ <&wcss_smp2p_in 1 IRQ_TYPE_NONE>,
+ <&wcss_smp2p_in 2 IRQ_TYPE_NONE>,
+ <&wcss_smp2p_in 3 IRQ_TYPE_NONE>;
+ interrupt-names = "wdog",
+ "fatal",
+ "ready",
+ "handover",
+ "stop-ack";
+
+ qcom,smem-states = <&wcss_smp2p_out 1>,
+ <&wcss_smp2p_out 0>;
+ qcom,smem-state-names = "stop",
+ "shutdown";
+ memory-region = <&q6_region>;
+
+ glink-edge {
+ interrupts = <GIC_SPI 321 IRQ_TYPE_EDGE_RISING>;
+ label = "rtr";
+ qcom,remote-pid = <1>;
+ mboxes = <&apcs_glb 8>;
+ };
+ };
};
thermal-zones {
@@ -987,4 +1021,28 @@ timer {
<GIC_PPI 4 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
<GIC_PPI 1 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
};
+
+ wcss: wcss-smp2p {
+ compatible = "qcom,smp2p";
+ qcom,smem = <435>, <428>;
+
+ interrupt-parent = <&intc>;
+ interrupts = <GIC_SPI 322 IRQ_TYPE_EDGE_RISING>;
+
+ mboxes = <&apcs_glb 9>;
+
+ qcom,local-pid = <0>;
+ qcom,remote-pid = <1>;
+
+ wcss_smp2p_out: master-kernel {
+ qcom,entry-name = "master-kernel";
+ #qcom,smem-state-cells = <1>;
+ };
+
+ wcss_smp2p_in: slave-kernel {
+ qcom,entry-name = "slave-kernel";
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ };
+ };
};
--
2.34.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH V3 8/8] arm64: dts: qcom: ipq5424: add nodes to bring up q6
2025-01-07 10:16 [PATCH V3 0/8] Add new driver for WCSS secure PIL loading Gokul Sriram Palanisamy
` (6 preceding siblings ...)
2025-01-07 10:16 ` [PATCH V3 7/8] arm64: dts: qcom: ipq9574: add nodes to bring up q6 Gokul Sriram Palanisamy
@ 2025-01-07 10:16 ` Gokul Sriram Palanisamy
2025-01-24 18:00 ` [PATCH V3 0/8] Add new driver for WCSS secure PIL loading Jeff Johnson
8 siblings, 0 replies; 28+ messages in thread
From: Gokul Sriram Palanisamy @ 2025-01-07 10:16 UTC (permalink / raw)
To: jassisinghbrar, robh, krzk+dt, conor+dt, andersson,
mathieu.poirier, konradybcio, quic_mmanikan, linux-arm-msm,
linux-kernel, devicetree, linux-remoteproc, dmitry.baryshkov
Cc: quic_gokulsri, quic_viswanat, quic_srichara
Enable nodes required for q6 remoteproc bring up.
Signed-off-by: Gokul Sriram Palanisamy <quic_gokulsri@quicinc.com>
---
arch/arm64/boot/dts/qcom/ipq5424.dtsi | 80 ++++++++++++++++++++++++++-
1 file changed, 79 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq5424.dtsi b/arch/arm64/boot/dts/qcom/ipq5424.dtsi
index 5e219f900412..32c8fa837dcb 100644
--- a/arch/arm64/boot/dts/qcom/ipq5424.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq5424.dtsi
@@ -3,7 +3,7 @@
* IPQ5424 device tree source
*
* Copyright (c) 2020-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2025 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <dt-bindings/interrupt-controller/arm-gic.h>
@@ -125,6 +125,11 @@ reserved-memory {
#size-cells = <2>;
ranges;
+ q6_region: wcnss@8a900000 {
+ no-map;
+ reg = <0x0 0x8a900000 0x0 0x2800000>;
+ };
+
tz@8a600000 {
reg = <0x0 0x8a600000 0x0 0x200000>;
no-map;
@@ -233,6 +238,55 @@ intc: interrupt-controller@f200000 {
msi-controller;
};
+ apcs_glb: mailbox@f400004 {
+ compatible = "qcom,ipq5424-apcs-apps-global",
+ "qcom,ipq6018-apcs-apps-global";
+ reg = <0 0xf400004 0 0x6000>;
+ #clock-cells = <1>;
+ #mbox-cells = <1>;
+ };
+
+ tmel_qmp: qmp@32090000 {
+ compatible = "qcom,ipq5424-tmel-qmp";
+ reg = <0 0x32090000 0 0x2000>;
+ interrupts = <GIC_SPI 126 IRQ_TYPE_EDGE_RISING>;
+ mboxes = <&apcs_glb 20>;
+ #mbox-cells = <1>;
+ };
+
+ q6v5_wcss: remoteproc@d100000 {
+ compatible = "qcom,ipq5424-wcss-sec-pil";
+ reg = <0 0x0cd00000 0 0x4040>;
+ firmware-name = "ath12k/IPQ5424/hw1.0/q6_fw0.mdt";
+ interrupts-extended = <&intc GIC_SPI 508 IRQ_TYPE_EDGE_RISING>,
+ <&wcss_smp2p_in 0 0>,
+ <&wcss_smp2p_in 1 0>,
+ <&wcss_smp2p_in 2 0>,
+ <&wcss_smp2p_in 3 0>;
+ interrupt-names = "wdog",
+ "fatal",
+ "ready",
+ "handover",
+ "stop-ack";
+
+ mboxes = <&tmel_qmp 0>;
+ qcom,smem-states = <&wcss_smp2p_out 0>,
+ <&wcss_smp2p_out 1>;
+ qcom,smem-state-names = "shutdown",
+ "stop";
+
+ memory-region = <&q6_region>;
+
+ status = "okay";
+
+ glink-edge {
+ interrupts = <GIC_SPI 500 IRQ_TYPE_EDGE_RISING>;
+ label = "rtr";
+ qcom,remote-pid = <1>;
+ mboxes = <&apcs_glb 8>;
+ };
+ };
+
timer@f420000 {
compatible = "arm,armv7-timer-mem";
reg = <0 0xf420000 0 0x1000>;
@@ -302,4 +356,28 @@ timer {
<GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
<GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
};
+
+ wcss: wcss-smp2p {
+ compatible = "qcom,smp2p";
+ qcom,smem = <435>, <428>;
+
+ interrupt-parent = <&intc>;
+ interrupts = <GIC_SPI 501 IRQ_TYPE_EDGE_RISING>;
+
+ mboxes = <&apcs_glb 9>;
+
+ qcom,local-pid = <0>;
+ qcom,remote-pid = <1>;
+
+ wcss_smp2p_out: master-kernel {
+ qcom,entry-name = "master-kernel";
+ #qcom,smem-state-cells = <1>;
+ };
+
+ wcss_smp2p_in: slave-kernel {
+ qcom,entry-name = "slave-kernel";
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ };
+ };
};
--
2.34.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [PATCH V3 2/8] dt-bindings: remoteproc: qcom: document hexagon based WCSS secure PIL
2025-01-07 10:16 ` [PATCH V3 2/8] dt-bindings: remoteproc: qcom: document hexagon based WCSS secure PIL Gokul Sriram Palanisamy
@ 2025-01-07 12:21 ` Dmitry Baryshkov
[not found] ` <f0eef19b-8497-4e7d-bed1-882cdb8c1ab1@quicinc.com>
[not found] ` <3e64b792-bfca-4b07-a13e-6deb966f3d4f@quicinc.com>
0 siblings, 2 replies; 28+ messages in thread
From: Dmitry Baryshkov @ 2025-01-07 12:21 UTC (permalink / raw)
To: Gokul Sriram Palanisamy
Cc: jassisinghbrar, robh, krzk+dt, conor+dt, andersson,
mathieu.poirier, konradybcio, quic_mmanikan, linux-arm-msm,
linux-kernel, devicetree, linux-remoteproc, quic_viswanat,
quic_srichara
On Tue, Jan 07, 2025 at 03:46:41PM +0530, Gokul Sriram Palanisamy wrote:
> From: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
>
> Add new binding document for hexagon based WCSS secure PIL remoteproc.
> IPQ5332, IPQ5424 and IPQ9574 follows secure PIL remoteproc.
>
> Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
> Signed-off-by: Gokul Sriram Palanisamy <quic_gokulsri@quicinc.com>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
> .../remoteproc/qcom,wcss-sec-pil.yaml | 131 ++++++++++++++++++
> 1 file changed, 131 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,wcss-sec-pil.yaml
> +examples:
> + - |
> + #include <dt-bindings/interrupt-controller/arm-gic.h>
> + #include <dt-bindings/clock/qcom,ipq5332-gcc.h>
> + remoteproc@d100000 {
> + compatible = "qcom,ipq5332-wcss-sec-pil";
> + reg = <0xd100000 0x4040>;
> + firmware-name = "ath12k/IPQ5332/hw1.0/q6_fw0.mdt";
Nit: .mbn
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH V3 6/8] arm64: dts: qcom: ipq5332: add nodes to bringup q6
2025-01-07 10:16 ` [PATCH V3 6/8] arm64: dts: qcom: ipq5332: add nodes to bringup q6 Gokul Sriram Palanisamy
@ 2025-01-07 12:24 ` Dmitry Baryshkov
2025-01-09 13:11 ` Konrad Dybcio
1 sibling, 0 replies; 28+ messages in thread
From: Dmitry Baryshkov @ 2025-01-07 12:24 UTC (permalink / raw)
To: Gokul Sriram Palanisamy
Cc: jassisinghbrar, robh, krzk+dt, conor+dt, andersson,
mathieu.poirier, konradybcio, quic_mmanikan, linux-arm-msm,
linux-kernel, devicetree, linux-remoteproc, quic_viswanat,
quic_srichara
On Tue, Jan 07, 2025 at 03:46:45PM +0530, Gokul Sriram Palanisamy wrote:
> From: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
>
> Enable nodes required for q6 remoteproc bring up.
>
> Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
> Signed-off-by: Gokul Sriram Palanisamy <quic_gokulsri@quicinc.com>
> ---
> arch/arm64/boot/dts/qcom/ipq5332.dtsi | 64 ++++++++++++++++++++++++++-
> 1 file changed, 63 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/boot/dts/qcom/ipq5332.dtsi b/arch/arm64/boot/dts/qcom/ipq5332.dtsi
> index d3c3e215a15c..85e10b20342a 100644
> --- a/arch/arm64/boot/dts/qcom/ipq5332.dtsi
> +++ b/arch/arm64/boot/dts/qcom/ipq5332.dtsi
> @@ -2,7 +2,7 @@
> /*
> * IPQ5332 device tree source
> *
> - * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
> + * Copyright (c) 2022-2025 Qualcomm Innovation Center, Inc. All rights reserved.
> */
>
> #include <dt-bindings/clock/qcom,apss-ipq.h>
> @@ -146,6 +146,11 @@ smem@4a800000 {
>
> hwlocks = <&tcsr_mutex 3>;
> };
> +
> + q6_region: wcss@4a900000 {
> + reg = <0x0 0x4a900000 0x0 0x2b00000>;
> + no-map;
> + };
> };
>
> soc@0 {
> @@ -479,6 +484,39 @@ frame@b128000 {
> status = "disabled";
> };
> };
> +
> + q6v5_wcss: remoteproc@d100000 {
> + compatible = "qcom,ipq5332-wcss-sec-pil";
> + reg = <0xd100000 0x4040>;
> + firmware-name = "ath12k/IPQ5332/hw1.0/q6_fw0.mdt";
If the device is fused to use vendor keys, will the same firmware image
work? If not, the remoteproc should be disabled by default and the
firmware-name should go to the board file.
And anyway, please use .mbn
> + interrupts-extended = <&intc GIC_SPI 421 IRQ_TYPE_EDGE_RISING>,
> + <&wcss_smp2p_in 0 IRQ_TYPE_NONE>,
> + <&wcss_smp2p_in 1 IRQ_TYPE_NONE>,
> + <&wcss_smp2p_in 2 IRQ_TYPE_NONE>,
> + <&wcss_smp2p_in 3 IRQ_TYPE_NONE>;
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH V3 4/8] remoteproc: qcom: add hexagon based WCSS secure PIL driver
2025-01-07 10:16 ` [PATCH V3 4/8] remoteproc: qcom: add hexagon based WCSS secure PIL driver Gokul Sriram Palanisamy
@ 2025-01-08 4:09 ` Bjorn Andersson
2025-01-08 6:29 ` Sricharan Ramabadhran
2025-01-09 12:18 ` Gokul Sriram Palanisamy
0 siblings, 2 replies; 28+ messages in thread
From: Bjorn Andersson @ 2025-01-08 4:09 UTC (permalink / raw)
To: Gokul Sriram Palanisamy
Cc: jassisinghbrar, robh, krzk+dt, conor+dt, mathieu.poirier,
konradybcio, quic_mmanikan, linux-arm-msm, linux-kernel,
devicetree, linux-remoteproc, dmitry.baryshkov, quic_viswanat,
quic_srichara
On Tue, Jan 07, 2025 at 03:46:43PM +0530, Gokul Sriram Palanisamy wrote:
> From: Vignesh Viswanathan <quic_viswanat@quicinc.com>
>
> Add support to bring up hexagon based WCSS secure PIL remoteproc.
> IPQ5332, IPQ9574 supports secure PIL remoteproc.
I'd love for this to be extended with a short description of what the
WCSS secure subsystem is, the reason for a new drivers etc. Following
the style of
https://docs.kernel.org/process/submitting-patches.html#describe-your-changes
>
> Signed-off-by: Vignesh Viswanathan <quic_viswanat@quicinc.com>
> Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
> Signed-off-by: Gokul Sriram Palanisamy <quic_gokulsri@quicinc.com>
> ---
> drivers/remoteproc/Kconfig | 22 ++
> drivers/remoteproc/Makefile | 1 +
> drivers/remoteproc/qcom_q6v5_wcss_sec.c | 406 ++++++++++++++++++++++++
> 3 files changed, 429 insertions(+)
> create mode 100644 drivers/remoteproc/qcom_q6v5_wcss_sec.c
>
> diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
> index 83962a114dc9..c4e94b15c538 100644
> --- a/drivers/remoteproc/Kconfig
> +++ b/drivers/remoteproc/Kconfig
> @@ -255,6 +255,28 @@ config QCOM_Q6V5_WCSS
> Hexagon V5 based WCSS remote processors on e.g. IPQ8074. This is
> a non-TrustZone wireless subsystem.
>
> +config QCOM_Q6V5_WCSS_SEC
> + tristate "Qualcomm Hexagon based WCSS Secure Peripheral Image Loader"
> + depends on OF && ARCH_QCOM
> + depends on QCOM_SMEM
> + depends on RPMSG_QCOM_SMD || RPMSG_QCOM_SMD=n
> + depends on RPMSG_QCOM_GLINK_SMEM || RPMSG_QCOM_GLINK_SMEM=n
> + depends on QCOM_SYSMON || QCOM_SYSMON=n
> + depends on RPMSG_QCOM_GLINK || RPMSG_QCOM_GLINK=n
> + depends on QCOM_AOSS_QMP || QCOM_AOSS_QMP=n
Please review these depends, did you inherit a few too many?
> + select QCOM_MDT_LOADER
> + select QCOM_PIL_INFO
> + select QCOM_Q6V5_COMMON
> + select QCOM_RPROC_COMMON
> + select QCOM_SCM
> + help
> + Say y here to support the Qualcomm Secure Peripheral Image Loader
> + for the Hexagon based remote processors on e.g. IPQ5332.
> +
> + This is TrustZone wireless subsystem. The firmware is
> + verified and booted with the help of the Peripheral Authentication
> + System (PAS) in TrustZone.
> +
> config QCOM_SYSMON
> tristate "Qualcomm sysmon driver"
> depends on RPMSG
> diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile
> index 5ff4e2fee4ab..d4971b672812 100644
> --- a/drivers/remoteproc/Makefile
> +++ b/drivers/remoteproc/Makefile
> @@ -28,6 +28,7 @@ obj-$(CONFIG_QCOM_Q6V5_ADSP) += qcom_q6v5_adsp.o
> obj-$(CONFIG_QCOM_Q6V5_MSS) += qcom_q6v5_mss.o
> obj-$(CONFIG_QCOM_Q6V5_PAS) += qcom_q6v5_pas.o
> obj-$(CONFIG_QCOM_Q6V5_WCSS) += qcom_q6v5_wcss.o
> +obj-$(CONFIG_QCOM_Q6V5_WCSS_SEC) += qcom_q6v5_wcss_sec.o
> obj-$(CONFIG_QCOM_SYSMON) += qcom_sysmon.o
> obj-$(CONFIG_QCOM_WCNSS_PIL) += qcom_wcnss_pil.o
> qcom_wcnss_pil-y += qcom_wcnss.o
> diff --git a/drivers/remoteproc/qcom_q6v5_wcss_sec.c b/drivers/remoteproc/qcom_q6v5_wcss_sec.c
> new file mode 100644
> index 000000000000..ef4e893e37c7
> --- /dev/null
> +++ b/drivers/remoteproc/qcom_q6v5_wcss_sec.c
> @@ -0,0 +1,406 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2016-2018 Linaro Ltd.
> + * Copyright (C) 2014 Sony Mobile Communications AB
> + * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
> + * Copyright (c) 2024-2025 Qualcomm Innovation Center, Inc. All rights reserved.
> + */
> +#include <linux/clk.h>
> +#include <linux/delay.h>
Please check that all these includes are required.
> +#include <linux/firmware/qcom/qcom_scm.h>
> +#include <linux/interrupt.h>
> +#include <linux/io.h>
> +#include <linux/iopoll.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/of_address.h>
> +#include <linux/of_device.h>
> +#include <linux/of_reserved_mem.h>
> +#include <linux/platform_device.h>
> +#include <linux/reset.h>
> +#include <linux/soc/qcom/mdt_loader.h>
> +#include <linux/soc/qcom/smem.h>
> +#include <linux/soc/qcom/smem_state.h>
> +#include <linux/mailbox_client.h>
> +#include <linux/mailbox/tmelcom-qmp.h>
This will require mailbox maintainer to first accept the tmelcom mailbox
driver, and share a immutable branch with me (or we have to wait until
this include file trickles in).
Please ensure that mailbox maintainer is aware of this request.
> +#include "qcom_common.h"
> +#include "qcom_q6v5.h"
> +
> +#include "qcom_pil_info.h"
> +#include "remoteproc_internal.h"
> +
> +#define WCSS_CRASH_REASON 421
> +
> +#define WCSS_PAS_ID 0x6
> +#define MPD_WCSS_PAS_ID 0xD
I like lowercase hex digits.
> +
> +struct wcss_sec {
> + struct device *dev;
> + struct qcom_rproc_glink glink_subdev;
> + struct qcom_rproc_ssr ssr_subdev;
> + struct qcom_q6v5 q6;
> + phys_addr_t mem_phys;
> + phys_addr_t mem_reloc;
> + void *mem_region;
> + size_t mem_size;
> + const struct wcss_data *desc;
Assigned but never used.
> + const char *fw_name;
Assigned but never used.
> +
> + struct clk *sleep_clk;
Assigned but never used.
> +
> + struct mbox_client mbox_client;
> + struct mbox_chan *mbox_chan;
> + void *metadata;
> + size_t metadata_len;
> +};
> +
> +struct wcss_data {
> + u32 pasid;
> + const struct rproc_ops *ops;
> + bool auto_boot;
> + bool tmelcom;
> +};
> +
> +static int wcss_sec_start(struct rproc *rproc)
> +{
> + struct wcss_sec *wcss = rproc->priv;
> + struct device *dev = wcss->dev;
> + const struct wcss_data *desc = of_device_get_match_data(dev);
Please avoid "parsing" DT in runtime.
> + struct tmel_sec_auth tsa;
> + struct tmel_qmp_msg tqm;
> + int ret;
> +
> + qcom_q6v5_prepare(&wcss->q6);
It would be sensible to check the return value here.
> +
> + tsa.data = wcss->metadata;
This looks broken.
wcss->metadata is assigned in wcss_sec_load() only if tmelcom, and in
that code path wcss_sec_load() invokes kfree() on the pointer.
So, as far as I can tell, you're either going to pass NULL here or a
pointer to a freed (and perhaps overwritten) buffer.
> + tsa.size = wcss->metadata_len;
> + tsa.pas_id = desc->pasid;
> + tqm.msg = &tsa;
> + tqm.msg_id = TMEL_MSG_UID_SECBOOT_SEC_AUTH;
> +
> + if (desc->tmelcom) {
As I point out below, mbox_chan should probably only be assigned when
desc->tmelcom == true, so you wouldn't even need any additional state,
just check if mbox_chan is valid here.
> + mbox_send_message(wcss->mbox_chan, (void *)&tqm);
This does return errors as well, perhaps worth checking that as well?
> + } else {
> + ret = qcom_scm_pas_auth_and_reset(desc->pasid);
Please confirm that you're not required to keep the metadata buffer
passed to PAS init_image during qcom_mdt_load() alive until this point -
as is required by all modern SDMs.
> + if (ret) {
> + dev_err(dev, "wcss_reset failed\n");
> + return ret;
> + }
> + }
> +
> + ret = qcom_q6v5_wait_for_start(&wcss->q6, 5 * HZ);
> + if (ret == -ETIMEDOUT)
> + dev_err(dev, "start timed out\n");
Don't you need to qcom_scm_pas_shutdown() here to have QHEEBSP release
the memory back to you?
> +
> + return ret;
> +}
> +
> +static int wcss_sec_stop(struct rproc *rproc)
> +{
> + struct wcss_sec *wcss = rproc->priv;
> + struct device *dev = wcss->dev;
> + const struct wcss_data *desc = of_device_get_match_data(dev);
> + struct tmel_sec_auth tsa;
> + struct tmel_qmp_msg tqm;
> + int ret;
> +
> + tsa.pas_id = desc->pasid;
tsa is passing a couple of random values over your mbox. Please
zero-initialize these.
Why is this filled in outside desc->tmelcom, when that's the only place
it's used?
> + tqm.msg = &tsa;
> + tqm.msg_id = TMEL_MSG_UID_SECBOOT_SS_TEAR_DOWN;
> +
> + if (desc->tmelcom) {
> + mbox_send_message(wcss->mbox_chan, (void *)&tqm);
> + } else {
> + ret = qcom_scm_pas_shutdown(desc->pasid);
> + if (ret) {
> + dev_err(dev, "not able to shutdown\n");
> + return ret;
> + }
> + }
> +
> + qcom_q6v5_unprepare(&wcss->q6);
> +
> + return 0;
> +}
> +
> +static void *wcss_sec_da_to_va(struct rproc *rproc, u64 da, size_t len,
> + bool *is_iomem)
> +{
> + struct wcss_sec *wcss = rproc->priv;
> + int offset;
> +
> + offset = da - wcss->mem_reloc;
> + if (offset < 0 || offset + len > wcss->mem_size)
> + return NULL;
> +
> + return wcss->mem_region + offset;
> +}
> +
> +static int wcss_sec_load(struct rproc *rproc, const struct firmware *fw)
> +{
> + struct wcss_sec *wcss = rproc->priv;
> + struct device *dev = wcss->dev;
> + const struct wcss_data *desc = of_device_get_match_data(dev);
> + int ret;
> +
> + if (desc->tmelcom) {
> + wcss->metadata = qcom_mdt_read_metadata(fw, &wcss->metadata_len,
> + rproc->firmware, wcss->dev);
> + if (IS_ERR(wcss->metadata)) {
> + ret = PTR_ERR(wcss->metadata);
> + dev_err(wcss->dev, "error %d reading firmware %s metadata\n",
> + ret, rproc->firmware);
> + return ret;
> + }
> +
> + ret = qcom_mdt_load_no_init(wcss->dev, fw, rproc->firmware, desc->pasid,
> + wcss->mem_region, wcss->mem_phys, wcss->mem_size,
> + &wcss->mem_reloc);
> + kfree(wcss->metadata);
> + } else {
> + ret = qcom_mdt_load(dev, fw, rproc->firmware, desc->pasid, wcss->mem_region,
> + wcss->mem_phys, wcss->mem_size, &wcss->mem_reloc);
> + }
> +
> + if (ret)
> + return ret;
> +
> + qcom_pil_info_store("wcss", wcss->mem_phys, wcss->mem_size);
> +
> + return ret;
ret can't be anything but 0 here, so better just write that.
> +}
> +
> +static unsigned long wcss_sec_panic(struct rproc *rproc)
> +{
> + struct wcss_sec *wcss = rproc->priv;
> +
> + return qcom_q6v5_panic(&wcss->q6);
> +}
> +
> +static void wcss_sec_copy_segment(struct rproc *rproc,
> + struct rproc_dump_segment *segment,
> + void *dest, size_t offset, size_t size)
> +{
> + struct wcss_sec *wcss = rproc->priv;
> + struct device *dev = wcss->dev;
> + void *ptr;
> +
> + ptr = ioremap_wc(segment->da, segment->size);
> + if (!ptr) {
> + dev_err(dev, "Failed to ioremap segment %pad size %zx\n",
Make that %#zx to ensure that the base 16 size is prefixed with 0x
> + &segment->da, segment->size);
> + return;
> + }
> +
> + if (size <= segment->size - offset)
I'd prefer if the expression in the check and access are on the same
form. I.e. test offset + size vs segement->size
> + memcpy(dest, ptr + offset, size);
> + else
> + dev_err(dev, "Copy size greater than segment size. Skipping\n");
> + iounmap(ptr);
> +}
> +
> +static int wcss_sec_dump_segments(struct rproc *rproc,
> + const struct firmware *fw)
> +{
> + struct device *dev = rproc->dev.parent;
> + struct reserved_mem *rmem = NULL;
> + struct device_node *node;
> + int num_segs, index = 0;
> + int ret;
> +
> + /* Parse through additional reserved memory regions for the rproc
Leave first line in multiline comment blank, as the docs says.
> + * and add them to the coredump segments
> + */
> + num_segs = of_count_phandle_with_args(dev->of_node,
> + "memory-region", NULL);
> + while (index < num_segs) {
You're zero-initializing index above, checking index here and explicitly
increment it at the bottom of the loop. Why isn't this written as a for
loop?
> + node = of_parse_phandle(dev->of_node,
> + "memory-region", index);
> + if (!node)
> + return -EINVAL;
> +
> + rmem = of_reserved_mem_lookup(node);
> + of_node_put(node);
> + if (!rmem) {
> + dev_err(dev, "unable to acquire memory-region index %d num_segs %d\n",
> + index, num_segs);
> + return -EINVAL;
> + }
> +
> + dev_dbg(dev, "Adding segment 0x%pa size 0x%pa",
> + &rmem->base, &rmem->size);
> + ret = rproc_coredump_add_custom_segment(rproc,
> + rmem->base,
> + rmem->size,
> + wcss_sec_copy_segment,
> + NULL);
> + if (ret)
> + return ret;
> +
> + index++;
> + }
> +
> + return 0;
> +}
> +
> +static const struct rproc_ops wcss_sec_ops = {
> + .start = wcss_sec_start,
> + .stop = wcss_sec_stop,
> + .da_to_va = wcss_sec_da_to_va,
> + .load = wcss_sec_load,
> + .get_boot_addr = rproc_elf_get_boot_addr,
> + .panic = wcss_sec_panic,
> + .parse_fw = wcss_sec_dump_segments,
> +};
> +
> +static int wcss_sec_alloc_memory_region(struct wcss_sec *wcss)
> +{
> + struct reserved_mem *rmem = NULL;
> + struct device_node *node;
> + struct device *dev = wcss->dev;
> +
> + node = of_parse_phandle(dev->of_node, "memory-region", 0);
> + if (!node) {
> + dev_err(dev, "can't find phandle memory-region\n");
> + return -EINVAL;
> + }
> +
> + rmem = of_reserved_mem_lookup(node);
> + of_node_put(node);
> +
> + if (!rmem) {
> + dev_err(dev, "unable to acquire memory-region\n");
> + return -EINVAL;
> + }
> +
> + wcss->mem_phys = rmem->base;
> + wcss->mem_reloc = rmem->base;
> + wcss->mem_size = rmem->size;
> + wcss->mem_region = devm_ioremap_wc(dev, wcss->mem_phys, wcss->mem_size);
> + if (!wcss->mem_region) {
> + dev_err(dev, "unable to map memory region: %pa+%pa\n",
> + &rmem->base, &rmem->size);
> + return -ENOMEM;
> + }
> +
> + return 0;
> +}
> +
> +static int wcss_sec_probe(struct platform_device *pdev)
> +{
> + struct wcss_sec *wcss;
> + struct rproc *rproc;
> + const char *fw_name = NULL;
> + const struct wcss_data *desc = of_device_get_match_data(&pdev->dev);
> + int ret;
> +
> + if (!desc)
> + return -EINVAL;
It shouldn't be possible to get here with desc == NULL, so let the
person have an oops with a callstack to aid debugging. (I.e. remove the
check)
> +
> + ret = of_property_read_string(pdev->dev.of_node, "firmware-name",
> + &fw_name);
> + if (ret < 0)
> + return ret;
> +
> + rproc = devm_rproc_alloc(&pdev->dev, pdev->name, desc->ops, fw_name,
> + sizeof(*wcss));
Not sure how your system composition looks like, but please consider
something like b64b1266d619 ("remoteproc: qcom: pas: Make remoteproc
name human friendly"), to avoid the human-unfriendly pdev->name. (Only
if possible)
> + if (!rproc) {
> + dev_err(&pdev->dev, "failed to allocate rproc\n");
> + return -ENOMEM;
> + }
> +
> + wcss = rproc->priv;
> + wcss->dev = &pdev->dev;
> + wcss->desc = desc;
> + wcss->fw_name = fw_name;
> +
> + ret = wcss_sec_alloc_memory_region(wcss);
> + if (ret)
> + return ret;
> +
> + wcss->sleep_clk = devm_clk_get_optional_enabled(&pdev->dev, "sleep");
> + if (IS_ERR(wcss->sleep_clk))
> + return dev_err_probe(&pdev->dev, PTR_ERR(wcss->sleep_clk),
> + "Failed to get sleep clock\n");
> +
> + ret = qcom_q6v5_init(&wcss->q6, pdev, rproc,
> + WCSS_CRASH_REASON, NULL, NULL);
> + if (ret)
> + return ret;
> +
> + qcom_add_glink_subdev(rproc, &wcss->glink_subdev, "q6wcss");
> + qcom_add_ssr_subdev(rproc, &wcss->ssr_subdev, pdev->name);
> +
> + rproc->auto_boot = desc->auto_boot;
> + rproc->dump_conf = RPROC_COREDUMP_INLINE;
> + rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE);
> +
> + ret = devm_rproc_add(&pdev->dev, rproc);
In the event of auto_boot, I believe it should be possible to enter
wcss_sec_load() et al from this point onwards. So, it seems reasonable
to acquire mbox_chan prior to registering the remoteproc.
> + if (ret)
> + return ret;
> +
> + platform_set_drvdata(pdev, rproc);
> +
> + wcss->mbox_client.dev = wcss->dev;
> + wcss->mbox_client.knows_txdone = true;
> + wcss->mbox_client.tx_block = true;
> + wcss->mbox_chan = mbox_request_channel(&wcss->mbox_client, 0);
"mboxes" is optional in binding, but seems to be required here, but then
mbox_chan is only accessed when tmelcom is true.
Should mbox_request_channel() be made conditional on tmelcom?
> + if (IS_ERR(wcss->mbox_chan)) {
> + dev_err(wcss->dev, "mbox chan for IPC is missing\n");
> + return PTR_ERR(wcss->mbox_chan);
> + }
> +
> + return 0;
qcom_q6v5_pas.c was recently updated to clean up various things on
error, please do the same here.
> +}
> +
> +static void wcss_sec_remove(struct platform_device *pdev)
> +{
> + struct rproc *rproc = platform_get_drvdata(pdev);
> + struct wcss_sec *wcss = rproc->priv;
> +
> + qcom_q6v5_deinit(&wcss->q6);
> + qcom_remove_glink_subdev(rproc, &wcss->glink_subdev);
> + qcom_remove_ssr_subdev(rproc, &wcss->ssr_subdev);
mbox_chan?
> +}
> +
> +static const struct wcss_data wcss_sec_ipq5332_res_init = {
> + .pasid = MPD_WCSS_PAS_ID,
> + .auto_boot = true,
> + .ops = &wcss_sec_ops,
Please avoid unnecessary flexibility (i.e. ops is always wcss_sec_ops).
> + .tmelcom = false,
> +};
> +
> +static const struct wcss_data wcss_sec_ipq9574_res_init = {
> + .pasid = WCSS_PAS_ID,
> + .auto_boot = true,
> + .ops = &wcss_sec_ops,
> + .tmelcom = false,
> +};
> +
> +static const struct wcss_data wcss_sec_ipq5424_res_init = {
> + .pasid = MPD_WCSS_PAS_ID,
> + .auto_boot = true,
> + .ops = &wcss_sec_ops,
> + .tmelcom = true,
> +};
> +
> +static const struct of_device_id wcss_sec_of_match[] = {
> + { .compatible = "qcom,ipq5332-wcss-sec-pil", .data = &wcss_sec_ipq5332_res_init },
> + { .compatible = "qcom,ipq9574-wcss-sec-pil", .data = &wcss_sec_ipq9574_res_init },
> + { .compatible = "qcom,ipq5424-wcss-sec-pil", .data = &wcss_sec_ipq5424_res_init },
Please sort alphabetically.
> + { },
> +};
> +MODULE_DEVICE_TABLE(of, wcss_sec_of_match);
> +
Regards,
Bjorn
> +static struct platform_driver wcss_sec_driver = {
> + .probe = wcss_sec_probe,
> + .remove = wcss_sec_remove,
> + .driver = {
> + .name = "qcom-wcss-secure-pil",
> + .of_match_table = wcss_sec_of_match,
> + },
> +};
> +module_platform_driver(wcss_sec_driver);
> +
> +MODULE_DESCRIPTION("Hexagon WCSS Secure Peripheral Image Loader");
> +MODULE_LICENSE("GPL");
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH V3 1/8] firmware: qcom_scm: ipq5332: add support to pass metadata size
2025-01-07 10:16 ` [PATCH V3 1/8] firmware: qcom_scm: ipq5332: add support to pass metadata size Gokul Sriram Palanisamy
@ 2025-01-08 4:15 ` Bjorn Andersson
0 siblings, 0 replies; 28+ messages in thread
From: Bjorn Andersson @ 2025-01-08 4:15 UTC (permalink / raw)
To: Gokul Sriram Palanisamy
Cc: jassisinghbrar, robh, krzk+dt, conor+dt, mathieu.poirier,
konradybcio, quic_mmanikan, linux-arm-msm, linux-kernel,
devicetree, linux-remoteproc, dmitry.baryshkov, quic_viswanat,
quic_srichara
On Tue, Jan 07, 2025 at 03:46:40PM +0530, Gokul Sriram Palanisamy wrote:
> From: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
>
> IPQ5332 security software running under trustzone requires metadata size.
> With new command support added in TrustZone that includes a size parameter,
> pass metadata size as well. This new command is specific to IPQ5332 SoC.
But function 0x1a is reserved by TZ owners across the company, right?
>
> Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
> Signed-off-by: Gokul Sriram Palanisamy <quic_gokulsri@quicinc.com>
> ---
> drivers/firmware/qcom/qcom_scm.c | 13 +++++++++++--
> drivers/firmware/qcom/qcom_scm.h | 1 +
> 2 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c
> index 72bf87ddcd96..a713788926b0 100644
> --- a/drivers/firmware/qcom/qcom_scm.c
> +++ b/drivers/firmware/qcom/qcom_scm.c
> @@ -580,8 +580,6 @@ int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size,
> int ret;
> struct qcom_scm_desc desc = {
> .svc = QCOM_SCM_SVC_PIL,
> - .cmd = QCOM_SCM_PIL_PAS_INIT_IMAGE,
> - .arginfo = QCOM_SCM_ARGS(2, QCOM_SCM_VAL, QCOM_SCM_RW),
> .args[0] = peripheral,
The arginfo and args are tightly coupled, so I'd prefer if you move
assignment of args[0] with the assignment below (and yes duplicate it).
> .owner = ARM_SMCCC_OWNER_SIP,
> };
> @@ -616,6 +614,17 @@ int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size,
>
> desc.args[1] = mdata_phys;
I find this rather ugly as well, so please move (and duplicate this) as
well - so we get it all gathered in one (two) place(s).
>
> + if (__qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_PIL,
> + QCOM_SCM_PAS_INIT_IMAGE_V2)) {
> + desc.cmd = QCOM_SCM_PAS_INIT_IMAGE_V2;
> + desc.arginfo =
> + QCOM_SCM_ARGS(3, QCOM_SCM_VAL, QCOM_SCM_RW, QCOM_SCM_VAL);
Better leave this line unbroken.
Thanks,
Bjorn
> + desc.args[2] = size;
> + } else {
> + desc.cmd = QCOM_SCM_PIL_PAS_INIT_IMAGE;
> + desc.arginfo = QCOM_SCM_ARGS(2, QCOM_SCM_VAL, QCOM_SCM_RW);
> + }
> +
> ret = qcom_scm_call(__scm->dev, &desc, &res);
> qcom_scm_bw_disable();
>
> diff --git a/drivers/firmware/qcom/qcom_scm.h b/drivers/firmware/qcom/qcom_scm.h
> index e36b2f67607f..9aad9f92517f 100644
> --- a/drivers/firmware/qcom/qcom_scm.h
> +++ b/drivers/firmware/qcom/qcom_scm.h
> @@ -96,6 +96,7 @@ struct qcom_tzmem_pool *qcom_scm_get_tzmem_pool(void);
>
> #define QCOM_SCM_SVC_PIL 0x02
> #define QCOM_SCM_PIL_PAS_INIT_IMAGE 0x01
> +#define QCOM_SCM_PAS_INIT_IMAGE_V2 0x1a
> #define QCOM_SCM_PIL_PAS_MEM_SETUP 0x02
> #define QCOM_SCM_PIL_PAS_AUTH_AND_RESET 0x05
> #define QCOM_SCM_PIL_PAS_SHUTDOWN 0x06
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH V3 4/8] remoteproc: qcom: add hexagon based WCSS secure PIL driver
2025-01-08 4:09 ` Bjorn Andersson
@ 2025-01-08 6:29 ` Sricharan Ramabadhran
2025-01-08 6:42 ` Sricharan Ramabadhran
2025-01-09 12:18 ` Gokul Sriram Palanisamy
1 sibling, 1 reply; 28+ messages in thread
From: Sricharan Ramabadhran @ 2025-01-08 6:29 UTC (permalink / raw)
To: Bjorn Andersson, Gokul Sriram Palanisamy
Cc: jassisinghbrar, robh, krzk+dt, conor+dt, mathieu.poirier,
konradybcio, quic_mmanikan, linux-arm-msm, linux-kernel,
devicetree, linux-remoteproc, dmitry.baryshkov, quic_viswanat
[..]
>> +#include <linux/firmware/qcom/qcom_scm.h>
>> +#include <linux/interrupt.h>
>> +#include <linux/io.h>
>> +#include <linux/iopoll.h>
>> +#include <linux/kernel.h>
>> +#include <linux/module.h>
>> +#include <linux/of_address.h>
>> +#include <linux/of_device.h>
>> +#include <linux/of_reserved_mem.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/reset.h>
>> +#include <linux/soc/qcom/mdt_loader.h>
>> +#include <linux/soc/qcom/smem.h>
>> +#include <linux/soc/qcom/smem_state.h>
>> +#include <linux/mailbox_client.h>
>> +#include <linux/mailbox/tmelcom-qmp.h>
>
> This will require mailbox maintainer to first accept the tmelcom mailbox
> driver, and share a immutable branch with me (or we have to wait until
> this include file trickles in).
>
> Please ensure that mailbox maintainer is aware of this request.
Hi Bjorn,
The plan is, in the next spin of TMEL[V3], tmel driver will take care
of routing the request to either SCM(or)TMEL, so that client drivers
like rproc/crypto etc which requires those secure services can be
abstract (ie) just do a mbox_send_message with a SCM cmd id. That way
for adding any future secure services in client drivers, nothing
extra needs to be done and this will avoid this header dependency
as well. Is that approach fine ?
Regards,
Sricharan
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH V3 4/8] remoteproc: qcom: add hexagon based WCSS secure PIL driver
2025-01-08 6:29 ` Sricharan Ramabadhran
@ 2025-01-08 6:42 ` Sricharan Ramabadhran
0 siblings, 0 replies; 28+ messages in thread
From: Sricharan Ramabadhran @ 2025-01-08 6:42 UTC (permalink / raw)
To: Bjorn Andersson, Gokul Sriram Palanisamy
Cc: jassisinghbrar, robh, krzk+dt, conor+dt, mathieu.poirier,
konradybcio, quic_mmanikan, linux-arm-msm, linux-kernel,
devicetree, linux-remoteproc, dmitry.baryshkov, quic_viswanat
On 1/8/2025 11:59 AM, Sricharan Ramabadhran wrote:
> [..]
>
>>> +#include <linux/firmware/qcom/qcom_scm.h>
>>> +#include <linux/interrupt.h>
>>> +#include <linux/io.h>
>>> +#include <linux/iopoll.h>
>>> +#include <linux/kernel.h>
>>> +#include <linux/module.h>
>>> +#include <linux/of_address.h>
>>> +#include <linux/of_device.h>
>>> +#include <linux/of_reserved_mem.h>
>>> +#include <linux/platform_device.h>
>>> +#include <linux/reset.h>
>>> +#include <linux/soc/qcom/mdt_loader.h>
>>> +#include <linux/soc/qcom/smem.h>
>>> +#include <linux/soc/qcom/smem_state.h>
>>> +#include <linux/mailbox_client.h>
>>> +#include <linux/mailbox/tmelcom-qmp.h>
>>
>> This will require mailbox maintainer to first accept the tmelcom mailbox
>> driver, and share a immutable branch with me (or we have to wait until
>> this include file trickles in).
>>
>> Please ensure that mailbox maintainer is aware of this request.
>
> Hi Bjorn,
> The plan is, in the next spin of TMEL[V3], tmel driver will take care
> of routing the request to either SCM(or)TMEL, so that client drivers
> like rproc/crypto etc which requires those secure services can be
> abstract (ie) just do a mbox_send_message with a SCM cmd id. That way
> for adding any future secure services in client drivers, nothing
> extra needs to be done and this will avoid this header dependency
> as well. Is that approach fine ?
Ok, with more thought, i guess this approach will not work. Will stick
to what you are suggesting, just use mbox->chan available in client
itself to take the decision.
Regards,
Sricharan
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH V3 2/8] dt-bindings: remoteproc: qcom: document hexagon based WCSS secure PIL
[not found] ` <f0eef19b-8497-4e7d-bed1-882cdb8c1ab1@quicinc.com>
@ 2025-01-08 7:34 ` Krzysztof Kozlowski
2025-01-08 11:19 ` Gokul Sriram P (QUIC)
0 siblings, 1 reply; 28+ messages in thread
From: Krzysztof Kozlowski @ 2025-01-08 7:34 UTC (permalink / raw)
To: Gokul Sriram P, Dmitry Baryshkov
Cc: jassisinghbrar, robh, krzk+dt, conor+dt, andersson,
mathieu.poirier, konradybcio, quic_mmanikan, linux-arm-msm,
linux-kernel, devicetree, linux-remoteproc, quic_viswanat,
quic_srichara
On 07/01/2025 13:56, Gokul Sriram P wrote:
>>> +examples:
>>> + - |
>>> + #include <dt-bindings/interrupt-controller/arm-gic.h>
>>> + #include <dt-bindings/clock/qcom,ipq5332-gcc.h>
>>> + remoteproc@d100000 {
>>> + compatible = "qcom,ipq5332-wcss-sec-pil";
>>> + reg = <0xd100000 0x4040>;
>>> + firmware-name = "ath12k/IPQ5332/hw1.0/q6_fw0.mdt";
>> Nit: .mbn
>>
>
> Hi Dmitry,
>
> Its .mdt format only in our case.
>
Then probably you need to fix your format.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH V3 3/8] dt-bindings: mailbox: qcom: Add IPQ5424 APCS compatible
2025-01-07 10:16 ` [PATCH V3 3/8] dt-bindings: mailbox: qcom: Add IPQ5424 APCS compatible Gokul Sriram Palanisamy
@ 2025-01-08 8:32 ` Krzysztof Kozlowski
0 siblings, 0 replies; 28+ messages in thread
From: Krzysztof Kozlowski @ 2025-01-08 8:32 UTC (permalink / raw)
To: Gokul Sriram Palanisamy
Cc: jassisinghbrar, robh, krzk+dt, conor+dt, andersson,
mathieu.poirier, konradybcio, quic_mmanikan, linux-arm-msm,
linux-kernel, devicetree, linux-remoteproc, dmitry.baryshkov,
quic_viswanat, quic_srichara
On Tue, Jan 07, 2025 at 03:46:42PM +0530, Gokul Sriram Palanisamy wrote:
> Add compatible for the Qualcomm IPQ5424 APCS block.
>
> Signed-off-by: Gokul Sriram Palanisamy <quic_gokulsri@quicinc.com>
> ---
> .../devicetree/bindings/mailbox/qcom,apcs-kpss-global.yaml | 1 +
> 1 file changed, 1 insertion(+)
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH V3 2/8] dt-bindings: remoteproc: qcom: document hexagon based WCSS secure PIL
[not found] ` <3e64b792-bfca-4b07-a13e-6deb966f3d4f@quicinc.com>
@ 2025-01-08 10:54 ` Dmitry Baryshkov
2025-01-08 12:44 ` Gokul Sriram P (QUIC)
0 siblings, 1 reply; 28+ messages in thread
From: Dmitry Baryshkov @ 2025-01-08 10:54 UTC (permalink / raw)
To: Gokul Sriram P
Cc: jassisinghbrar, robh, krzk+dt, conor+dt, andersson,
mathieu.poirier, konradybcio, quic_mmanikan, linux-arm-msm,
linux-kernel, devicetree, linux-remoteproc, quic_viswanat,
quic_srichara
On Tue, 7 Jan 2025 at 14:52, Gokul Sriram P <quic_gokulsri@quicinc.com> wrote:
>
> +examples:
> + - |
> + #include <dt-bindings/interrupt-controller/arm-gic.h>
> + #include <dt-bindings/clock/qcom,ipq5332-gcc.h>
> + remoteproc@d100000 {
> + compatible = "qcom,ipq5332-wcss-sec-pil";
> + reg = <0xd100000 0x4040>;
> + firmware-name = "ath12k/IPQ5332/hw1.0/q6_fw0.mdt";
>
> Nit: .mbn
>
> Hi Dmitry,
Please fix your email client to never ever send HTML emails if you are
participating in discussions on the public mailing lists. For example,
quotation level is incorrect.
> Its .mdt format only in our case.
NAK, please work with Kalle to pil-squash the remoteproc firmware.
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 28+ messages in thread
* RE: [PATCH V3 2/8] dt-bindings: remoteproc: qcom: document hexagon based WCSS secure PIL
2025-01-08 7:34 ` Krzysztof Kozlowski
@ 2025-01-08 11:19 ` Gokul Sriram P (QUIC)
2025-01-08 11:51 ` Krzysztof Kozlowski
0 siblings, 1 reply; 28+ messages in thread
From: Gokul Sriram P (QUIC) @ 2025-01-08 11:19 UTC (permalink / raw)
To: Krzysztof Kozlowski, dmitry.baryshkov@linaro.org
Cc: jassisinghbrar@gmail.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, andersson@kernel.org,
mathieu.poirier@linaro.org, konradybcio@kernel.org,
Manikanta Mylavarapu (QUIC), linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-remoteproc@vger.kernel.org, Vignesh Viswanathan (QUIC),
Sricharan Ramabadhran (QUIC)
On 07/01/2025 13:56, Gokul Sriram P wrote:
>>>> +examples:
>>>> + - |
>>>> + #include <dt-bindings/interrupt-controller/arm-gic.h>
>>>> + #include <dt-bindings/clock/qcom,ipq5332-gcc.h>
>>>> + remoteproc@d100000 {
>>>> + compatible = "qcom,ipq5332-wcss-sec-pil";
>>>> + reg = <0xd100000 0x4040>;
>>>> + firmware-name = "ath12k/IPQ5332/hw1.0/q6_fw0.mdt";
>>> Nit: .mbn
>>>
>>
>> Hi Dmitry,
>>
>> Its .mdt format only in our case.
>>
> Then probably you need to fix your format.
Hi Dmitry/ Krzysztof,
We use split firmware image where .mbn image is split into x segments with .b00 to .bxx extension. The mbn header along with signing metadata will be part of the .mdt. The secure authenticatior (TrustZone) will expect metadata as part of .mdt and will authenticate the .bxx segments.
Certain msm platforms already support .mdt format as in https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/remoteproc/qcom,sm6115-pas.yaml?h=v6.13-rc6.
Regards,
Gokul
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH V3 2/8] dt-bindings: remoteproc: qcom: document hexagon based WCSS secure PIL
2025-01-08 11:19 ` Gokul Sriram P (QUIC)
@ 2025-01-08 11:51 ` Krzysztof Kozlowski
0 siblings, 0 replies; 28+ messages in thread
From: Krzysztof Kozlowski @ 2025-01-08 11:51 UTC (permalink / raw)
To: Gokul Sriram P (QUIC), dmitry.baryshkov@linaro.org
Cc: jassisinghbrar@gmail.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, andersson@kernel.org,
mathieu.poirier@linaro.org, konradybcio@kernel.org,
Manikanta Mylavarapu (QUIC), linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-remoteproc@vger.kernel.org, Vignesh Viswanathan (QUIC),
Sricharan Ramabadhran (QUIC)
On 08/01/2025 12:19, Gokul Sriram P (QUIC) wrote:
> On 07/01/2025 13:56, Gokul Sriram P wrote:
>>>>> +examples:
>>>>> + - |
>>>>> + #include <dt-bindings/interrupt-controller/arm-gic.h>
>>>>> + #include <dt-bindings/clock/qcom,ipq5332-gcc.h>
>>>>> + remoteproc@d100000 {
>>>>> + compatible = "qcom,ipq5332-wcss-sec-pil";
>>>>> + reg = <0xd100000 0x4040>;
>>>>> + firmware-name = "ath12k/IPQ5332/hw1.0/q6_fw0.mdt";
>>>> Nit: .mbn
>>>>
>>>
>>> Hi Dmitry,
>>>
>>> Its .mdt format only in our case.
>>>
>> Then probably you need to fix your format.
>
> Hi Dmitry/ Krzysztof,
> We use split firmware image where .mbn image is split into x segments with .b00 to .bxx extension. The mbn header along with signing metadata will be part of the .mdt. The secure authenticatior (TrustZone) will expect metadata as part of .mdt and will authenticate the .bxx segments.
NAK, you got feedback which you refuse to implement.
>
> Certain msm platforms already support .mdt format as in https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/remoteproc/qcom,sm6115-pas.yaml?h=v6.13-rc6.
That's an overlook, not support. Don't use arguments "someone sneaked
it, so I can as well".
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 28+ messages in thread
* RE: [PATCH V3 2/8] dt-bindings: remoteproc: qcom: document hexagon based WCSS secure PIL
2025-01-08 10:54 ` Dmitry Baryshkov
@ 2025-01-08 12:44 ` Gokul Sriram P (QUIC)
0 siblings, 0 replies; 28+ messages in thread
From: Gokul Sriram P (QUIC) @ 2025-01-08 12:44 UTC (permalink / raw)
To: dmitry.baryshkov@linaro.org
Cc: jassisinghbrar@gmail.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, andersson@kernel.org,
mathieu.poirier@linaro.org, konradybcio@kernel.org,
Manikanta Mylavarapu (QUIC), linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-remoteproc@vger.kernel.org, Vignesh Viswanathan (QUIC),
Sricharan Ramabadhran (QUIC)
>>
>> +examples:
>> + - |
>> + #include <dt-bindings/interrupt-controller/arm-gic.h>
>> + #include <dt-bindings/clock/qcom,ipq5332-gcc.h>
>> + remoteproc@d100000 {
>> + compatible = "qcom,ipq5332-wcss-sec-pil";
>> + reg = <0xd100000 0x4040>;
>> + firmware-name = "ath12k/IPQ5332/hw1.0/q6_fw0.mdt";
>>
>> Nit: .mbn
>>
>> Hi Dmitry,
>
> Please fix your email client to never ever send HTML emails if you are participating in discussions on the public mailing lists. For example, quotation level is incorrect.
>
>> Its .mdt format only in our case.
>
> NAK, please work with Kalle to pil-squash the remoteproc firmware.
Sure Dmitry. Will check and address.
Regards,
Gokul
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH V3 4/8] remoteproc: qcom: add hexagon based WCSS secure PIL driver
2025-01-08 4:09 ` Bjorn Andersson
2025-01-08 6:29 ` Sricharan Ramabadhran
@ 2025-01-09 12:18 ` Gokul Sriram Palanisamy
2025-01-11 13:46 ` Kathiravan Thirumoorthy
1 sibling, 1 reply; 28+ messages in thread
From: Gokul Sriram Palanisamy @ 2025-01-09 12:18 UTC (permalink / raw)
To: Bjorn Andersson
Cc: jassisinghbrar@gmail.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, mathieu.poirier@linaro.org,
konradybcio@kernel.org, Manikanta Mylavarapu (QUIC),
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org,
dmitry.baryshkov@linaro.org, Vignesh Viswanathan (QUIC),
Sricharan Ramabadhran (QUIC)
On 1/8/2025 9:39 AM, Bjorn Andersson wrote:
> On Tue, Jan 07, 2025 at 03:46:43PM +0530, Gokul Sriram Palanisamy wrote:
>> From: Vignesh Viswanathan <quic_viswanat@quicinc.com>
>>
>> Add support to bring up hexagon based WCSS secure PIL remoteproc.
>> IPQ5332, IPQ9574 supports secure PIL remoteproc.
>
> I'd love for this to be extended with a short description of what the
> WCSS secure subsystem is, the reason for a new drivers etc. Following
> the style of
> https://docs.kernel.org/process/submitting-patches.html#describe-your-changes
>
Sure. Bjorn. Will add it here.
>>
>> Signed-off-by: Vignesh Viswanathan <quic_viswanat@quicinc.com>
>> Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
>> Signed-off-by: Gokul Sriram Palanisamy <quic_gokulsri@quicinc.com>
>> ---
>> drivers/remoteproc/Kconfig | 22 ++
>> drivers/remoteproc/Makefile | 1 +
>> drivers/remoteproc/qcom_q6v5_wcss_sec.c | 406 ++++++++++++++++++++++++
>> 3 files changed, 429 insertions(+)
>> create mode 100644 drivers/remoteproc/qcom_q6v5_wcss_sec.c
>>
>> diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
>> index 83962a114dc9..c4e94b15c538 100644
>> --- a/drivers/remoteproc/Kconfig
>> +++ b/drivers/remoteproc/Kconfig
>> @@ -255,6 +255,28 @@ config QCOM_Q6V5_WCSS
>> Hexagon V5 based WCSS remote processors on e.g. IPQ8074. This is
>> a non-TrustZone wireless subsystem.
>>
>> +config QCOM_Q6V5_WCSS_SEC
>> + tristate "Qualcomm Hexagon based WCSS Secure Peripheral Image Loader"
>> + depends on OF && ARCH_QCOM
>> + depends on QCOM_SMEM
>> + depends on RPMSG_QCOM_SMD || RPMSG_QCOM_SMD=n
>> + depends on RPMSG_QCOM_GLINK_SMEM || RPMSG_QCOM_GLINK_SMEM=n
>> + depends on QCOM_SYSMON || QCOM_SYSMON=n
>> + depends on RPMSG_QCOM_GLINK || RPMSG_QCOM_GLINK=n
>> + depends on QCOM_AOSS_QMP || QCOM_AOSS_QMP=n
>
> Please review these depends, did you inherit a few too many?
sure. Will address.
>
>> + select QCOM_MDT_LOADER
>> + select QCOM_PIL_INFO
>> + select QCOM_Q6V5_COMMON
>> + select QCOM_RPROC_COMMON
>> + select QCOM_SCM
>> + help
>> + Say y here to support the Qualcomm Secure Peripheral Image Loader
>> + for the Hexagon based remote processors on e.g. IPQ5332.
>> +
>> + This is TrustZone wireless subsystem. The firmware is
>> + verified and booted with the help of the Peripheral Authentication
>> + System (PAS) in TrustZone.
>> +
>> config QCOM_SYSMON
>> tristate "Qualcomm sysmon driver"
>> depends on RPMSG
>> diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile
>> index 5ff4e2fee4ab..d4971b672812 100644
>> --- a/drivers/remoteproc/Makefile
>> +++ b/drivers/remoteproc/Makefile
>> @@ -28,6 +28,7 @@ obj-$(CONFIG_QCOM_Q6V5_ADSP) += qcom_q6v5_adsp.o
>> obj-$(CONFIG_QCOM_Q6V5_MSS) += qcom_q6v5_mss.o
>> obj-$(CONFIG_QCOM_Q6V5_PAS) += qcom_q6v5_pas.o
>> obj-$(CONFIG_QCOM_Q6V5_WCSS) += qcom_q6v5_wcss.o
>> +obj-$(CONFIG_QCOM_Q6V5_WCSS_SEC) += qcom_q6v5_wcss_sec.o
>> obj-$(CONFIG_QCOM_SYSMON) += qcom_sysmon.o
>> obj-$(CONFIG_QCOM_WCNSS_PIL) += qcom_wcnss_pil.o
>> qcom_wcnss_pil-y += qcom_wcnss.o
>> diff --git a/drivers/remoteproc/qcom_q6v5_wcss_sec.c b/drivers/remoteproc/qcom_q6v5_wcss_sec.c
>> new file mode 100644
>> index 000000000000..ef4e893e37c7
>> --- /dev/null
>> +++ b/drivers/remoteproc/qcom_q6v5_wcss_sec.c
>> @@ -0,0 +1,406 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * Copyright (C) 2016-2018 Linaro Ltd.
>> + * Copyright (C) 2014 Sony Mobile Communications AB
>> + * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
>> + * Copyright (c) 2024-2025 Qualcomm Innovation Center, Inc. All rights reserved.
>> + */
>> +#include <linux/clk.h>
>> +#include <linux/delay.h>
>
> Please check that all these includes are required.
>
sure. will address.
>> +#include <linux/firmware/qcom/qcom_scm.h>
>> +#include <linux/interrupt.h>
>> +#include <linux/io.h>
>> +#include <linux/iopoll.h>
>> +#include <linux/kernel.h>
>> +#include <linux/module.h>
>> +#include <linux/of_address.h>
>> +#include <linux/of_device.h>
>> +#include <linux/of_reserved_mem.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/reset.h>
>> +#include <linux/soc/qcom/mdt_loader.h>
>> +#include <linux/soc/qcom/smem.h>
>> +#include <linux/soc/qcom/smem_state.h>
>> +#include <linux/mailbox_client.h>
>> +#include <linux/mailbox/tmelcom-qmp.h>
>
> This will require mailbox maintainer to first accept the tmelcom mailbox
> driver, and share a immutable branch with me (or we have to wait until
> this include file trickles in).
>
> Please ensure that mailbox maintainer is aware of this request.
>
understood.
>> +#include "qcom_common.h"
>> +#include "qcom_q6v5.h"
>> +
sure.
>> +#include "qcom_pil_info.h"
>> +#include "remoteproc_internal.h"
>> +
>> +#define WCSS_CRASH_REASON 421
>> +
>> +#define WCSS_PAS_ID 0x6
>> +#define MPD_WCSS_PAS_ID 0xD
>
> I like lowercase hex digits.
>
>> +
>> +struct wcss_sec {
>> + struct device *dev;
>> + struct qcom_rproc_glink glink_subdev;
>> + struct qcom_rproc_ssr ssr_subdev;
>> + struct qcom_q6v5 q6;
>> + phys_addr_t mem_phys;
>> + phys_addr_t mem_reloc;
>> + void *mem_region;
>> + size_t mem_size;
>> + const struct wcss_data *desc;
>
> Assigned but never used.
>
>> + const char *fw_name;
>
> Assigned but never used.
>
>> +
>> + struct clk *sleep_clk;
>
> Assigned but never used.
>
will remove. Thanks
>> +
>> + struct mbox_client mbox_client;
>> + struct mbox_chan *mbox_chan;
>> + void *metadata;
>> + size_t metadata_len;
>> +};
>> +
>> +struct wcss_data {
>> + u32 pasid;
>> + const struct rproc_ops *ops;
>> + bool auto_boot;
>> + bool tmelcom;
>> +};
>> +
>> +static int wcss_sec_start(struct rproc *rproc)
>> +{
>> + struct wcss_sec *wcss = rproc->priv;
>> + struct device *dev = wcss->dev;
>> + const struct wcss_data *desc = of_device_get_match_data(dev);
>
> Please avoid "parsing" DT in runtime.
I didn't underatand this.
>
>> + struct tmel_sec_auth tsa;
>> + struct tmel_qmp_msg tqm;
>> + int ret;
>> +
>> + qcom_q6v5_prepare(&wcss->q6);
>
> It would be sensible to check the return value here.
>
sure. Will address.
>> +
>> + tsa.data = wcss->metadata;
>
> This looks broken.
>
> wcss->metadata is assigned in wcss_sec_load() only if tmelcom, and in
> that code path wcss_sec_load() invokes kfree() on the pointer.
>
> So, as far as I can tell, you're either going to pass NULL here or a
> pointer to a freed (and perhaps overwritten) buffer.
>
got it. will fix.
>> + tsa.size = wcss->metadata_len;
>> + tsa.pas_id = desc->pasid;
>> + tqm.msg = &tsa;
>> + tqm.msg_id = TMEL_MSG_UID_SECBOOT_SEC_AUTH;
>> +
>> + if (desc->tmelcom) {
>
> As I point out below, mbox_chan should probably only be assigned when
> desc->tmelcom == true, so you wouldn't even need any additional state,
> just check if mbox_chan is valid here.
>
>> + mbox_send_message(wcss->mbox_chan, (void *)&tqm);
>
> This does return errors as well, perhaps worth checking that as well?
>
>> + } else {
>> + ret = qcom_scm_pas_auth_and_reset(desc->pasid);
>
> Please confirm that you're not required to keep the metadata buffer
> passed to PAS init_image during qcom_mdt_load() alive until this point -
> as is required by all modern SDMs.
>
will address.
>> + if (ret) {
>> + dev_err(dev, "wcss_reset failed\n");
>> + return ret;
>> + }
>> + }
>> +
>> + ret = qcom_q6v5_wait_for_start(&wcss->q6, 5 * HZ);
>> + if (ret == -ETIMEDOUT)
>> + dev_err(dev, "start timed out\n");
>
> Don't you need to qcom_scm_pas_shutdown() here to have QHEEBSP release
> the memory back to you?
>
yes. Will need. Will fix.
>> +
>> + return ret;
>> +}
>> +
>> +static int wcss_sec_stop(struct rproc *rproc)
>> +{
>> + struct wcss_sec *wcss = rproc->priv;
>> + struct device *dev = wcss->dev;
>> + const struct wcss_data *desc = of_device_get_match_data(dev);
>> + struct tmel_sec_auth tsa;
>> + struct tmel_qmp_msg tqm;
>> + int ret;
>> +
>> + tsa.pas_id = desc->pasid;
>
> tsa is passing a couple of random values over your mbox. Please
> zero-initialize these.
>
> Why is this filled in outside desc->tmelcom, when that's the only place
> it's used?
>
will address.
>> + tqm.msg = &tsa;
>> + tqm.msg_id = TMEL_MSG_UID_SECBOOT_SS_TEAR_DOWN;
>> +
>> + if (desc->tmelcom) {
>> + mbox_send_message(wcss->mbox_chan, (void *)&tqm);
>> + } else {
>> + ret = qcom_scm_pas_shutdown(desc->pasid);
>> + if (ret) {
>> + dev_err(dev, "not able to shutdown\n");
>> + return ret;
>> + }
>> + }
>> +
>> + qcom_q6v5_unprepare(&wcss->q6);
>> +
>> + return 0;
>> +}
>> +
>> +static void *wcss_sec_da_to_va(struct rproc *rproc, u64 da, size_t len,
>> + bool *is_iomem)
>> +{
>> + struct wcss_sec *wcss = rproc->priv;
>> + int offset;
>> +
>> + offset = da - wcss->mem_reloc;
>> + if (offset < 0 || offset + len > wcss->mem_size)
>> + return NULL;
>> +
>> + return wcss->mem_region + offset;
>> +}
>> +
>> +static int wcss_sec_load(struct rproc *rproc, const struct firmware *fw)
>> +{
>> + struct wcss_sec *wcss = rproc->priv;
>> + struct device *dev = wcss->dev;
>> + const struct wcss_data *desc = of_device_get_match_data(dev);
>> + int ret;
>> +
>> + if (desc->tmelcom) {
>> + wcss->metadata = qcom_mdt_read_metadata(fw, &wcss->metadata_len,
>> + rproc->firmware, wcss->dev);
>> + if (IS_ERR(wcss->metadata)) {
>> + ret = PTR_ERR(wcss->metadata);
>> + dev_err(wcss->dev, "error %d reading firmware %s metadata\n",
>> + ret, rproc->firmware);
>> + return ret;
>> + }
>> +
>> + ret = qcom_mdt_load_no_init(wcss->dev, fw, rproc->firmware, desc->pasid,
>> + wcss->mem_region, wcss->mem_phys, wcss->mem_size,
>> + &wcss->mem_reloc);
>> + kfree(wcss->metadata);
>> + } else {
>> + ret = qcom_mdt_load(dev, fw, rproc->firmware, desc->pasid, wcss->mem_region,
>> + wcss->mem_phys, wcss->mem_size, &wcss->mem_reloc);
>> + }
>> +
>> + if (ret)
>> + return ret;
>> +
>> + qcom_pil_info_store("wcss", wcss->mem_phys, wcss->mem_size);
>> +
>> + return ret;
>
> ret can't be anything but 0 here, so better just write that.
>
right. Will fix.
>> +}
>> +
>> +static unsigned long wcss_sec_panic(struct rproc *rproc)
>> +{
>> + struct wcss_sec *wcss = rproc->priv;
>> +
>> + return qcom_q6v5_panic(&wcss->q6);
>> +}
>> +
>> +static void wcss_sec_copy_segment(struct rproc *rproc,
>> + struct rproc_dump_segment *segment,
>> + void *dest, size_t offset, size_t size)
>> +{
>> + struct wcss_sec *wcss = rproc->priv;
>> + struct device *dev = wcss->dev;
>> + void *ptr;
>> +
>> + ptr = ioremap_wc(segment->da, segment->size);
>> + if (!ptr) {
>> + dev_err(dev, "Failed to ioremap segment %pad size %zx\n",
>
> Make that %#zx to ensure that the base 16 size is prefixed with 0x
>
will do.
>> + &segment->da, segment->size);
>> + return;
>> + }
>> +
>> + if (size <= segment->size - offset)
>
> I'd prefer if the expression in the check and access are on the same
> form. I.e. test offset + size vs segement->size
oh, sure. got it.
>
>> + memcpy(dest, ptr + offset, size);
>> + else
>> + dev_err(dev, "Copy size greater than segment size. Skipping\n");
>> + iounmap(ptr);
>> +}
>> +
>> +static int wcss_sec_dump_segments(struct rproc *rproc,
>> + const struct firmware *fw)
>> +{
>> + struct device *dev = rproc->dev.parent;
>> + struct reserved_mem *rmem = NULL;
>> + struct device_node *node;
>> + int num_segs, index = 0;
>> + int ret;
>> +
>> + /* Parse through additional reserved memory regions for the rproc
>
> Leave first line in multiline comment blank, as the docs says.
>
Got it.
>> + * and add them to the coredump segments
>> + */
>> + num_segs = of_count_phandle_with_args(dev->of_node,
>> + "memory-region", NULL);
>> + while (index < num_segs) {
>
> You're zero-initializing index above, checking index here and explicitly
> increment it at the bottom of the loop. Why isn't this written as a for
> loop?
Right. for loop looks appropriate. Will fix.
>
>> + node = of_parse_phandle(dev->of_node,
>> + "memory-region", index);
>> + if (!node)
>> + return -EINVAL;
>> +
>> + rmem = of_reserved_mem_lookup(node);
>> + of_node_put(node);
>> + if (!rmem) {
>> + dev_err(dev, "unable to acquire memory-region index %d num_segs %d\n",
>> + index, num_segs);
>> + return -EINVAL;
>> + }
>> +
>> + dev_dbg(dev, "Adding segment 0x%pa size 0x%pa",
>> + &rmem->base, &rmem->size);
>> + ret = rproc_coredump_add_custom_segment(rproc,
>> + rmem->base,
>> + rmem->size,
>> + wcss_sec_copy_segment,
>> + NULL);
>> + if (ret)
>> + return ret;
>> +
>> + index++;
>> + }
>> +
>> + return 0;
>> +}
>> +
>> +static const struct rproc_ops wcss_sec_ops = {
>> + .start = wcss_sec_start,
>> + .stop = wcss_sec_stop,
>> + .da_to_va = wcss_sec_da_to_va,
>> + .load = wcss_sec_load,
>> + .get_boot_addr = rproc_elf_get_boot_addr,
>> + .panic = wcss_sec_panic,
>> + .parse_fw = wcss_sec_dump_segments,
>> +};
>> +
>> +static int wcss_sec_alloc_memory_region(struct wcss_sec *wcss)
>> +{
>> + struct reserved_mem *rmem = NULL;
>> + struct device_node *node;
>> + struct device *dev = wcss->dev;
>> +
>> + node = of_parse_phandle(dev->of_node, "memory-region", 0);
>> + if (!node) {
>> + dev_err(dev, "can't find phandle memory-region\n");
>> + return -EINVAL;
>> + }
>> +
>> + rmem = of_reserved_mem_lookup(node);
>> + of_node_put(node);
>> +
>> + if (!rmem) {
>> + dev_err(dev, "unable to acquire memory-region\n");
>> + return -EINVAL;
>> + }
>> +
>> + wcss->mem_phys = rmem->base;
>> + wcss->mem_reloc = rmem->base;
>> + wcss->mem_size = rmem->size;
>> + wcss->mem_region = devm_ioremap_wc(dev, wcss->mem_phys, wcss->mem_size);
>> + if (!wcss->mem_region) {
>> + dev_err(dev, "unable to map memory region: %pa+%pa\n",
>> + &rmem->base, &rmem->size);
>> + return -ENOMEM;
>> + }
>> +
>> + return 0;
>> +}
>> +
>> +static int wcss_sec_probe(struct platform_device *pdev)
>> +{
>> + struct wcss_sec *wcss;
>> + struct rproc *rproc;
>> + const char *fw_name = NULL;
>> + const struct wcss_data *desc = of_device_get_match_data(&pdev->dev);
>> + int ret;
>> +
>> + if (!desc)
>> + return -EINVAL;
>
> It shouldn't be possible to get here with desc == NULL, so let the
> person have an oops with a callstack to aid debugging. (I.e. remove the
> check)
>
ok, will do.
>> +
>> + ret = of_property_read_string(pdev->dev.of_node, "firmware-name",
>> + &fw_name);
>> + if (ret < 0)
>> + return ret;
>> +
>> + rproc = devm_rproc_alloc(&pdev->dev, pdev->name, desc->ops, fw_name,
>> + sizeof(*wcss));
>
> Not sure how your system composition looks like, but please consider
> something like b64b1266d619 ("remoteproc: qcom: pas: Make remoteproc
> name human friendly"), to avoid the human-unfriendly pdev->name. (Only
> if possible)
>
sure. will check.
>> + if (!rproc) {
>> + dev_err(&pdev->dev, "failed to allocate rproc\n");
>> + return -ENOMEM;
>> + }
>> +
>> + wcss = rproc->priv;
>> + wcss->dev = &pdev->dev;
>> + wcss->desc = desc;
>> + wcss->fw_name = fw_name;
>> +
>> + ret = wcss_sec_alloc_memory_region(wcss);
>> + if (ret)
>> + return ret;
>> +
>> + wcss->sleep_clk = devm_clk_get_optional_enabled(&pdev->dev, "sleep");
>> + if (IS_ERR(wcss->sleep_clk))
>> + return dev_err_probe(&pdev->dev, PTR_ERR(wcss->sleep_clk),
>> + "Failed to get sleep clock\n");
>> +
>> + ret = qcom_q6v5_init(&wcss->q6, pdev, rproc,
>> + WCSS_CRASH_REASON, NULL, NULL);
>> + if (ret)
>> + return ret;
>> +
>> + qcom_add_glink_subdev(rproc, &wcss->glink_subdev, "q6wcss");
>> + qcom_add_ssr_subdev(rproc, &wcss->ssr_subdev, pdev->name);
>> +
>> + rproc->auto_boot = desc->auto_boot;
>> + rproc->dump_conf = RPROC_COREDUMP_INLINE;
>> + rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE);
>> +
>> + ret = devm_rproc_add(&pdev->dev, rproc);
>
> In the event of auto_boot, I believe it should be possible to enter
> wcss_sec_load() et al from this point onwards. So, it seems reasonable
> to acquire mbox_chan prior to registering the remoteproc.
>
ok. sure. will move mbox request channel to the beginning of probe.
>> + if (ret)
>> + return ret;
>> +
>> + platform_set_drvdata(pdev, rproc);
>> +
>> + wcss->mbox_client.dev = wcss->dev;
>> + wcss->mbox_client.knows_txdone = true;
>> + wcss->mbox_client.tx_block = true;
>> + wcss->mbox_chan = mbox_request_channel(&wcss->mbox_client, 0);
>
> "mboxes" is optional in binding, but seems to be required here, but then
> mbox_chan is only accessed when tmelcom is true.
>
> Should mbox_request_channel() be made conditional on tmelcom?
Yeah, infact, as you suggested in the beginning, will make tmelcom
based on mbox chan availability. So that way, if mbox chan registered,
then client uses mbox_send else scm_send. So will remove the below
return on error for mbox_chan since its optional.
>
>> + if (IS_ERR(wcss->mbox_chan)) {
>> + dev_err(wcss->dev, "mbox chan for IPC is missing\n");
>> + return PTR_ERR(wcss->mbox_chan);
>> + }
>> +
>> + return 0;
>
> qcom_q6v5_pas.c was recently updated to clean up various things on
> error, please do the same here.
>
ok, will do.
>> +}
>> +
>> +static void wcss_sec_remove(struct platform_device *pdev)
>> +{
>> + struct rproc *rproc = platform_get_drvdata(pdev);
>> + struct wcss_sec *wcss = rproc->priv;
>> +
>> + qcom_q6v5_deinit(&wcss->q6);
>> + qcom_remove_glink_subdev(rproc, &wcss->glink_subdev);
>> + qcom_remove_ssr_subdev(rproc, &wcss->ssr_subdev);
>
> mbox_chan?
>
yes, will add.
>> +}
>> +
>> +static const struct wcss_data wcss_sec_ipq5332_res_init = {
>> + .pasid = MPD_WCSS_PAS_ID,
>> + .auto_boot = true,
>> + .ops = &wcss_sec_ops,
>
> Please avoid unnecessary flexibility (i.e. ops is always wcss_sec_ops).
>
>> + .tmelcom = false,
>> +};
>> +
>> +static const struct wcss_data wcss_sec_ipq9574_res_init = {
>> + .pasid = WCSS_PAS_ID,
>> + .auto_boot = true,
>> + .ops = &wcss_sec_ops,
>> + .tmelcom = false,
>> +};
>> +
>> +static const struct wcss_data wcss_sec_ipq5424_res_init = {
>> + .pasid = MPD_WCSS_PAS_ID,
>> + .auto_boot = true,
>> + .ops = &wcss_sec_ops,
>> + .tmelcom = true,
>> +};
>> +
>> +static const struct of_device_id wcss_sec_of_match[] = {
>> + { .compatible = "qcom,ipq5332-wcss-sec-pil", .data = &wcss_sec_ipq5332_res_init },
>> + { .compatible = "qcom,ipq9574-wcss-sec-pil", .data = &wcss_sec_ipq9574_res_init },
>> + { .compatible = "qcom,ipq5424-wcss-sec-pil", .data = &wcss_sec_ipq5424_res_init },
>
> Please sort alphabetically.
>
ok, will do.
Thanks,
Gokul
>> + { },
>> +};
>> +MODULE_DEVICE_TABLE(of, wcss_sec_of_match);
>> +
>
> Regards,
> Bjorn
>
>> +static struct platform_driver wcss_sec_driver = {
>> + .probe = wcss_sec_probe,
>> + .remove = wcss_sec_remove,
>> + .driver = {
>> + .name = "qcom-wcss-secure-pil",
>> + .of_match_table = wcss_sec_of_match,
>> + },
>> +};
>> +module_platform_driver(wcss_sec_driver);
>> +
>> +MODULE_DESCRIPTION("Hexagon WCSS Secure Peripheral Image Loader");
>> +MODULE_LICENSE("GPL");
>> --
>> 2.34.1
>>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH V3 6/8] arm64: dts: qcom: ipq5332: add nodes to bringup q6
2025-01-07 10:16 ` [PATCH V3 6/8] arm64: dts: qcom: ipq5332: add nodes to bringup q6 Gokul Sriram Palanisamy
2025-01-07 12:24 ` Dmitry Baryshkov
@ 2025-01-09 13:11 ` Konrad Dybcio
1 sibling, 0 replies; 28+ messages in thread
From: Konrad Dybcio @ 2025-01-09 13:11 UTC (permalink / raw)
To: Gokul Sriram Palanisamy, jassisinghbrar, robh, krzk+dt, conor+dt,
andersson, mathieu.poirier, konradybcio, quic_mmanikan,
linux-arm-msm, linux-kernel, devicetree, linux-remoteproc,
dmitry.baryshkov
Cc: quic_viswanat, quic_srichara
On 7.01.2025 11:16 AM, Gokul Sriram Palanisamy wrote:
> From: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
>
> Enable nodes required for q6 remoteproc bring up.
>
> Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
> Signed-off-by: Gokul Sriram Palanisamy <quic_gokulsri@quicinc.com>
> ---
[...]
> + q6v5_wcss: remoteproc@d100000 {
> + compatible = "qcom,ipq5332-wcss-sec-pil";
> + reg = <0xd100000 0x4040>;
Please pad the address part to 8 hex digits with leading zeroes
> + firmware-name = "ath12k/IPQ5332/hw1.0/q6_fw0.mdt";
> + interrupts-extended = <&intc GIC_SPI 421 IRQ_TYPE_EDGE_RISING>,
> + <&wcss_smp2p_in 0 IRQ_TYPE_NONE>,
> + <&wcss_smp2p_in 1 IRQ_TYPE_NONE>,
> + <&wcss_smp2p_in 2 IRQ_TYPE_NONE>,
> + <&wcss_smp2p_in 3 IRQ_TYPE_NONE>;
> + interrupt-names = "wdog",
> + "fatal",
> + "ready",
> + "handover",
> + "stop-ack";
> +
> + clocks = <&gcc GCC_IM_SLEEP_CLK>;
> + clock-names = "sleep";
> +
> + qcom,smem-states = <&wcss_smp2p_out 1>,
> + <&wcss_smp2p_out 0>;
> + qcom,smem-state-names = "stop",
> + "shutdown";
> +
> + memory-region = <&q6_region>;
> +
> + glink-edge {
> + interrupts = <GIC_SPI 417 IRQ_TYPE_EDGE_RISING>;
> + label = "rtr";
> + qcom,remote-pid = <1>;
> + mboxes = <&apcs_glb 8>;
> + };
> + };
> };
>
> timer {
> @@ -488,4 +526,28 @@ timer {
> <GIC_PPI 4 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
> <GIC_PPI 1 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
> };
> +
> + wcss: wcss-smp2p {
All other DTs (except the odd cookie ipq6018 which sneaked through) call
these smp2p-foo instead of foo-smp2p
Konrad
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH V3 7/8] arm64: dts: qcom: ipq9574: add nodes to bring up q6
2025-01-07 10:16 ` [PATCH V3 7/8] arm64: dts: qcom: ipq9574: add nodes to bring up q6 Gokul Sriram Palanisamy
@ 2025-01-09 13:12 ` Konrad Dybcio
2025-01-15 10:05 ` Gokul Sriram P
0 siblings, 1 reply; 28+ messages in thread
From: Konrad Dybcio @ 2025-01-09 13:12 UTC (permalink / raw)
To: Gokul Sriram Palanisamy, jassisinghbrar, robh, krzk+dt, conor+dt,
andersson, mathieu.poirier, konradybcio, quic_mmanikan,
linux-arm-msm, linux-kernel, devicetree, linux-remoteproc,
dmitry.baryshkov
Cc: quic_viswanat, quic_srichara
On 7.01.2025 11:16 AM, Gokul Sriram Palanisamy wrote:
> From: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
>
> Enable nodes required for q6 remoteproc bring up.
>
> Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
> Signed-off-by: Gokul Sriram Palanisamy <quic_gokulsri@quicinc.com>
> ---
The comments you got on patch 6 apply here and to patch 8 too
Konrad
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH V3 4/8] remoteproc: qcom: add hexagon based WCSS secure PIL driver
2025-01-09 12:18 ` Gokul Sriram Palanisamy
@ 2025-01-11 13:46 ` Kathiravan Thirumoorthy
0 siblings, 0 replies; 28+ messages in thread
From: Kathiravan Thirumoorthy @ 2025-01-11 13:46 UTC (permalink / raw)
To: Gokul Sriram Palanisamy, Bjorn Andersson
Cc: jassisinghbrar@gmail.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, mathieu.poirier@linaro.org,
konradybcio@kernel.org, Manikanta Mylavarapu (QUIC),
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org,
dmitry.baryshkov@linaro.org, Vignesh Viswanathan (QUIC),
Sricharan Ramabadhran (QUIC)
>>> +static int wcss_sec_start(struct rproc *rproc)
>>> +{
>>> + struct wcss_sec *wcss = rproc->priv;
>>> + struct device *dev = wcss->dev;
>>> + const struct wcss_data *desc = of_device_get_match_data(dev);
>>
>> Please avoid "parsing" DT in runtime.
>
> I didn't underatand this.
>
IIUC, you should handle this in probe (one time) rather than for every
wcss_sec_start() call. In probe, you are already fetching this data. So
you can re-use the wcss->desc instead of parsing it again.
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH V3 7/8] arm64: dts: qcom: ipq9574: add nodes to bring up q6
2025-01-09 13:12 ` Konrad Dybcio
@ 2025-01-15 10:05 ` Gokul Sriram P
0 siblings, 0 replies; 28+ messages in thread
From: Gokul Sriram P @ 2025-01-15 10:05 UTC (permalink / raw)
To: Konrad Dybcio, jassisinghbrar@gmail.com, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, andersson@kernel.org,
mathieu.poirier@linaro.org, konradybcio@kernel.org,
Manikanta Mylavarapu (QUIC), linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-remoteproc@vger.kernel.org, dmitry.baryshkov@linaro.org
Cc: Vignesh Viswanathan (QUIC), Sricharan Ramabadhran (QUIC)
On 1/9/2025 6:42 PM, Konrad Dybcio wrote:
> On 7.01.2025 11:16 AM, Gokul Sriram Palanisamy wrote:
>> From: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
>>
>> Enable nodes required for q6 remoteproc bring up.
>>
>> Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
>> Signed-off-by: Gokul Sriram Palanisamy <quic_gokulsri@quicinc.com>
>> ---
> The comments you got on patch 6 apply here and to patch 8 too
sure Konrad. Will address.
Regards,
Gokul
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH V3 0/8] Add new driver for WCSS secure PIL loading
2025-01-07 10:16 [PATCH V3 0/8] Add new driver for WCSS secure PIL loading Gokul Sriram Palanisamy
` (7 preceding siblings ...)
2025-01-07 10:16 ` [PATCH V3 8/8] arm64: dts: qcom: ipq5424: " Gokul Sriram Palanisamy
@ 2025-01-24 18:00 ` Jeff Johnson
2025-03-28 5:17 ` Vignesh Viswanathan
8 siblings, 1 reply; 28+ messages in thread
From: Jeff Johnson @ 2025-01-24 18:00 UTC (permalink / raw)
To: Gokul Sriram Palanisamy, jassisinghbrar, robh, krzk+dt, conor+dt,
andersson, mathieu.poirier, konradybcio, quic_mmanikan,
linux-arm-msm, linux-kernel, devicetree, linux-remoteproc,
dmitry.baryshkov
Cc: quic_viswanat, quic_srichara
On 1/7/25 02:16, Gokul Sriram Palanisamy wrote:
> This series depends on Sricharan's tmel-qmp mailbox driver series v2 [1].
>
> - Secure PIL is signed, split firmware images which only TrustZone (TZ)
> can authenticate and load. Linux kernel will send a request to TZ to
> authenticate and load the PIL images.
>
> - When secure PIL support was added to the existing wcss PIL driver
> earlier in [2], Bjorn suggested not to overload the existing WCSS
> rproc driver, instead post a new driver for PAS based IPQ WCSS driver.
> This series adds a new secure PIL driver for the same.
>
> - Also adds changes to scm to pass metadata size as required for IPQ5332,
> reposted from [3].
>
> [1]
> https://patchwork.kernel.org/project/linux-arm-msm/cover/20241231054900.2144961-1-quic_srichara@quicinc.com/
>
> [2]
> https://patchwork.kernel.org/project/linux-arm-msm/patch/1611984013-10201-3-git-send-email-gokulsri@codeaurora.org/
>
> [3]
> https://patchwork.kernel.org/project/linux-arm-msm/patch/20240820055618.267554-6-quic_gokulsri@quicinc.com/
>
> changes in v3:
> - fixed copyright years and markings based on Jeff's comments.
> - replaced devm_ioremap_wc() with ioremap_wc() in
> wcss_sec_copy_segment().
> - replaced rproc_alloc() and rproc_add() with their devres
> counterparts.
> - added mailbox call to tmelcom for secure image authentication
> as required for IPQ5424. Added ipq5424 APCS comatible required.
> - added changes to scm call to pass metadata size as equired for
> IPQ5332.
>
> changes in v2:
> - Removed dependency of this series to q6 clock removal series
> as recommended by Krzysztof
>
> Gokul Sriram Palanisamy (3):
> dt-bindings: mailbox: qcom: Add IPQ5424 APCS compatible
> mailbox: qcom: Add support for IPQ5424 APCS IPC
> arm64: dts: qcom: ipq5424: add nodes to bring up q6
>
> Manikanta Mylavarapu (4):
> firmware: qcom_scm: ipq5332: add support to pass metadata size
> dt-bindings: remoteproc: qcom: document hexagon based WCSS secure PIL
> arm64: dts: qcom: ipq5332: add nodes to bringup q6
> arm64: dts: qcom: ipq9574: add nodes to bring up q6
>
> Vignesh Viswanathan (1):
> remoteproc: qcom: add hexagon based WCSS secure PIL driver
>
> .../mailbox/qcom,apcs-kpss-global.yaml | 1 +
> .../remoteproc/qcom,wcss-sec-pil.yaml | 131 ++++++
> arch/arm64/boot/dts/qcom/ipq5332.dtsi | 64 ++-
> arch/arm64/boot/dts/qcom/ipq5424.dtsi | 80 +++-
> arch/arm64/boot/dts/qcom/ipq9574.dtsi | 60 ++-
> drivers/firmware/qcom/qcom_scm.c | 13 +-
> drivers/firmware/qcom/qcom_scm.h | 1 +
> drivers/mailbox/qcom-apcs-ipc-mailbox.c | 1 +
> drivers/remoteproc/Kconfig | 22 +
> drivers/remoteproc/Makefile | 1 +
> drivers/remoteproc/qcom_q6v5_wcss_sec.c | 406 ++++++++++++++++++
> 11 files changed, 775 insertions(+), 5 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,wcss-sec-pil.yaml
> create mode 100644 drivers/remoteproc/qcom_q6v5_wcss_sec.c
>
This series is listed as a dependency of a WLAN series, and when I pull this
series using my automation I see the following kernel-doc warnings. I don't
know if these are existing issues, or issues introduced by the series, since
the automation runs kernel-doc on all of the patched files.
drivers/firmware/qcom/qcom_scm.c:302: warning: No description found for return value of 'qcom_scm_call'
drivers/firmware/qcom/qcom_scm.c:328: warning: No description found for return value of 'qcom_scm_call_atomic'
drivers/firmware/qcom/qcom_scm.c:425: warning: No description found for return value of 'qcom_scm_set_warm_boot_addr'
drivers/firmware/qcom/qcom_scm.c:438: warning: No description found for return value of 'qcom_scm_set_cold_boot_addr'
drivers/firmware/qcom/qcom_scm.c:675: warning: No description found for return value of 'qcom_scm_pas_mem_setup'
drivers/firmware/qcom/qcom_scm.c:714: warning: No description found for return value of 'qcom_scm_pas_auth_and_reset'
drivers/firmware/qcom/qcom_scm.c:750: warning: No description found for return value of 'qcom_scm_pas_shutdown'
drivers/firmware/qcom/qcom_scm.c:787: warning: No description found for return value of 'qcom_scm_pas_supported'
drivers/firmware/qcom/qcom_scm.c:892: warning: No description found for return value of 'qcom_scm_restore_sec_cfg_available'
drivers/firmware/qcom/qcom_scm.c:1070: warning: No description found for return value of 'qcom_scm_assign_mem'
drivers/firmware/qcom/qcom_scm.c:1141: warning: No description found for return value of 'qcom_scm_ocmem_lock_available'
drivers/firmware/qcom/qcom_scm.c:1158: warning: No description found for return value of 'qcom_scm_ocmem_lock'
drivers/firmware/qcom/qcom_scm.c:1182: warning: No description found for return value of 'qcom_scm_ocmem_unlock'
drivers/firmware/qcom/qcom_scm.c:1298: warning: No description found for return value of 'qcom_scm_hdcp_available'
drivers/firmware/qcom/qcom_scm.c:1323: warning: No description found for return value of 'qcom_scm_hdcp_req'
drivers/firmware/qcom/qcom_scm.c:1879: warning: No description found for return value of 'qcom_scm_is_available'
drivers/firmware/qcom/qcom_scm.h:47: warning: missing initial short description on line:
* struct qcom_scm_desc
drivers/firmware/qcom/qcom_scm.h:57: warning: Function parameter or struct member 'svc' not described in 'qcom_scm_desc'
drivers/firmware/qcom/qcom_scm.h:57: warning: Function parameter or struct member 'cmd' not described in 'qcom_scm_desc'
drivers/firmware/qcom/qcom_scm.h:57: warning: Function parameter or struct member 'owner' not described in 'qcom_scm_desc'
drivers/firmware/qcom/qcom_scm.h:60: warning: missing initial short description on line:
* struct qcom_scm_res
21 warnings as Errors
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH V3 0/8] Add new driver for WCSS secure PIL loading
2025-01-24 18:00 ` [PATCH V3 0/8] Add new driver for WCSS secure PIL loading Jeff Johnson
@ 2025-03-28 5:17 ` Vignesh Viswanathan
0 siblings, 0 replies; 28+ messages in thread
From: Vignesh Viswanathan @ 2025-03-28 5:17 UTC (permalink / raw)
To: Jeff Johnson, Gokul Sriram Palanisamy, jassisinghbrar, robh,
krzk+dt, conor+dt, andersson, mathieu.poirier, konradybcio,
quic_mmanikan, linux-arm-msm, linux-kernel, devicetree,
linux-remoteproc, dmitry.baryshkov
Cc: quic_viswanat, quic_srichara
On 1/24/2025 11:30 PM, Jeff Johnson wrote:
> On 1/7/25 02:16, Gokul Sriram Palanisamy wrote:
>> This series depends on Sricharan's tmel-qmp mailbox driver series v2 [1].
>>
>> - Secure PIL is signed, split firmware images which only TrustZone (TZ)
>> can authenticate and load. Linux kernel will send a request to TZ to
>> authenticate and load the PIL images.
>>
>> - When secure PIL support was added to the existing wcss PIL driver
>> earlier in [2], Bjorn suggested not to overload the existing WCSS
>> rproc driver, instead post a new driver for PAS based IPQ WCSS driver.
>> This series adds a new secure PIL driver for the same.
>>
>> - Also adds changes to scm to pass metadata size as required for IPQ5332,
>> reposted from [3].
>>
>> [1]
>> https://patchwork.kernel.org/project/linux-arm-msm/cover/20241231054900.2144961-1-quic_srichara@quicinc.com/
>>
>> [2]
>> https://patchwork.kernel.org/project/linux-arm-msm/patch/1611984013-10201-3-git-send-email-gokulsri@codeaurora.org/
>>
>> [3]
>> https://patchwork.kernel.org/project/linux-arm-msm/patch/20240820055618.267554-6-quic_gokulsri@quicinc.com/
>>
>> changes in v3:
>> - fixed copyright years and markings based on Jeff's comments.
>> - replaced devm_ioremap_wc() with ioremap_wc() in
>> wcss_sec_copy_segment().
>> - replaced rproc_alloc() and rproc_add() with their devres
>> counterparts.
>> - added mailbox call to tmelcom for secure image authentication
>> as required for IPQ5424. Added ipq5424 APCS comatible required.
>> - added changes to scm call to pass metadata size as equired for
>> IPQ5332.
>>
>> changes in v2:
>> - Removed dependency of this series to q6 clock removal series
>> as recommended by Krzysztof
>>
>> Gokul Sriram Palanisamy (3):
>> dt-bindings: mailbox: qcom: Add IPQ5424 APCS compatible
>> mailbox: qcom: Add support for IPQ5424 APCS IPC
>> arm64: dts: qcom: ipq5424: add nodes to bring up q6
>>
>> Manikanta Mylavarapu (4):
>> firmware: qcom_scm: ipq5332: add support to pass metadata size
>> dt-bindings: remoteproc: qcom: document hexagon based WCSS secure PIL
>> arm64: dts: qcom: ipq5332: add nodes to bringup q6
>> arm64: dts: qcom: ipq9574: add nodes to bring up q6
>>
>> Vignesh Viswanathan (1):
>> remoteproc: qcom: add hexagon based WCSS secure PIL driver
>>
>> .../mailbox/qcom,apcs-kpss-global.yaml | 1 +
>> .../remoteproc/qcom,wcss-sec-pil.yaml | 131 ++++++
>> arch/arm64/boot/dts/qcom/ipq5332.dtsi | 64 ++-
>> arch/arm64/boot/dts/qcom/ipq5424.dtsi | 80 +++-
>> arch/arm64/boot/dts/qcom/ipq9574.dtsi | 60 ++-
>> drivers/firmware/qcom/qcom_scm.c | 13 +-
>> drivers/firmware/qcom/qcom_scm.h | 1 +
>> drivers/mailbox/qcom-apcs-ipc-mailbox.c | 1 +
>> drivers/remoteproc/Kconfig | 22 +
>> drivers/remoteproc/Makefile | 1 +
>> drivers/remoteproc/qcom_q6v5_wcss_sec.c | 406 ++++++++++++++++++
>> 11 files changed, 775 insertions(+), 5 deletions(-)
>> create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,wcss-sec-pil.yaml
>> create mode 100644 drivers/remoteproc/qcom_q6v5_wcss_sec.c
>>
>
> This series is listed as a dependency of a WLAN series, and when I pull this
> series using my automation I see the following kernel-doc warnings. I don't
> know if these are existing issues, or issues introduced by the series, since
> the automation runs kernel-doc on all of the patched files.
>
> drivers/firmware/qcom/qcom_scm.c:302: warning: No description found for return value of 'qcom_scm_call'
> drivers/firmware/qcom/qcom_scm.c:328: warning: No description found for return value of 'qcom_scm_call_atomic'
> drivers/firmware/qcom/qcom_scm.c:425: warning: No description found for return value of 'qcom_scm_set_warm_boot_addr'
> drivers/firmware/qcom/qcom_scm.c:438: warning: No description found for return value of 'qcom_scm_set_cold_boot_addr'
> drivers/firmware/qcom/qcom_scm.c:675: warning: No description found for return value of 'qcom_scm_pas_mem_setup'
> drivers/firmware/qcom/qcom_scm.c:714: warning: No description found for return value of 'qcom_scm_pas_auth_and_reset'
> drivers/firmware/qcom/qcom_scm.c:750: warning: No description found for return value of 'qcom_scm_pas_shutdown'
> drivers/firmware/qcom/qcom_scm.c:787: warning: No description found for return value of 'qcom_scm_pas_supported'
> drivers/firmware/qcom/qcom_scm.c:892: warning: No description found for return value of 'qcom_scm_restore_sec_cfg_available'
> drivers/firmware/qcom/qcom_scm.c:1070: warning: No description found for return value of 'qcom_scm_assign_mem'
> drivers/firmware/qcom/qcom_scm.c:1141: warning: No description found for return value of 'qcom_scm_ocmem_lock_available'
> drivers/firmware/qcom/qcom_scm.c:1158: warning: No description found for return value of 'qcom_scm_ocmem_lock'
> drivers/firmware/qcom/qcom_scm.c:1182: warning: No description found for return value of 'qcom_scm_ocmem_unlock'
> drivers/firmware/qcom/qcom_scm.c:1298: warning: No description found for return value of 'qcom_scm_hdcp_available'
> drivers/firmware/qcom/qcom_scm.c:1323: warning: No description found for return value of 'qcom_scm_hdcp_req'
> drivers/firmware/qcom/qcom_scm.c:1879: warning: No description found for return value of 'qcom_scm_is_available'
> drivers/firmware/qcom/qcom_scm.h:47: warning: missing initial short description on line:
> * struct qcom_scm_desc
> drivers/firmware/qcom/qcom_scm.h:57: warning: Function parameter or struct member 'svc' not described in 'qcom_scm_desc'
> drivers/firmware/qcom/qcom_scm.h:57: warning: Function parameter or struct member 'cmd' not described in 'qcom_scm_desc'
> drivers/firmware/qcom/qcom_scm.h:57: warning: Function parameter or struct member 'owner' not described in 'qcom_scm_desc'
> drivers/firmware/qcom/qcom_scm.h:60: warning: missing initial short description on line:
> * struct qcom_scm_res
> 21 warnings as Errors
Hi Jeff,
These warnings are not introduced as part of this series.
Thanks,
Vignesh
>
>
^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2025-03-28 5:17 UTC | newest]
Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-07 10:16 [PATCH V3 0/8] Add new driver for WCSS secure PIL loading Gokul Sriram Palanisamy
2025-01-07 10:16 ` [PATCH V3 1/8] firmware: qcom_scm: ipq5332: add support to pass metadata size Gokul Sriram Palanisamy
2025-01-08 4:15 ` Bjorn Andersson
2025-01-07 10:16 ` [PATCH V3 2/8] dt-bindings: remoteproc: qcom: document hexagon based WCSS secure PIL Gokul Sriram Palanisamy
2025-01-07 12:21 ` Dmitry Baryshkov
[not found] ` <f0eef19b-8497-4e7d-bed1-882cdb8c1ab1@quicinc.com>
2025-01-08 7:34 ` Krzysztof Kozlowski
2025-01-08 11:19 ` Gokul Sriram P (QUIC)
2025-01-08 11:51 ` Krzysztof Kozlowski
[not found] ` <3e64b792-bfca-4b07-a13e-6deb966f3d4f@quicinc.com>
2025-01-08 10:54 ` Dmitry Baryshkov
2025-01-08 12:44 ` Gokul Sriram P (QUIC)
2025-01-07 10:16 ` [PATCH V3 3/8] dt-bindings: mailbox: qcom: Add IPQ5424 APCS compatible Gokul Sriram Palanisamy
2025-01-08 8:32 ` Krzysztof Kozlowski
2025-01-07 10:16 ` [PATCH V3 4/8] remoteproc: qcom: add hexagon based WCSS secure PIL driver Gokul Sriram Palanisamy
2025-01-08 4:09 ` Bjorn Andersson
2025-01-08 6:29 ` Sricharan Ramabadhran
2025-01-08 6:42 ` Sricharan Ramabadhran
2025-01-09 12:18 ` Gokul Sriram Palanisamy
2025-01-11 13:46 ` Kathiravan Thirumoorthy
2025-01-07 10:16 ` [PATCH V3 5/8] mailbox: qcom: Add support for IPQ5424 APCS IPC Gokul Sriram Palanisamy
2025-01-07 10:16 ` [PATCH V3 6/8] arm64: dts: qcom: ipq5332: add nodes to bringup q6 Gokul Sriram Palanisamy
2025-01-07 12:24 ` Dmitry Baryshkov
2025-01-09 13:11 ` Konrad Dybcio
2025-01-07 10:16 ` [PATCH V3 7/8] arm64: dts: qcom: ipq9574: add nodes to bring up q6 Gokul Sriram Palanisamy
2025-01-09 13:12 ` Konrad Dybcio
2025-01-15 10:05 ` Gokul Sriram P
2025-01-07 10:16 ` [PATCH V3 8/8] arm64: dts: qcom: ipq5424: " Gokul Sriram Palanisamy
2025-01-24 18:00 ` [PATCH V3 0/8] Add new driver for WCSS secure PIL loading Jeff Johnson
2025-03-28 5:17 ` Vignesh Viswanathan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).