linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v8 0/7] Update ADSP pil loader for SC7280 platform
@ 2022-09-23 13:05 Srinivasa Rao Mandadapu
  2022-09-23 13:05 ` [PATCH v8 1/7] dt-bindings: remoteproc: qcom: Add SC7280 ADSP support Srinivasa Rao Mandadapu
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Srinivasa Rao Mandadapu @ 2022-09-23 13:05 UTC (permalink / raw)
  To: linux-remoteproc, agross, andersson, lgirdwood, broonie, robh+dt,
	quic_plai, bgoswami, perex, tiwai, srinivas.kandagatla,
	quic_rohkumar, linux-arm-msm, linux-kernel, swboyd, judyhsiao,
	devicetree, krzysztof.kozlowski
  Cc: Srinivasa Rao Mandadapu

Update ADSP pil loader driver for SC7280 platforms.
Changes since V7:
	-- Drop out of reset time out patch.
	-- Remove redundant clocks in dt bindings.
	-- Fix dt compilation error in dt bindings.
Changes since V6:
	-- Update dt-bindings with glink-edge
	-- Add qcom,qmp property.
	-- Update parse firmware callback.
	-- Update commit message.
	-- Update smmu map and unmap function names.
	-- Revert adsp_ops const change.
	-- Move iommu check to within smmu map/unmap functions.
Changes since V5:
	-- Remove adsp_rproc_unmap_smmu, adsp_of_unmap_smmu, adsp_of_map_smmu and 
	   adsp_rproc_map_smmu functions.
	-- Remove find_loaded_rsc_table call back initialization.
	-- Rename adsp_sandbox_needed to has_iommu.
	-- Update parse_fw callback in rproc ops.
	-- Remove qcom,adsp-memory-regions property in dt-bindings.
	-- Change adsp binary extension name.
Changes since V4:
	-- Update halt registers description in dt bindings.
	-- Update Memory sandboxing with proper APIs for resource
	   allocation and free.
Changes since V3:
	-- Rename is_adsp_sb_needed to adsp_sandbox_needed.
	-- Update sc7280 compatible name entry in sorted order.
	-- Add smmu unmapping in error case and in adsp stop.
	-- Revert converting sdm845 dt bindings to generic and 
	   create new dt bindings for sc7280.
Changes since V2:
	-- Generated patch with -M flag.
	-- Add Clock property in dt bindings.
	-- Add qcom,adsp-memory-regions property.
	-- Add is_adsp_sb_needed flag instead of is_wpss.
	-- Initialize is_adsp_sb_needed flag.
	-- Remove empty proxy pds array.
	-- Replace platform_bus_type with adsp->dev->bus.
	-- Use API of_parse_phandle_with_args() instead of 
	    of_parse_phandle_with_fixed_args().
	-- Replace adsp->is_wpss with adsp->is_adsp.
	-- Update error handling in adsp_start().
Changes since V1:
	-- Change reg property maxItems to minItems and update description.
	-- Fix typo errors.

Srinivasa Rao Mandadapu (7):
  dt-bindings: remoteproc: qcom: Add SC7280 ADSP support
  remoteproc: qcom: Add flag in adsp private data structure
  remoteproc: qcom: Add compatible name for SC7280 ADSP
  remoteproc: qcom: Update rproc parse firmware callback
  remoteproc: qcom: Replace hard coded values with macros
  remoteproc: qcom: Add efuse evb selection control
  remoteproc: qcom: Add support for memory sandbox

 .../bindings/remoteproc/qcom,sc7280-adsp-pil.yaml  | 207 +++++++++++++++++++++
 drivers/remoteproc/qcom_q6v5_adsp.c                | 124 +++++++++++-
 2 files changed, 327 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,sc7280-adsp-pil.yaml

-- 
2.7.4


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v8 1/7] dt-bindings: remoteproc: qcom: Add SC7280 ADSP support
  2022-09-23 13:05 [PATCH v8 0/7] Update ADSP pil loader for SC7280 platform Srinivasa Rao Mandadapu
@ 2022-09-23 13:05 ` Srinivasa Rao Mandadapu
  2022-09-23 17:23   ` Krzysztof Kozlowski
  2022-09-23 13:05 ` [PATCH v8 2/7] remoteproc: qcom: Add flag in adsp private data structure Srinivasa Rao Mandadapu
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Srinivasa Rao Mandadapu @ 2022-09-23 13:05 UTC (permalink / raw)
  To: linux-remoteproc, agross, andersson, lgirdwood, broonie, robh+dt,
	quic_plai, bgoswami, perex, tiwai, srinivas.kandagatla,
	quic_rohkumar, linux-arm-msm, linux-kernel, swboyd, judyhsiao,
	devicetree, krzysztof.kozlowski
  Cc: Srinivasa Rao Mandadapu

Add ADSP PIL loading support for SC7280 SoCs.

Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
---
Changes since V7:
	-- Remove redundant clocks in dt bindings.
	-- Fix dt compilation error in dt bindings.
Changes since V6:
	-- Update glink-edge property.
	-- Add qcom,qmp property.
Changes since V5:
	-- Remove qcom,adsp-memory-regions property.
Changes since V4:
	-- Update halt registers description in dt bindings.

 .../bindings/remoteproc/qcom,sc7280-adsp-pil.yaml  | 207 +++++++++++++++++++++
 1 file changed, 207 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,sc7280-adsp-pil.yaml

diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,sc7280-adsp-pil.yaml b/Documentation/devicetree/bindings/remoteproc/qcom,sc7280-adsp-pil.yaml
new file mode 100644
index 0000000..79ef3c0
--- /dev/null
+++ b/Documentation/devicetree/bindings/remoteproc/qcom,sc7280-adsp-pil.yaml
@@ -0,0 +1,207 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/remoteproc/qcom,sc7280-adsp-pil.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm SC7280 ADSP Peripheral Image Loader
+
+maintainers:
+  - Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
+
+description:
+  This document describes the hardware for a component that loads and boots firmware
+  on the Qualcomm Technology Inc. ADSP.
+
+properties:
+  compatible:
+    enum:
+      - qcom,sc7280-adsp-pil
+
+  reg:
+    minItems: 1
+    items:
+      - description: qdsp6ss register
+      - description: efuse q6ss register
+
+  interrupts:
+    items:
+      - description: Watchdog interrupt
+      - description: Fatal interrupt
+      - description: Ready interrupt
+      - description: Handover interrupt
+      - description: Stop acknowledge interrupt
+      - description: Shutdown acknowledge interrupt
+
+  interrupt-names:
+    items:
+      - const: wdog
+      - const: fatal
+      - const: ready
+      - const: handover
+      - const: stop-ack
+      - const: shutdown-ack
+
+  clocks:
+    items:
+      - description: XO clock
+      - description: GCC CFG NOC LPASS clock
+
+  clock-names:
+    items:
+      - const: xo
+      - const: gcc_cfg_noc_lpass
+
+  power-domains:
+    items:
+      - description: LCX power domain
+
+  resets:
+    items:
+      - description: PDC AUDIO SYNC RESET
+      - description: CC LPASS restart
+
+  reset-names:
+    items:
+      - const: pdc_sync
+      - const: cc_lpass
+
+  memory-region:
+    maxItems: 1
+    description: Reference to the reserved-memory for the Hexagon core
+
+  qcom,halt-regs:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    description:
+      Phandle reference to a syscon representing TCSR followed by the
+      four offsets within syscon for q6, CE, AXI and qv6 halt registers.
+    items:
+      items:
+        - description: phandle to TCSR MUTEX
+        - description: offset to q6 halt registers
+        - description: offset to CE halt registers
+        - description: offset to AXI halt registers
+        - description: offset to qv6 halt registers
+
+  qcom,smem-states:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    description: States used by the AP to signal the Hexagon core
+    items:
+      - description: Stop the modem
+
+  qcom,smem-state-names:
+    description: The names of the state bits used for SMP2P output
+    const: stop
+
+  qcom,qmp:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: Reference to the AOSS side-channel message RAM.
+
+  glink-edge:
+    type: object
+    description: |
+      Qualcomm G-Link subnode which represents communication edge, channels
+      and devices related to the ADSP.
+
+    properties:
+      interrupts:
+        items:
+          - description: IRQ from ADSP to GLINK
+
+      mboxes:
+        items:
+          - description: Mailbox for communication between APPS and ADSP
+
+      label:
+        description: The names of the state bits used for SMP2P output
+        items:
+          - const: lpass
+
+      qcom,remote-pid:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: ID of the shared memory used by GLINK for communication with ADSP
+
+      gpr: true
+      apr: false
+      fastrpc: false
+
+    required:
+      - interrupts
+      - mboxes
+      - label
+      - qcom,remote-pid
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - interrupt-names
+  - clocks
+  - clock-names
+  - power-domains
+  - resets
+  - reset-names
+  - qcom,halt-regs
+  - memory-region
+  - qcom,smem-states
+  - qcom,smem-state-names
+  - qcom,qmp
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/clock/qcom,rpmh.h>
+    #include <dt-bindings/clock/qcom,gcc-sc7280.h>
+    #include <dt-bindings/clock/qcom,lpass-sc7280.h>
+    #include <dt-bindings/reset/qcom,sdm845-aoss.h>
+    #include <dt-bindings/reset/qcom,sdm845-pdc.h>
+    #include <dt-bindings/power/qcom-rpmpd.h>
+    #include <dt-bindings/mailbox/qcom-ipcc.h>
+
+    remoteproc@3000000 {
+        compatible = "qcom,sc7280-adsp-pil";
+        reg = <0x03000000 0x5000>,
+              <0x0355b000 0x10>;
+
+        interrupts-extended = <&pdc 162 IRQ_TYPE_EDGE_RISING>,
+                <&adsp_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
+                <&adsp_smp2p_in 1 IRQ_TYPE_EDGE_RISING>,
+                <&adsp_smp2p_in 2 IRQ_TYPE_EDGE_RISING>,
+                <&adsp_smp2p_in 3 IRQ_TYPE_EDGE_RISING>,
+                <&adsp_smp2p_in 7 IRQ_TYPE_EDGE_RISING>;
+
+        interrupt-names = "wdog", "fatal", "ready",
+                "handover", "stop-ack", "shutdown-ack";
+
+        clocks = <&rpmhcc RPMH_CXO_CLK>,
+                 <&gcc GCC_CFG_NOC_LPASS_CLK>;
+        clock-names = "xo", "gcc_cfg_noc_lpass";
+
+        power-domains = <&rpmhpd SC7280_LCX>;
+
+        resets = <&pdc_reset PDC_AUDIO_SYNC_RESET>,
+                 <&aoss_reset AOSS_CC_LPASS_RESTART>;
+        reset-names = "pdc_sync", "cc_lpass";
+
+        qcom,halt-regs = <&tcsr_mutex 0x23000 0x25000 0x28000 0x33000>;
+
+        memory-region = <&adsp_mem>;
+
+        qcom,smem-states = <&adsp_smp2p_out 0>;
+        qcom,smem-state-names = "stop";
+
+        qcom,qmp = <&aoss_qmp>;
+
+        glink-edge {
+            interrupts-extended = <&ipcc IPCC_CLIENT_LPASS
+                                         IPCC_MPROC_SIGNAL_GLINK_QMP
+                                         IRQ_TYPE_EDGE_RISING>;
+            mboxes = <&ipcc IPCC_CLIENT_LPASS
+                            IPCC_MPROC_SIGNAL_GLINK_QMP>;
+
+            label = "lpass";
+            qcom,remote-pid = <2>;
+        };
+    };
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v8 2/7] remoteproc: qcom: Add flag in adsp private data structure
  2022-09-23 13:05 [PATCH v8 0/7] Update ADSP pil loader for SC7280 platform Srinivasa Rao Mandadapu
  2022-09-23 13:05 ` [PATCH v8 1/7] dt-bindings: remoteproc: qcom: Add SC7280 ADSP support Srinivasa Rao Mandadapu
@ 2022-09-23 13:05 ` Srinivasa Rao Mandadapu
  2022-09-23 13:05 ` [PATCH v8 3/7] remoteproc: qcom: Add compatible name for SC7280 ADSP Srinivasa Rao Mandadapu
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Srinivasa Rao Mandadapu @ 2022-09-23 13:05 UTC (permalink / raw)
  To: linux-remoteproc, agross, andersson, lgirdwood, broonie, robh+dt,
	quic_plai, bgoswami, perex, tiwai, srinivas.kandagatla,
	quic_rohkumar, linux-arm-msm, linux-kernel, swboyd, judyhsiao,
	devicetree, krzysztof.kozlowski
  Cc: Srinivasa Rao Mandadapu

Add flag in qcom_adsp private data structure and initialize
it to distinguish ADSP modules, which has iommu requirement,
for using iommu selectively.

Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Sibi Sankar <quic_sibis@quicinc.com>
---
Changes since V6:
	-- Update commit message.
Changes since V5:
	-- Rename adsp_sandbox_needed to has_iommu.
Changes since V3:
	-- Rename is_adsp_sb_needed to adsp_sandbox_needed.
Changes since V2:
	-- Add is_adsp_sb_needed flag instead of is_wpss.

 drivers/remoteproc/qcom_q6v5_adsp.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c
index 2f3b9f5..fa2ccac 100644
--- a/drivers/remoteproc/qcom_q6v5_adsp.c
+++ b/drivers/remoteproc/qcom_q6v5_adsp.c
@@ -62,6 +62,7 @@ struct adsp_pil_data {
 	const char *sysmon_name;
 	int ssctl_id;
 	bool is_wpss;
+	bool has_iommu;
 	bool auto_boot;
 
 	const char **clk_ids;
@@ -99,6 +100,7 @@ struct qcom_adsp {
 	phys_addr_t mem_reloc;
 	void *mem_region;
 	size_t mem_size;
+	bool has_iommu;
 
 	struct device *proxy_pds[QCOM_Q6V5_RPROC_PROXY_PD_MAX];
 	size_t proxy_pd_count;
@@ -596,12 +598,15 @@ static int adsp_probe(struct platform_device *pdev)
 	}
 
 	rproc->auto_boot = desc->auto_boot;
+	rproc->has_iommu = desc->has_iommu;
 	rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE);
 
 	adsp = (struct qcom_adsp *)rproc->priv;
 	adsp->dev = &pdev->dev;
 	adsp->rproc = rproc;
 	adsp->info_name = desc->sysmon_name;
+	adsp->has_iommu = desc->has_iommu;
+
 	platform_set_drvdata(pdev, adsp);
 
 	if (desc->is_wpss)
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v8 3/7] remoteproc: qcom: Add compatible name for SC7280 ADSP
  2022-09-23 13:05 [PATCH v8 0/7] Update ADSP pil loader for SC7280 platform Srinivasa Rao Mandadapu
  2022-09-23 13:05 ` [PATCH v8 1/7] dt-bindings: remoteproc: qcom: Add SC7280 ADSP support Srinivasa Rao Mandadapu
  2022-09-23 13:05 ` [PATCH v8 2/7] remoteproc: qcom: Add flag in adsp private data structure Srinivasa Rao Mandadapu
@ 2022-09-23 13:05 ` Srinivasa Rao Mandadapu
  2022-09-23 13:05 ` [PATCH v8 4/7] remoteproc: qcom: Update rproc parse firmware callback Srinivasa Rao Mandadapu
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Srinivasa Rao Mandadapu @ 2022-09-23 13:05 UTC (permalink / raw)
  To: linux-remoteproc, agross, andersson, lgirdwood, broonie, robh+dt,
	quic_plai, bgoswami, perex, tiwai, srinivas.kandagatla,
	quic_rohkumar, linux-arm-msm, linux-kernel, swboyd, judyhsiao,
	devicetree, krzysztof.kozlowski
  Cc: Srinivasa Rao Mandadapu

Update adsp pil data and compatible name for loading ADSP
binary on SC7280 based platforms.

Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
---
Changes since V5:
	-- Rename adsp_sandbox_needed to has_iommu.
	-- Change adsp binary extension name.
Changes since V3:
	-- Rename is_adsp_sb_needed to adsp_sandbox_needed.
	-- Update sc7280 compatible name entry in sorted order.
Changes since V2:
	-- Initialize is_adsp_sb_needed flag.
	-- Remove empty proxy pds array.

 drivers/remoteproc/qcom_q6v5_adsp.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c
index fa2ccac..02d17b4 100644
--- a/drivers/remoteproc/qcom_q6v5_adsp.c
+++ b/drivers/remoteproc/qcom_q6v5_adsp.c
@@ -702,6 +702,21 @@ static const struct adsp_pil_data adsp_resource_init = {
 	},
 };
 
+static const struct adsp_pil_data adsp_sc7280_resource_init = {
+	.crash_reason_smem = 423,
+	.firmware_name = "adsp.pbn",
+	.load_state = "adsp",
+	.ssr_name = "lpass",
+	.sysmon_name = "adsp",
+	.ssctl_id = 0x14,
+	.has_iommu = true,
+	.auto_boot = true,
+	.clk_ids = (const char*[]) {
+		"gcc_cfg_noc_lpass", NULL
+	},
+	.num_clks = 1,
+};
+
 static const struct adsp_pil_data cdsp_resource_init = {
 	.crash_reason_smem = 601,
 	.firmware_name = "cdsp.mdt",
@@ -740,6 +755,7 @@ static const struct adsp_pil_data wpss_resource_init = {
 
 static const struct of_device_id adsp_of_match[] = {
 	{ .compatible = "qcom,qcs404-cdsp-pil", .data = &cdsp_resource_init },
+	{ .compatible = "qcom,sc7280-adsp-pil", .data = &adsp_sc7280_resource_init },
 	{ .compatible = "qcom,sc7280-wpss-pil", .data = &wpss_resource_init },
 	{ .compatible = "qcom,sdm845-adsp-pil", .data = &adsp_resource_init },
 	{ },
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v8 4/7] remoteproc: qcom: Update rproc parse firmware callback
  2022-09-23 13:05 [PATCH v8 0/7] Update ADSP pil loader for SC7280 platform Srinivasa Rao Mandadapu
                   ` (2 preceding siblings ...)
  2022-09-23 13:05 ` [PATCH v8 3/7] remoteproc: qcom: Add compatible name for SC7280 ADSP Srinivasa Rao Mandadapu
@ 2022-09-23 13:05 ` Srinivasa Rao Mandadapu
  2022-09-23 13:05 ` [PATCH v8 5/7] remoteproc: qcom: Replace hard coded values with macros Srinivasa Rao Mandadapu
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Srinivasa Rao Mandadapu @ 2022-09-23 13:05 UTC (permalink / raw)
  To: linux-remoteproc, agross, andersson, lgirdwood, broonie, robh+dt,
	quic_plai, bgoswami, perex, tiwai, srinivas.kandagatla,
	quic_rohkumar, linux-arm-msm, linux-kernel, swboyd, judyhsiao,
	devicetree, krzysztof.kozlowski
  Cc: Srinivasa Rao Mandadapu

Change parse_fw callback in rproc ops from qcom_register_dump_segments
to local function such that, it can perform coredump segments registration
and it can parse section header in memory sandboxing required platforms.

Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
---
Changes since V6:
	-- Update parse firmware callback.

 drivers/remoteproc/qcom_q6v5_adsp.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c
index 02d17b4..9ea10b7 100644
--- a/drivers/remoteproc/qcom_q6v5_adsp.c
+++ b/drivers/remoteproc/qcom_q6v5_adsp.c
@@ -440,6 +440,27 @@ static void *adsp_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *is_iom
 	return adsp->mem_region + offset;
 }
 
+static int adsp_parse_firmware(struct rproc *rproc, const struct firmware *fw)
+{
+	struct qcom_adsp *adsp = rproc->priv;
+	int ret;
+
+	ret = qcom_register_dump_segments(rproc, fw);
+	if (ret) {
+		dev_err(&rproc->dev, "Error in registering dump segments\n");
+		return ret;
+	}
+
+	if (adsp->has_iommu) {
+		ret = rproc_elf_load_rsc_table(rproc, fw);
+		if (ret) {
+			dev_err(&rproc->dev, "Error in loading resource table\n");
+			return ret;
+		}
+	}
+	return 0;
+}
+
 static unsigned long adsp_panic(struct rproc *rproc)
 {
 	struct qcom_adsp *adsp = rproc->priv;
@@ -451,7 +472,7 @@ static const struct rproc_ops adsp_ops = {
 	.start = adsp_start,
 	.stop = adsp_stop,
 	.da_to_va = adsp_da_to_va,
-	.parse_fw = qcom_register_dump_segments,
+	.parse_fw = adsp_parse_firmware,
 	.load = adsp_load,
 	.panic = adsp_panic,
 };
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v8 5/7] remoteproc: qcom: Replace hard coded values with macros
  2022-09-23 13:05 [PATCH v8 0/7] Update ADSP pil loader for SC7280 platform Srinivasa Rao Mandadapu
                   ` (3 preceding siblings ...)
  2022-09-23 13:05 ` [PATCH v8 4/7] remoteproc: qcom: Update rproc parse firmware callback Srinivasa Rao Mandadapu
@ 2022-09-23 13:05 ` Srinivasa Rao Mandadapu
  2022-09-23 13:05 ` [PATCH v8 6/7] remoteproc: qcom: Add efuse evb selection control Srinivasa Rao Mandadapu
  2022-09-23 13:05 ` [PATCH v8 7/7] remoteproc: qcom: Add support for memory sandbox Srinivasa Rao Mandadapu
  6 siblings, 0 replies; 14+ messages in thread
From: Srinivasa Rao Mandadapu @ 2022-09-23 13:05 UTC (permalink / raw)
  To: linux-remoteproc, agross, andersson, lgirdwood, broonie, robh+dt,
	quic_plai, bgoswami, perex, tiwai, srinivas.kandagatla,
	quic_rohkumar, linux-arm-msm, linux-kernel, swboyd, judyhsiao,
	devicetree, krzysztof.kozlowski
  Cc: Srinivasa Rao Mandadapu

Replace hard coded values of QDSP6 boot control reg params
with appropriate macro names.

Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Sibi Sankar <quic_sibis@quicinc.com>
---
 drivers/remoteproc/qcom_q6v5_adsp.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c
index 9ea10b7..80c8169 100644
--- a/drivers/remoteproc/qcom_q6v5_adsp.c
+++ b/drivers/remoteproc/qcom_q6v5_adsp.c
@@ -54,6 +54,9 @@
 
 #define QCOM_Q6V5_RPROC_PROXY_PD_MAX	3
 
+#define LPASS_BOOT_CORE_START	BIT(0)
+#define LPASS_BOOT_CMD_START	BIT(0)
+
 struct adsp_pil_data {
 	int crash_reason_smem;
 	const char *firmware_name;
@@ -366,10 +369,10 @@ static int adsp_start(struct rproc *rproc)
 	writel(adsp->mem_phys >> 4, adsp->qdsp6ss_base + RST_EVB_REG);
 
 	/* De-assert QDSP6 stop core. QDSP6 will execute after out of reset */
-	writel(0x1, adsp->qdsp6ss_base + CORE_START_REG);
+	writel(LPASS_BOOT_CORE_START, adsp->qdsp6ss_base + CORE_START_REG);
 
 	/* Trigger boot FSM to start QDSP6 */
-	writel(0x1, adsp->qdsp6ss_base + BOOT_CMD_REG);
+	writel(LPASS_BOOT_CMD_START, adsp->qdsp6ss_base + BOOT_CMD_REG);
 
 	/* Wait for core to come out of reset */
 	ret = readl_poll_timeout(adsp->qdsp6ss_base + BOOT_STATUS_REG,
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v8 6/7] remoteproc: qcom: Add efuse evb selection control
  2022-09-23 13:05 [PATCH v8 0/7] Update ADSP pil loader for SC7280 platform Srinivasa Rao Mandadapu
                   ` (4 preceding siblings ...)
  2022-09-23 13:05 ` [PATCH v8 5/7] remoteproc: qcom: Replace hard coded values with macros Srinivasa Rao Mandadapu
@ 2022-09-23 13:05 ` Srinivasa Rao Mandadapu
  2022-09-23 17:25   ` Krzysztof Kozlowski
  2022-09-23 13:05 ` [PATCH v8 7/7] remoteproc: qcom: Add support for memory sandbox Srinivasa Rao Mandadapu
  6 siblings, 1 reply; 14+ messages in thread
From: Srinivasa Rao Mandadapu @ 2022-09-23 13:05 UTC (permalink / raw)
  To: linux-remoteproc, agross, andersson, lgirdwood, broonie, robh+dt,
	quic_plai, bgoswami, perex, tiwai, srinivas.kandagatla,
	quic_rohkumar, linux-arm-msm, linux-kernel, swboyd, judyhsiao,
	devicetree, krzysztof.kozlowski
  Cc: Srinivasa Rao Mandadapu

Add efuse evb selection control and enable it for starting ADSP.

Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Sibi Sankar <quic_sibis@quicinc.com>
---
Changes since V5:
	-- Split devm_platform_ioremap_resource_byname function.

 drivers/remoteproc/qcom_q6v5_adsp.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c
index 80c8169..e463fbc 100644
--- a/drivers/remoteproc/qcom_q6v5_adsp.c
+++ b/drivers/remoteproc/qcom_q6v5_adsp.c
@@ -56,6 +56,7 @@
 
 #define LPASS_BOOT_CORE_START	BIT(0)
 #define LPASS_BOOT_CMD_START	BIT(0)
+#define LPASS_EFUSE_Q6SS_EVB_SEL 0x0
 
 struct adsp_pil_data {
 	int crash_reason_smem;
@@ -86,6 +87,7 @@ struct qcom_adsp {
 	struct clk_bulk_data *clks;
 
 	void __iomem *qdsp6ss_base;
+	void __iomem *lpass_efuse;
 
 	struct reset_control *pdc_sync_reset;
 	struct reset_control *restart;
@@ -368,6 +370,9 @@ static int adsp_start(struct rproc *rproc)
 	/* Program boot address */
 	writel(adsp->mem_phys >> 4, adsp->qdsp6ss_base + RST_EVB_REG);
 
+	if (adsp->lpass_efuse)
+		writel(LPASS_EFUSE_Q6SS_EVB_SEL, adsp->lpass_efuse);
+
 	/* De-assert QDSP6 stop core. QDSP6 will execute after out of reset */
 	writel(LPASS_BOOT_CORE_START, adsp->qdsp6ss_base + CORE_START_REG);
 
@@ -534,6 +539,7 @@ static int adsp_init_reset(struct qcom_adsp *adsp)
 static int adsp_init_mmio(struct qcom_adsp *adsp,
 				struct platform_device *pdev)
 {
+	struct resource *efuse_region;
 	struct device_node *syscon;
 	int ret;
 
@@ -543,6 +549,17 @@ static int adsp_init_mmio(struct qcom_adsp *adsp,
 		return PTR_ERR(adsp->qdsp6ss_base);
 	}
 
+	efuse_region = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+	if (!efuse_region) {
+		adsp->lpass_efuse = NULL;
+		dev_dbg(adsp->dev, "failed to get efuse memory region\n");
+	} else {
+		adsp->lpass_efuse = devm_ioremap_resource(&pdev->dev, efuse_region);
+		if (IS_ERR(adsp->lpass_efuse)) {
+			dev_err(adsp->dev, "failed to map efuse registers\n");
+			return PTR_ERR(adsp->lpass_efuse);
+		}
+	}
 	syscon = of_parse_phandle(pdev->dev.of_node, "qcom,halt-regs", 0);
 	if (!syscon) {
 		dev_err(&pdev->dev, "failed to parse qcom,halt-regs\n");
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v8 7/7] remoteproc: qcom: Add support for memory sandbox
  2022-09-23 13:05 [PATCH v8 0/7] Update ADSP pil loader for SC7280 platform Srinivasa Rao Mandadapu
                   ` (5 preceding siblings ...)
  2022-09-23 13:05 ` [PATCH v8 6/7] remoteproc: qcom: Add efuse evb selection control Srinivasa Rao Mandadapu
@ 2022-09-23 13:05 ` Srinivasa Rao Mandadapu
  2022-09-23 17:26   ` Krzysztof Kozlowski
  6 siblings, 1 reply; 14+ messages in thread
From: Srinivasa Rao Mandadapu @ 2022-09-23 13:05 UTC (permalink / raw)
  To: linux-remoteproc, agross, andersson, lgirdwood, broonie, robh+dt,
	quic_plai, bgoswami, perex, tiwai, srinivas.kandagatla,
	quic_rohkumar, linux-arm-msm, linux-kernel, swboyd, judyhsiao,
	devicetree, krzysztof.kozlowski
  Cc: Srinivasa Rao Mandadapu

Update pil driver with SMMU mapping for allowing authorised
memory access to ADSP firmware, by carveout reserved adsp memory
region from device tree file.

Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
---
Changes since V6:
	-- Update smmu map and unmap function names.
	-- Revert adsp_ops const change.
	-- Move iommu check to within smmu map/unmap functions.
Changes since V5:
	-- Remove adsp_rproc_unmap_smmu, adsp_of_unmap_smmu, adsp_of_map_smmu and 
	   adsp_rproc_map_smmu functions.
	-- Remove find_loaded_rsc_table call back initialization.
	-- Rename adsp_sandbox_needed to has_iommu.
Changes since V4:
	-- Split the code and add appropriate APIs for resource allocation and free.
	-- Update adsp_unmap_smmu with missing free ops call.
	-- Update normalizing length value in adsp_of_unmap_smmu.
Changes since V3:
	-- Rename is_adsp_sb_needed to adsp_sandbox_needed.
	-- Add smmu unmapping in error case and in adsp stop.
Changes since V2:
	-- Replace platform_bus_type with adsp->dev->bus.
	-- Use API of_parse_phandle_with_args() instead of of_parse_phandle_with_fixed_args().
	-- Replace adsp->is_wpss with adsp->is_adsp.
	-- Update error handling in adsp_start().

 drivers/remoteproc/qcom_q6v5_adsp.c | 56 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 55 insertions(+), 1 deletion(-)

diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c
index e463fbc..d89f3fa 100644
--- a/drivers/remoteproc/qcom_q6v5_adsp.c
+++ b/drivers/remoteproc/qcom_q6v5_adsp.c
@@ -9,6 +9,7 @@
 #include <linux/firmware.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
+#include <linux/iommu.h>
 #include <linux/iopoll.h>
 #include <linux/kernel.h>
 #include <linux/mfd/syscon.h>
@@ -48,6 +49,8 @@
 #define LPASS_PWR_ON_REG		0x10
 #define LPASS_HALTREQ_REG		0x0
 
+#define SID_MASK_DEFAULT        0xF
+
 #define QDSP6SS_XO_CBCR		0x38
 #define QDSP6SS_CORE_CBCR	0x20
 #define QDSP6SS_SLEEP_CBCR	0x3c
@@ -333,6 +336,47 @@ static int adsp_load(struct rproc *rproc, const struct firmware *fw)
 	return 0;
 }
 
+static void adsp_unmap_carveout(struct rproc *rproc)
+{
+	struct qcom_adsp *adsp = rproc->priv;
+
+	if (adsp->has_iommu)
+		iommu_unmap(rproc->domain, adsp->mem_phys, adsp->mem_size);
+}
+
+static int adsp_map_carveout(struct rproc *rproc)
+{
+	struct qcom_adsp *adsp = rproc->priv;
+	struct of_phandle_args args;
+	long long sid;
+	unsigned long iova;
+	int ret;
+
+	if (!adsp->has_iommu)
+		return 0;
+
+	if (!rproc->domain)
+		return -EINVAL;
+
+	ret = of_parse_phandle_with_args(adsp->dev->of_node, "iommus", "#iommu-cells", 0, &args);
+	if (ret < 0)
+		return ret;
+
+	sid = args.args[0] & SID_MASK_DEFAULT;
+
+	/* Add SID configuration for ADSP Firmware to SMMU */
+	iova =  adsp->mem_phys | (sid << 32);
+
+	ret = iommu_map(rproc->domain, iova, adsp->mem_phys,
+			adsp->mem_size,	IOMMU_READ | IOMMU_WRITE);
+	if (ret) {
+		dev_err(adsp->dev, "Unable to map ADSP Physical Memory\n");
+		return ret;
+	}
+
+	return 0;
+}
+
 static int adsp_start(struct rproc *rproc)
 {
 	struct qcom_adsp *adsp = (struct qcom_adsp *)rproc->priv;
@@ -343,9 +387,15 @@ static int adsp_start(struct rproc *rproc)
 	if (ret)
 		return ret;
 
+	ret = adsp_map_carveout(rproc);
+	if (ret) {
+		dev_err(adsp->dev, "ADSP smmu mapping failed\n");
+		goto disable_irqs;
+	}
+
 	ret = clk_prepare_enable(adsp->xo);
 	if (ret)
-		goto disable_irqs;
+		goto adsp_smmu_unmap;
 
 	ret = qcom_rproc_pds_enable(adsp, adsp->proxy_pds,
 				    adsp->proxy_pd_count);
@@ -401,6 +451,8 @@ static int adsp_start(struct rproc *rproc)
 	qcom_rproc_pds_disable(adsp, adsp->proxy_pds, adsp->proxy_pd_count);
 disable_xo_clk:
 	clk_disable_unprepare(adsp->xo);
+adsp_smmu_unmap:
+	adsp_unmap_carveout(rproc);
 disable_irqs:
 	qcom_q6v5_unprepare(&adsp->q6v5);
 
@@ -429,6 +481,8 @@ static int adsp_stop(struct rproc *rproc)
 	if (ret)
 		dev_err(adsp->dev, "failed to shutdown: %d\n", ret);
 
+	adsp_unmap_carveout(rproc);
+
 	handover = qcom_q6v5_unprepare(&adsp->q6v5);
 	if (handover)
 		qcom_adsp_pil_handover(&adsp->q6v5);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v8 1/7] dt-bindings: remoteproc: qcom: Add SC7280 ADSP support
  2022-09-23 13:05 ` [PATCH v8 1/7] dt-bindings: remoteproc: qcom: Add SC7280 ADSP support Srinivasa Rao Mandadapu
@ 2022-09-23 17:23   ` Krzysztof Kozlowski
  2022-09-27 13:17     ` Srinivasa Rao Mandadapu
  0 siblings, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2022-09-23 17:23 UTC (permalink / raw)
  To: Srinivasa Rao Mandadapu, linux-remoteproc, agross, andersson,
	lgirdwood, broonie, robh+dt, quic_plai, bgoswami, perex, tiwai,
	srinivas.kandagatla, quic_rohkumar, linux-arm-msm, linux-kernel,
	swboyd, judyhsiao, devicetree

On 23/09/2022 15:05, Srinivasa Rao Mandadapu wrote:
> Add ADSP PIL loading support for SC7280 SoCs.
> 
> Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
> Reviewed-by: Rob Herring <robh@kernel.org>
> Reviewed-by: Stephen Boyd <swboyd@chromium.org>
> ---
> Changes since V7:
> 	-- Remove redundant clocks in dt bindings.
> 	-- Fix dt compilation error in dt bindings.
> Changes since V6:
> 	-- Update glink-edge property.
> 	-- Add qcom,qmp property.
> Changes since V5:
> 	-- Remove qcom,adsp-memory-regions property.
> Changes since V4:
> 	-- Update halt registers description in dt bindings.
> 
>  .../bindings/remoteproc/qcom,sc7280-adsp-pil.yaml  | 207 +++++++++++++++++++++
>  1 file changed, 207 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,sc7280-adsp-pil.yaml
> 
> diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,sc7280-adsp-pil.yaml b/Documentation/devicetree/bindings/remoteproc/qcom,sc7280-adsp-pil.yaml
> new file mode 100644
> index 0000000..79ef3c0
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/remoteproc/qcom,sc7280-adsp-pil.yaml
> @@ -0,0 +1,207 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/remoteproc/qcom,sc7280-adsp-pil.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Qualcomm SC7280 ADSP Peripheral Image Loader
> +
> +maintainers:
> +  - Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
> +
> +description:
> +  This document describes the hardware for a component that loads and boots firmware
> +  on the Qualcomm Technology Inc. ADSP.
> +
> +properties:
> +  compatible:
> +    enum:
> +      - qcom,sc7280-adsp-pil
> +
> +  reg:
> +    minItems: 1
> +    items:
> +      - description: qdsp6ss register
> +      - description: efuse q6ss register

Why second IO address space is optional?

> +
> +  interrupts:
> +    items:
> +      - description: Watchdog interrupt
> +      - description: Fatal interrupt
> +      - description: Ready interrupt
> +      - description: Handover interrupt
> +      - description: Stop acknowledge interrupt
> +      - description: Shutdown acknowledge interrupt
> +
> +  interrupt-names:
> +    items:
> +      - const: wdog
> +      - const: fatal
> +      - const: ready
> +      - const: handover
> +      - const: stop-ack
> +      - const: shutdown-ack
> +
> +  clocks:
> +    items:
> +      - description: XO clock
> +      - description: GCC CFG NOC LPASS clock
> +
> +  clock-names:
> +    items:
> +      - const: xo
> +      - const: gcc_cfg_noc_lpass
> +
> +  power-domains:
> +    items:
> +      - description: LCX power domain
> +
> +  resets:
> +    items:
> +      - description: PDC AUDIO SYNC RESET
> +      - description: CC LPASS restart
> +
> +  reset-names:
> +    items:
> +      - const: pdc_sync
> +      - const: cc_lpass
> +
> +  memory-region:
> +    maxItems: 1
> +    description: Reference to the reserved-memory for the Hexagon core
> +
> +  qcom,halt-regs:
> +    $ref: /schemas/types.yaml#/definitions/phandle-array
> +    description:
> +      Phandle reference to a syscon representing TCSR followed by the
> +      four offsets within syscon for q6, CE, AXI and qv6 halt registers.
> +    items:
> +      items:

This has to be strictly defined, IOW, the second items must be already
an item of previous list. Look at the other mss-pil.

> +        - description: phandle to TCSR MUTEX
> +        - description: offset to q6 halt registers
> +        - description: offset to CE halt registers
> +        - description: offset to AXI halt registers
> +        - description: offset to qv6 halt registers
> +
> +  qcom,smem-states:
> +    $ref: /schemas/types.yaml#/definitions/phandle-array
> +    description: States used by the AP to signal the Hexagon core
> +    items:
> +      - description: Stop the modem
> +
> +  qcom,smem-state-names:
> +    description: The names of the state bits used for SMP2P output
> +    const: stop
> +
> +  qcom,qmp:
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description: Reference to the AOSS side-channel message RAM.
> +
> +  glink-edge:
> +    type: object

Missing ref to glink-edge and unevaluatedProperties:false. Please take a
look at recent
Documentation/devicetree/bindings/remoteproc/qcom,sc7180-mss-pil.yaml

> +    description: |
> +      Qualcomm G-Link subnode which represents communication edge, channels
> +      and devices related to the ADSP.
> +
> +    properties:
> +      interrupts:
> +        items:
> +          - description: IRQ from ADSP to GLINK

Skip interrupts and mboxes - both are coming from glink-edge.

> +
> +      mboxes:
> +        items:
> +          - description: Mailbox for communication between APPS and ADSP
> +
> +      label:
> +        description: The names of the state bits used for SMP2P output

Skip description

> +        items:
> +          - const: lpass

No items, just const: lpass

> +
> +      qcom,remote-pid:
> +        $ref: /schemas/types.yaml#/definitions/uint32
> +        description: ID of the shared memory used by GLINK for communication with ADSP

This can be dropped.

> +
> +      gpr: true
> +      apr: false
> +      fastrpc: false


BTW, all these three do not make sense without ref to glink-edge. After
adding ref, these seem reasonable.

> +
> +    required:
> +      - interrupts
> +      - mboxes
> +      - label
> +      - qcom,remote-pid
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - interrupt-names
> +  - clocks
> +  - clock-names
> +  - power-domains
> +  - resets
> +  - reset-names
> +  - qcom,halt-regs
> +  - memory-region
> +  - qcom,smem-states
> +  - qcom,smem-state-names
> +  - qcom,qmp
> +
> +additionalProperties: false

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v8 6/7] remoteproc: qcom: Add efuse evb selection control
  2022-09-23 13:05 ` [PATCH v8 6/7] remoteproc: qcom: Add efuse evb selection control Srinivasa Rao Mandadapu
@ 2022-09-23 17:25   ` Krzysztof Kozlowski
  2022-09-27 13:20     ` Srinivasa Rao Mandadapu
  0 siblings, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2022-09-23 17:25 UTC (permalink / raw)
  To: Srinivasa Rao Mandadapu, linux-remoteproc, agross, andersson,
	lgirdwood, broonie, robh+dt, quic_plai, bgoswami, perex, tiwai,
	srinivas.kandagatla, quic_rohkumar, linux-arm-msm, linux-kernel,
	swboyd, judyhsiao, devicetree

On 23/09/2022 15:05, Srinivasa Rao Mandadapu wrote:
> Add efuse evb selection control and enable it for starting ADSP.
> 
> Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
> Reviewed-by: Stephen Boyd <swboyd@chromium.org>
> Reviewed-by: Sibi Sankar <quic_sibis@quicinc.com>
> ---

Thank you for your patch. There is something to discuss/improve.

> @@ -543,6 +549,17 @@ static int adsp_init_mmio(struct qcom_adsp *adsp,
>  		return PTR_ERR(adsp->qdsp6ss_base);
>  	}
>  
> +	efuse_region = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> +	if (!efuse_region) {
> +		adsp->lpass_efuse = NULL;
> +		dev_dbg(adsp->dev, "failed to get efuse memory region\n");
> +	} else {

This needs bindings updates in all users.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v8 7/7] remoteproc: qcom: Add support for memory sandbox
  2022-09-23 13:05 ` [PATCH v8 7/7] remoteproc: qcom: Add support for memory sandbox Srinivasa Rao Mandadapu
@ 2022-09-23 17:26   ` Krzysztof Kozlowski
  2022-09-27 13:21     ` Srinivasa Rao Mandadapu
  0 siblings, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2022-09-23 17:26 UTC (permalink / raw)
  To: Srinivasa Rao Mandadapu, linux-remoteproc, agross, andersson,
	lgirdwood, broonie, robh+dt, quic_plai, bgoswami, perex, tiwai,
	srinivas.kandagatla, quic_rohkumar, linux-arm-msm, linux-kernel,
	swboyd, judyhsiao, devicetree

On 23/09/2022 15:05, Srinivasa Rao Mandadapu wrote:
> Update pil driver with SMMU mapping for allowing authorised
> memory access to ADSP firmware, by carveout reserved adsp memory
> region from device tree file.
> 


Thank you for your patch. There is something to discuss/improve.

> +	if (!rproc->domain)
> +		return -EINVAL;
> +
> +	ret = of_parse_phandle_with_args(adsp->dev->of_node, "iommus", "#iommu-cells", 0, &args);

I think your bindings do not allow iommus property.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v8 1/7] dt-bindings: remoteproc: qcom: Add SC7280 ADSP support
  2022-09-23 17:23   ` Krzysztof Kozlowski
@ 2022-09-27 13:17     ` Srinivasa Rao Mandadapu
  0 siblings, 0 replies; 14+ messages in thread
From: Srinivasa Rao Mandadapu @ 2022-09-27 13:17 UTC (permalink / raw)
  To: Krzysztof Kozlowski, linux-remoteproc, agross, andersson,
	lgirdwood, broonie, robh+dt, quic_plai, bgoswami, perex, tiwai,
	srinivas.kandagatla, quic_rohkumar, linux-arm-msm, linux-kernel,
	swboyd, judyhsiao, devicetree


On 9/23/2022 10:53 PM, Krzysztof Kozlowski wrote:
Thanks for Your time Krzyszto!!!
> On 23/09/2022 15:05, Srinivasa Rao Mandadapu wrote:
>> Add ADSP PIL loading support for SC7280 SoCs.
>>
>> Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
>> Reviewed-by: Rob Herring <robh@kernel.org>
>> Reviewed-by: Stephen Boyd <swboyd@chromium.org>
>> ---
>> Changes since V7:
>> 	-- Remove redundant clocks in dt bindings.
>> 	-- Fix dt compilation error in dt bindings.
>> Changes since V6:
>> 	-- Update glink-edge property.
>> 	-- Add qcom,qmp property.
>> Changes since V5:
>> 	-- Remove qcom,adsp-memory-regions property.
>> Changes since V4:
>> 	-- Update halt registers description in dt bindings.
>>
>>   .../bindings/remoteproc/qcom,sc7280-adsp-pil.yaml  | 207 +++++++++++++++++++++
>>   1 file changed, 207 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,sc7280-adsp-pil.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,sc7280-adsp-pil.yaml b/Documentation/devicetree/bindings/remoteproc/qcom,sc7280-adsp-pil.yaml
>> new file mode 100644
>> index 0000000..79ef3c0
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/remoteproc/qcom,sc7280-adsp-pil.yaml
>> @@ -0,0 +1,207 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/remoteproc/qcom,sc7280-adsp-pil.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Qualcomm SC7280 ADSP Peripheral Image Loader
>> +
>> +maintainers:
>> +  - Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
>> +
>> +description:
>> +  This document describes the hardware for a component that loads and boots firmware
>> +  on the Qualcomm Technology Inc. ADSP.
>> +
>> +properties:
>> +  compatible:
>> +    enum:
>> +      - qcom,sc7280-adsp-pil
>> +
>> +  reg:
>> +    minItems: 1
>> +    items:
>> +      - description: qdsp6ss register
>> +      - description: efuse q6ss register
> Why second IO address space is optional?
Yeah, both are required for SC7280. will remove minItems.
>
>> +
>> +  interrupts:
>> +    items:
>> +      - description: Watchdog interrupt
>> +      - description: Fatal interrupt
>> +      - description: Ready interrupt
>> +      - description: Handover interrupt
>> +      - description: Stop acknowledge interrupt
>> +      - description: Shutdown acknowledge interrupt
>> +
>> +  interrupt-names:
>> +    items:
>> +      - const: wdog
>> +      - const: fatal
>> +      - const: ready
>> +      - const: handover
>> +      - const: stop-ack
>> +      - const: shutdown-ack
>> +
>> +  clocks:
>> +    items:
>> +      - description: XO clock
>> +      - description: GCC CFG NOC LPASS clock
>> +
>> +  clock-names:
>> +    items:
>> +      - const: xo
>> +      - const: gcc_cfg_noc_lpass
>> +
>> +  power-domains:
>> +    items:
>> +      - description: LCX power domain
>> +
>> +  resets:
>> +    items:
>> +      - description: PDC AUDIO SYNC RESET
>> +      - description: CC LPASS restart
>> +
>> +  reset-names:
>> +    items:
>> +      - const: pdc_sync
>> +      - const: cc_lpass
>> +
>> +  memory-region:
>> +    maxItems: 1
>> +    description: Reference to the reserved-memory for the Hexagon core
>> +
>> +  qcom,halt-regs:
>> +    $ref: /schemas/types.yaml#/definitions/phandle-array
>> +    description:
>> +      Phandle reference to a syscon representing TCSR followed by the
>> +      four offsets within syscon for q6, CE, AXI and qv6 halt registers.
>> +    items:
>> +      items:
> This has to be strictly defined, IOW, the second items must be already
> an item of previous list. Look at the other mss-pil.
Okay. Will modify as per mss-pil.
>
>> +        - description: phandle to TCSR MUTEX
>> +        - description: offset to q6 halt registers
>> +        - description: offset to CE halt registers
>> +        - description: offset to AXI halt registers
>> +        - description: offset to qv6 halt registers
>> +
>> +  qcom,smem-states:
>> +    $ref: /schemas/types.yaml#/definitions/phandle-array
>> +    description: States used by the AP to signal the Hexagon core
>> +    items:
>> +      - description: Stop the modem
>> +
>> +  qcom,smem-state-names:
>> +    description: The names of the state bits used for SMP2P output
>> +    const: stop
>> +
>> +  qcom,qmp:
>> +    $ref: /schemas/types.yaml#/definitions/phandle
>> +    description: Reference to the AOSS side-channel message RAM.
>> +
>> +  glink-edge:
>> +    type: object
> Missing ref to glink-edge and unevaluatedProperties:false. Please take a
> look at recent
> Documentation/devicetree/bindings/remoteproc/qcom,sc7180-mss-pil.yaml
Okay. Will add reference to glink-edge.
>
>> +    description: |
>> +      Qualcomm G-Link subnode which represents communication edge, channels
>> +      and devices related to the ADSP.
>> +
>> +    properties:
>> +      interrupts:
>> +        items:
>> +          - description: IRQ from ADSP to GLINK
> Skip interrupts and mboxes - both are coming from glink-edge.
Okay. Will remove it. But Same is followed in mss-pil
>
>> +
>> +      mboxes:
>> +        items:
>> +          - description: Mailbox for communication between APPS and ADSP
>> +
>> +      label:
>> +        description: The names of the state bits used for SMP2P output
> Skip description
Okay.
>
>> +        items:
>> +          - const: lpass
> No items, just const: lpass
Okay.
>
>> +
>> +      qcom,remote-pid:
>> +        $ref: /schemas/types.yaml#/definitions/uint32
>> +        description: ID of the shared memory used by GLINK for communication with ADSP
> This can be dropped.
Okay. Will remove qcom,remote-pid.
>
>> +
>> +      gpr: true
>> +      apr: false
>> +      fastrpc: false
>
> BTW, all these three do not make sense without ref to glink-edge. After
> adding ref, these seem reasonable.
Okay. will add glink-edge reference.
>
>> +
>> +    required:
>> +      - interrupts
>> +      - mboxes
>> +      - label
>> +      - qcom,remote-pid
>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +  - interrupts
>> +  - interrupt-names
>> +  - clocks
>> +  - clock-names
>> +  - power-domains
>> +  - resets
>> +  - reset-names
>> +  - qcom,halt-regs
>> +  - memory-region
>> +  - qcom,smem-states
>> +  - qcom,smem-state-names
>> +  - qcom,qmp
>> +
>> +additionalProperties: false
> Best regards,
> Krzysztof
>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v8 6/7] remoteproc: qcom: Add efuse evb selection control
  2022-09-23 17:25   ` Krzysztof Kozlowski
@ 2022-09-27 13:20     ` Srinivasa Rao Mandadapu
  0 siblings, 0 replies; 14+ messages in thread
From: Srinivasa Rao Mandadapu @ 2022-09-27 13:20 UTC (permalink / raw)
  To: Krzysztof Kozlowski, linux-remoteproc, agross, andersson,
	lgirdwood, broonie, robh+dt, quic_plai, bgoswami, perex, tiwai,
	srinivas.kandagatla, quic_rohkumar, linux-arm-msm, linux-kernel,
	swboyd, judyhsiao, devicetree


On 9/23/2022 10:55 PM, Krzysztof Kozlowski wrote:
Thanks for Your time Krzyszto!!!
> On 23/09/2022 15:05, Srinivasa Rao Mandadapu wrote:
>> Add efuse evb selection control and enable it for starting ADSP.
>>
>> Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
>> Reviewed-by: Stephen Boyd <swboyd@chromium.org>
>> Reviewed-by: Sibi Sankar <quic_sibis@quicinc.com>
>> ---
> Thank you for your patch. There is something to discuss/improve.
>
>> @@ -543,6 +549,17 @@ static int adsp_init_mmio(struct qcom_adsp *adsp,
>>   		return PTR_ERR(adsp->qdsp6ss_base);
>>   	}
>>   
>> +	efuse_region = platform_get_resource(pdev, IORESOURCE_MEM, 1);
>> +	if (!efuse_region) {
>> +		adsp->lpass_efuse = NULL;
>> +		dev_dbg(adsp->dev, "failed to get efuse memory region\n");
>> +	} else {
> This needs bindings updates in all users.

Actually this is being used in SC7280 platform only. I am not sure if it 
applicable for other platforms.

If required, it can be posted as new series after this series got main 
lined.

>
> Best regards,
> Krzysztof
>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v8 7/7] remoteproc: qcom: Add support for memory sandbox
  2022-09-23 17:26   ` Krzysztof Kozlowski
@ 2022-09-27 13:21     ` Srinivasa Rao Mandadapu
  0 siblings, 0 replies; 14+ messages in thread
From: Srinivasa Rao Mandadapu @ 2022-09-27 13:21 UTC (permalink / raw)
  To: Krzysztof Kozlowski, linux-remoteproc, agross, andersson,
	lgirdwood, broonie, robh+dt, quic_plai, bgoswami, perex, tiwai,
	srinivas.kandagatla, quic_rohkumar, linux-arm-msm, linux-kernel,
	swboyd, judyhsiao, devicetree


On 9/23/2022 10:56 PM, Krzysztof Kozlowski wrote:
Thanks for Your time Krzyszto!!!
> On 23/09/2022 15:05, Srinivasa Rao Mandadapu wrote:
>> Update pil driver with SMMU mapping for allowing authorised
>> memory access to ADSP firmware, by carveout reserved adsp memory
>> region from device tree file.
>>
>
> Thank you for your patch. There is something to discuss/improve.
>
>> +	if (!rproc->domain)
>> +		return -EINVAL;
>> +
>> +	ret = of_parse_phandle_with_args(adsp->dev->of_node, "iommus", "#iommu-cells", 0, &args);
> I think your bindings do not allow iommus property.
Okay. Will add iommus in dt-bindings.
>
> Best regards,
> Krzysztof
>

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-09-27 13:36 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-23 13:05 [PATCH v8 0/7] Update ADSP pil loader for SC7280 platform Srinivasa Rao Mandadapu
2022-09-23 13:05 ` [PATCH v8 1/7] dt-bindings: remoteproc: qcom: Add SC7280 ADSP support Srinivasa Rao Mandadapu
2022-09-23 17:23   ` Krzysztof Kozlowski
2022-09-27 13:17     ` Srinivasa Rao Mandadapu
2022-09-23 13:05 ` [PATCH v8 2/7] remoteproc: qcom: Add flag in adsp private data structure Srinivasa Rao Mandadapu
2022-09-23 13:05 ` [PATCH v8 3/7] remoteproc: qcom: Add compatible name for SC7280 ADSP Srinivasa Rao Mandadapu
2022-09-23 13:05 ` [PATCH v8 4/7] remoteproc: qcom: Update rproc parse firmware callback Srinivasa Rao Mandadapu
2022-09-23 13:05 ` [PATCH v8 5/7] remoteproc: qcom: Replace hard coded values with macros Srinivasa Rao Mandadapu
2022-09-23 13:05 ` [PATCH v8 6/7] remoteproc: qcom: Add efuse evb selection control Srinivasa Rao Mandadapu
2022-09-23 17:25   ` Krzysztof Kozlowski
2022-09-27 13:20     ` Srinivasa Rao Mandadapu
2022-09-23 13:05 ` [PATCH v8 7/7] remoteproc: qcom: Add support for memory sandbox Srinivasa Rao Mandadapu
2022-09-23 17:26   ` Krzysztof Kozlowski
2022-09-27 13:21     ` Srinivasa Rao Mandadapu

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).