Skip to contentSkip to conversation

Qualcomm AOSS QMP driver and modem dts

PATCH In review Bjorn Andersson 4 participants 15 messages Feb 6, 2019 – Mar 26, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v6 cover Qualcomm AOSS QMP driver and modem dts

Update the reserved memory map for SDM845, add the ADSP and CDSP nodes, introduce a communication driver for the AOSS and a PD driver for this and finally add the modem remoteproc driver.

Bjorn Andersson (7):
arm64: dts: qcom: sdm845: Update reserved memory map
arm64: dts: qcom: sdm845: Define rmtfs memory
arm64: dts: sdm845: Introduce ADSP and CDSP PAS nodes
dt-bindings: soc: qcom: Add AOSS QMP binding
soc: qcom: Add AOSS QMP communication driver
soc: qcom: Add AOSS QMP genpd provider
arm64: dts: qcom: Add AOSS QMP node

Sibi Sankar (1):
arm64: dts: qcom: sdm845: Add Q6V5 MSS node

 .../bindings/soc/qcom/qcom,aoss-qmp.txt       |  76 ++++
 arch/arm64/boot/dts/qcom/sdm845-mtp.dts       |   8 +
 arch/arm64/boot/dts/qcom/sdm845.dtsi          | 209 ++++++++++-
 drivers/soc/qcom/Kconfig                      |  18 +
 drivers/soc/qcom/Makefile                     |   2 +
 drivers/soc/qcom/aoss-qmp-pd.c                | 158 +++++++++
 drivers/soc/qcom/aoss-qmp.c                   | 326 ++++++++++++++++++
 include/dt-bindings/power/qcom-aoss-qmp.h     |  15 +
 include/linux/soc/qcom/aoss-qmp.h             |  14 +
 9 files changed, 819 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,aoss-qmp.txt
 create mode 100644 drivers/soc/qcom/aoss-qmp-pd.c
 create mode 100644 drivers/soc/qcom/aoss-qmp.c
 create mode 100644 include/dt-bindings/power/qcom-aoss-qmp.h
 create mode 100644 include/linux/soc/qcom/aoss-qmp.h
Signature · 1 line
2.18.0
#1 lore raw

PATCH v6 1/8 arm64: dts: qcom: sdm845: Update reserved memory map

Update existing and add missing regions to the reserved memory map, as described in version 10.

---

Changes since v5:
- Replaced a few 0x0 with 0
- Corrected size of tz_mem

 arch/arm64/boot/dts/qcom/sdm845.dtsi | 74 +++++++++++++++++++++++++---
 1 file changed, 67 insertions(+), 7 deletions(-)
arch/arm64/boot/dts/qcom/sdm845.dtsi +67 -7
index ade2f385507c..16a060063882 100644
@@ -72,29 +72,69 @@
 		#size-cells = <2>;
 		ranges;
 
-		memory@85fc0000 {
+		hyp_mem: memory@85700000 {
+			reg = <0 0x85700000 0 0x600000>;
+			no-map;
+		};
+
+		xbl_mem: memory@85e00000 {
+			reg = <0 0x85e00000 0 0x100000>;
+			no-map;
+		};
+
+		aop_mem: memory@85fc0000 {
 			reg = <0 0x85fc0000 0 0x20000>;
 			no-map;
 		};
 
-		memory@85fe0000 {
+		aop_cmd_db_mem: memory@85fe0000 {
 			compatible = "qcom,cmd-db";
-			reg = <0x0 0x85fe0000 0x0 0x20000>;
+			reg = <0x0 0x85fe0000 0 0x20000>;
 			no-map;
 		};
 
 		smem_mem: memory@86000000 {
-			reg = <0x0 0x86000000 0x0 0x200000>;
+			reg = <0x0 0x86000000 0 0x200000>;
 			no-map;
 		};
 
-		memory@86200000 {
+		tz_mem: memory@86200000 {
 			reg = <0 0x86200000 0 0x2d00000>;
 			no-map;
 		};
 
-		wlan_msa_mem: memory@96700000 {
-			reg = <0 0x96700000 0 0x100000>;
+		qseecom_mem: memory@8ab00000 {
+			reg = <0 0x8ab00000 0 0x1400000>;
+			no-map;
+		};
+
+		camera_mem: memory@8bf00000 {
+			reg = <0 0x8bf00000 0 0x500000>;
+			no-map;
+		};
+
+		ipa_fw_mem: memory@8c400000 {
+			reg = <0 0x8c400000 0 0x10000>;
+			no-map;
+		};
+
+		ipa_gsi_mem: memory@8c410000 {
+			reg = <0 0x8c410000 0 0x5000>;
+			no-map;
+		};
+
+		gpu_mem: memory@8c415000 {
+			reg = <0 0x8c415000 0 0x2000>;
+			no-map;
+		};
+
+		adsp_mem: memory@8c500000 {
+			reg = <0 0x8c500000 0 0x1a00000>;
+			no-map;
+		};
+
+		wlan_msa_mem: memory@8df00000 {
+			reg = <0 0x8df00000 0 0x100000>;
 			no-map;
 		};
 
@@ -103,10 +143,30 @@
 			no-map;
 		};
 
+		venus_mem: memory@95800000 {
+			reg = <0 0x95800000 0 0x500000>;
+			no-map;
+		};
+
+		cdsp_mem: memory@95d00000 {
+			reg = <0 0x95d00000 0 0x800000>;
+			no-map;
+		};
+
 		mba_region: memory@96500000 {
 			reg = <0 0x96500000 0 0x200000>;
 			no-map;
 		};
+
+		slpi_mem: memory@96700000 {
+			reg = <0 0x96700000 0 0x1400000>;
+			no-map;
+		};
+
+		spss_mem: memory@97b00000 {
+			reg = <0 0x97b00000 0 0x100000>;
+			no-map;
+		};
 	};
 
 	cpus {
Signature · 1 line
2.18.0
#2 lore raw

PATCH v6 2/8 arm64: dts: qcom: sdm845: Define rmtfs memory

In reply to Bjorn Andersson

Define the rmtfs memory node. As the memory region specified in version 10 of the memory map is only 1MB a chunk of unallocated memory is chosen.

---

Changes since v5:
- Corrected unit address

 arch/arm64/boot/dts/qcom/sdm845.dtsi | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm64/boot/dts/qcom/sdm845.dtsi +9 -0
index 16a060063882..a33d27b3a389 100644
@@ -103,6 +103,15 @@
 			no-map;
 		};
 
+		rmtfs_mem: memory@88f00000 {
+			compatible = "qcom,rmtfs-mem";
+			reg = <0 0x88f00000 0 0x200000>;
+			no-map;
+
+			qcom,client-id = <1>;
+			qcom,vmid = <15>;
+		};
+
 		qseecom_mem: memory@8ab00000 {
 			reg = <0 0x8ab00000 0 0x1400000>;
 			no-map;
Signature · 1 line
2.18.0
#3 lore raw

PATCH v6 3/8 arm64: dts: sdm845: Introduce ADSP and CDSP PAS nodes

In reply to Bjorn Andersson

Add the Audio DSP (ADSP) and Compute DSP (CDSP) nodes for TrustZone based remoteproc, supporting booting these cores on e.g. the MTP, and enable the same for the MTP.

---

Changes since v5:
- None

 arch/arm64/boot/dts/qcom/sdm845-mtp.dts |  8 ++++
 arch/arm64/boot/dts/qcom/sdm845.dtsi    | 58 +++++++++++++++++++++++++
 2 files changed, 66 insertions(+)
arch/arm64/boot/dts/qcom/sdm845-mtp.dts +8 -0
index 89071463a84a..2e78638eb73b 100644
@@ -48,6 +48,10 @@
 	};
 };
 
+&adsp_pas {
+	status = "okay";
+};
+
 &apps_rsc {
 	pm8998-rpmh-regulators {
 		compatible = "qcom,pm8998-rpmh-regulators";
@@ -344,6 +348,10 @@
 	};
 };
 
+&cdsp_pas {
+	status = "okay";
+};
+
 &gcc {
 	protected-clocks = <GCC_QSPI_CORE_CLK>,
 			   <GCC_QSPI_CORE_CLK_SRC>,
arch/arm64/boot/dts/qcom/sdm845.dtsi +58 -0

64 lines not on this page · raw message

Signature · 1 line
2.18.0
#4 lore raw

PATCH v6 4/8 dt-bindings: soc: qcom: Add AOSS QMP binding

In reply to Bjorn Andersson

Add binding for the QMP based side-channel communication mechanism to the AOSS, which is used to control resources not exposed through the RPMh interface.

---

Changes since v5:
- None

 .../bindings/soc/qcom/qcom,aoss-qmp.txt       | 76 +++++++++++++++++++
 include/dt-bindings/power/qcom-aoss-qmp.h     | 15 ++++
 2 files changed, 91 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,aoss-qmp.txt
 create mode 100644 include/dt-bindings/power/qcom-aoss-qmp.h
Documentation/devicetree/bindings/soc/qcom/qcom,aoss-qmp.txt new file +76 -0
new file mode 100644
index 000000000000..9ce6c42192ad
@@ -0,0 +1,76 @@
+Qualcomm Always-On Subsystem side channel binding
+
+This binding describes the hardware component responsible for side channel
+requests to the always-on subsystem (AOSS), used for certain power management
+requests that is not handled by the standard RPMh interface. Each client in the
+SoC has it's own block of message RAM and IRQ for communication with the AOSS.
+The protocol used to communicate in the message RAM is known as Qualcomm
+Messagin Protocol (QMP)
+
+The AOSS side channel exposes control over a set of resources, used to control
+a set of debug related clocks and to affect the low power state of resources
+related to the secondary subsystems. These resources are exposed as a set of
+power-domains.
+
+- compatible:
+	Usage: required
+	Value type: <string>
+	Definition: must be "qcom,sdm845-aoss-qmp"
+
+- reg:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: the base address and size of the message RAM for this
+		    client's communication with the AOSS
+
+- interrupts:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: should specify the AOSS message IRQ for this client
+
+- mboxes:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: reference to the mailbox representing the outgoing doorbell
+		    in APCS for this client, as described in mailbox/mailbox.txt
+
+- #power-domain-cells:
+	Usage: optional
+	Value type: <u32>
+	Definition: must be 1
+		    The provided power-domains are:
+		    QDSS clock-domain (0), CDSP state (1), LPASS state (2),
+		    modem state (3), SLPI state (4), SPSS state (5) and Venus
+		    state (6).
+
+= SUBNODES
+The AOSS side channel also provides the controls for three cooling devices,
+these are expressed as subnodes of the QMP node. The name of the node is used
+to identify the resource and must therefor be "cx", "mx" or "ebi".
+
+- #cooling-cells:
+	Usage: optional
+	Value type: <u32>
+	Definition: must be 2
+
+= EXAMPLE
+
+The following example represents the AOSS side-channel message RAM and the
+mechanism exposing the power-domains, as found in SDM845.
+
+  aoss_qmp: qmp@c300000 {
+	  compatible = "qcom,sdm845-aoss-qmp";
+	  reg = <0x0c300000 0x100000>;
+	  interrupts = <GIC_SPI 389 IRQ_TYPE_EDGE_RISING>;
+	  mboxes = <&apss_shared 0>;
+
+	  #power-domain-cells = <1>;
+
+	  cx_cdev: cx {
+		#cooling-cells = <2>;
+	  };
+
+	  mx_cdev: mx {
+		#cooling-cells = <2>;
+	  };
+  };
include/dt-bindings/power/qcom-aoss-qmp.h new file +15 -0
new file mode 100644
index 000000000000..7d8ac1a4f90c
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright (c) 2018, Linaro Ltd. */
+
+#ifndef __DT_BINDINGS_POWER_QCOM_AOSS_QMP_H
+#define __DT_BINDINGS_POWER_QCOM_AOSS_QMP_H
+
+#define AOSS_QMP_QDSS_CLK	0
+#define AOSS_QMP_LS_CDSP		1
+#define AOSS_QMP_LS_LPASS	2
+#define AOSS_QMP_LS_MODEM	3
+#define AOSS_QMP_LS_SLPI		4
+#define AOSS_QMP_LS_SPSS		5
+#define AOSS_QMP_LS_VENUS	6
+
+#endif
Signature · 1 line
2.18.0
#5 lore raw

PATCH v6 5/8 soc: qcom: Add AOSS QMP communication driver

In reply to Bjorn Andersson

The AOSS QMP driver is used to communicate with the AOSS for certain side-channel requests, that are not enabled through the RPMh interface.

The communication is a very simple synchronous mechanism of messages being written in message RAM and a doorbell in the AOSS is rung. As the AOSS has processed the message length is cleared and an interrupt is fired by the AOSS as acknowledgment.

---

Changes since v5:
- Remove wait for event when checking magic
- Kick after signaling channel up
- Fail probe if registration of child device fails
- Fix ordering in remove

 drivers/soc/qcom/Kconfig          |   9 +
 drivers/soc/qcom/Makefile         |   1 +
 drivers/soc/qcom/aoss-qmp.c       | 326 ++++++++++++++++++++++++++++++
 include/linux/soc/qcom/aoss-qmp.h |  14 ++
 4 files changed, 350 insertions(+)
 create mode 100644 drivers/soc/qcom/aoss-qmp.c
 create mode 100644 include/linux/soc/qcom/aoss-qmp.h
drivers/soc/qcom/Kconfig +9 -0
index 1ee298f6bf17..28ab19bf8c98 100644
@@ -3,6 +3,15 @@
 #
 menu "Qualcomm SoC drivers"
 
+config QCOM_AOSS_QMP
+	tristate "Qualcomm AOSS Messaging Driver"
+	depends on ARCH_QCOM || COMPILE_TEST
+	depends on MAILBOX
+	help
+	  This driver provides the means for communicating with the
+	  micro-controller in the AOSS, using QMP, to control certain resource
+	  that are not exposed through RPMh.
+
 config QCOM_COMMAND_DB
 	bool "Qualcomm Command DB"
 	depends on ARCH_QCOM || COMPILE_TEST
drivers/soc/qcom/Makefile +1 -0
index ffe519b0cb66..2c04d27fbf9e 100644
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 CFLAGS_rpmh-rsc.o := -I$(src)
+obj-$(CONFIG_QCOM_AOSS_QMP) +=	aoss-qmp.o
 obj-$(CONFIG_QCOM_GENI_SE) +=	qcom-geni-se.o
 obj-$(CONFIG_QCOM_COMMAND_DB) += cmd-db.o
 obj-$(CONFIG_QCOM_GLINK_SSR) +=	glink_ssr.o
drivers/soc/qcom/aoss-qmp.c new file +326 -0

326 lines not on this page · raw message

include/linux/soc/qcom/aoss-qmp.h new file +14 -0
new file mode 100644
index 000000000000..a2ac891d7fd4
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2018, Linaro Ltd
+ */
+#ifndef __AOP_QMP_H__
+#define __AOP_QMP_H__
+
+#include <linux/types.h>
+
+struct qmp;
+
+int qmp_send(struct qmp *qmp, const void *data, size_t len);
+
+#endif
Signature · 1 line
2.18.0
#6 lore raw

Re: [PATCH v6 5/8] soc: qcom: Add AOSS QMP communication driver

Hi,

drivers/soc/qcom/aoss-qmp.c line 281

Quoted 7 lines · Bjorn Andersson
drivers/soc/qcom/aoss-qmp.c new file +7 -0
+       if (of_property_read_bool(pdev->dev.of_node, "#power-domain-cells")) {
+               qmp->pd_pdev = platform_device_register_data(&pdev->dev,
+                                                            "aoss_qmp_pd",
+                                                            PLATFORM_DEVID_NONE,
+                                                            NULL, 0);
+               if (IS_ERR(qmp->pd_pdev)) {
+                       dev_err(&pdev->dev, "failed to register AOSS PD\n");

nit: not worth spinning just for this, but if you happen to spin you could print the error number in your message.

drivers/soc/qcom/aoss-qmp.c line 285

Quoted 4 lines
drivers/soc/qcom/aoss-qmp.c new file +4 -0
+                       ret = PTR_ERR(qmp->pd_pdev);
+                       goto err_close_qmp;
+               }
+       }

As discussed in v5 I wonder if the complexity of a separate driver is really worth it or if everything would be a lot easier to just link the two ".c" files together. Now that it's a full error case if "aoss_qmp_pd" doesn't probe I'd vote for linking the two ".c" files together, but part of that is because I don't really want to dig into all the details of how you're supposed to call platform_device_register_data() for sub-devices and double-checking that you've got all the corner cases correct.

...NOTE: presumably if you just change it to a straight-up function call then you can also get rid of the above "dev_err" since (presumably) you'll know that the init code of aoss_qmp_pd will print any relevant errors?

-Doug

#7 lore raw

PATCH v6 6/8 soc: qcom: Add AOSS QMP genpd provider

In reply to Bjorn Andersson

The AOSS QMP genpd provider implements control over power-related resources related to low-power state associated with the remoteprocs in the system as well as control over a set of clocks related to debug hardware in the SoC.

---

Changes since v5:
- Clear outgoing buffer, to avoid sending unitialized stack content to AOP
- Fix domain initialization
- Clean up domains on failure and remove

 drivers/soc/qcom/Kconfig       |   9 ++
 drivers/soc/qcom/Makefile      |   1 +
 drivers/soc/qcom/aoss-qmp-pd.c | 158 +++++++++++++++++++++++++++++++++
 3 files changed, 168 insertions(+)
 create mode 100644 drivers/soc/qcom/aoss-qmp-pd.c
drivers/soc/qcom/Kconfig +9 -0
index 28ab19bf8c98..893b56b70957 100644
@@ -12,6 +12,15 @@ config QCOM_AOSS_QMP
 	  micro-controller in the AOSS, using QMP, to control certain resource
 	  that are not exposed through RPMh.
 
+config QCOM_AOSS_QMP_PD
+	tristate "Qualcomm AOSS Messaging Power Domain driver"
+	depends on QCOM_AOSS_QMP
+	select PM_GENERIC_DOMAINS
+	help
+	  This driver provides the means of controlling the AOSS's handling of
+	  low-power state for resources related to the remoteproc subsystems as
+	  well as controlling the debug clocks.
+
 config QCOM_COMMAND_DB
 	bool "Qualcomm Command DB"
 	depends on ARCH_QCOM || COMPILE_TEST
drivers/soc/qcom/Makefile +1 -0
index 2c04d27fbf9e..16913e73fddf 100644
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 CFLAGS_rpmh-rsc.o := -I$(src)
 obj-$(CONFIG_QCOM_AOSS_QMP) +=	aoss-qmp.o
+obj-$(CONFIG_QCOM_AOSS_QMP_PD) += aoss-qmp-pd.o
 obj-$(CONFIG_QCOM_GENI_SE) +=	qcom-geni-se.o
 obj-$(CONFIG_QCOM_COMMAND_DB) += cmd-db.o
 obj-$(CONFIG_QCOM_GLINK_SSR) +=	glink_ssr.o
drivers/soc/qcom/aoss-qmp-pd.c new file +158 -0

158 lines not on this page · raw message

Signature · 1 line
2.18.0
#8 lore raw

Re: [PATCH v6 6/8] soc: qcom: Add AOSS QMP genpd provider

Hi,

drivers/soc/qcom/aoss-qmp-pd.c line 51

Quoted 5 lines · Bjorn Andersson
drivers/soc/qcom/aoss-qmp-pd.c new file +5 -0
+static int qmp_pd_image_toggle(struct qmp_pd *res, bool enable)
+{
+       char buf[AOSS_QMP_PD_MSG_LEN];
+
+       memset(buf, 0, sizeof(buf));

Personally I find it safer/cleaner to do something like:

char buf[AOSS_QMP_PD_MSG_LEN] = { };

...but I won't insist. If you change this, change in qmp_pd_clock_toggle() too.

Quoted 26 lines
drivers/soc/qcom/aoss-qmp-pd.c new file +26 -0
+static int qmp_pd_probe(struct platform_device *pdev)
+{
+       struct genpd_onecell_data *data;
+       struct device *parent = pdev->dev.parent;
+       struct qmp_pd *res;
+       struct qmp *qmp;
+       size_t num = ARRAY_SIZE(sdm845_resources);
+       int ret;
+       int i;
+
+       qmp = dev_get_drvdata(pdev->dev.parent);
+       if (!qmp)
+               return -EINVAL;
+
+       res = devm_kcalloc(&pdev->dev, num, sizeof(*res), GFP_KERNEL);
+       if (!res)
+               return -ENOMEM;
+
+       data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
+       if (!data)
+               return -ENOMEM;
+
+       data->domains = devm_kcalloc(&pdev->dev, num, sizeof(*data->domains),
+                                    GFP_KERNEL);
+       if (!data->domains)
+               return -ENOMEM;

drivers/soc/qcom/aoss-qmp-pd.c line 113

Quoted 10 lines
drivers/soc/qcom/aoss-qmp-pd.c new file +10 -0
+
+       for (i = 0; i < num; i++) {
+               res[i].qmp = qmp;
+               res[i].pd.name = sdm845_resources[i].name;
+               res[i].pd.power_on = sdm845_resources[i].on;
+               res[i].pd.power_off = sdm845_resources[i].off;
+
+               ret = pm_genpd_init(&res[i].pd, NULL, true);
+               if (ret < 0) {
+                       dev_err(&pdev->dev, "failed to init genpd\n");

It's often nice to print the error number (ret) in the message.

drivers/soc/qcom/aoss-qmp-pd.c line 124

Quoted 11 lines
drivers/soc/qcom/aoss-qmp-pd.c new file +11 -0
+                       goto unroll_genpds;
+               }
+
+               data->domains[i] = &res[i].pd;
+       }
+
+       data->num_domains = i;
+
+       platform_set_drvdata(pdev, data);
+
+       return of_genpd_add_provider_onecell(parent->of_node, data);

Now that you have error handling (the calls to "pm_genpd_remove"), you can't just do this. You need:

ret = of_genpd_add_provider_onecell(parent->of_node, data); if (!ret)
return 0;

Quoted 7 lines
drivers/soc/qcom/aoss-qmp-pd.c new file +7 -0
+unroll_genpds:
+       for (i--; i >= 0; i--)
+               pm_genpd_remove(data->domains[i]);
+
+       return ret;
+}
+

drivers/soc/qcom/aoss-qmp-pd.c line 142

Quoted 10 lines
drivers/soc/qcom/aoss-qmp-pd.c new file +10 -0
+static int qmp_pd_remove(struct platform_device *pdev)
+{
+       struct device *parent = pdev->dev.parent;
+       struct genpd_onecell_data *data = platform_get_drvdata(pdev);
+       int i;
+
+       of_genpd_del_provider(parent->of_node);
+
+       for (i = 0; i < data->num_domains; i++)
+               pm_genpd_remove(data->domains[i]);

I presume it doesn't matter, but if you truly want to be the inverse of the "probe" then you'd want to iterate starting at "num_domains - 1" and go to 0.

-Doug

#9 lore raw

PATCH v6 7/8 arm64: dts: qcom: Add AOSS QMP node

In reply to Bjorn Andersson

The AOSS QMP provides a number of power domains, used for QDSS and PIL, add the node for this.

---

Changes since v5:
- None

 arch/arm64/boot/dts/qcom/sdm845.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm64/boot/dts/qcom/sdm845.dtsi +10 -0
index 12efbdb1fa2e..560c16616ee6 100644
@@ -13,6 +13,7 @@
 #include <dt-bindings/clock/qcom,videocc-sdm845.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/phy/phy-qcom-qusb2.h>
+#include <dt-bindings/power/qcom-aoss-qmp.h>
 #include <dt-bindings/power/qcom-rpmpd.h>
 #include <dt-bindings/reset/qcom,sdm845-aoss.h>
 #include <dt-bindings/reset/qcom,sdm845-pdc.h>
@@ -2080,6 +2081,15 @@
 			#reset-cells = <1>;
 		};
 
+		aoss_qmp: qmp@c300000 {
+			compatible = "qcom,sdm845-aoss-qmp";
+			reg = <0 0x0c300000 0 0x100000>;
+			interrupts = <GIC_SPI 389 IRQ_TYPE_EDGE_RISING>;
+			mboxes = <&apss_shared 0>;
+
+			#power-domain-cells = <1>;
+		};
+
 		spmi_bus: spmi@c440000 {
 			compatible = "qcom,spmi-pmic-arb";
 			reg = <0 0x0c440000 0 0x1100>,
Signature · 1 line
2.18.0
#10 lore raw

PATCH v6 8/8 arm64: dts: qcom: sdm845: Add Q6V5 MSS node

In reply to Bjorn Andersson

From: Sibi Sankar <[email protected]>

This patch adds Q6V5 MSS remoteproc node for SDM845 SoCs.

---

Changes since v5:
- None

 arch/arm64/boot/dts/qcom/sdm845.dtsi | 58 ++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
arch/arm64/boot/dts/qcom/sdm845.dtsi +58 -0
index 560c16616ee6..5c41f6fe3e1b 100644
@@ -1612,6 +1612,64 @@
 			};
 		};
 
+		mss_pil: remoteproc@4080000 {
+			compatible = "qcom,sdm845-mss-pil";
+			reg = <0 0x04080000 0 0x408>, <0 0x04180000 0 0x48>;
+			reg-names = "qdsp6", "rmb";
+
+			interrupts-extended =
+				<&intc GIC_SPI 266 IRQ_TYPE_EDGE_RISING>,
+				<&modem_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
+				<&modem_smp2p_in 1 IRQ_TYPE_EDGE_RISING>,
+				<&modem_smp2p_in 2 IRQ_TYPE_EDGE_RISING>,
+				<&modem_smp2p_in 3 IRQ_TYPE_EDGE_RISING>,
+				<&modem_smp2p_in 7 IRQ_TYPE_EDGE_RISING>;
+			interrupt-names = "wdog", "fatal", "ready",
+					  "handover", "stop-ack",
+					  "shutdown-ack";
+
+			clocks = <&gcc GCC_MSS_CFG_AHB_CLK>,
+				 <&gcc GCC_MSS_Q6_MEMNOC_AXI_CLK>,
+				 <&gcc GCC_BOOT_ROM_AHB_CLK>,
+				 <&gcc GCC_MSS_GPLL0_DIV_CLK_SRC>,
+				 <&gcc GCC_MSS_SNOC_AXI_CLK>,
+				 <&gcc GCC_MSS_MFAB_AXIS_CLK>,
+				 <&gcc GCC_PRNG_AHB_CLK>,
+				 <&rpmhcc RPMH_CXO_CLK>;
+			clock-names = "iface", "bus", "mem", "gpll0_mss",
+				      "snoc_axi", "mnoc_axi", "prng", "xo";
+
+			qcom,smem-states = <&modem_smp2p_out 0>;
+			qcom,smem-state-names = "stop";
+
+			resets = <&aoss_reset AOSS_CC_MSS_RESTART>,
+				 <&pdc_reset PDC_MODEM_SYNC_RESET>;
+			reset-names = "mss_restart", "pdc_reset";
+
+			qcom,halt-regs = <&tcsr_mutex_regs 0x23000 0x25000 0x24000>;
+
+			power-domains = <&aoss_qmp AOSS_QMP_LS_MODEM>,
+					<&rpmhpd SDM845_CX>,
+					<&rpmhpd SDM845_MX>,
+					<&rpmhpd SDM845_MSS>;
+			power-domain-names = "load_state", "cx", "mx", "mss";
+
+			mba {
+				memory-region = <&mba_region>;
+			};
+
+			mpss {
+				memory-region = <&mpss_region>;
+			};
+
+			glink-edge {
+				interrupts = <GIC_SPI 449 IRQ_TYPE_EDGE_RISING>;
+				label = "modem";
+				qcom,remote-pid = <1>;
+				mboxes = <&apss_shared 12>;
+			};
+		};
+
 		gpucc: clock-controller@5090000 {
 			compatible = "qcom,sdm845-gpucc";
 			reg = <0 0x05090000 0 0x9000>;
Signature · 1 line
2.18.0
#11 lore raw

Re: [PATCH v6 8/8] arm64: dts: qcom: sdm845: Add Q6V5 MSS node

Hi,

Quoted 21 lines · Bjorn Andersson

From: Sibi Sankar <[email protected]>

This patch adds Q6V5 MSS remoteproc node for SDM845 SoCs.

---

Changes since v5:
- None

 arch/arm64/boot/dts/qcom/sdm845.dtsi | 58 ++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
arch/arm64/boot/dts/qcom/sdm845.dtsi +0 -0
index 560c16616ee6..5c41f6fe3e1b 100644

arch/arm64/boot/dts/qcom/sdm845.dtsi line 1618

Quoted 7 lines
arch/arm64/boot/dts/qcom/sdm845.dtsi +4 -0
@@ -1612,6 +1612,64 @@
                        };
                };
 
+               mss_pil: remoteproc@4080000 {
+                       compatible = "qcom,sdm845-mss-pil";
+                       reg = <0 0x04080000 0 0x408>, <0 0x04180000 0 0x48>;
+                       reg-names = "qdsp6", "rmb";

I found that when I disabled IOMMU bypass by booting with "arm-smmu.disable_bypass=y" that I'd get this failure:

---

[   13.633776] qcom-q6v5-mss 4080000.remoteproc: MBA booted, loading mpss
[   13.647694] arm-smmu 15000000.iommu: Unexpected global fault, this
could be serious
[   13.660278] arm-smmu 15000000.iommu: GFSR 0x80000002, GFSYNR0
0x00000000, GFSYNR1 0x00000781, GFSYNR2 0x00000000
...
[   14.648830] qcom-q6v5-mss 4080000.remoteproc: MPSS header
authentication timed out
[   14.657141] qcom-q6v5-mss 4080000.remoteproc: port failed halt
[   14.664983] remoteproc remoteproc0: can't start rproc

4080000.remoteproc: -110

---

Adding "iommus = <&apps_smmu 0x781 0>;" here fixed my problem. NOTE that I'm no expert on IOMMUs so you should confirm that this is right, but if it is then maybe you could include it in the next spin of the series? I got the "0x781" just by looking at the value of the GFSYNR1 in the above splat. I wasn't sure what to put for the mask so I put 0x0.

-Doug

#12 lore raw

Re: [PATCH v6 8/8] arm64: dts: qcom: sdm845: Add Q6V5 MSS node

Hi,

Quoted 51 lines · Doug Anderson

Hi,

Quoted 21 lines · Bjorn Andersson

From: Sibi Sankar <[email protected]>

This patch adds Q6V5 MSS remoteproc node for SDM845 SoCs.

---

Changes since v5:
- None

 arch/arm64/boot/dts/qcom/sdm845.dtsi | 58 ++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
arch/arm64/boot/dts/qcom/sdm845.dtsi +0 -0
index 560c16616ee6..5c41f6fe3e1b 100644

arch/arm64/boot/dts/qcom/sdm845.dtsi line 1618

Quoted 7 lines
arch/arm64/boot/dts/qcom/sdm845.dtsi +4 -0
@@ -1612,6 +1612,64 @@
                        };
                };
 
+               mss_pil: remoteproc@4080000 {
+                       compatible = "qcom,sdm845-mss-pil";
+                       reg = <0 0x04080000 0 0x408>, <0 0x04180000 0 0x48>;
+                       reg-names = "qdsp6", "rmb";

I found that when I disabled IOMMU bypass by booting with "arm-smmu.disable_bypass=y" that I'd get this failure:

---

[   13.633776] qcom-q6v5-mss 4080000.remoteproc: MBA booted, loading mpss
[   13.647694] arm-smmu 15000000.iommu: Unexpected global fault, this
could be serious
[   13.660278] arm-smmu 15000000.iommu: GFSR 0x80000002, GFSYNR0
0x00000000, GFSYNR1 0x00000781, GFSYNR2 0x00000000
...
[   14.648830] qcom-q6v5-mss 4080000.remoteproc: MPSS header
authentication timed out
[   14.657141] qcom-q6v5-mss 4080000.remoteproc: port failed halt
[   14.664983] remoteproc remoteproc0: can't start rproc

4080000.remoteproc: -110

Quoted 8 lines

---

Adding "iommus = <&apps_smmu 0x781 0>;" here fixed my problem. NOTE that I'm no expert on IOMMUs so you should confirm that this is right, but if it is then maybe you could include it in the next spin of the series? I got the "0x781" just by looking at the value of the GFSYNR1 in the above splat. I wasn't sure what to put for the mask so I put 0x0.

Upon more testing the "iommus" line that I came up with avoids the global fault but doesn't actually work. I just get:

qcom-q6v5-mss 4080000.remoteproc: failed to allocate mdt buffer

I'm hoping someone from Qualcomm can help out here and say how this should be solved. Thanks!

-Doug

#13 lore raw

Re: [PATCH v6 8/8] arm64: dts: qcom: sdm845: Add Q6V5 MSS node

Hey Doug,

Quoted 63 lines · Doug Anderson

Hi,

Quoted 51 lines · Doug Anderson

Hi,

Quoted 21 lines · Bjorn Andersson

From: Sibi Sankar <[email protected]>

This patch adds Q6V5 MSS remoteproc node for SDM845 SoCs.

---

Changes since v5:
- None

 arch/arm64/boot/dts/qcom/sdm845.dtsi | 58 ++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
arch/arm64/boot/dts/qcom/sdm845.dtsi +0 -0
index 560c16616ee6..5c41f6fe3e1b 100644

arch/arm64/boot/dts/qcom/sdm845.dtsi line 1618

Quoted 7 lines
arch/arm64/boot/dts/qcom/sdm845.dtsi +4 -0
@@ -1612,6 +1612,64 @@
                        };
                };
 
+               mss_pil: remoteproc@4080000 {
+                       compatible = "qcom,sdm845-mss-pil";
+                       reg = <0 0x04080000 0 0x408>, <0 0x04180000 0 0x48>;
+                       reg-names = "qdsp6", "rmb";

I found that when I disabled IOMMU bypass by booting with "arm-smmu.disable_bypass=y" that I'd get this failure:

---

[   13.633776] qcom-q6v5-mss 4080000.remoteproc: MBA booted, loading mpss
[   13.647694] arm-smmu 15000000.iommu: Unexpected global fault, this
could be serious
[   13.660278] arm-smmu 15000000.iommu: GFSR 0x80000002, GFSYNR0
0x00000000, GFSYNR1 0x00000781, GFSYNR2 0x00000000
...
[   14.648830] qcom-q6v5-mss 4080000.remoteproc: MPSS header
authentication timed out
[   14.657141] qcom-q6v5-mss 4080000.remoteproc: port failed halt
[   14.664983] remoteproc remoteproc0: can't start rproc

4080000.remoteproc: -110

Quoted 8 lines

---

Adding "iommus = <&apps_smmu 0x781 0>;" here fixed my problem. NOTE that I'm no expert on IOMMUs so you should confirm that this is right, but if it is then maybe you could include it in the next spin of the series? I got the "0x781" just by looking at the value of the GFSYNR1 in the above splat. I wasn't sure what to put for the mask so I put 0x0.

Quoted 4 lines

Upon more testing the "iommus" line that I came up with avoids the global fault but doesn't actually work. I just get:

qcom-q6v5-mss 4080000.remoteproc: failed to allocate mdt buffer

AFAIK modem does not have a smmu in front of it.

We have reserved memory nodes for mba and mpss,
however for mdt authentication we just rely on
dma_alloc_attrs with DMA_ATTR_FORCE_CONTIGUOUS
for allocation which seems to fail here.

Quoted 3 lines

I'm hoping someone from Qualcomm can help out here and say how this should be solved. Thanks!

Yeah I'll enable arm-smmu.disable_bypass and
have a go at booting modem.

Quoted 3 lines

-Doug

Signature · 3 lines
-- Sibi Sankar --
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project.
#14 lore raw

Re: [PATCH v6 8/8] arm64: dts: qcom: sdm845: Add Q6V5 MSS node

In reply to Doug Anderson

Hi Doug,

Quoted 64 lines · Doug Anderson

Hi,

Quoted 51 lines · Doug Anderson

Hi,

Quoted 21 lines · Bjorn Andersson

From: Sibi Sankar <[email protected]>

This patch adds Q6V5 MSS remoteproc node for SDM845 SoCs.

---

Changes since v5:
- None

 arch/arm64/boot/dts/qcom/sdm845.dtsi | 58 ++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
arch/arm64/boot/dts/qcom/sdm845.dtsi +0 -0
index 560c16616ee6..5c41f6fe3e1b 100644

arch/arm64/boot/dts/qcom/sdm845.dtsi line 1618

Quoted 7 lines
arch/arm64/boot/dts/qcom/sdm845.dtsi +4 -0
@@ -1612,6 +1612,64 @@
                        };
                };
 
+               mss_pil: remoteproc@4080000 {
+                       compatible = "qcom,sdm845-mss-pil";
+                       reg = <0 0x04080000 0 0x408>, <0 0x04180000 0 0x48>;
+                       reg-names = "qdsp6", "rmb";

I found that when I disabled IOMMU bypass by booting with "arm-smmu.disable_bypass=y" that I'd get this failure:

---

[   13.633776] qcom-q6v5-mss 4080000.remoteproc: MBA booted, loading mpss
[   13.647694] arm-smmu 15000000.iommu: Unexpected global fault, this
could be serious
[   13.660278] arm-smmu 15000000.iommu: GFSR 0x80000002, GFSYNR0
0x00000000, GFSYNR1 0x00000781, GFSYNR2 0x00000000
...
[   14.648830] qcom-q6v5-mss 4080000.remoteproc: MPSS header
authentication timed out
[   14.657141] qcom-q6v5-mss 4080000.remoteproc: port failed halt
[   14.664983] remoteproc remoteproc0: can't start rproc

4080000.remoteproc: -110

Quoted 8 lines

---

Adding "iommus = <&apps_smmu 0x781 0>;" here fixed my problem. NOTE that I'm no expert on IOMMUs so you should confirm that this is right, but if it is then maybe you could include it in the next spin of the series? I got the "0x781" just by looking at the value of the GFSYNR1 in the above splat. I wasn't sure what to put for the mask so I put 0x0.

Quoted 7 lines

Upon more testing the "iommus" line that I came up with avoids the global fault but doesn't actually work. I just get:

qcom-q6v5-mss 4080000.remoteproc: failed to allocate mdt buffer

I'm hoping someone from Qualcomm can help out here and say how this should be solved. Thanks!

I and Sibi had a chance to look at this, and we could compare things with MTP sdm845
device as well.

Quoted 1 line

From the 845 block diagram it's clear that one of the MPSS paths goes

through SMMU
and therefore we have the SIDs 0x780 - 0x783 reserved for these streams. However, it is recommended to use them in a bypass mode (S2CR_TYPE_BYPASS).

On MTP devices, the secure code programs these SIDs in SMMU and, as these SMRs are marked secure they are not visible to the kernel. Thus kernel wouldn't overwrite anything.
However, in your case there's no such reservation by the secure code. In such a case,
we may need to make SMMU aware of these SIDs in the kernel.

And please note that adding "iommus = <&apps_smmu 0x781 0>" to the PIL device may not
be the correct thing to do, since actual MPSS data streams don't use the SMMU. So, configuring DMA path via SMMU isn't right.

Thanks & regards
Vivek

Quoted 3 lines

-Doug

Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation