linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/14] Add dedicated device tree node for RPM processor/subsystem
@ 2023-06-05  7:08 Stephan Gerhold
  2023-06-05  7:08 ` [PATCH 01/14] dt-bindings soc: qcom: smd-rpm: Fix sort order Stephan Gerhold
                   ` (13 more replies)
  0 siblings, 14 replies; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-05  7:08 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc, Stephan Gerhold

The Resource Power Manager (RPM) currently does not have a dedicated 
device tree node that represents the remoteproc/subsystem. The 
functionality exposed through the SMD/GLINK channels is described in 
top-level nodes of the device tree. This makes it hard to group other 
functionality provided by the RPM together in the device tree. This 
series adds a single top-level remoteproc-rpm/rpm-proc device tree node 
that groups all RPM functionality together.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
Stephan Gerhold (14):
      dt-bindings  soc: qcom: smd-rpm: Fix sort order
      dt-bindings: soc: qcom: smd-rpm: Add MSM8909 to qcom,smd-channels
      dt-bindings: soc: qcom: smd-rpm: Add some more compatibles
      soc: qcom: smd-rpm: Match rpmsg channel instead of compatible
      dt-bindings: remoteproc: Add Qualcomm RPM processor/subsystem
      dt-bindings: soc: qcom: smd-rpm: Use qcom,rpm-proc in example
      dt-bindings: qcom: smd: Mark as deprecated
      soc: qcom: smem: Add qcom_smem_is_available()
      rpmsg: qcom_smd: Use qcom_smem_is_available()
      soc: qcom: Add RPM processor/subsystem driver
      arm64: dts: qcom: Add rpm-proc node for SMD platforms
      arm64: dts: qcom: Add rpm-proc node for GLINK gplatforms
      ARM: dts: qcom: Add rpm-proc node for SMD platforms
      ARM: dts: qcom: apq8064: Drop redundant /smd node

 .../bindings/remoteproc/qcom,rpm-proc.yaml         | 125 +++++++++++++++++
 .../devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml |  23 +++-
 .../devicetree/bindings/soc/qcom/qcom,smd.yaml     |   7 +
 arch/arm/boot/dts/qcom-apq8064.dtsi                |  40 ------
 arch/arm/boot/dts/qcom-apq8084.dtsi                |   6 +-
 arch/arm/boot/dts/qcom-msm8226.dtsi                |  38 +++---
 arch/arm/boot/dts/qcom-msm8974.dtsi                |  44 +++---
 arch/arm64/boot/dts/qcom/ipq6018.dtsi              |  48 ++++---
 arch/arm64/boot/dts/qcom/ipq9574.dtsi              |  28 ++--
 arch/arm64/boot/dts/qcom/msm8916.dtsi              |   6 +-
 arch/arm64/boot/dts/qcom/msm8939.dtsi              | 112 +++++++--------
 arch/arm64/boot/dts/qcom/msm8953.dtsi              | 136 +++++++++---------
 arch/arm64/boot/dts/qcom/msm8976.dtsi              | 152 ++++++++++-----------
 arch/arm64/boot/dts/qcom/msm8994.dtsi              |  99 +++++++-------
 arch/arm64/boot/dts/qcom/msm8996.dtsi              | 113 +++++++--------
 arch/arm64/boot/dts/qcom/msm8998.dtsi              |  98 ++++++-------
 arch/arm64/boot/dts/qcom/qcm2290.dtsi              | 126 ++++++++---------
 arch/arm64/boot/dts/qcom/qcs404.dtsi               | 152 +++++++++++----------
 arch/arm64/boot/dts/qcom/sdm630.dtsi               | 132 +++++++++---------
 arch/arm64/boot/dts/qcom/sm6115.dtsi               | 128 ++++++++---------
 arch/arm64/boot/dts/qcom/sm6125.dtsi               | 140 ++++++++++---------
 arch/arm64/boot/dts/qcom/sm6375.dtsi               | 126 ++++++++---------
 drivers/rpmsg/qcom_smd.c                           |  10 +-
 drivers/soc/qcom/Makefile                          |   2 +-
 drivers/soc/qcom/rpm-proc.c                        |  76 +++++++++++
 drivers/soc/qcom/smd-rpm.c                         |  35 ++---
 drivers/soc/qcom/smem.c                            |   9 ++
 include/linux/soc/qcom/smem.h                      |   1 +
 28 files changed, 1111 insertions(+), 901 deletions(-)
---
base-commit: 8d5a57ea6a0b1722725170e32e511701ca7c454c
change-id: 20230531-rpm-rproc-758364839cdd

Best regards,
-- 
Stephan Gerhold <stephan@gerhold.net>


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

* [PATCH 01/14] dt-bindings soc: qcom: smd-rpm: Fix sort order
  2023-06-05  7:08 [PATCH 00/14] Add dedicated device tree node for RPM processor/subsystem Stephan Gerhold
@ 2023-06-05  7:08 ` Stephan Gerhold
  2023-06-06  6:25   ` Krzysztof Kozlowski
  2023-06-05  7:08 ` [PATCH 02/14] dt-bindings: soc: qcom: smd-rpm: Add MSM8909 to qcom,smd-channels Stephan Gerhold
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-05  7:08 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc, Stephan Gerhold

Some of the enum entries are not properly ordered, fix that.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml b/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml
index 65c02a7fef80..fe814b991559 100644
--- a/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml
@@ -44,12 +44,12 @@ properties:
       - qcom,rpm-msm8994
       - qcom,rpm-msm8996
       - qcom,rpm-msm8998
+      - qcom,rpm-qcm2290
+      - qcom,rpm-qcs404
       - qcom,rpm-sdm660
       - qcom,rpm-sm6115
       - qcom,rpm-sm6125
       - qcom,rpm-sm6375
-      - qcom,rpm-qcm2290
-      - qcom,rpm-qcs404
 
   clock-controller:
     $ref: /schemas/clock/qcom,rpmcc.yaml#
@@ -84,9 +84,9 @@ if:
           - qcom,rpm-msm8226
           - qcom,rpm-msm8916
           - qcom,rpm-msm8936
+          - qcom,rpm-msm8953
           - qcom,rpm-msm8974
           - qcom,rpm-msm8976
-          - qcom,rpm-msm8953
           - qcom,rpm-msm8994
 then:
   properties:

-- 
2.40.1


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

* [PATCH 02/14] dt-bindings: soc: qcom: smd-rpm: Add MSM8909 to qcom,smd-channels
  2023-06-05  7:08 [PATCH 00/14] Add dedicated device tree node for RPM processor/subsystem Stephan Gerhold
  2023-06-05  7:08 ` [PATCH 01/14] dt-bindings soc: qcom: smd-rpm: Fix sort order Stephan Gerhold
@ 2023-06-05  7:08 ` Stephan Gerhold
  2023-06-06  6:26   ` Krzysztof Kozlowski
  2023-06-05  7:08 ` [PATCH 03/14] dt-bindings: soc: qcom: smd-rpm: Add some more compatibles Stephan Gerhold
                   ` (11 subsequent siblings)
  13 siblings, 1 reply; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-05  7:08 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc, Stephan Gerhold

MSM8909 is using qcom,smd-channels but is missing in the list, add it
there as well.

Fixes: 709d473dd5e1 ("dt-bindings: soc: qcom: smd-rpm: Add MSM8909")
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml b/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml
index fe814b991559..78822315edeb 100644
--- a/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml
@@ -82,6 +82,7 @@ if:
         enum:
           - qcom,rpm-apq8084
           - qcom,rpm-msm8226
+          - qcom,rpm-msm8909
           - qcom,rpm-msm8916
           - qcom,rpm-msm8936
           - qcom,rpm-msm8953

-- 
2.40.1


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

* [PATCH 03/14] dt-bindings: soc: qcom: smd-rpm: Add some more compatibles
  2023-06-05  7:08 [PATCH 00/14] Add dedicated device tree node for RPM processor/subsystem Stephan Gerhold
  2023-06-05  7:08 ` [PATCH 01/14] dt-bindings soc: qcom: smd-rpm: Fix sort order Stephan Gerhold
  2023-06-05  7:08 ` [PATCH 02/14] dt-bindings: soc: qcom: smd-rpm: Add MSM8909 to qcom,smd-channels Stephan Gerhold
@ 2023-06-05  7:08 ` Stephan Gerhold
  2023-06-06  6:27   ` Krzysztof Kozlowski
  2023-06-05  7:08 ` [PATCH 04/14] soc: qcom: smd-rpm: Match rpmsg channel instead of compatible Stephan Gerhold
                   ` (10 subsequent siblings)
  13 siblings, 1 reply; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-05  7:08 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc, Stephan Gerhold

To avoid several more small patches adding new RPM compatibles in the
future, add MDM9607, MSM8610, MSM8917, MSM8937 and MSM8952 at once.
All of these have been worked on over the time by some people and are
definitely compatible as-is with the smd-rpm driver.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml b/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml
index 78822315edeb..c6930706bfa9 100644
--- a/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml
@@ -34,10 +34,15 @@ properties:
       - qcom,rpm-apq8084
       - qcom,rpm-ipq6018
       - qcom,rpm-ipq9574
+      - qcom,rpm-mdm9607
       - qcom,rpm-msm8226
+      - qcom,rpm-msm8610
       - qcom,rpm-msm8909
       - qcom,rpm-msm8916
+      - qcom,rpm-msm8917
       - qcom,rpm-msm8936
+      - qcom,rpm-msm8937
+      - qcom,rpm-msm8952
       - qcom,rpm-msm8953
       - qcom,rpm-msm8974
       - qcom,rpm-msm8976
@@ -81,10 +86,15 @@ if:
       contains:
         enum:
           - qcom,rpm-apq8084
+          - qcom,rpm-mdm9607
           - qcom,rpm-msm8226
+          - qcom,rpm-msm8610
           - qcom,rpm-msm8909
           - qcom,rpm-msm8916
+          - qcom,rpm-msm8917
           - qcom,rpm-msm8936
+          - qcom,rpm-msm8937
+          - qcom,rpm-msm8952
           - qcom,rpm-msm8953
           - qcom,rpm-msm8974
           - qcom,rpm-msm8976

-- 
2.40.1


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

* [PATCH 04/14] soc: qcom: smd-rpm: Match rpmsg channel instead of compatible
  2023-06-05  7:08 [PATCH 00/14] Add dedicated device tree node for RPM processor/subsystem Stephan Gerhold
                   ` (2 preceding siblings ...)
  2023-06-05  7:08 ` [PATCH 03/14] dt-bindings: soc: qcom: smd-rpm: Add some more compatibles Stephan Gerhold
@ 2023-06-05  7:08 ` Stephan Gerhold
  2023-06-05 18:49   ` Konrad Dybcio
  2023-06-05  7:08 ` [PATCH 05/14] dt-bindings: remoteproc: Add Qualcomm RPM processor/subsystem Stephan Gerhold
                   ` (9 subsequent siblings)
  13 siblings, 1 reply; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-05  7:08 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc, Stephan Gerhold

There is an ever growing list of compatibles in the smd-rpm.c driver.
A fallback compatible would help here but would still require keeping
the current list around for backwards compatibility.

As an alternative, let's switch the driver to match the rpmsg_device_id
instead, which is always "rpm_requests" on all platforms. Add a check
to ensure that there is a device tree node defined for the device since
otherwise the of_platform_populate() call will operate on the root node (/).

Similar approaches with matching rpmsg_device_id are already used in
qcom_sysmon, qcom_glink_ssr, qrtr, and rpmsg_wwan_ctrl.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 drivers/soc/qcom/smd-rpm.c | 35 +++++++++--------------------------
 1 file changed, 9 insertions(+), 26 deletions(-)

diff --git a/drivers/soc/qcom/smd-rpm.c b/drivers/soc/qcom/smd-rpm.c
index 0c1aa809cc4e..13d8c52330d0 100644
--- a/drivers/soc/qcom/smd-rpm.c
+++ b/drivers/soc/qcom/smd-rpm.c
@@ -199,6 +199,9 @@ static int qcom_smd_rpm_probe(struct rpmsg_device *rpdev)
 	struct qcom_smd_rpm *rpm;
 	int ret;
 
+	if (!rpdev->dev.of_node)
+		return -EINVAL;
+
 	rpm = devm_kzalloc(&rpdev->dev, sizeof(*rpm), GFP_KERNEL);
 	if (!rpm)
 		return -ENOMEM;
@@ -230,38 +233,18 @@ static void qcom_smd_rpm_remove(struct rpmsg_device *rpdev)
 	of_platform_depopulate(&rpdev->dev);
 }
 
-static const struct of_device_id qcom_smd_rpm_of_match[] = {
-	{ .compatible = "qcom,rpm-apq8084" },
-	{ .compatible = "qcom,rpm-ipq6018" },
-	{ .compatible = "qcom,rpm-ipq9574" },
-	{ .compatible = "qcom,rpm-msm8226" },
-	{ .compatible = "qcom,rpm-msm8909" },
-	{ .compatible = "qcom,rpm-msm8916" },
-	{ .compatible = "qcom,rpm-msm8936" },
-	{ .compatible = "qcom,rpm-msm8953" },
-	{ .compatible = "qcom,rpm-msm8974" },
-	{ .compatible = "qcom,rpm-msm8976" },
-	{ .compatible = "qcom,rpm-msm8994" },
-	{ .compatible = "qcom,rpm-msm8996" },
-	{ .compatible = "qcom,rpm-msm8998" },
-	{ .compatible = "qcom,rpm-sdm660" },
-	{ .compatible = "qcom,rpm-sm6115" },
-	{ .compatible = "qcom,rpm-sm6125" },
-	{ .compatible = "qcom,rpm-sm6375" },
-	{ .compatible = "qcom,rpm-qcm2290" },
-	{ .compatible = "qcom,rpm-qcs404" },
-	{}
+static const struct rpmsg_device_id qcom_smd_rpm_id_table[] = {
+	{ .name = "rpm_requests", },
+	{ /* sentinel */ }
 };
-MODULE_DEVICE_TABLE(of, qcom_smd_rpm_of_match);
+MODULE_DEVICE_TABLE(rpmsg, qcom_smd_rpm_id_table);
 
 static struct rpmsg_driver qcom_smd_rpm_driver = {
 	.probe = qcom_smd_rpm_probe,
 	.remove = qcom_smd_rpm_remove,
 	.callback = qcom_smd_rpm_callback,
-	.drv  = {
-		.name  = "qcom_smd_rpm",
-		.of_match_table = qcom_smd_rpm_of_match,
-	},
+	.id_table = qcom_smd_rpm_id_table,
+	.drv.name = "qcom_smd_rpm",
 };
 
 static int __init qcom_smd_rpm_init(void)

-- 
2.40.1


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

* [PATCH 05/14] dt-bindings: remoteproc: Add Qualcomm RPM processor/subsystem
  2023-06-05  7:08 [PATCH 00/14] Add dedicated device tree node for RPM processor/subsystem Stephan Gerhold
                   ` (3 preceding siblings ...)
  2023-06-05  7:08 ` [PATCH 04/14] soc: qcom: smd-rpm: Match rpmsg channel instead of compatible Stephan Gerhold
@ 2023-06-05  7:08 ` Stephan Gerhold
  2023-06-05  8:33   ` Rob Herring
  2023-06-06  6:36   ` Krzysztof Kozlowski
  2023-06-05  7:08 ` [PATCH 06/14] dt-bindings: soc: qcom: smd-rpm: Use qcom,rpm-proc in example Stephan Gerhold
                   ` (8 subsequent siblings)
  13 siblings, 2 replies; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-05  7:08 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc, Stephan Gerhold

On Qualcomm platforms, most subsystems (e.g. audio/modem DSP) are
described as remote processors in the device tree, with a dedicated
node where properties and services related to them can be described.

The Resource Power Manager (RPM) is also such a subsystem, with a
remote processor that is running a special firmware. Unfortunately,
the RPM never got a dedicated node representing it properly in the
device tree. Most of the RPM services are described below a top-level
/smd or /rpm-glink node.

However, SMD/GLINK is just one of the communication channels to the RPM
firmware. For example, the MPM interrupt functionality provided by the
RPM does not use SMD/GLINK but writes directly to a special memory
region allocated by the RPM firmware in combination with a mailbox.
Currently there is no good place in the device tree to describe this
functionality. It doesn't belong below SMD/GLINK but it's not an
independent top-level device either.

Introduce a new "qcom,rpm-proc" compatible that allows describing the
RPM as a remote processor/subsystem like all others. The SMD/GLINK node
is moved to a "smd-edge"/"glink-edge" subnode consistent with other
existing bindings. Additional subnodes (e.g. interrupt-controller for
MPM, rpm-master-stats) can be also added there.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 .../bindings/remoteproc/qcom,rpm-proc.yaml         | 125 +++++++++++++++++++++
 1 file changed, 125 insertions(+)

diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,rpm-proc.yaml b/Documentation/devicetree/bindings/remoteproc/qcom,rpm-proc.yaml
new file mode 100644
index 000000000000..c06dd4f66503
--- /dev/null
+++ b/Documentation/devicetree/bindings/remoteproc/qcom,rpm-proc.yaml
@@ -0,0 +1,125 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/remoteproc/qcom,rpm-proc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Resource Power Manager (RPM) Processor/Subsystem
+
+maintainers:
+  - Bjorn Andersson <andersson@kernel.org>
+  - Konrad Dybcio <konrad.dybcio@linaro.org>
+
+description:
+  Resource Power Manager (RPM) subsystem found in various Qualcomm platforms.
+  The RPM allows each component in the system to vote for state of the system
+  resources, such as clocks, regulators and bus frequencies. rpm-proc is the
+  top-level device tree node that groups all the RPM functionality together.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - qcom,apq8084-rpm-proc
+          - qcom,ipq6018-rpm-proc
+          - qcom,ipq9574-rpm-proc
+          - qcom,mdm9607-rpm-proc
+          - qcom,msm8226-rpm-proc
+          - qcom,msm8610-rpm-proc
+          - qcom,msm8909-rpm-proc
+          - qcom,msm8916-rpm-proc
+          - qcom,msm8917-rpm-proc
+          - qcom,msm8936-rpm-proc
+          - qcom,msm8937-rpm-proc
+          - qcom,msm8952-rpm-proc
+          - qcom,msm8953-rpm-proc
+          - qcom,msm8974-rpm-proc
+          - qcom,msm8976-rpm-proc
+          - qcom,msm8994-rpm-proc
+          - qcom,msm8996-rpm-proc
+          - qcom,msm8998-rpm-proc
+          - qcom,qcm2290-rpm-proc
+          - qcom,qcs404-rpm-proc
+          - qcom,sdm660-rpm-proc
+          - qcom,sm6115-rpm-proc
+          - qcom,sm6125-rpm-proc
+          - qcom,sm6375-rpm-proc
+      - const: qcom,rpm-proc
+
+  smd-edge:
+    $ref: /schemas/remoteproc/qcom,smd-edge.yaml#
+    description:
+      Qualcomm Shared Memory subnode which represents communication edge,
+      channels and devices related to the RPM subsystem.
+
+  glink-rpm:
+    $ref: /schemas/remoteproc/qcom,glink-rpm-edge.yaml#
+    description:
+      Qualcomm G-Link subnode which represents communication edge,
+      channels and devices related to the RPM subsystem.
+
+  interrupt-controller:
+    type: object
+    $ref: /schemas/interrupt-controller/qcom,mpm.yaml#
+    description:
+      MSM Power Manager (MPM) interrupt controller that monitors interrupts
+      when the system is asleep.
+
+  master-stats:
+    $ref: /schemas/soc/qcom/qcom,rpm-master-stats.yaml#
+    description:
+      Subsystem-level low-power mode statistics provided by RPM.
+
+required:
+  - compatible
+
+oneOf:
+  - required:
+      - smd-edge
+  - required:
+      - glink-rpm
+
+additionalProperties: false
+
+examples:
+  # SMD
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    remoteproc-rpm {
+      compatible = "qcom,msm8916-rpm-proc", "qcom,rpm-proc";
+
+      smd-edge {
+        interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
+        qcom,ipc = <&apcs 8 0>;
+        qcom,smd-edge = <15>;
+
+        rpm-requests {
+          compatible = "qcom,rpm-msm8916";
+          qcom,smd-channels = "rpm_requests";
+          /* ... */
+        };
+      };
+    };
+  # GLINK
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    remoteproc-rpm {
+      compatible = "qcom,qcm2290-rpm-proc", "qcom,rpm-proc";
+
+      glink-rpm {
+        compatible = "qcom,glink-rpm";
+        interrupts = <GIC_SPI 194 IRQ_TYPE_EDGE_RISING>;
+        qcom,rpm-msg-ram = <&rpm_msg_ram>;
+        mboxes = <&apcs_glb 0>;
+
+        rpm-requests {
+          compatible = "qcom,rpm-qcm2290";
+          qcom,glink-channels = "rpm_requests";
+          /* ... */
+        };
+      };
+    };

-- 
2.40.1


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

* [PATCH 06/14] dt-bindings: soc: qcom: smd-rpm: Use qcom,rpm-proc in example
  2023-06-05  7:08 [PATCH 00/14] Add dedicated device tree node for RPM processor/subsystem Stephan Gerhold
                   ` (4 preceding siblings ...)
  2023-06-05  7:08 ` [PATCH 05/14] dt-bindings: remoteproc: Add Qualcomm RPM processor/subsystem Stephan Gerhold
@ 2023-06-05  7:08 ` Stephan Gerhold
  2023-06-05  8:33   ` Rob Herring
  2023-06-06  6:37   ` Krzysztof Kozlowski
  2023-06-05  7:08 ` [PATCH 07/14] dt-bindings: qcom: smd: Mark as deprecated Stephan Gerhold
                   ` (7 subsequent siblings)
  13 siblings, 2 replies; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-05  7:08 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc, Stephan Gerhold

Use the new top-level rpm-proc node instead of having a dummy top-level
/smd node that only contains the RPM but not other remote processors.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml b/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml
index c6930706bfa9..06e574239bd4 100644
--- a/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml
@@ -120,10 +120,10 @@ examples:
     #include <dt-bindings/interrupt-controller/arm-gic.h>
     #include <dt-bindings/interrupt-controller/irq.h>
 
-    smd {
-        compatible = "qcom,smd";
+    remoteproc-rpm {
+        compatible = "qcom,msm8916-rpm-proc", "qcom,rpm-proc";
 
-        rpm {
+        smd-edge {
             interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
             qcom,ipc = <&apcs 8 0>;
             qcom,smd-edge = <15>;

-- 
2.40.1


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

* [PATCH 07/14] dt-bindings: qcom: smd: Mark as deprecated
  2023-06-05  7:08 [PATCH 00/14] Add dedicated device tree node for RPM processor/subsystem Stephan Gerhold
                   ` (5 preceding siblings ...)
  2023-06-05  7:08 ` [PATCH 06/14] dt-bindings: soc: qcom: smd-rpm: Use qcom,rpm-proc in example Stephan Gerhold
@ 2023-06-05  7:08 ` Stephan Gerhold
  2023-06-05  7:08 ` [PATCH 08/14] soc: qcom: smem: Add qcom_smem_is_available() Stephan Gerhold
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-05  7:08 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc, Stephan Gerhold

The RPM processor/subsystem is the only user of the /smd top-level
node. All other remote processors define their SMD channels/edges
in a "smd-edge" subnode inside the DT node of the remote processor.

Since the RPM has its own dedicated device tree node now as well,
deprecate using the dummy /smd node.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 Documentation/devicetree/bindings/soc/qcom/qcom,smd.yaml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,smd.yaml b/Documentation/devicetree/bindings/soc/qcom/qcom,smd.yaml
index 063e595c12f7..4819ce90d206 100644
--- a/Documentation/devicetree/bindings/soc/qcom/qcom,smd.yaml
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,smd.yaml
@@ -15,6 +15,12 @@ description:
   The Qualcomm Shared Memory Driver is a FIFO based communication channel for
   sending data between the various subsystems in Qualcomm platforms.
 
+  Using the top-level SMD node is deprecated. Instead, the SMD edges are defined
+  directly below the device node representing the respective remote subsystem
+  or remote processor.
+
+deprecated: true
+
 properties:
   compatible:
     const: qcom,smd
@@ -37,6 +43,7 @@ examples:
   # The following example represents a smd node, with one edge representing the
   # "rpm" subsystem. For the "rpm" subsystem we have a device tied to the
   # "rpm_request" channel.
+  # NOTE: This is deprecated, represent the RPM using "qcom,rpm-proc" instead.
   - |
     #include <dt-bindings/interrupt-controller/arm-gic.h>
 

-- 
2.40.1


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

* [PATCH 08/14] soc: qcom: smem: Add qcom_smem_is_available()
  2023-06-05  7:08 [PATCH 00/14] Add dedicated device tree node for RPM processor/subsystem Stephan Gerhold
                   ` (6 preceding siblings ...)
  2023-06-05  7:08 ` [PATCH 07/14] dt-bindings: qcom: smd: Mark as deprecated Stephan Gerhold
@ 2023-06-05  7:08 ` Stephan Gerhold
  2023-06-05 18:53   ` Konrad Dybcio
  2023-06-05  7:08 ` [PATCH 09/14] rpmsg: qcom_smd: Use qcom_smem_is_available() Stephan Gerhold
                   ` (5 subsequent siblings)
  13 siblings, 1 reply; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-05  7:08 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc, Stephan Gerhold

Avoid having to look up a dummy item from SMEM to detect if it is
already available or if we need to defer probing.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 drivers/soc/qcom/smem.c       | 9 +++++++++
 include/linux/soc/qcom/smem.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
index b0d59e815c3b..3d93a6681494 100644
--- a/drivers/soc/qcom/smem.c
+++ b/drivers/soc/qcom/smem.c
@@ -359,6 +359,15 @@ static struct qcom_smem *__smem;
 /* Timeout (ms) for the trylock of remote spinlocks */
 #define HWSPINLOCK_TIMEOUT	1000
 
+/**
+ * qcom_smem_is_available() - Checks if SMEM is available
+ */
+bool qcom_smem_is_available(void)
+{
+	return !!__smem;
+}
+EXPORT_SYMBOL(qcom_smem_is_available);
+
 static int qcom_smem_alloc_private(struct qcom_smem *smem,
 				   struct smem_partition *part,
 				   unsigned item,
diff --git a/include/linux/soc/qcom/smem.h b/include/linux/soc/qcom/smem.h
index 223db6a9c733..a36a3b9d4929 100644
--- a/include/linux/soc/qcom/smem.h
+++ b/include/linux/soc/qcom/smem.h
@@ -4,6 +4,7 @@
 
 #define QCOM_SMEM_HOST_ANY -1
 
+bool qcom_smem_is_available(void);
 int qcom_smem_alloc(unsigned host, unsigned item, size_t size);
 void *qcom_smem_get(unsigned host, unsigned item, size_t *size);
 

-- 
2.40.1


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

* [PATCH 09/14] rpmsg: qcom_smd: Use qcom_smem_is_available()
  2023-06-05  7:08 [PATCH 00/14] Add dedicated device tree node for RPM processor/subsystem Stephan Gerhold
                   ` (7 preceding siblings ...)
  2023-06-05  7:08 ` [PATCH 08/14] soc: qcom: smem: Add qcom_smem_is_available() Stephan Gerhold
@ 2023-06-05  7:08 ` Stephan Gerhold
  2023-06-05 18:56   ` Konrad Dybcio
  2023-06-05  7:08 ` [PATCH 10/14] soc: qcom: Add RPM processor/subsystem driver Stephan Gerhold
                   ` (4 subsequent siblings)
  13 siblings, 1 reply; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-05  7:08 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc, Stephan Gerhold

Rather than looking up a dummy item from SMEM, use the new
qcom_smem_is_available() function to make the code more clear
(and reduce the overhead slightly).

Add the same check to qcom_smd_register_edge() as well to ensure that
it only succeeds if SMEM is already available - if a driver calls the
function and SMEM is not available yet then the initial state will be
read incorrectly and the RPMSG devices might never become available.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 drivers/rpmsg/qcom_smd.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c
index 7b9c298aa491..43f601c84b4f 100644
--- a/drivers/rpmsg/qcom_smd.c
+++ b/drivers/rpmsg/qcom_smd.c
@@ -1479,6 +1479,9 @@ struct qcom_smd_edge *qcom_smd_register_edge(struct device *parent,
 	struct qcom_smd_edge *edge;
 	int ret;
 
+	if (!qcom_smem_is_available())
+		return ERR_PTR(-EPROBE_DEFER);
+
 	edge = kzalloc(sizeof(*edge), GFP_KERNEL);
 	if (!edge)
 		return ERR_PTR(-ENOMEM);
@@ -1553,12 +1556,9 @@ EXPORT_SYMBOL(qcom_smd_unregister_edge);
 static int qcom_smd_probe(struct platform_device *pdev)
 {
 	struct device_node *node;
-	void *p;
 
-	/* Wait for smem */
-	p = qcom_smem_get(QCOM_SMEM_HOST_ANY, smem_items[0].alloc_tbl_id, NULL);
-	if (PTR_ERR(p) == -EPROBE_DEFER)
-		return PTR_ERR(p);
+	if (!qcom_smem_is_available())
+		return -EPROBE_DEFER;
 
 	for_each_available_child_of_node(pdev->dev.of_node, node)
 		qcom_smd_register_edge(&pdev->dev, node);

-- 
2.40.1


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

* [PATCH 10/14] soc: qcom: Add RPM processor/subsystem driver
  2023-06-05  7:08 [PATCH 00/14] Add dedicated device tree node for RPM processor/subsystem Stephan Gerhold
                   ` (8 preceding siblings ...)
  2023-06-05  7:08 ` [PATCH 09/14] rpmsg: qcom_smd: Use qcom_smem_is_available() Stephan Gerhold
@ 2023-06-05  7:08 ` Stephan Gerhold
  2023-06-05 19:06   ` Konrad Dybcio
  2023-06-05 20:31   ` kernel test robot
  2023-06-05  7:08 ` [PATCH 11/14] arm64: dts: qcom: Add rpm-proc node for SMD platforms Stephan Gerhold
                   ` (3 subsequent siblings)
  13 siblings, 2 replies; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-05  7:08 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc, Stephan Gerhold

Add a simple driver for the qcom,rpm-proc compatible that registers the
"smd-edge" and populates other children defined in the device tree.

Note that the DT schema belongs to the remoteproc subsystem while this
driver is added inside soc/qcom. I argue that the RPM *is* a remoteproc,
but as an implementation detail in Linux it can currently not benefit
from anything provided by the remoteproc subsystem. The RPM firmware is
usually already loaded and started by earlier components in the boot
chain and is not meant to be ever restarted.

To avoid breaking existing kernel configurations the driver is always
built when smd-rpm.c is also built. They belong closely together anyway.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 drivers/soc/qcom/Makefile   |  2 +-
 drivers/soc/qcom/rpm-proc.c | 76 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 77 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile
index 99114c71092b..113b9ff2ad43 100644
--- a/drivers/soc/qcom/Makefile
+++ b/drivers/soc/qcom/Makefile
@@ -18,7 +18,7 @@ obj-$(CONFIG_QCOM_RPM_MASTER_STATS)	+= rpm_master_stats.o
 obj-$(CONFIG_QCOM_RPMH)		+= qcom_rpmh.o
 qcom_rpmh-y			+= rpmh-rsc.o
 qcom_rpmh-y			+= rpmh.o
-obj-$(CONFIG_QCOM_SMD_RPM)	+= smd-rpm.o
+obj-$(CONFIG_QCOM_SMD_RPM)	+= rpm-proc.o smd-rpm.o
 obj-$(CONFIG_QCOM_SMEM) +=	smem.o
 obj-$(CONFIG_QCOM_SMEM_STATE) += smem_state.o
 obj-$(CONFIG_QCOM_SMP2P)	+= smp2p.o
diff --git a/drivers/soc/qcom/rpm-proc.c b/drivers/soc/qcom/rpm-proc.c
new file mode 100644
index 000000000000..0652be7f7895
--- /dev/null
+++ b/drivers/soc/qcom/rpm-proc.c
@@ -0,0 +1,76 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/* Copyright (c) 2021-2023, Stephan Gerhold <stephan@gerhold.net> */
+
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+#include <linux/rpmsg/qcom_smd.h>
+
+static int rpm_proc_probe(struct platform_device *pdev)
+{
+	struct qcom_smd_edge *edge = NULL;
+	struct device *dev = &pdev->dev;
+	struct device_node *edge_node;
+	int ret;
+
+	edge_node = of_get_child_by_name(dev->of_node, "smd-edge");
+	if (edge_node) {
+		edge = qcom_smd_register_edge(dev, edge_node);
+		if (IS_ERR(edge))
+			return dev_err_probe(dev, PTR_ERR(edge),
+					     "Failed to register smd-edge\n");
+	}
+
+	ret = devm_of_platform_populate(dev);
+	if (ret) {
+		dev_err(dev, "Failed to populate children devices: %d\n", ret);
+		goto err;
+	}
+
+	platform_set_drvdata(pdev, edge);
+	return 0;
+err:
+	if (edge)
+		qcom_smd_unregister_edge(edge);
+	return ret;
+}
+
+static void rpm_proc_remove(struct platform_device *pdev)
+{
+	struct qcom_smd_edge *edge = platform_get_drvdata(pdev);
+
+	if (edge)
+		qcom_smd_unregister_edge(edge);
+}
+
+static const struct of_device_id rpm_proc_of_match[] = {
+	{ .compatible = "qcom,rpm-proc", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, rpm_proc_of_match);
+
+static struct platform_driver rpm_proc_driver = {
+	.probe = rpm_proc_probe,
+	.remove_new = rpm_proc_remove,
+	.driver = {
+		.name = "qcom-rpm-proc",
+		.of_match_table = rpm_proc_of_match,
+	},
+};
+
+static int __init rpm_proc_init(void)
+{
+	return platform_driver_register(&rpm_proc_driver);
+}
+arch_initcall(rpm_proc_init);
+
+static void __exit rpm_proc_exit(void)
+{
+	platform_driver_unregister(&rpm_proc_driver);
+}
+module_exit(rpm_proc_exit);
+
+MODULE_DESCRIPTION("Qualcomm RPM processor/subsystem driver");
+MODULE_AUTHOR("Stephan Gerhold <stephan@gerhold.net>");
+MODULE_LICENSE("GPL");

-- 
2.40.1


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

* [PATCH 11/14] arm64: dts: qcom: Add rpm-proc node for SMD platforms
  2023-06-05  7:08 [PATCH 00/14] Add dedicated device tree node for RPM processor/subsystem Stephan Gerhold
                   ` (9 preceding siblings ...)
  2023-06-05  7:08 ` [PATCH 10/14] soc: qcom: Add RPM processor/subsystem driver Stephan Gerhold
@ 2023-06-05  7:08 ` Stephan Gerhold
  2023-06-05 19:07   ` Konrad Dybcio
  2023-06-05  7:08 ` [PATCH 12/14] arm64: dts: qcom: Add rpm-proc node for GLINK gplatforms Stephan Gerhold
                   ` (2 subsequent siblings)
  13 siblings, 1 reply; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-05  7:08 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc, Stephan Gerhold

Rather than having the RPM SMD channels as the only child of a dummy
SMD node, switch to representing the RPM as remoteproc like all the
other remoteprocs (WCNSS, modem DSP).

This allows assigning additional subdevices to it like the MPM
interrupt-controller or rpm-master-stats.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 arch/arm64/boot/dts/qcom/msm8916.dtsi |   6 +-
 arch/arm64/boot/dts/qcom/msm8939.dtsi | 112 ++++++++++++-------------
 arch/arm64/boot/dts/qcom/msm8953.dtsi | 136 +++++++++++++++---------------
 arch/arm64/boot/dts/qcom/msm8976.dtsi | 152 +++++++++++++++++-----------------
 arch/arm64/boot/dts/qcom/msm8994.dtsi |  99 +++++++++++-----------
 5 files changed, 253 insertions(+), 252 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi
index 9494b6512d87..667748612d3e 100644
--- a/arch/arm64/boot/dts/qcom/msm8916.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi
@@ -282,10 +282,10 @@ CLUSTER_PD: power-domain-cluster {
 		};
 	};
 
-	smd {
-		compatible = "qcom,smd";
+	rpm: remoteproc-rpm {
+		compatible = "qcom,msm8916-rpm-proc", "qcom,rpm-proc";
 
-		rpm {
+		smd-edge {
 			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
 			qcom,ipc = <&apcs 8 0>;
 			qcom,smd-edge = <15>;
diff --git a/arch/arm64/boot/dts/qcom/msm8939.dtsi b/arch/arm64/boot/dts/qcom/msm8939.dtsi
index 0d9f8b951b66..f11d522586eb 100644
--- a/arch/arm64/boot/dts/qcom/msm8939.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8939.dtsi
@@ -240,6 +240,62 @@ pmu {
 		interrupts = <GIC_PPI 7 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_HIGH)>;
 	};
 
+	rpm: remoteproc-rpm {
+		compatible = "qcom,msm8936-rpm-proc", "qcom,rpm-proc";
+
+		smd-edge {
+			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
+			qcom,ipc = <&apcs1_mbox 8 0>;
+			qcom,smd-edge = <15>;
+
+			rpm_requests: rpm-requests {
+				compatible = "qcom,rpm-msm8936";
+				qcom,smd-channels = "rpm_requests";
+
+				rpmcc: clock-controller {
+					compatible = "qcom,rpmcc-msm8936", "qcom,rpmcc";
+					#clock-cells = <1>;
+					clock-names = "xo";
+					clocks = <&xo_board>;
+				};
+
+				rpmpd: power-controller {
+					compatible = "qcom,msm8939-rpmpd";
+					#power-domain-cells = <1>;
+					operating-points-v2 = <&rpmpd_opp_table>;
+
+					rpmpd_opp_table: opp-table {
+						compatible = "operating-points-v2";
+
+						rpmpd_opp_ret: opp1 {
+							opp-level = <1>;
+						};
+
+						rpmpd_opp_svs_krait: opp2 {
+							opp-level = <2>;
+						};
+
+						rpmpd_opp_svs_soc: opp3 {
+							opp-level = <3>;
+						};
+
+						rpmpd_opp_nom: opp4 {
+							opp-level = <4>;
+						};
+
+						rpmpd_opp_turbo: opp5 {
+							opp-level = <5>;
+						};
+
+						rpmpd_opp_super_turbo: opp6 {
+							opp-level = <6>;
+						};
+					};
+				};
+			};
+		};
+	};
+
 	reserved-memory {
 		#address-cells = <2>;
 		#size-cells = <2>;
@@ -308,62 +364,6 @@ mba_mem: mba@8cb00000 {
 		};
 	};
 
-	smd {
-		compatible = "qcom,smd";
-
-		rpm {
-			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
-			qcom,ipc = <&apcs1_mbox 8 0>;
-			qcom,smd-edge = <15>;
-
-			rpm_requests: rpm-requests {
-				compatible = "qcom,rpm-msm8936";
-				qcom,smd-channels = "rpm_requests";
-
-				rpmcc: clock-controller {
-					compatible = "qcom,rpmcc-msm8936", "qcom,rpmcc";
-					#clock-cells = <1>;
-					clock-names = "xo";
-					clocks = <&xo_board>;
-				};
-
-				rpmpd: power-controller {
-					compatible = "qcom,msm8939-rpmpd";
-					#power-domain-cells = <1>;
-					operating-points-v2 = <&rpmpd_opp_table>;
-
-					rpmpd_opp_table: opp-table {
-						compatible = "operating-points-v2";
-
-						rpmpd_opp_ret: opp1 {
-							opp-level = <1>;
-						};
-
-						rpmpd_opp_svs_krait: opp2 {
-							opp-level = <2>;
-						};
-
-						rpmpd_opp_svs_soc: opp3 {
-							opp-level = <3>;
-						};
-
-						rpmpd_opp_nom: opp4 {
-							opp-level = <4>;
-						};
-
-						rpmpd_opp_turbo: opp5 {
-							opp-level = <5>;
-						};
-
-						rpmpd_opp_super_turbo: opp6 {
-							opp-level = <6>;
-						};
-					};
-				};
-			};
-		};
-	};
-
 	smp2p-hexagon {
 		compatible = "qcom,smp2p";
 		qcom,smem = <435>, <428>;
diff --git a/arch/arm64/boot/dts/qcom/msm8953.dtsi b/arch/arm64/boot/dts/qcom/msm8953.dtsi
index 7d193a467819..4b2f02850a10 100644
--- a/arch/arm64/boot/dts/qcom/msm8953.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8953.dtsi
@@ -190,6 +190,74 @@ psci {
 		method = "smc";
 	};
 
+	rpm: remoteproc-rpm {
+		compatible = "qcom,msm8953-rpm-proc", "qcom,rpm-proc";
+
+		smd-edge {
+			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
+			qcom,ipc = <&apcs 8 0>;
+			qcom,smd-edge = <15>;
+
+			rpm_requests: rpm-requests {
+				compatible = "qcom,rpm-msm8953";
+				qcom,smd-channels = "rpm_requests";
+
+				rpmcc: clock-controller {
+					compatible = "qcom,rpmcc-msm8953", "qcom,rpmcc";
+					clocks = <&xo_board>;
+					clock-names = "xo";
+					#clock-cells = <1>;
+				};
+
+				rpmpd: power-controller {
+					compatible = "qcom,msm8953-rpmpd";
+					#power-domain-cells = <1>;
+					operating-points-v2 = <&rpmpd_opp_table>;
+
+					rpmpd_opp_table: opp-table {
+						compatible = "operating-points-v2";
+
+						rpmpd_opp_ret: opp1 {
+							opp-level = <RPM_SMD_LEVEL_RETENTION>;
+						};
+
+						rpmpd_opp_ret_plus: opp2 {
+							opp-level = <RPM_SMD_LEVEL_RETENTION_PLUS>;
+						};
+
+						rpmpd_opp_min_svs: opp3 {
+							opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
+						};
+
+						rpmpd_opp_low_svs: opp4 {
+							opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
+						};
+
+						rpmpd_opp_svs: opp5 {
+							opp-level = <RPM_SMD_LEVEL_SVS>;
+						};
+
+						rpmpd_opp_svs_plus: opp6 {
+							opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
+						};
+
+						rpmpd_opp_nom: opp7 {
+							opp-level = <RPM_SMD_LEVEL_NOM>;
+						};
+
+						rpmpd_opp_nom_plus: opp8 {
+							opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
+						};
+
+						rpmpd_opp_turbo: opp9 {
+							opp-level = <RPM_SMD_LEVEL_TURBO>;
+						};
+					};
+				};
+			};
+		};
+	};
+
 	reserved-memory {
 		#address-cells = <2>;
 		#size-cells = <2>;
@@ -263,74 +331,6 @@ rmtfs@f2d00000 {
 		};
 	};
 
-	smd {
-		compatible = "qcom,smd";
-
-		rpm {
-			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
-			qcom,ipc = <&apcs 8 0>;
-			qcom,smd-edge = <15>;
-
-			rpm_requests: rpm-requests {
-				compatible = "qcom,rpm-msm8953";
-				qcom,smd-channels = "rpm_requests";
-
-				rpmcc: clock-controller {
-					compatible = "qcom,rpmcc-msm8953", "qcom,rpmcc";
-					clocks = <&xo_board>;
-					clock-names = "xo";
-					#clock-cells = <1>;
-				};
-
-				rpmpd: power-controller {
-					compatible = "qcom,msm8953-rpmpd";
-					#power-domain-cells = <1>;
-					operating-points-v2 = <&rpmpd_opp_table>;
-
-					rpmpd_opp_table: opp-table {
-						compatible = "operating-points-v2";
-
-						rpmpd_opp_ret: opp1 {
-							opp-level = <RPM_SMD_LEVEL_RETENTION>;
-						};
-
-						rpmpd_opp_ret_plus: opp2 {
-							opp-level = <RPM_SMD_LEVEL_RETENTION_PLUS>;
-						};
-
-						rpmpd_opp_min_svs: opp3 {
-							opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
-						};
-
-						rpmpd_opp_low_svs: opp4 {
-							opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
-						};
-
-						rpmpd_opp_svs: opp5 {
-							opp-level = <RPM_SMD_LEVEL_SVS>;
-						};
-
-						rpmpd_opp_svs_plus: opp6 {
-							opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
-						};
-
-						rpmpd_opp_nom: opp7 {
-							opp-level = <RPM_SMD_LEVEL_NOM>;
-						};
-
-						rpmpd_opp_nom_plus: opp8 {
-							opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
-						};
-
-						rpmpd_opp_turbo: opp9 {
-							opp-level = <RPM_SMD_LEVEL_TURBO>;
-						};
-					};
-				};
-			};
-		};
-	};
-
 	smp2p-adsp {
 		compatible = "qcom,smp2p";
 		qcom,smem = <443>, <429>;
diff --git a/arch/arm64/boot/dts/qcom/msm8976.dtsi b/arch/arm64/boot/dts/qcom/msm8976.dtsi
index 753b9a2105ed..6f856562923f 100644
--- a/arch/arm64/boot/dts/qcom/msm8976.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8976.dtsi
@@ -232,6 +232,82 @@ psci {
 		method = "smc";
 	};
 
+	rpm: remoteproc-rpm {
+		compatible = "qcom,msm8976-rpm-proc", "qcom,rpm-proc";
+
+		smd-edge {
+			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
+			qcom,ipc = <&apcs 8 0>;
+			qcom,smd-edge = <15>;
+
+			rpm_requests: rpm-requests {
+				compatible = "qcom,rpm-msm8976";
+				qcom,smd-channels = "rpm_requests";
+
+				rpmcc: clock-controller {
+					compatible = "qcom,rpmcc-msm8976", "qcom,rpmcc";
+					clocks = <&xo_board>;
+					clock-names = "xo";
+					#clock-cells = <1>;
+				};
+
+				rpmpd: power-controller {
+					compatible = "qcom,msm8976-rpmpd";
+					#power-domain-cells = <1>;
+					operating-points-v2 = <&rpmpd_opp_table>;
+
+					rpmpd_opp_table: opp-table {
+						compatible = "operating-points-v2";
+
+						rpmpd_opp_ret: opp1 {
+							opp-level = <RPM_SMD_LEVEL_RETENTION>;
+						};
+
+						rpmpd_opp_ret_plus: opp2 {
+							opp-level = <RPM_SMD_LEVEL_RETENTION_PLUS>;
+						};
+
+						rpmpd_opp_min_svs: opp3 {
+							opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
+						};
+
+						rpmpd_opp_low_svs: opp4 {
+							opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
+						};
+
+						rpmpd_opp_svs: opp5 {
+							opp-level = <RPM_SMD_LEVEL_SVS>;
+						};
+
+						rpmpd_opp_svs_plus: opp6 {
+							opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
+						};
+
+						rpmpd_opp_nom: opp7 {
+							opp-level = <RPM_SMD_LEVEL_NOM>;
+						};
+
+						rpmpd_opp_nom_plus: opp8 {
+							opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
+						};
+
+						rpmpd_opp_turbo: opp9 {
+							opp-level = <RPM_SMD_LEVEL_TURBO>;
+						};
+
+						rpmpd_opp_turbo_no_cpr: opp10 {
+							opp-level = <RPM_SMD_LEVEL_TURBO_NO_CPR>;
+						};
+
+						rpmpd_opp_turbo_high: opp111 {
+							opp-level = <RPM_SMD_LEVEL_TURBO_HIGH>;
+						};
+					};
+				};
+			};
+		};
+	};
+
 	reserved-memory {
 		#address-cells = <2>;
 		#size-cells = <2>;
@@ -346,82 +422,6 @@ wcnss_smp2p_in: slave-kernel {
 		};
 	};
 
-	smd {
-		compatible = "qcom,smd";
-
-		rpm {
-			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
-			qcom,ipc = <&apcs 8 0>;
-			qcom,smd-edge = <15>;
-
-			rpm_requests: rpm-requests {
-				compatible = "qcom,rpm-msm8976";
-				qcom,smd-channels = "rpm_requests";
-
-				rpmcc: clock-controller {
-					compatible = "qcom,rpmcc-msm8976", "qcom,rpmcc";
-					clocks = <&xo_board>;
-					clock-names = "xo";
-					#clock-cells = <1>;
-				};
-
-				rpmpd: power-controller {
-					compatible = "qcom,msm8976-rpmpd";
-					#power-domain-cells = <1>;
-					operating-points-v2 = <&rpmpd_opp_table>;
-
-					rpmpd_opp_table: opp-table {
-						compatible = "operating-points-v2";
-
-						rpmpd_opp_ret: opp1 {
-							opp-level = <RPM_SMD_LEVEL_RETENTION>;
-						};
-
-						rpmpd_opp_ret_plus: opp2 {
-							opp-level = <RPM_SMD_LEVEL_RETENTION_PLUS>;
-						};
-
-						rpmpd_opp_min_svs: opp3 {
-							opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
-						};
-
-						rpmpd_opp_low_svs: opp4 {
-							opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
-						};
-
-						rpmpd_opp_svs: opp5 {
-							opp-level = <RPM_SMD_LEVEL_SVS>;
-						};
-
-						rpmpd_opp_svs_plus: opp6 {
-							opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
-						};
-
-						rpmpd_opp_nom: opp7 {
-							opp-level = <RPM_SMD_LEVEL_NOM>;
-						};
-
-						rpmpd_opp_nom_plus: opp8 {
-							opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
-						};
-
-						rpmpd_opp_turbo: opp9 {
-							opp-level = <RPM_SMD_LEVEL_TURBO>;
-						};
-
-						rpmpd_opp_turbo_no_cpr: opp10 {
-							opp-level = <RPM_SMD_LEVEL_TURBO_NO_CPR>;
-						};
-
-						rpmpd_opp_turbo_high: opp111 {
-							opp-level = <RPM_SMD_LEVEL_TURBO_HIGH>;
-						};
-					};
-				};
-			};
-		};
-	};
-
 	smsm {
 		compatible = "qcom,smsm";
 
diff --git a/arch/arm64/boot/dts/qcom/msm8994.dtsi b/arch/arm64/boot/dts/qcom/msm8994.dtsi
index 5a7923d7c62a..6168d0aeff57 100644
--- a/arch/arm64/boot/dts/qcom/msm8994.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8994.dtsi
@@ -178,6 +178,56 @@ psci {
 		method = "hvc";
 	};
 
+	rpm: remoteproc-rpm {
+		compatible = "qcom,msm8994-rpm-proc", "qcom,rpm-proc";
+
+		smd-edge {
+			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
+			qcom,ipc = <&apcs 8 0>;
+			qcom,smd-edge = <15>;
+			qcom,remote-pid = <6>;
+
+			rpm_requests: rpm-requests {
+				compatible = "qcom,rpm-msm8994";
+				qcom,smd-channels = "rpm_requests";
+
+				rpmcc: clock-controller {
+					compatible = "qcom,rpmcc-msm8994", "qcom,rpmcc";
+					#clock-cells = <1>;
+				};
+
+				rpmpd: power-controller {
+					compatible = "qcom,msm8994-rpmpd";
+					#power-domain-cells = <1>;
+					operating-points-v2 = <&rpmpd_opp_table>;
+
+					rpmpd_opp_table: opp-table {
+						compatible = "operating-points-v2";
+
+						rpmpd_opp_ret: opp1 {
+							opp-level = <1>;
+						};
+						rpmpd_opp_svs_krait: opp2 {
+							opp-level = <2>;
+						};
+						rpmpd_opp_svs_soc: opp3 {
+							opp-level = <3>;
+						};
+						rpmpd_opp_nom: opp4 {
+							opp-level = <4>;
+						};
+						rpmpd_opp_turbo: opp5 {
+							opp-level = <5>;
+						};
+						rpmpd_opp_super_turbo: opp6 {
+							opp-level = <6>;
+						};
+					};
+				};
+			};
+		};
+	};
+
 	reserved-memory {
 		#address-cells = <2>;
 		#size-cells = <2>;
@@ -237,55 +287,6 @@ reserved@6c00000 {
 		};
 	};
 
-	smd {
-		compatible = "qcom,smd";
-		rpm {
-			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
-			qcom,ipc = <&apcs 8 0>;
-			qcom,smd-edge = <15>;
-			qcom,remote-pid = <6>;
-
-			rpm_requests: rpm-requests {
-				compatible = "qcom,rpm-msm8994";
-				qcom,smd-channels = "rpm_requests";
-
-				rpmcc: clock-controller {
-					compatible = "qcom,rpmcc-msm8994", "qcom,rpmcc";
-					#clock-cells = <1>;
-				};
-
-				rpmpd: power-controller {
-					compatible = "qcom,msm8994-rpmpd";
-					#power-domain-cells = <1>;
-					operating-points-v2 = <&rpmpd_opp_table>;
-
-					rpmpd_opp_table: opp-table {
-						compatible = "operating-points-v2";
-
-						rpmpd_opp_ret: opp1 {
-							opp-level = <1>;
-						};
-						rpmpd_opp_svs_krait: opp2 {
-							opp-level = <2>;
-						};
-						rpmpd_opp_svs_soc: opp3 {
-							opp-level = <3>;
-						};
-						rpmpd_opp_nom: opp4 {
-							opp-level = <4>;
-						};
-						rpmpd_opp_turbo: opp5 {
-							opp-level = <5>;
-						};
-						rpmpd_opp_super_turbo: opp6 {
-							opp-level = <6>;
-						};
-					};
-				};
-			};
-		};
-	};
-
 	smem {
 		compatible = "qcom,smem";
 		memory-region = <&smem_mem>;

-- 
2.40.1


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

* [PATCH 12/14] arm64: dts: qcom: Add rpm-proc node for GLINK gplatforms
  2023-06-05  7:08 [PATCH 00/14] Add dedicated device tree node for RPM processor/subsystem Stephan Gerhold
                   ` (10 preceding siblings ...)
  2023-06-05  7:08 ` [PATCH 11/14] arm64: dts: qcom: Add rpm-proc node for SMD platforms Stephan Gerhold
@ 2023-06-05  7:08 ` Stephan Gerhold
  2023-06-05 19:43   ` Konrad Dybcio
  2023-06-05  7:08 ` [PATCH 13/14] ARM: dts: qcom: Add rpm-proc node for SMD platforms Stephan Gerhold
  2023-06-05  7:08 ` [PATCH 14/14] ARM: dts: qcom: apq8064: Drop redundant /smd node Stephan Gerhold
  13 siblings, 1 reply; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-05  7:08 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc, Stephan Gerhold

Rather than having the RPM GLINK channels as the only child of a dummy
top-level rpm-glink node, switch to representing the RPM as remoteproc
like all the other remoteprocs (modem DSP, ...).

This allows assigning additional subdevices to it like the MPM
interrupt-controller or rpm-master-stats.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 arch/arm64/boot/dts/qcom/ipq6018.dtsi |  48 ++++++-----
 arch/arm64/boot/dts/qcom/ipq9574.dtsi |  28 ++++---
 arch/arm64/boot/dts/qcom/msm8996.dtsi | 113 ++++++++++++-------------
 arch/arm64/boot/dts/qcom/msm8998.dtsi |  98 +++++++++++-----------
 arch/arm64/boot/dts/qcom/qcm2290.dtsi | 126 ++++++++++++++--------------
 arch/arm64/boot/dts/qcom/qcs404.dtsi  | 152 +++++++++++++++++-----------------
 arch/arm64/boot/dts/qcom/sdm630.dtsi  | 132 +++++++++++++++--------------
 arch/arm64/boot/dts/qcom/sm6115.dtsi  | 128 ++++++++++++++--------------
 arch/arm64/boot/dts/qcom/sm6125.dtsi  | 140 ++++++++++++++++---------------
 arch/arm64/boot/dts/qcom/sm6375.dtsi  | 126 ++++++++++++++--------------
 10 files changed, 564 insertions(+), 527 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/ipq6018.dtsi b/arch/arm64/boot/dts/qcom/ipq6018.dtsi
index 7355f266742a..fff4a4014bd8 100644
--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi
@@ -146,6 +146,32 @@ psci: psci {
 		method = "smc";
 	};
 
+	rpm: remoteproc-rpm {
+		compatible = "qcom,ipq6018-rpm-proc", "qcom,rpm-proc";
+
+		glink-rpm {
+			compatible = "qcom,glink-rpm";
+			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
+			qcom,rpm-msg-ram = <&rpm_msg_ram>;
+			mboxes = <&apcs_glb 0>;
+
+			rpm_requests: rpm-requests {
+				compatible = "qcom,rpm-ipq6018";
+				qcom,glink-channels = "rpm_requests";
+
+				regulators {
+					compatible = "qcom,rpm-mp5496-regulators";
+
+					ipq6018_s2: s2 {
+						regulator-min-microvolt = <725000>;
+						regulator-max-microvolt = <1062500>;
+						regulator-always-on;
+					};
+				};
+			};
+		};
+	};
+
 	reserved-memory {
 		#address-cells = <2>;
 		#size-cells = <2>;
@@ -182,28 +208,6 @@ q6_region: memory@4ab00000 {
 		};
 	};
 
-	rpm-glink {
-		compatible = "qcom,glink-rpm";
-		interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
-		qcom,rpm-msg-ram = <&rpm_msg_ram>;
-		mboxes = <&apcs_glb 0>;
-
-		rpm_requests: rpm-requests {
-			compatible = "qcom,rpm-ipq6018";
-			qcom,glink-channels = "rpm_requests";
-
-			regulators {
-				compatible = "qcom,rpm-mp5496-regulators";
-
-				ipq6018_s2: s2 {
-					regulator-min-microvolt = <725000>;
-					regulator-max-microvolt = <1062500>;
-					regulator-always-on;
-				};
-			};
-		};
-	};
-
 	smem {
 		compatible = "qcom,smem";
 		memory-region = <&smem_region>;
diff --git a/arch/arm64/boot/dts/qcom/ipq9574.dtsi b/arch/arm64/boot/dts/qcom/ipq9574.dtsi
index 0baeb10bbdae..3222568ac4cf 100644
--- a/arch/arm64/boot/dts/qcom/ipq9574.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq9574.dtsi
@@ -151,6 +151,22 @@ psci {
 		method = "smc";
 	};
 
+	rpm: remoteproc-rpm {
+		compatible = "qcom,ipq9574-rpm-proc", "qcom,rpm-proc";
+
+		glink-rpm {
+			compatible = "qcom,glink-rpm";
+			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
+			qcom,rpm-msg-ram = <&rpm_msg_ram>;
+			mboxes = <&apcs_glb 0>;
+
+			rpm_requests: rpm-requests {
+				compatible = "qcom,rpm-ipq9574";
+				qcom,glink-channels = "rpm_requests";
+			};
+		};
+	};
+
 	reserved-memory {
 		#address-cells = <2>;
 		#size-cells = <2>;
@@ -169,18 +185,6 @@ smem@4aa00000 {
 		};
 	};
 
-	rpm-glink {
-		compatible = "qcom,glink-rpm";
-		interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
-		qcom,rpm-msg-ram = <&rpm_msg_ram>;
-		mboxes = <&apcs_glb 0>;
-
-		rpm_requests: rpm-requests {
-			compatible = "qcom,rpm-ipq9574";
-			qcom,glink-channels = "rpm_requests";
-		};
-	};
-
 	soc: soc@0 {
 		compatible = "simple-bus";
 		#address-cells = <1>;
diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi
index f75932cc2a30..50ede09d6368 100644
--- a/arch/arm64/boot/dts/qcom/msm8996.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi
@@ -398,6 +398,63 @@ psci {
 		method = "smc";
 	};
 
+	rpm: remoteproc-rpm {
+		compatible = "qcom,msm8996-rpm-proc", "qcom,rpm-proc";
+
+		glink-rpm {
+			compatible = "qcom,glink-rpm";
+			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
+			qcom,rpm-msg-ram = <&rpm_msg_ram>;
+			mboxes = <&apcs_glb 0>;
+
+			rpm_requests: rpm-requests {
+				compatible = "qcom,rpm-msm8996";
+				qcom,glink-channels = "rpm_requests";
+
+				rpmcc: clock-controller {
+					compatible = "qcom,rpmcc-msm8996", "qcom,rpmcc";
+					#clock-cells = <1>;
+					clocks = <&xo_board>;
+					clock-names = "xo";
+				};
+
+				rpmpd: power-controller {
+					compatible = "qcom,msm8996-rpmpd";
+					#power-domain-cells = <1>;
+					operating-points-v2 = <&rpmpd_opp_table>;
+
+					rpmpd_opp_table: opp-table {
+						compatible = "operating-points-v2";
+
+						rpmpd_opp1: opp1 {
+							opp-level = <1>;
+						};
+
+						rpmpd_opp2: opp2 {
+							opp-level = <2>;
+						};
+
+						rpmpd_opp3: opp3 {
+							opp-level = <3>;
+						};
+
+						rpmpd_opp4: opp4 {
+							opp-level = <4>;
+						};
+
+						rpmpd_opp5: opp5 {
+							opp-level = <5>;
+						};
+
+						rpmpd_opp6: opp6 {
+							opp-level = <6>;
+						};
+					};
+				};
+			};
+		};
+	};
+
 	reserved-memory {
 		#address-cells = <2>;
 		#size-cells = <2>;
@@ -472,62 +529,6 @@ mdata_mem: mpss-metadata {
 		};
 	};
 
-	rpm-glink {
-		compatible = "qcom,glink-rpm";
-
-		interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
-
-		qcom,rpm-msg-ram = <&rpm_msg_ram>;
-
-		mboxes = <&apcs_glb 0>;
-
-		rpm_requests: rpm-requests {
-			compatible = "qcom,rpm-msm8996";
-			qcom,glink-channels = "rpm_requests";
-
-			rpmcc: clock-controller {
-				compatible = "qcom,rpmcc-msm8996", "qcom,rpmcc";
-				#clock-cells = <1>;
-				clocks = <&xo_board>;
-				clock-names = "xo";
-			};
-
-			rpmpd: power-controller {
-				compatible = "qcom,msm8996-rpmpd";
-				#power-domain-cells = <1>;
-				operating-points-v2 = <&rpmpd_opp_table>;
-
-				rpmpd_opp_table: opp-table {
-					compatible = "operating-points-v2";
-
-					rpmpd_opp1: opp1 {
-						opp-level = <1>;
-					};
-
-					rpmpd_opp2: opp2 {
-						opp-level = <2>;
-					};
-
-					rpmpd_opp3: opp3 {
-						opp-level = <3>;
-					};
-
-					rpmpd_opp4: opp4 {
-						opp-level = <4>;
-					};
-
-					rpmpd_opp5: opp5 {
-						opp-level = <5>;
-					};
-
-					rpmpd_opp6: opp6 {
-						opp-level = <6>;
-					};
-				};
-			};
-		};
-	};
-
 	smem {
 		compatible = "qcom,smem";
 		memory-region = <&smem_mem>;
diff --git a/arch/arm64/boot/dts/qcom/msm8998.dtsi b/arch/arm64/boot/dts/qcom/msm8998.dtsi
index f0e943ff0046..bc51fa6a18aa 100644
--- a/arch/arm64/boot/dts/qcom/msm8998.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8998.dtsi
@@ -321,68 +321,72 @@ psci {
 		method = "smc";
 	};
 
-	rpm-glink {
-		compatible = "qcom,glink-rpm";
+	rpm: remoteproc-rpm {
+		compatible = "qcom,msm8998-rpm-proc", "qcom,rpm-proc";
 
-		interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
-		qcom,rpm-msg-ram = <&rpm_msg_ram>;
-		mboxes = <&apcs_glb 0>;
+		glink-rpm {
+			compatible = "qcom,glink-rpm";
 
-		rpm_requests: rpm-requests {
-			compatible = "qcom,rpm-msm8998";
-			qcom,glink-channels = "rpm_requests";
+			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
+			qcom,rpm-msg-ram = <&rpm_msg_ram>;
+			mboxes = <&apcs_glb 0>;
 
-			rpmcc: clock-controller {
-				compatible = "qcom,rpmcc-msm8998", "qcom,rpmcc";
-				#clock-cells = <1>;
-			};
+			rpm_requests: rpm-requests {
+				compatible = "qcom,rpm-msm8998";
+				qcom,glink-channels = "rpm_requests";
 
-			rpmpd: power-controller {
-				compatible = "qcom,msm8998-rpmpd";
-				#power-domain-cells = <1>;
-				operating-points-v2 = <&rpmpd_opp_table>;
+				rpmcc: clock-controller {
+					compatible = "qcom,rpmcc-msm8998", "qcom,rpmcc";
+					#clock-cells = <1>;
+				};
 
-				rpmpd_opp_table: opp-table {
-					compatible = "operating-points-v2";
+				rpmpd: power-controller {
+					compatible = "qcom,msm8998-rpmpd";
+					#power-domain-cells = <1>;
+					operating-points-v2 = <&rpmpd_opp_table>;
 
-					rpmpd_opp_ret: opp1 {
-						opp-level = <RPM_SMD_LEVEL_RETENTION>;
-					};
+					rpmpd_opp_table: opp-table {
+						compatible = "operating-points-v2";
 
-					rpmpd_opp_ret_plus: opp2 {
-						opp-level = <RPM_SMD_LEVEL_RETENTION_PLUS>;
-					};
+						rpmpd_opp_ret: opp1 {
+							opp-level = <RPM_SMD_LEVEL_RETENTION>;
+						};
 
-					rpmpd_opp_min_svs: opp3 {
-						opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
-					};
+						rpmpd_opp_ret_plus: opp2 {
+							opp-level = <RPM_SMD_LEVEL_RETENTION_PLUS>;
+						};
 
-					rpmpd_opp_low_svs: opp4 {
-						opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
-					};
+						rpmpd_opp_min_svs: opp3 {
+							opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
+						};
 
-					rpmpd_opp_svs: opp5 {
-						opp-level = <RPM_SMD_LEVEL_SVS>;
-					};
+						rpmpd_opp_low_svs: opp4 {
+							opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
+						};
 
-					rpmpd_opp_svs_plus: opp6 {
-						opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
-					};
+						rpmpd_opp_svs: opp5 {
+							opp-level = <RPM_SMD_LEVEL_SVS>;
+						};
 
-					rpmpd_opp_nom: opp7 {
-						opp-level = <RPM_SMD_LEVEL_NOM>;
-					};
+						rpmpd_opp_svs_plus: opp6 {
+							opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
+						};
 
-					rpmpd_opp_nom_plus: opp8 {
-						opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
-					};
+						rpmpd_opp_nom: opp7 {
+							opp-level = <RPM_SMD_LEVEL_NOM>;
+						};
 
-					rpmpd_opp_turbo: opp9 {
-						opp-level = <RPM_SMD_LEVEL_TURBO>;
-					};
+						rpmpd_opp_nom_plus: opp8 {
+							opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
+						};
+
+						rpmpd_opp_turbo: opp9 {
+							opp-level = <RPM_SMD_LEVEL_TURBO>;
+						};
 
-					rpmpd_opp_turbo_plus: opp10 {
-						opp-level = <RPM_SMD_LEVEL_BINNING>;
+						rpmpd_opp_turbo_plus: opp10 {
+							opp-level = <RPM_SMD_LEVEL_BINNING>;
+						};
 					};
 				};
 			};
diff --git a/arch/arm64/boot/dts/qcom/qcm2290.dtsi b/arch/arm64/boot/dts/qcom/qcm2290.dtsi
index b29bc4e4b837..ad1b721d1e1e 100644
--- a/arch/arm64/boot/dts/qcom/qcm2290.dtsi
+++ b/arch/arm64/boot/dts/qcom/qcm2290.dtsi
@@ -137,6 +137,71 @@ psci {
 		method = "smc";
 	};
 
+	rpm: remoteproc-rpm {
+		compatible = "qcom,qcm2290-rpm-proc", "qcom,rpm-proc";
+
+		glink-rpm {
+			compatible = "qcom,glink-rpm";
+			interrupts = <GIC_SPI 194 IRQ_TYPE_EDGE_RISING>;
+			qcom,rpm-msg-ram = <&rpm_msg_ram>;
+			mboxes = <&apcs_glb 0>;
+
+			rpm_requests: rpm-requests {
+				compatible = "qcom,rpm-qcm2290";
+				qcom,glink-channels = "rpm_requests";
+
+				rpmcc: clock-controller {
+					compatible = "qcom,rpmcc-qcm2290", "qcom,rpmcc";
+					clocks = <&xo_board>;
+					clock-names = "xo";
+					#clock-cells = <1>;
+				};
+
+				rpmpd: power-controller {
+					compatible = "qcom,qcm2290-rpmpd";
+					#power-domain-cells = <1>;
+					operating-points-v2 = <&rpmpd_opp_table>;
+
+					rpmpd_opp_table: opp-table {
+						compatible = "operating-points-v2";
+
+						rpmpd_opp_min_svs: opp1 {
+							opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
+						};
+
+						rpmpd_opp_low_svs: opp2 {
+							opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
+						};
+
+						rpmpd_opp_svs: opp3 {
+							opp-level = <RPM_SMD_LEVEL_SVS>;
+						};
+
+						rpmpd_opp_svs_plus: opp4 {
+							opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
+						};
+
+						rpmpd_opp_nom: opp5 {
+							opp-level = <RPM_SMD_LEVEL_NOM>;
+						};
+
+						rpmpd_opp_nom_plus: opp6 {
+							opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
+						};
+
+						rpmpd_opp_turbo: opp7 {
+							opp-level = <RPM_SMD_LEVEL_TURBO>;
+						};
+
+						rpmpd_opp_turbo_plus: opp8 {
+							opp-level = <RPM_SMD_LEVEL_TURBO_NO_CPR>;
+						};
+					};
+				};
+			};
+		};
+	};
+
 	reserved_memory: reserved-memory {
 		#address-cells = <2>;
 		#size-cells = <2>;
@@ -227,67 +292,6 @@ rmtfs_mem: memory@89b01000 {
 		};
 	};
 
-	rpm-glink {
-		compatible = "qcom,glink-rpm";
-		interrupts = <GIC_SPI 194 IRQ_TYPE_EDGE_RISING>;
-		qcom,rpm-msg-ram = <&rpm_msg_ram>;
-		mboxes = <&apcs_glb 0>;
-
-		rpm_requests: rpm-requests {
-			compatible = "qcom,rpm-qcm2290";
-			qcom,glink-channels = "rpm_requests";
-
-			rpmcc: clock-controller {
-				compatible = "qcom,rpmcc-qcm2290", "qcom,rpmcc";
-				clocks = <&xo_board>;
-				clock-names = "xo";
-				#clock-cells = <1>;
-			};
-
-			rpmpd: power-controller {
-				compatible = "qcom,qcm2290-rpmpd";
-				#power-domain-cells = <1>;
-				operating-points-v2 = <&rpmpd_opp_table>;
-
-				rpmpd_opp_table: opp-table {
-					compatible = "operating-points-v2";
-
-					rpmpd_opp_min_svs: opp1 {
-						opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
-					};
-
-					rpmpd_opp_low_svs: opp2 {
-						opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
-					};
-
-					rpmpd_opp_svs: opp3 {
-						opp-level = <RPM_SMD_LEVEL_SVS>;
-					};
-
-					rpmpd_opp_svs_plus: opp4 {
-						opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
-					};
-
-					rpmpd_opp_nom: opp5 {
-						opp-level = <RPM_SMD_LEVEL_NOM>;
-					};
-
-					rpmpd_opp_nom_plus: opp6 {
-						opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
-					};
-
-					rpmpd_opp_turbo: opp7 {
-						opp-level = <RPM_SMD_LEVEL_TURBO>;
-					};
-
-					rpmpd_opp_turbo_plus: opp8 {
-						opp-level = <RPM_SMD_LEVEL_TURBO_NO_CPR>;
-					};
-				};
-			};
-		};
-	};
-
 	smp2p-adsp {
 		compatible = "qcom,smp2p";
 		qcom,smem = <443>, <429>;
diff --git a/arch/arm64/boot/dts/qcom/qcs404.dtsi b/arch/arm64/boot/dts/qcom/qcs404.dtsi
index 972f753847e1..329363cace5a 100644
--- a/arch/arm64/boot/dts/qcom/qcs404.dtsi
+++ b/arch/arm64/boot/dts/qcom/qcs404.dtsi
@@ -166,6 +166,84 @@ psci {
 		method = "smc";
 	};
 
+	rpm: remoteproc-rpm {
+		compatible = "qcom,qcs404-rpm-proc", "qcom,rpm-proc";
+
+		glink-rpm {
+			compatible = "qcom,glink-rpm";
+
+			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
+			qcom,rpm-msg-ram = <&rpm_msg_ram>;
+			mboxes = <&apcs_glb 0>;
+
+			rpm_requests: rpm-requests {
+				compatible = "qcom,rpm-qcs404";
+				qcom,glink-channels = "rpm_requests";
+
+				rpmcc: clock-controller {
+					compatible = "qcom,rpmcc-qcs404", "qcom,rpmcc";
+					#clock-cells = <1>;
+					clocks = <&xo_board>;
+					clock-names = "xo";
+				};
+
+				rpmpd: power-controller {
+					compatible = "qcom,qcs404-rpmpd";
+					#power-domain-cells = <1>;
+					operating-points-v2 = <&rpmpd_opp_table>;
+
+					rpmpd_opp_table: opp-table {
+						compatible = "operating-points-v2";
+
+						rpmpd_opp_ret: opp1 {
+							opp-level = <16>;
+						};
+
+						rpmpd_opp_ret_plus: opp2 {
+							opp-level = <32>;
+						};
+
+						rpmpd_opp_min_svs: opp3 {
+							opp-level = <48>;
+						};
+
+						rpmpd_opp_low_svs: opp4 {
+							opp-level = <64>;
+						};
+
+						rpmpd_opp_svs: opp5 {
+							opp-level = <128>;
+						};
+
+						rpmpd_opp_svs_plus: opp6 {
+							opp-level = <192>;
+						};
+
+						rpmpd_opp_nom: opp7 {
+							opp-level = <256>;
+						};
+
+						rpmpd_opp_nom_plus: opp8 {
+							opp-level = <320>;
+						};
+
+						rpmpd_opp_turbo: opp9 {
+							opp-level = <384>;
+						};
+
+						rpmpd_opp_turbo_no_cpr: opp10 {
+							opp-level = <416>;
+						};
+
+						rpmpd_opp_turbo_plus: opp11 {
+							opp-level = <512>;
+						};
+					};
+				};
+			};
+		};
+	};
+
 	reserved-memory {
 		#address-cells = <2>;
 		#size-cells = <2>;
@@ -217,80 +295,6 @@ uefi_mem: memory@9f800000 {
 		};
 	};
 
-	rpm-glink {
-		compatible = "qcom,glink-rpm";
-
-		interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
-		qcom,rpm-msg-ram = <&rpm_msg_ram>;
-		mboxes = <&apcs_glb 0>;
-
-		rpm_requests: rpm-requests {
-			compatible = "qcom,rpm-qcs404";
-			qcom,glink-channels = "rpm_requests";
-
-			rpmcc: clock-controller {
-				compatible = "qcom,rpmcc-qcs404", "qcom,rpmcc";
-				#clock-cells = <1>;
-				clocks = <&xo_board>;
-				clock-names = "xo";
-			};
-
-			rpmpd: power-controller {
-				compatible = "qcom,qcs404-rpmpd";
-				#power-domain-cells = <1>;
-				operating-points-v2 = <&rpmpd_opp_table>;
-
-				rpmpd_opp_table: opp-table {
-					compatible = "operating-points-v2";
-
-					rpmpd_opp_ret: opp1 {
-						opp-level = <16>;
-					};
-
-					rpmpd_opp_ret_plus: opp2 {
-						opp-level = <32>;
-					};
-
-					rpmpd_opp_min_svs: opp3 {
-						opp-level = <48>;
-					};
-
-					rpmpd_opp_low_svs: opp4 {
-						opp-level = <64>;
-					};
-
-					rpmpd_opp_svs: opp5 {
-						opp-level = <128>;
-					};
-
-					rpmpd_opp_svs_plus: opp6 {
-						opp-level = <192>;
-					};
-
-					rpmpd_opp_nom: opp7 {
-						opp-level = <256>;
-					};
-
-					rpmpd_opp_nom_plus: opp8 {
-						opp-level = <320>;
-					};
-
-					rpmpd_opp_turbo: opp9 {
-						opp-level = <384>;
-					};
-
-					rpmpd_opp_turbo_no_cpr: opp10 {
-						opp-level = <416>;
-					};
-
-					rpmpd_opp_turbo_plus: opp11 {
-						opp-level = <512>;
-					};
-				};
-			};
-		};
-	};
-
 	smem {
 		compatible = "qcom,smem";
 
diff --git a/arch/arm64/boot/dts/qcom/sdm630.dtsi b/arch/arm64/boot/dts/qcom/sdm630.dtsi
index 897f2440c9c8..2dfaec074c24 100644
--- a/arch/arm64/boot/dts/qcom/sdm630.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm630.dtsi
@@ -359,6 +359,74 @@ psci {
 		method = "smc";
 	};
 
+	rpm: remoteproc-rpm {
+		compatible = "qcom,sdm660-rpm-proc", "qcom,rpm-proc";
+
+		glink-rpm {
+			compatible = "qcom,glink-rpm";
+
+			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
+			qcom,rpm-msg-ram = <&rpm_msg_ram>;
+			mboxes = <&apcs_glb 0>;
+
+			rpm_requests: rpm-requests {
+				compatible = "qcom,rpm-sdm660";
+				qcom,glink-channels = "rpm_requests";
+
+				rpmcc: clock-controller {
+					compatible = "qcom,rpmcc-sdm660", "qcom,rpmcc";
+					#clock-cells = <1>;
+				};
+
+				rpmpd: power-controller {
+					compatible = "qcom,sdm660-rpmpd";
+					#power-domain-cells = <1>;
+					operating-points-v2 = <&rpmpd_opp_table>;
+
+					rpmpd_opp_table: opp-table {
+						compatible = "operating-points-v2";
+
+						rpmpd_opp_ret: opp1 {
+							opp-level = <RPM_SMD_LEVEL_RETENTION>;
+						};
+
+						rpmpd_opp_ret_plus: opp2 {
+							opp-level = <RPM_SMD_LEVEL_RETENTION_PLUS>;
+						};
+
+						rpmpd_opp_min_svs: opp3 {
+							opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
+						};
+
+						rpmpd_opp_low_svs: opp4 {
+							opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
+						};
+
+						rpmpd_opp_svs: opp5 {
+							opp-level = <RPM_SMD_LEVEL_SVS>;
+						};
+
+						rpmpd_opp_svs_plus: opp6 {
+							opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
+						};
+
+						rpmpd_opp_nom: opp7 {
+							opp-level = <RPM_SMD_LEVEL_NOM>;
+						};
+
+						rpmpd_opp_nom_plus: opp8 {
+							opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
+						};
+
+						rpmpd_opp_turbo: opp9 {
+							opp-level = <RPM_SMD_LEVEL_TURBO>;
+						};
+					};
+				};
+			};
+		};
+	};
+
 	reserved-memory {
 		#address-cells = <2>;
 		#size-cells = <2>;
@@ -440,70 +508,6 @@ zap_shader_region: gpu@fed00000 {
 		};
 	};
 
-	rpm-glink {
-		compatible = "qcom,glink-rpm";
-
-		interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
-		qcom,rpm-msg-ram = <&rpm_msg_ram>;
-		mboxes = <&apcs_glb 0>;
-
-		rpm_requests: rpm-requests {
-			compatible = "qcom,rpm-sdm660";
-			qcom,glink-channels = "rpm_requests";
-
-			rpmcc: clock-controller {
-				compatible = "qcom,rpmcc-sdm660", "qcom,rpmcc";
-				#clock-cells = <1>;
-			};
-
-			rpmpd: power-controller {
-				compatible = "qcom,sdm660-rpmpd";
-				#power-domain-cells = <1>;
-				operating-points-v2 = <&rpmpd_opp_table>;
-
-				rpmpd_opp_table: opp-table {
-					compatible = "operating-points-v2";
-
-					rpmpd_opp_ret: opp1 {
-						opp-level = <RPM_SMD_LEVEL_RETENTION>;
-					};
-
-					rpmpd_opp_ret_plus: opp2 {
-						opp-level = <RPM_SMD_LEVEL_RETENTION_PLUS>;
-					};
-
-					rpmpd_opp_min_svs: opp3 {
-						opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
-					};
-
-					rpmpd_opp_low_svs: opp4 {
-						opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
-					};
-
-					rpmpd_opp_svs: opp5 {
-						opp-level = <RPM_SMD_LEVEL_SVS>;
-					};
-
-					rpmpd_opp_svs_plus: opp6 {
-						opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
-					};
-
-					rpmpd_opp_nom: opp7 {
-						opp-level = <RPM_SMD_LEVEL_NOM>;
-					};
-
-					rpmpd_opp_nom_plus: opp8 {
-						opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
-					};
-
-					rpmpd_opp_turbo: opp9 {
-						opp-level = <RPM_SMD_LEVEL_TURBO>;
-					};
-				};
-			};
-		};
-	};
-
 	smem: smem {
 		compatible = "qcom,smem";
 		memory-region = <&smem_region>;
diff --git a/arch/arm64/boot/dts/qcom/sm6115.dtsi b/arch/arm64/boot/dts/qcom/sm6115.dtsi
index 55118577bf92..d3ea67f7563d 100644
--- a/arch/arm64/boot/dts/qcom/sm6115.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm6115.dtsi
@@ -341,6 +341,72 @@ CLUSTER_1_PD: power-domain-cpu-cluster1 {
 		};
 	};
 
+	rpm: remoteproc-rpm {
+		compatible = "qcom,sm6115-rpm-proc", "qcom,rpm-proc";
+
+		glink-rpm {
+			compatible = "qcom,glink-rpm";
+
+			interrupts = <GIC_SPI 194 IRQ_TYPE_EDGE_RISING>;
+			qcom,rpm-msg-ram = <&rpm_msg_ram>;
+			mboxes = <&apcs_glb 0>;
+
+			rpm_requests: rpm-requests {
+				compatible = "qcom,rpm-sm6115";
+				qcom,glink-channels = "rpm_requests";
+
+				rpmcc: clock-controller {
+					compatible = "qcom,rpmcc-sm6115", "qcom,rpmcc";
+					clocks = <&xo_board>;
+					clock-names = "xo";
+					#clock-cells = <1>;
+				};
+
+				rpmpd: power-controller {
+					compatible = "qcom,sm6115-rpmpd";
+					#power-domain-cells = <1>;
+					operating-points-v2 = <&rpmpd_opp_table>;
+
+					rpmpd_opp_table: opp-table {
+						compatible = "operating-points-v2";
+
+						rpmpd_opp_min_svs: opp1 {
+							opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
+						};
+
+						rpmpd_opp_low_svs: opp2 {
+							opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
+						};
+
+						rpmpd_opp_svs: opp3 {
+							opp-level = <RPM_SMD_LEVEL_SVS>;
+						};
+
+						rpmpd_opp_svs_plus: opp4 {
+							opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
+						};
+
+						rpmpd_opp_nom: opp5 {
+							opp-level = <RPM_SMD_LEVEL_NOM>;
+						};
+
+						rpmpd_opp_nom_plus: opp6 {
+							opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
+						};
+
+						rpmpd_opp_turbo: opp7 {
+							opp-level = <RPM_SMD_LEVEL_TURBO>;
+						};
+
+						rpmpd_opp_turbo_plus: opp8 {
+							opp-level = <RPM_SMD_LEVEL_TURBO_NO_CPR>;
+						};
+					};
+				};
+			};
+		};
+	};
+
 	reserved_memory: reserved-memory {
 		#address-cells = <2>;
 		#size-cells = <2>;
@@ -440,68 +506,6 @@ rmtfs_mem: memory@89b01000 {
 		};
 	};
 
-	rpm-glink {
-		compatible = "qcom,glink-rpm";
-
-		interrupts = <GIC_SPI 194 IRQ_TYPE_EDGE_RISING>;
-		qcom,rpm-msg-ram = <&rpm_msg_ram>;
-		mboxes = <&apcs_glb 0>;
-
-		rpm_requests: rpm-requests {
-			compatible = "qcom,rpm-sm6115";
-			qcom,glink-channels = "rpm_requests";
-
-			rpmcc: clock-controller {
-				compatible = "qcom,rpmcc-sm6115", "qcom,rpmcc";
-				clocks = <&xo_board>;
-				clock-names = "xo";
-				#clock-cells = <1>;
-			};
-
-			rpmpd: power-controller {
-				compatible = "qcom,sm6115-rpmpd";
-				#power-domain-cells = <1>;
-				operating-points-v2 = <&rpmpd_opp_table>;
-
-				rpmpd_opp_table: opp-table {
-					compatible = "operating-points-v2";
-
-					rpmpd_opp_min_svs: opp1 {
-						opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
-					};
-
-					rpmpd_opp_low_svs: opp2 {
-						opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
-					};
-
-					rpmpd_opp_svs: opp3 {
-						opp-level = <RPM_SMD_LEVEL_SVS>;
-					};
-
-					rpmpd_opp_svs_plus: opp4 {
-						opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
-					};
-
-					rpmpd_opp_nom: opp5 {
-						opp-level = <RPM_SMD_LEVEL_NOM>;
-					};
-
-					rpmpd_opp_nom_plus: opp6 {
-						opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
-					};
-
-					rpmpd_opp_turbo: opp7 {
-						opp-level = <RPM_SMD_LEVEL_TURBO>;
-					};
-
-					rpmpd_opp_turbo_plus: opp8 {
-						opp-level = <RPM_SMD_LEVEL_TURBO_NO_CPR>;
-					};
-				};
-			};
-		};
-	};
-
 	smp2p-adsp {
 		compatible = "qcom,smp2p";
 		qcom,smem = <443>, <429>;
diff --git a/arch/arm64/boot/dts/qcom/sm6125.dtsi b/arch/arm64/boot/dts/qcom/sm6125.dtsi
index a596baa6ce3e..1d05ddf35e35 100644
--- a/arch/arm64/boot/dts/qcom/sm6125.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm6125.dtsi
@@ -181,6 +181,78 @@ psci {
 		method = "smc";
 	};
 
+	remoteproc-rpm {
+		compatible = "qcom,sm6125-rpm-proc", "qcom,rpm-proc";
+
+		glink-rpm {
+			compatible = "qcom,glink-rpm";
+
+			interrupts = <GIC_SPI 194 IRQ_TYPE_EDGE_RISING>;
+			qcom,rpm-msg-ram = <&rpm_msg_ram>;
+			mboxes = <&apcs_glb 0>;
+
+			rpm_requests: rpm-requests {
+				compatible = "qcom,rpm-sm6125";
+				qcom,glink-channels = "rpm_requests";
+
+				rpmcc: clock-controller {
+					compatible = "qcom,rpmcc-sm6125", "qcom,rpmcc";
+					#clock-cells = <1>;
+				};
+
+				rpmpd: power-controller {
+					compatible = "qcom,sm6125-rpmpd";
+					#power-domain-cells = <1>;
+					operating-points-v2 = <&rpmpd_opp_table>;
+
+					rpmpd_opp_table: opp-table {
+						compatible = "operating-points-v2";
+
+						rpmpd_opp_ret: opp1 {
+							opp-level = <RPM_SMD_LEVEL_RETENTION>;
+						};
+
+						rpmpd_opp_ret_plus: opp2 {
+							opp-level = <RPM_SMD_LEVEL_RETENTION_PLUS>;
+						};
+
+						rpmpd_opp_min_svs: opp3 {
+							opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
+						};
+
+						rpmpd_opp_low_svs: opp4 {
+							opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
+						};
+
+						rpmpd_opp_svs: opp5 {
+							opp-level = <RPM_SMD_LEVEL_SVS>;
+						};
+
+						rpmpd_opp_svs_plus: opp6 {
+							opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
+						};
+
+						rpmpd_opp_nom: opp7 {
+							opp-level = <RPM_SMD_LEVEL_NOM>;
+						};
+
+						rpmpd_opp_nom_plus: opp8 {
+							opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
+						};
+
+						rpmpd_opp_turbo: opp9 {
+							opp-level = <RPM_SMD_LEVEL_TURBO>;
+						};
+
+						rpmpd_opp_turbo_no_cpr: opp10 {
+							opp-level = <RPM_SMD_LEVEL_TURBO_NO_CPR>;
+						};
+					};
+				};
+			};
+		};
+	};
+
 	reserved_memory: reserved-memory {
 		#address-cells = <2>;
 		#size-cells = <2>;
@@ -292,74 +364,6 @@ qseecom_ta_mem: memory@13fc00000 {
 		};
 	};
 
-	rpm-glink {
-		compatible = "qcom,glink-rpm";
-
-		interrupts = <GIC_SPI 194 IRQ_TYPE_EDGE_RISING>;
-		qcom,rpm-msg-ram = <&rpm_msg_ram>;
-		mboxes = <&apcs_glb 0>;
-
-		rpm_requests: rpm-requests {
-			compatible = "qcom,rpm-sm6125";
-			qcom,glink-channels = "rpm_requests";
-
-			rpmcc: clock-controller {
-				compatible = "qcom,rpmcc-sm6125", "qcom,rpmcc";
-				#clock-cells = <1>;
-			};
-
-			rpmpd: power-controller {
-				compatible = "qcom,sm6125-rpmpd";
-				#power-domain-cells = <1>;
-				operating-points-v2 = <&rpmpd_opp_table>;
-
-				rpmpd_opp_table: opp-table {
-					compatible = "operating-points-v2";
-
-					rpmpd_opp_ret: opp1 {
-						opp-level = <RPM_SMD_LEVEL_RETENTION>;
-					};
-
-					rpmpd_opp_ret_plus: opp2 {
-						opp-level = <RPM_SMD_LEVEL_RETENTION_PLUS>;
-					};
-
-					rpmpd_opp_min_svs: opp3 {
-						opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
-					};
-
-					rpmpd_opp_low_svs: opp4 {
-						opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
-					};
-
-					rpmpd_opp_svs: opp5 {
-						opp-level = <RPM_SMD_LEVEL_SVS>;
-					};
-
-					rpmpd_opp_svs_plus: opp6 {
-						opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
-					};
-
-					rpmpd_opp_nom: opp7 {
-						opp-level = <RPM_SMD_LEVEL_NOM>;
-					};
-
-					rpmpd_opp_nom_plus: opp8 {
-						opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
-					};
-
-					rpmpd_opp_turbo: opp9 {
-						opp-level = <RPM_SMD_LEVEL_TURBO>;
-					};
-
-					rpmpd_opp_turbo_no_cpr: opp10 {
-						opp-level = <RPM_SMD_LEVEL_TURBO_NO_CPR>;
-					};
-				};
-			};
-		};
-	};
-
 	smem: smem {
 		compatible = "qcom,smem";
 		memory-region = <&smem_mem>;
diff --git a/arch/arm64/boot/dts/qcom/sm6375.dtsi b/arch/arm64/boot/dts/qcom/sm6375.dtsi
index f8d9c34d3b2f..9834c5089fe8 100644
--- a/arch/arm64/boot/dts/qcom/sm6375.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm6375.dtsi
@@ -493,67 +493,71 @@ cmdline_region: cmdline@ffd00000 {
 		};
 	};
 
-	rpm-glink {
-		compatible = "qcom,glink-rpm";
-		interrupts-extended = <&ipcc IPCC_CLIENT_AOP
-					     IPCC_MPROC_SIGNAL_GLINK_QMP
-					     IRQ_TYPE_EDGE_RISING>;
-		qcom,rpm-msg-ram = <&rpm_msg_ram>;
-		mboxes = <&ipcc IPCC_CLIENT_AOP IPCC_MPROC_SIGNAL_GLINK_QMP>;
-
-		rpm_requests: rpm-requests {
-			compatible = "qcom,rpm-sm6375";
-			qcom,glink-channels = "rpm_requests";
-
-			rpmcc: clock-controller {
-				compatible = "qcom,rpmcc-sm6375", "qcom,rpmcc";
-				clocks = <&xo_board_clk>;
-				clock-names = "xo";
-				#clock-cells = <1>;
-			};
-
-			rpmpd: power-controller {
-				compatible = "qcom,sm6375-rpmpd";
-				#power-domain-cells = <1>;
-				operating-points-v2 = <&rpmpd_opp_table>;
-
-				rpmpd_opp_table: opp-table {
-					compatible = "operating-points-v2";
-
-					rpmpd_opp_ret: opp1 {
-						opp-level = <RPM_SMD_LEVEL_RETENTION>;
-					};
-
-					rpmpd_opp_min_svs: opp2 {
-						opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
-					};
-
-					rpmpd_opp_low_svs: opp3 {
-						opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
-					};
-
-					rpmpd_opp_svs: opp4 {
-						opp-level = <RPM_SMD_LEVEL_SVS>;
-					};
-
-					rpmpd_opp_svs_plus: opp5 {
-						opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
-					};
-
-					rpmpd_opp_nom: opp6 {
-						opp-level = <RPM_SMD_LEVEL_NOM>;
-					};
-
-					rpmpd_opp_nom_plus: opp7 {
-						opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
-					};
-
-					rpmpd_opp_turbo: opp8 {
-						opp-level = <RPM_SMD_LEVEL_TURBO>;
-					};
-
-					rpmpd_opp_turbo_no_cpr: opp9 {
-						opp-level = <RPM_SMD_LEVEL_TURBO_NO_CPR>;
+	remoteproc-rpm {
+		compatible = "qcom,sm6375-rpm-proc", "qcom,rpm-proc";
+
+		glink-rpm {
+			compatible = "qcom,glink-rpm";
+			interrupts-extended = <&ipcc IPCC_CLIENT_AOP
+						     IPCC_MPROC_SIGNAL_GLINK_QMP
+						     IRQ_TYPE_EDGE_RISING>;
+			qcom,rpm-msg-ram = <&rpm_msg_ram>;
+			mboxes = <&ipcc IPCC_CLIENT_AOP IPCC_MPROC_SIGNAL_GLINK_QMP>;
+
+			rpm_requests: rpm-requests {
+				compatible = "qcom,rpm-sm6375";
+				qcom,glink-channels = "rpm_requests";
+
+				rpmcc: clock-controller {
+					compatible = "qcom,rpmcc-sm6375", "qcom,rpmcc";
+					clocks = <&xo_board_clk>;
+					clock-names = "xo";
+					#clock-cells = <1>;
+				};
+
+				rpmpd: power-controller {
+					compatible = "qcom,sm6375-rpmpd";
+					#power-domain-cells = <1>;
+					operating-points-v2 = <&rpmpd_opp_table>;
+
+					rpmpd_opp_table: opp-table {
+						compatible = "operating-points-v2";
+
+						rpmpd_opp_ret: opp1 {
+							opp-level = <RPM_SMD_LEVEL_RETENTION>;
+						};
+
+						rpmpd_opp_min_svs: opp2 {
+							opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
+						};
+
+						rpmpd_opp_low_svs: opp3 {
+							opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
+						};
+
+						rpmpd_opp_svs: opp4 {
+							opp-level = <RPM_SMD_LEVEL_SVS>;
+						};
+
+						rpmpd_opp_svs_plus: opp5 {
+							opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
+						};
+
+						rpmpd_opp_nom: opp6 {
+							opp-level = <RPM_SMD_LEVEL_NOM>;
+						};
+
+						rpmpd_opp_nom_plus: opp7 {
+							opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
+						};
+
+						rpmpd_opp_turbo: opp8 {
+							opp-level = <RPM_SMD_LEVEL_TURBO>;
+						};
+
+						rpmpd_opp_turbo_no_cpr: opp9 {
+							opp-level = <RPM_SMD_LEVEL_TURBO_NO_CPR>;
+						};
 					};
 				};
 			};

-- 
2.40.1


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

* [PATCH 13/14] ARM: dts: qcom: Add rpm-proc node for SMD platforms
  2023-06-05  7:08 [PATCH 00/14] Add dedicated device tree node for RPM processor/subsystem Stephan Gerhold
                   ` (11 preceding siblings ...)
  2023-06-05  7:08 ` [PATCH 12/14] arm64: dts: qcom: Add rpm-proc node for GLINK gplatforms Stephan Gerhold
@ 2023-06-05  7:08 ` Stephan Gerhold
  2023-06-05  7:08 ` [PATCH 14/14] ARM: dts: qcom: apq8064: Drop redundant /smd node Stephan Gerhold
  13 siblings, 0 replies; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-05  7:08 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc, Stephan Gerhold

Rather than having the RPM SMD channels as the only child of a dummy
SMD node, switch to representing the RPM as remoteproc like all the
other remoteprocs (WCNSS, modem DSP).

This allows assigning additional subdevices to it like the MPM
interrupt-controller or rpm-master-stats.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 arch/arm/boot/dts/qcom-apq8084.dtsi |  6 ++---
 arch/arm/boot/dts/qcom-msm8226.dtsi | 38 ++++++++++++++++----------------
 arch/arm/boot/dts/qcom-msm8974.dtsi | 44 ++++++++++++++++++-------------------
 3 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/arch/arm/boot/dts/qcom-apq8084.dtsi b/arch/arm/boot/dts/qcom-apq8084.dtsi
index 8f178bc87e1d..b24e3bd89ae7 100644
--- a/arch/arm/boot/dts/qcom-apq8084.dtsi
+++ b/arch/arm/boot/dts/qcom-apq8084.dtsi
@@ -784,10 +784,10 @@ spmi_bus: spmi@fc4cf000 {
 		};
 	};
 
-	smd {
-		compatible = "qcom,smd";
+	rpm: remoteproc-rpm {
+		compatible = "qcom,apq8084-rpm-proc", "qcom,rpm-proc";
 
-		rpm {
+		smd-edge {
 			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
 			qcom,ipc = <&apcs 8 0>;
 			qcom,smd-edge = <15>;
diff --git a/arch/arm/boot/dts/qcom-msm8226.dtsi b/arch/arm/boot/dts/qcom-msm8226.dtsi
index a3a9162e9c28..38867a9e07a0 100644
--- a/arch/arm/boot/dts/qcom-msm8226.dtsi
+++ b/arch/arm/boot/dts/qcom-msm8226.dtsi
@@ -53,26 +53,10 @@ pmu {
 					 IRQ_TYPE_LEVEL_HIGH)>;
 	};
 
-	reserved-memory {
-		#address-cells = <1>;
-		#size-cells = <1>;
-		ranges;
-
-		smem_region: smem@3000000 {
-			reg = <0x3000000 0x100000>;
-			no-map;
-		};
-
-		adsp_region: adsp@dc00000 {
-			reg = <0x0dc00000 0x1900000>;
-			no-map;
-		};
-	};
-
-	smd {
-		compatible = "qcom,smd";
+	rpm: remoteproc-rpm {
+		compatible = "qcom,msm8226-rpm-proc", "qcom,rpm-proc";
 
-		rpm {
+		smd-edge {
 			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
 			qcom,ipc = <&apcs 8 0>;
 			qcom,smd-edge = <15>;
@@ -120,6 +104,22 @@ rpmpd_opp_super_turbo: opp6 {
 		};
 	};
 
+	reserved-memory {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		smem_region: smem@3000000 {
+			reg = <0x3000000 0x100000>;
+			no-map;
+		};
+
+		adsp_region: adsp@dc00000 {
+			reg = <0x0dc00000 0x1900000>;
+			no-map;
+		};
+	};
+
 	smem {
 		compatible = "qcom,smem";
 
diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-msm8974.dtsi
index 58e144957c5d..edffd3afec2a 100644
--- a/arch/arm/boot/dts/qcom-msm8974.dtsi
+++ b/arch/arm/boot/dts/qcom-msm8974.dtsi
@@ -113,6 +113,28 @@ pmu {
 		interrupts = <GIC_PPI 7 0xf04>;
 	};
 
+	rpm: remoteproc-rpm {
+		compatible = "qcom,msm8974-rpm-proc", "qcom,rpm-proc";
+
+		smd-edge {
+			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
+			qcom,ipc = <&apcs 8 0>;
+			qcom,smd-edge = <15>;
+
+			rpm_requests: rpm-requests {
+				compatible = "qcom,rpm-msm8974";
+				qcom,smd-channels = "rpm_requests";
+
+				rpmcc: clock-controller {
+					compatible = "qcom,rpmcc-msm8974", "qcom,rpmcc";
+					#clock-cells = <1>;
+					clocks = <&xo_board>;
+					clock-names = "xo";
+				};
+			};
+		};
+	};
+
 	reserved-memory {
 		#address-cells = <1>;
 		#size-cells = <1>;
@@ -293,28 +315,6 @@ wcnss_smsm: wcnss@7 {
 		};
 	};
 
-	smd {
-		compatible = "qcom,smd";
-
-		rpm {
-			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
-			qcom,ipc = <&apcs 8 0>;
-			qcom,smd-edge = <15>;
-
-			rpm_requests: rpm-requests {
-				compatible = "qcom,rpm-msm8974";
-				qcom,smd-channels = "rpm_requests";
-
-				rpmcc: clock-controller {
-					compatible = "qcom,rpmcc-msm8974", "qcom,rpmcc";
-					#clock-cells = <1>;
-					clocks = <&xo_board>;
-					clock-names = "xo";
-				};
-			};
-		};
-	};
-
 	soc: soc {
 		#address-cells = <1>;
 		#size-cells = <1>;

-- 
2.40.1


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

* [PATCH 14/14] ARM: dts: qcom: apq8064: Drop redundant /smd node
  2023-06-05  7:08 [PATCH 00/14] Add dedicated device tree node for RPM processor/subsystem Stephan Gerhold
                   ` (12 preceding siblings ...)
  2023-06-05  7:08 ` [PATCH 13/14] ARM: dts: qcom: Add rpm-proc node for SMD platforms Stephan Gerhold
@ 2023-06-05  7:08 ` Stephan Gerhold
  2023-06-05 19:00   ` Konrad Dybcio
  13 siblings, 1 reply; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-05  7:08 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc, Stephan Gerhold

The "smd-edge"s for remote processors are typically specified below the
remoteproc nodes. For some reason apq8064 also has them all listed in a
top-level /smd node, disabled by default. None of the boards enable them.

Right now apq8064 only has support for WCNSS/riva, but there the
smd-edge is already defined with the same interrupt etc below the
riva-pil node.

Drop these redundant definitions since the /smd top-level node is now
deprecated.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 arch/arm/boot/dts/qcom-apq8064.dtsi | 40 -------------------------------------
 1 file changed, 40 deletions(-)

diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi
index d2289205ff81..e0adf237fc5c 100644
--- a/arch/arm/boot/dts/qcom-apq8064.dtsi
+++ b/arch/arm/boot/dts/qcom-apq8064.dtsi
@@ -226,46 +226,6 @@ smem {
 		hwlocks = <&sfpb_mutex 3>;
 	};
 
-	smd {
-		compatible = "qcom,smd";
-
-		modem-edge {
-			interrupts = <0 37 IRQ_TYPE_EDGE_RISING>;
-
-			qcom,ipc = <&l2cc 8 3>;
-			qcom,smd-edge = <0>;
-
-			status = "disabled";
-		};
-
-		q6-edge {
-			interrupts = <0 90 IRQ_TYPE_EDGE_RISING>;
-
-			qcom,ipc = <&l2cc 8 15>;
-			qcom,smd-edge = <1>;
-
-			status = "disabled";
-		};
-
-		dsps-edge {
-			interrupts = <0 138 IRQ_TYPE_EDGE_RISING>;
-
-			qcom,ipc = <&sps_sic_non_secure 0x4080 0>;
-			qcom,smd-edge = <3>;
-
-			status = "disabled";
-		};
-
-		riva-edge {
-			interrupts = <0 198 IRQ_TYPE_EDGE_RISING>;
-
-			qcom,ipc = <&l2cc 8 25>;
-			qcom,smd-edge = <6>;
-
-			status = "disabled";
-		};
-	};
-
 	smsm {
 		compatible = "qcom,smsm";
 

-- 
2.40.1


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

* Re: [PATCH 05/14] dt-bindings: remoteproc: Add Qualcomm RPM processor/subsystem
  2023-06-05  7:08 ` [PATCH 05/14] dt-bindings: remoteproc: Add Qualcomm RPM processor/subsystem Stephan Gerhold
@ 2023-06-05  8:33   ` Rob Herring
  2023-06-05  9:16     ` Stephan Gerhold
  2023-06-06  6:36   ` Krzysztof Kozlowski
  1 sibling, 1 reply; 42+ messages in thread
From: Rob Herring @ 2023-06-05  8:33 UTC (permalink / raw)
  To: Stephan Gerhold
  Cc: linux-arm-msm, Rob Herring, Conor Dooley, Mathieu Poirier,
	devicetree, linux-kernel, Bjorn Andersson, Krzysztof Kozlowski,
	Konrad Dybcio, Andy Gross, linux-remoteproc


On Mon, 05 Jun 2023 09:08:21 +0200, Stephan Gerhold wrote:
> On Qualcomm platforms, most subsystems (e.g. audio/modem DSP) are
> described as remote processors in the device tree, with a dedicated
> node where properties and services related to them can be described.
> 
> The Resource Power Manager (RPM) is also such a subsystem, with a
> remote processor that is running a special firmware. Unfortunately,
> the RPM never got a dedicated node representing it properly in the
> device tree. Most of the RPM services are described below a top-level
> /smd or /rpm-glink node.
> 
> However, SMD/GLINK is just one of the communication channels to the RPM
> firmware. For example, the MPM interrupt functionality provided by the
> RPM does not use SMD/GLINK but writes directly to a special memory
> region allocated by the RPM firmware in combination with a mailbox.
> Currently there is no good place in the device tree to describe this
> functionality. It doesn't belong below SMD/GLINK but it's not an
> independent top-level device either.
> 
> Introduce a new "qcom,rpm-proc" compatible that allows describing the
> RPM as a remote processor/subsystem like all others. The SMD/GLINK node
> is moved to a "smd-edge"/"glink-edge" subnode consistent with other
> existing bindings. Additional subnodes (e.g. interrupt-controller for
> MPM, rpm-master-stats) can be also added there.
> 
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
>  .../bindings/remoteproc/qcom,rpm-proc.yaml         | 125 +++++++++++++++++++++
>  1 file changed, 125 insertions(+)
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
./Documentation/devicetree/bindings/remoteproc/qcom,rpm-proc.yaml: Unable to find schema file matching $id: http://devicetree.org/schemas/soc/qcom/qcom,rpm-master-stats.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230531-rpm-rproc-v1-5-e0a3b6de1f14@gerhold.net

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.


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

* Re: [PATCH 06/14] dt-bindings: soc: qcom: smd-rpm: Use qcom,rpm-proc in example
  2023-06-05  7:08 ` [PATCH 06/14] dt-bindings: soc: qcom: smd-rpm: Use qcom,rpm-proc in example Stephan Gerhold
@ 2023-06-05  8:33   ` Rob Herring
  2023-06-05  9:20     ` Stephan Gerhold
  2023-06-06  6:37   ` Krzysztof Kozlowski
  1 sibling, 1 reply; 42+ messages in thread
From: Rob Herring @ 2023-06-05  8:33 UTC (permalink / raw)
  To: Stephan Gerhold
  Cc: devicetree, Mathieu Poirier, Krzysztof Kozlowski, linux-kernel,
	Rob Herring, linux-arm-msm, Andy Gross, Conor Dooley,
	linux-remoteproc, Konrad Dybcio, Bjorn Andersson


On Mon, 05 Jun 2023 09:08:22 +0200, Stephan Gerhold wrote:
> Use the new top-level rpm-proc node instead of having a dummy top-level
> /smd node that only contains the RPM but not other remote processors.
> 
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
>  Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.example.dtb: /example-0/remoteproc-rpm: failed to match any schema with compatible: ['qcom,msm8916-rpm-proc', 'qcom,rpm-proc']

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230531-rpm-rproc-v1-6-e0a3b6de1f14@gerhold.net

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.


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

* Re: [PATCH 05/14] dt-bindings: remoteproc: Add Qualcomm RPM processor/subsystem
  2023-06-05  8:33   ` Rob Herring
@ 2023-06-05  9:16     ` Stephan Gerhold
  0 siblings, 0 replies; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-05  9:16 UTC (permalink / raw)
  To: Rob Herring
  Cc: linux-arm-msm, Rob Herring, Conor Dooley, Mathieu Poirier,
	devicetree, linux-kernel, Bjorn Andersson, Krzysztof Kozlowski,
	Konrad Dybcio, Andy Gross, linux-remoteproc

On Mon, Jun 05, 2023 at 02:33:58AM -0600, Rob Herring wrote:
> On Mon, 05 Jun 2023 09:08:21 +0200, Stephan Gerhold wrote:
> > On Qualcomm platforms, most subsystems (e.g. audio/modem DSP) are
> > described as remote processors in the device tree, with a dedicated
> > node where properties and services related to them can be described.
> > 
> > The Resource Power Manager (RPM) is also such a subsystem, with a
> > remote processor that is running a special firmware. Unfortunately,
> > the RPM never got a dedicated node representing it properly in the
> > device tree. Most of the RPM services are described below a top-level
> > /smd or /rpm-glink node.
> > 
> > However, SMD/GLINK is just one of the communication channels to the RPM
> > firmware. For example, the MPM interrupt functionality provided by the
> > RPM does not use SMD/GLINK but writes directly to a special memory
> > region allocated by the RPM firmware in combination with a mailbox.
> > Currently there is no good place in the device tree to describe this
> > functionality. It doesn't belong below SMD/GLINK but it's not an
> > independent top-level device either.
> > 
> > Introduce a new "qcom,rpm-proc" compatible that allows describing the
> > RPM as a remote processor/subsystem like all others. The SMD/GLINK node
> > is moved to a "smd-edge"/"glink-edge" subnode consistent with other
> > existing bindings. Additional subnodes (e.g. interrupt-controller for
> > MPM, rpm-master-stats) can be also added there.
> > 
> > Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> > ---
> >  .../bindings/remoteproc/qcom,rpm-proc.yaml         | 125 +++++++++++++++++++++
> >  1 file changed, 125 insertions(+)
> > 
> 
> My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> on your patch (DT_CHECKER_FLAGS is new in v5.13):
> 
> yamllint warnings/errors:
> 
> dtschema/dtc warnings/errors:
> ./Documentation/devicetree/bindings/remoteproc/qcom,rpm-proc.yaml: Unable to find schema file matching $id: http://devicetree.org/schemas/soc/qcom/qcom,rpm-master-stats.yaml
> 

I think we can ignore this error: The qcom,rpm-master-stats.yaml schema
exists only in the qcom for-next branch at the moment, which is what
this series targets. The base-commit in the cover letter also points
there (although I guess it might be tricky to resolve it reliably for
automated testing).

Before sending this series I verified that there are no dt_binding_check
and dtbs_check warnings or errors when applied to the correct branch.

Thanks,
Stephan

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

* Re: [PATCH 06/14] dt-bindings: soc: qcom: smd-rpm: Use qcom,rpm-proc in example
  2023-06-05  8:33   ` Rob Herring
@ 2023-06-05  9:20     ` Stephan Gerhold
  0 siblings, 0 replies; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-05  9:20 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree, Mathieu Poirier, Krzysztof Kozlowski, linux-kernel,
	Rob Herring, linux-arm-msm, Andy Gross, Conor Dooley,
	linux-remoteproc, Konrad Dybcio, Bjorn Andersson

On Mon, Jun 05, 2023 at 02:33:58AM -0600, Rob Herring wrote:
> On Mon, 05 Jun 2023 09:08:22 +0200, Stephan Gerhold wrote:
> > Use the new top-level rpm-proc node instead of having a dummy top-level
> > /smd node that only contains the RPM but not other remote processors.
> > 
> > Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> > ---
> >  Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> 
> My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> on your patch (DT_CHECKER_FLAGS is new in v5.13):
> 
> yamllint warnings/errors:
> 
> dtschema/dtc warnings/errors:
> Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.example.dtb: /example-0/remoteproc-rpm: failed to match any schema with compatible: ['qcom,msm8916-rpm-proc', 'qcom,rpm-proc']
> 

Huh? The schema that matches this compatible is in the previous patch. :)
Perhaps this error is related to the dt_binding_check problem on the
patch before (which is caused by applying the patches to the wrong base
branch).

Before sending this series I verified that there are no dt_binding_check
and dtbs_check warnings or errors when applied to the correct branch.

Thanks,
Stephan

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

* Re: [PATCH 04/14] soc: qcom: smd-rpm: Match rpmsg channel instead of compatible
  2023-06-05  7:08 ` [PATCH 04/14] soc: qcom: smd-rpm: Match rpmsg channel instead of compatible Stephan Gerhold
@ 2023-06-05 18:49   ` Konrad Dybcio
  0 siblings, 0 replies; 42+ messages in thread
From: Konrad Dybcio @ 2023-06-05 18:49 UTC (permalink / raw)
  To: Stephan Gerhold, Bjorn Andersson
  Cc: Andy Gross, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Mathieu Poirier, linux-arm-msm, devicetree, linux-kernel,
	linux-remoteproc



On 5.06.2023 09:08, Stephan Gerhold wrote:
> There is an ever growing list of compatibles in the smd-rpm.c driver.
> A fallback compatible would help here but would still require keeping
> the current list around for backwards compatibility.
> 
> As an alternative, let's switch the driver to match the rpmsg_device_id
> instead, which is always "rpm_requests" on all platforms. Add a check
> to ensure that there is a device tree node defined for the device since
> otherwise the of_platform_populate() call will operate on the root node (/).
> 
> Similar approaches with matching rpmsg_device_id are already used in
> qcom_sysmon, qcom_glink_ssr, qrtr, and rpmsg_wwan_ctrl.
> 
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
Tested-by: Konrad Dybcio <konrad.dybcio@linaro.org> # SM6375 (G-Link)
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
>  drivers/soc/qcom/smd-rpm.c | 35 +++++++++--------------------------
>  1 file changed, 9 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/soc/qcom/smd-rpm.c b/drivers/soc/qcom/smd-rpm.c
> index 0c1aa809cc4e..13d8c52330d0 100644
> --- a/drivers/soc/qcom/smd-rpm.c
> +++ b/drivers/soc/qcom/smd-rpm.c
> @@ -199,6 +199,9 @@ static int qcom_smd_rpm_probe(struct rpmsg_device *rpdev)
>  	struct qcom_smd_rpm *rpm;
>  	int ret;
>  
> +	if (!rpdev->dev.of_node)
> +		return -EINVAL;
> +
>  	rpm = devm_kzalloc(&rpdev->dev, sizeof(*rpm), GFP_KERNEL);
>  	if (!rpm)
>  		return -ENOMEM;
> @@ -230,38 +233,18 @@ static void qcom_smd_rpm_remove(struct rpmsg_device *rpdev)
>  	of_platform_depopulate(&rpdev->dev);
>  }
>  
> -static const struct of_device_id qcom_smd_rpm_of_match[] = {
> -	{ .compatible = "qcom,rpm-apq8084" },
> -	{ .compatible = "qcom,rpm-ipq6018" },
> -	{ .compatible = "qcom,rpm-ipq9574" },
> -	{ .compatible = "qcom,rpm-msm8226" },
> -	{ .compatible = "qcom,rpm-msm8909" },
> -	{ .compatible = "qcom,rpm-msm8916" },
> -	{ .compatible = "qcom,rpm-msm8936" },
> -	{ .compatible = "qcom,rpm-msm8953" },
> -	{ .compatible = "qcom,rpm-msm8974" },
> -	{ .compatible = "qcom,rpm-msm8976" },
> -	{ .compatible = "qcom,rpm-msm8994" },
> -	{ .compatible = "qcom,rpm-msm8996" },
> -	{ .compatible = "qcom,rpm-msm8998" },
> -	{ .compatible = "qcom,rpm-sdm660" },
> -	{ .compatible = "qcom,rpm-sm6115" },
> -	{ .compatible = "qcom,rpm-sm6125" },
> -	{ .compatible = "qcom,rpm-sm6375" },
> -	{ .compatible = "qcom,rpm-qcm2290" },
> -	{ .compatible = "qcom,rpm-qcs404" },
> -	{}
> +static const struct rpmsg_device_id qcom_smd_rpm_id_table[] = {
> +	{ .name = "rpm_requests", },
> +	{ /* sentinel */ }
>  };
> -MODULE_DEVICE_TABLE(of, qcom_smd_rpm_of_match);
> +MODULE_DEVICE_TABLE(rpmsg, qcom_smd_rpm_id_table);
>  
>  static struct rpmsg_driver qcom_smd_rpm_driver = {
>  	.probe = qcom_smd_rpm_probe,
>  	.remove = qcom_smd_rpm_remove,
>  	.callback = qcom_smd_rpm_callback,
> -	.drv  = {
> -		.name  = "qcom_smd_rpm",
> -		.of_match_table = qcom_smd_rpm_of_match,
> -	},
> +	.id_table = qcom_smd_rpm_id_table,
> +	.drv.name = "qcom_smd_rpm",
>  };
>  
>  static int __init qcom_smd_rpm_init(void)
> 

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

* Re: [PATCH 08/14] soc: qcom: smem: Add qcom_smem_is_available()
  2023-06-05  7:08 ` [PATCH 08/14] soc: qcom: smem: Add qcom_smem_is_available() Stephan Gerhold
@ 2023-06-05 18:53   ` Konrad Dybcio
  2023-06-05 19:13     ` Stephan Gerhold
  0 siblings, 1 reply; 42+ messages in thread
From: Konrad Dybcio @ 2023-06-05 18:53 UTC (permalink / raw)
  To: Stephan Gerhold, Bjorn Andersson
  Cc: Andy Gross, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Mathieu Poirier, linux-arm-msm, devicetree, linux-kernel,
	linux-remoteproc



On 5.06.2023 09:08, Stephan Gerhold wrote:
> Avoid having to look up a dummy item from SMEM to detect if it is
> already available or if we need to defer probing.
> 
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
>  drivers/soc/qcom/smem.c       | 9 +++++++++
>  include/linux/soc/qcom/smem.h | 1 +
>  2 files changed, 10 insertions(+)
> 
> diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
> index b0d59e815c3b..3d93a6681494 100644
> --- a/drivers/soc/qcom/smem.c
> +++ b/drivers/soc/qcom/smem.c
> @@ -359,6 +359,15 @@ static struct qcom_smem *__smem;
>  /* Timeout (ms) for the trylock of remote spinlocks */
>  #define HWSPINLOCK_TIMEOUT	1000
>  
> +/**
> + * qcom_smem_is_available() - Checks if SMEM is available
> + */
Shouldn't kerneldoc explicitly say "returns x if y else z"?

Modulo that:

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
> +bool qcom_smem_is_available(void)
> +{
> +	return !!__smem;
> +}
> +EXPORT_SYMBOL(qcom_smem_is_available);
> +
>  static int qcom_smem_alloc_private(struct qcom_smem *smem,
>  				   struct smem_partition *part,
>  				   unsigned item,
> diff --git a/include/linux/soc/qcom/smem.h b/include/linux/soc/qcom/smem.h
> index 223db6a9c733..a36a3b9d4929 100644
> --- a/include/linux/soc/qcom/smem.h
> +++ b/include/linux/soc/qcom/smem.h
> @@ -4,6 +4,7 @@
>  
>  #define QCOM_SMEM_HOST_ANY -1
>  
> +bool qcom_smem_is_available(void);
>  int qcom_smem_alloc(unsigned host, unsigned item, size_t size);
>  void *qcom_smem_get(unsigned host, unsigned item, size_t *size);
>  
> 

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

* Re: [PATCH 09/14] rpmsg: qcom_smd: Use qcom_smem_is_available()
  2023-06-05  7:08 ` [PATCH 09/14] rpmsg: qcom_smd: Use qcom_smem_is_available() Stephan Gerhold
@ 2023-06-05 18:56   ` Konrad Dybcio
  2023-06-05 19:18     ` Stephan Gerhold
  0 siblings, 1 reply; 42+ messages in thread
From: Konrad Dybcio @ 2023-06-05 18:56 UTC (permalink / raw)
  To: Stephan Gerhold, Bjorn Andersson
  Cc: Andy Gross, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Mathieu Poirier, linux-arm-msm, devicetree, linux-kernel,
	linux-remoteproc



On 5.06.2023 09:08, Stephan Gerhold wrote:
> Rather than looking up a dummy item from SMEM, use the new
> qcom_smem_is_available() function to make the code more clear
> (and reduce the overhead slightly).
> 
> Add the same check to qcom_smd_register_edge() as well to ensure that
> it only succeeds if SMEM is already available - if a driver calls the
> function and SMEM is not available yet then the initial state will be
> read incorrectly and the RPMSG devices might never become available.
> 
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
>  drivers/rpmsg/qcom_smd.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c
> index 7b9c298aa491..43f601c84b4f 100644
> --- a/drivers/rpmsg/qcom_smd.c
> +++ b/drivers/rpmsg/qcom_smd.c
> @@ -1479,6 +1479,9 @@ struct qcom_smd_edge *qcom_smd_register_edge(struct device *parent,
>  	struct qcom_smd_edge *edge;
>  	int ret;
>  
> +	if (!qcom_smem_is_available())
> +		return ERR_PTR(-EPROBE_DEFER);
> +
>  	edge = kzalloc(sizeof(*edge), GFP_KERNEL);
>  	if (!edge)
>  		return ERR_PTR(-ENOMEM);
> @@ -1553,12 +1556,9 @@ EXPORT_SYMBOL(qcom_smd_unregister_edge);
>  static int qcom_smd_probe(struct platform_device *pdev)
>  {
>  	struct device_node *node;
> -	void *p;
>  
> -	/* Wait for smem */
> -	p = qcom_smem_get(QCOM_SMEM_HOST_ANY, smem_items[0].alloc_tbl_id, NULL);
> -	if (PTR_ERR(p) == -EPROBE_DEFER)
> -		return PTR_ERR(p);
> +	if (!qcom_smem_is_available())
> +		return -EPROBE_DEFER;
>  
>  	for_each_available_child_of_node(pdev->dev.of_node, node)
>  		qcom_smd_register_edge(&pdev->dev, node);
Hm.. we're not checking the return value here, at all.. Perhaps that
could be improved and we could only check for smem presence inside
qcom_smd_register_edge()?

Konrad
> 

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

* Re: [PATCH 14/14] ARM: dts: qcom: apq8064: Drop redundant /smd node
  2023-06-05  7:08 ` [PATCH 14/14] ARM: dts: qcom: apq8064: Drop redundant /smd node Stephan Gerhold
@ 2023-06-05 19:00   ` Konrad Dybcio
  0 siblings, 0 replies; 42+ messages in thread
From: Konrad Dybcio @ 2023-06-05 19:00 UTC (permalink / raw)
  To: Stephan Gerhold, Bjorn Andersson
  Cc: Andy Gross, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Mathieu Poirier, linux-arm-msm, devicetree, linux-kernel,
	linux-remoteproc



On 5.06.2023 09:08, Stephan Gerhold wrote:
> The "smd-edge"s for remote processors are typically specified below the
> remoteproc nodes. For some reason apq8064 also has them all listed in a
> top-level /smd node, disabled by default. None of the boards enable them.
> 
> Right now apq8064 only has support for WCNSS/riva, but there the
> smd-edge is already defined with the same interrupt etc below the
> riva-pil node.
> 
> Drop these redundant definitions since the /smd top-level node is now
> deprecated.
> 
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
Hm, 2012 is calling.. it wants it dead code back!

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
>  arch/arm/boot/dts/qcom-apq8064.dtsi | 40 -------------------------------------
>  1 file changed, 40 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi
> index d2289205ff81..e0adf237fc5c 100644
> --- a/arch/arm/boot/dts/qcom-apq8064.dtsi
> +++ b/arch/arm/boot/dts/qcom-apq8064.dtsi
> @@ -226,46 +226,6 @@ smem {
>  		hwlocks = <&sfpb_mutex 3>;
>  	};
>  
> -	smd {
> -		compatible = "qcom,smd";
> -
> -		modem-edge {
> -			interrupts = <0 37 IRQ_TYPE_EDGE_RISING>;
> -
> -			qcom,ipc = <&l2cc 8 3>;
> -			qcom,smd-edge = <0>;
> -
> -			status = "disabled";
> -		};
> -
> -		q6-edge {
> -			interrupts = <0 90 IRQ_TYPE_EDGE_RISING>;
> -
> -			qcom,ipc = <&l2cc 8 15>;
> -			qcom,smd-edge = <1>;
> -
> -			status = "disabled";
> -		};
> -
> -		dsps-edge {
> -			interrupts = <0 138 IRQ_TYPE_EDGE_RISING>;
> -
> -			qcom,ipc = <&sps_sic_non_secure 0x4080 0>;
> -			qcom,smd-edge = <3>;
> -
> -			status = "disabled";
> -		};
> -
> -		riva-edge {
> -			interrupts = <0 198 IRQ_TYPE_EDGE_RISING>;
> -
> -			qcom,ipc = <&l2cc 8 25>;
> -			qcom,smd-edge = <6>;
> -
> -			status = "disabled";
> -		};
> -	};
> -
>  	smsm {
>  		compatible = "qcom,smsm";
>  
> 

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

* Re: [PATCH 10/14] soc: qcom: Add RPM processor/subsystem driver
  2023-06-05  7:08 ` [PATCH 10/14] soc: qcom: Add RPM processor/subsystem driver Stephan Gerhold
@ 2023-06-05 19:06   ` Konrad Dybcio
  2023-06-05 19:51     ` Stephan Gerhold
  2023-06-05 20:31   ` kernel test robot
  1 sibling, 1 reply; 42+ messages in thread
From: Konrad Dybcio @ 2023-06-05 19:06 UTC (permalink / raw)
  To: Stephan Gerhold, Bjorn Andersson
  Cc: Andy Gross, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Mathieu Poirier, linux-arm-msm, devicetree, linux-kernel,
	linux-remoteproc



On 5.06.2023 09:08, Stephan Gerhold wrote:
> Add a simple driver for the qcom,rpm-proc compatible that registers the
> "smd-edge" and populates other children defined in the device tree.
> 
> Note that the DT schema belongs to the remoteproc subsystem while this
> driver is added inside soc/qcom. I argue that the RPM *is* a remoteproc,
> but as an implementation detail in Linux it can currently not benefit
> from anything provided by the remoteproc subsystem. The RPM firmware is
> usually already loaded and started by earlier components in the boot
> chain and is not meant to be ever restarted.
> 
> To avoid breaking existing kernel configurations the driver is always
> built when smd-rpm.c is also built. They belong closely together anyway.
> 
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
>  drivers/soc/qcom/Makefile   |  2 +-
>  drivers/soc/qcom/rpm-proc.c | 76 +++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 77 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile
> index 99114c71092b..113b9ff2ad43 100644
> --- a/drivers/soc/qcom/Makefile
> +++ b/drivers/soc/qcom/Makefile
> @@ -18,7 +18,7 @@ obj-$(CONFIG_QCOM_RPM_MASTER_STATS)	+= rpm_master_stats.o
>  obj-$(CONFIG_QCOM_RPMH)		+= qcom_rpmh.o
>  qcom_rpmh-y			+= rpmh-rsc.o
>  qcom_rpmh-y			+= rpmh.o
> -obj-$(CONFIG_QCOM_SMD_RPM)	+= smd-rpm.o
> +obj-$(CONFIG_QCOM_SMD_RPM)	+= rpm-proc.o smd-rpm.o
>  obj-$(CONFIG_QCOM_SMEM) +=	smem.o
>  obj-$(CONFIG_QCOM_SMEM_STATE) += smem_state.o
>  obj-$(CONFIG_QCOM_SMP2P)	+= smp2p.o
> diff --git a/drivers/soc/qcom/rpm-proc.c b/drivers/soc/qcom/rpm-proc.c
> new file mode 100644
> index 000000000000..0652be7f7895
> --- /dev/null
> +++ b/drivers/soc/qcom/rpm-proc.c
> @@ -0,0 +1,76 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/* Copyright (c) 2021-2023, Stephan Gerhold <stephan@gerhold.net> */
> +
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/of_platform.h>
> +#include <linux/platform_device.h>
> +#include <linux/rpmsg/qcom_smd.h>
> +
> +static int rpm_proc_probe(struct platform_device *pdev)
> +{
> +	struct qcom_smd_edge *edge = NULL;
> +	struct device *dev = &pdev->dev;
> +	struct device_node *edge_node;
> +	int ret;
> +
> +	edge_node = of_get_child_by_name(dev->of_node, "smd-edge");
> +	if (edge_node) {
> +		edge = qcom_smd_register_edge(dev, edge_node);
> +		if (IS_ERR(edge))
> +			return dev_err_probe(dev, PTR_ERR(edge),
> +					     "Failed to register smd-edge\n");
Need of_node_put in both success and IS_ERR paths

> +	}
> +
> +	ret = devm_of_platform_populate(dev);
> +	if (ret) {
> +		dev_err(dev, "Failed to populate children devices: %d\n", ret);
I may be having a brain lag moment but I think it should be "child"
singular, otherwise it sounds like they're devices for children!

> +		goto err;
> +	}
> +
> +	platform_set_drvdata(pdev, edge);
> +	return 0;
> +err:
> +	if (edge)
> +		qcom_smd_unregister_edge(edge);
> +	return ret;
> +}
> +
> +static void rpm_proc_remove(struct platform_device *pdev)
> +{
> +	struct qcom_smd_edge *edge = platform_get_drvdata(pdev);
> +
> +	if (edge)
> +		qcom_smd_unregister_edge(edge);
> +}
> +
> +static const struct of_device_id rpm_proc_of_match[] = {
> +	{ .compatible = "qcom,rpm-proc", },
> +	{ /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, rpm_proc_of_match);
> +
> +static struct platform_driver rpm_proc_driver = {
> +	.probe = rpm_proc_probe,
> +	.remove_new = rpm_proc_remove,
> +	.driver = {
> +		.name = "qcom-rpm-proc",
> +		.of_match_table = rpm_proc_of_match,
> +	},
> +};
> +
> +static int __init rpm_proc_init(void)
> +{
> +	return platform_driver_register(&rpm_proc_driver);
> +}
> +arch_initcall(rpm_proc_init);
Maybe we can go as early as core...

Konrad
> +
> +static void __exit rpm_proc_exit(void)
> +{
> +	platform_driver_unregister(&rpm_proc_driver);
> +}
> +module_exit(rpm_proc_exit);
> +
> +MODULE_DESCRIPTION("Qualcomm RPM processor/subsystem driver");
> +MODULE_AUTHOR("Stephan Gerhold <stephan@gerhold.net>");
> +MODULE_LICENSE("GPL");
> 

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

* Re: [PATCH 11/14] arm64: dts: qcom: Add rpm-proc node for SMD platforms
  2023-06-05  7:08 ` [PATCH 11/14] arm64: dts: qcom: Add rpm-proc node for SMD platforms Stephan Gerhold
@ 2023-06-05 19:07   ` Konrad Dybcio
  0 siblings, 0 replies; 42+ messages in thread
From: Konrad Dybcio @ 2023-06-05 19:07 UTC (permalink / raw)
  To: Stephan Gerhold, Bjorn Andersson
  Cc: Andy Gross, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Mathieu Poirier, linux-arm-msm, devicetree, linux-kernel,
	linux-remoteproc



On 5.06.2023 09:08, Stephan Gerhold wrote:
> Rather than having the RPM SMD channels as the only child of a dummy
> SMD node, switch to representing the RPM as remoteproc like all the
> other remoteprocs (WCNSS, modem DSP).
> 
> This allows assigning additional subdevices to it like the MPM
> interrupt-controller or rpm-master-stats.
> 
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
>  arch/arm64/boot/dts/qcom/msm8916.dtsi |   6 +-
>  arch/arm64/boot/dts/qcom/msm8939.dtsi | 112 ++++++++++++-------------
>  arch/arm64/boot/dts/qcom/msm8953.dtsi | 136 +++++++++++++++---------------
>  arch/arm64/boot/dts/qcom/msm8976.dtsi | 152 +++++++++++++++++-----------------
>  arch/arm64/boot/dts/qcom/msm8994.dtsi |  99 +++++++++++-----------
>  5 files changed, 253 insertions(+), 252 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi
> index 9494b6512d87..667748612d3e 100644
> --- a/arch/arm64/boot/dts/qcom/msm8916.dtsi
> +++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi
> @@ -282,10 +282,10 @@ CLUSTER_PD: power-domain-cluster {
>  		};
>  	};
>  
> -	smd {
> -		compatible = "qcom,smd";
> +	rpm: remoteproc-rpm {
> +		compatible = "qcom,msm8916-rpm-proc", "qcom,rpm-proc";
>  
> -		rpm {
> +		smd-edge {
>  			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
>  			qcom,ipc = <&apcs 8 0>;
>  			qcom,smd-edge = <15>;
> diff --git a/arch/arm64/boot/dts/qcom/msm8939.dtsi b/arch/arm64/boot/dts/qcom/msm8939.dtsi
> index 0d9f8b951b66..f11d522586eb 100644
> --- a/arch/arm64/boot/dts/qcom/msm8939.dtsi
> +++ b/arch/arm64/boot/dts/qcom/msm8939.dtsi
> @@ -240,6 +240,62 @@ pmu {
>  		interrupts = <GIC_PPI 7 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_HIGH)>;
>  	};
>  
> +	rpm: remoteproc-rpm {
> +		compatible = "qcom,msm8936-rpm-proc", "qcom,rpm-proc";
> +
> +		smd-edge {
> +			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
> +			qcom,ipc = <&apcs1_mbox 8 0>;
> +			qcom,smd-edge = <15>;
> +
> +			rpm_requests: rpm-requests {
> +				compatible = "qcom,rpm-msm8936";
> +				qcom,smd-channels = "rpm_requests";
> +
> +				rpmcc: clock-controller {
> +					compatible = "qcom,rpmcc-msm8936", "qcom,rpmcc";
> +					#clock-cells = <1>;
> +					clock-names = "xo";
> +					clocks = <&xo_board>;
> +				};
> +
> +				rpmpd: power-controller {
> +					compatible = "qcom,msm8939-rpmpd";
> +					#power-domain-cells = <1>;
> +					operating-points-v2 = <&rpmpd_opp_table>;
> +
> +					rpmpd_opp_table: opp-table {
> +						compatible = "operating-points-v2";
> +
> +						rpmpd_opp_ret: opp1 {
> +							opp-level = <1>;
> +						};
> +
> +						rpmpd_opp_svs_krait: opp2 {
> +							opp-level = <2>;
> +						};
> +
> +						rpmpd_opp_svs_soc: opp3 {
> +							opp-level = <3>;
> +						};
> +
> +						rpmpd_opp_nom: opp4 {
> +							opp-level = <4>;
> +						};
> +
> +						rpmpd_opp_turbo: opp5 {
> +							opp-level = <5>;
> +						};
> +
> +						rpmpd_opp_super_turbo: opp6 {
> +							opp-level = <6>;
> +						};
> +					};
> +				};
> +			};
> +		};
> +	};
> +
>  	reserved-memory {
>  		#address-cells = <2>;
>  		#size-cells = <2>;
> @@ -308,62 +364,6 @@ mba_mem: mba@8cb00000 {
>  		};
>  	};
>  
> -	smd {
> -		compatible = "qcom,smd";
> -
> -		rpm {
> -			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
> -			qcom,ipc = <&apcs1_mbox 8 0>;
> -			qcom,smd-edge = <15>;
> -
> -			rpm_requests: rpm-requests {
> -				compatible = "qcom,rpm-msm8936";
> -				qcom,smd-channels = "rpm_requests";
> -
> -				rpmcc: clock-controller {
> -					compatible = "qcom,rpmcc-msm8936", "qcom,rpmcc";
> -					#clock-cells = <1>;
> -					clock-names = "xo";
> -					clocks = <&xo_board>;
> -				};
> -
> -				rpmpd: power-controller {
> -					compatible = "qcom,msm8939-rpmpd";
> -					#power-domain-cells = <1>;
> -					operating-points-v2 = <&rpmpd_opp_table>;
> -
> -					rpmpd_opp_table: opp-table {
> -						compatible = "operating-points-v2";
> -
> -						rpmpd_opp_ret: opp1 {
> -							opp-level = <1>;
> -						};
> -
> -						rpmpd_opp_svs_krait: opp2 {
> -							opp-level = <2>;
> -						};
> -
> -						rpmpd_opp_svs_soc: opp3 {
> -							opp-level = <3>;
> -						};
> -
> -						rpmpd_opp_nom: opp4 {
> -							opp-level = <4>;
> -						};
> -
> -						rpmpd_opp_turbo: opp5 {
> -							opp-level = <5>;
> -						};
> -
> -						rpmpd_opp_super_turbo: opp6 {
> -							opp-level = <6>;
> -						};
> -					};
> -				};
> -			};
> -		};
> -	};
> -
>  	smp2p-hexagon {
>  		compatible = "qcom,smp2p";
>  		qcom,smem = <435>, <428>;
> diff --git a/arch/arm64/boot/dts/qcom/msm8953.dtsi b/arch/arm64/boot/dts/qcom/msm8953.dtsi
> index 7d193a467819..4b2f02850a10 100644
> --- a/arch/arm64/boot/dts/qcom/msm8953.dtsi
> +++ b/arch/arm64/boot/dts/qcom/msm8953.dtsi
> @@ -190,6 +190,74 @@ psci {
>  		method = "smc";
>  	};
>  
> +	rpm: remoteproc-rpm {
> +		compatible = "qcom,msm8953-rpm-proc", "qcom,rpm-proc";
> +
> +		smd-edge {
> +			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
> +			qcom,ipc = <&apcs 8 0>;
> +			qcom,smd-edge = <15>;
> +
> +			rpm_requests: rpm-requests {
> +				compatible = "qcom,rpm-msm8953";
> +				qcom,smd-channels = "rpm_requests";
> +
> +				rpmcc: clock-controller {
> +					compatible = "qcom,rpmcc-msm8953", "qcom,rpmcc";
> +					clocks = <&xo_board>;
> +					clock-names = "xo";
> +					#clock-cells = <1>;
> +				};
> +
> +				rpmpd: power-controller {
> +					compatible = "qcom,msm8953-rpmpd";
> +					#power-domain-cells = <1>;
> +					operating-points-v2 = <&rpmpd_opp_table>;
> +
> +					rpmpd_opp_table: opp-table {
> +						compatible = "operating-points-v2";
> +
> +						rpmpd_opp_ret: opp1 {
> +							opp-level = <RPM_SMD_LEVEL_RETENTION>;
> +						};
> +
> +						rpmpd_opp_ret_plus: opp2 {
> +							opp-level = <RPM_SMD_LEVEL_RETENTION_PLUS>;
> +						};
> +
> +						rpmpd_opp_min_svs: opp3 {
> +							opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
> +						};
> +
> +						rpmpd_opp_low_svs: opp4 {
> +							opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
> +						};
> +
> +						rpmpd_opp_svs: opp5 {
> +							opp-level = <RPM_SMD_LEVEL_SVS>;
> +						};
> +
> +						rpmpd_opp_svs_plus: opp6 {
> +							opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
> +						};
> +
> +						rpmpd_opp_nom: opp7 {
> +							opp-level = <RPM_SMD_LEVEL_NOM>;
> +						};
> +
> +						rpmpd_opp_nom_plus: opp8 {
> +							opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
> +						};
> +
> +						rpmpd_opp_turbo: opp9 {
> +							opp-level = <RPM_SMD_LEVEL_TURBO>;
> +						};
> +					};
> +				};
> +			};
> +		};
> +	};
> +
>  	reserved-memory {
>  		#address-cells = <2>;
>  		#size-cells = <2>;
> @@ -263,74 +331,6 @@ rmtfs@f2d00000 {
>  		};
>  	};
>  
> -	smd {
> -		compatible = "qcom,smd";
> -
> -		rpm {
> -			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
> -			qcom,ipc = <&apcs 8 0>;
> -			qcom,smd-edge = <15>;
> -
> -			rpm_requests: rpm-requests {
> -				compatible = "qcom,rpm-msm8953";
> -				qcom,smd-channels = "rpm_requests";
> -
> -				rpmcc: clock-controller {
> -					compatible = "qcom,rpmcc-msm8953", "qcom,rpmcc";
> -					clocks = <&xo_board>;
> -					clock-names = "xo";
> -					#clock-cells = <1>;
> -				};
> -
> -				rpmpd: power-controller {
> -					compatible = "qcom,msm8953-rpmpd";
> -					#power-domain-cells = <1>;
> -					operating-points-v2 = <&rpmpd_opp_table>;
> -
> -					rpmpd_opp_table: opp-table {
> -						compatible = "operating-points-v2";
> -
> -						rpmpd_opp_ret: opp1 {
> -							opp-level = <RPM_SMD_LEVEL_RETENTION>;
> -						};
> -
> -						rpmpd_opp_ret_plus: opp2 {
> -							opp-level = <RPM_SMD_LEVEL_RETENTION_PLUS>;
> -						};
> -
> -						rpmpd_opp_min_svs: opp3 {
> -							opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
> -						};
> -
> -						rpmpd_opp_low_svs: opp4 {
> -							opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
> -						};
> -
> -						rpmpd_opp_svs: opp5 {
> -							opp-level = <RPM_SMD_LEVEL_SVS>;
> -						};
> -
> -						rpmpd_opp_svs_plus: opp6 {
> -							opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
> -						};
> -
> -						rpmpd_opp_nom: opp7 {
> -							opp-level = <RPM_SMD_LEVEL_NOM>;
> -						};
> -
> -						rpmpd_opp_nom_plus: opp8 {
> -							opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
> -						};
> -
> -						rpmpd_opp_turbo: opp9 {
> -							opp-level = <RPM_SMD_LEVEL_TURBO>;
> -						};
> -					};
> -				};
> -			};
> -		};
> -	};
> -
>  	smp2p-adsp {
>  		compatible = "qcom,smp2p";
>  		qcom,smem = <443>, <429>;
> diff --git a/arch/arm64/boot/dts/qcom/msm8976.dtsi b/arch/arm64/boot/dts/qcom/msm8976.dtsi
> index 753b9a2105ed..6f856562923f 100644
> --- a/arch/arm64/boot/dts/qcom/msm8976.dtsi
> +++ b/arch/arm64/boot/dts/qcom/msm8976.dtsi
> @@ -232,6 +232,82 @@ psci {
>  		method = "smc";
>  	};
>  
> +	rpm: remoteproc-rpm {
> +		compatible = "qcom,msm8976-rpm-proc", "qcom,rpm-proc";
> +
> +		smd-edge {
> +			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
> +			qcom,ipc = <&apcs 8 0>;
> +			qcom,smd-edge = <15>;
> +
> +			rpm_requests: rpm-requests {
> +				compatible = "qcom,rpm-msm8976";
> +				qcom,smd-channels = "rpm_requests";
> +
> +				rpmcc: clock-controller {
> +					compatible = "qcom,rpmcc-msm8976", "qcom,rpmcc";
> +					clocks = <&xo_board>;
> +					clock-names = "xo";
> +					#clock-cells = <1>;
> +				};
> +
> +				rpmpd: power-controller {
> +					compatible = "qcom,msm8976-rpmpd";
> +					#power-domain-cells = <1>;
> +					operating-points-v2 = <&rpmpd_opp_table>;
> +
> +					rpmpd_opp_table: opp-table {
> +						compatible = "operating-points-v2";
> +
> +						rpmpd_opp_ret: opp1 {
> +							opp-level = <RPM_SMD_LEVEL_RETENTION>;
> +						};
> +
> +						rpmpd_opp_ret_plus: opp2 {
> +							opp-level = <RPM_SMD_LEVEL_RETENTION_PLUS>;
> +						};
> +
> +						rpmpd_opp_min_svs: opp3 {
> +							opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
> +						};
> +
> +						rpmpd_opp_low_svs: opp4 {
> +							opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
> +						};
> +
> +						rpmpd_opp_svs: opp5 {
> +							opp-level = <RPM_SMD_LEVEL_SVS>;
> +						};
> +
> +						rpmpd_opp_svs_plus: opp6 {
> +							opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
> +						};
> +
> +						rpmpd_opp_nom: opp7 {
> +							opp-level = <RPM_SMD_LEVEL_NOM>;
> +						};
> +
> +						rpmpd_opp_nom_plus: opp8 {
> +							opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
> +						};
> +
> +						rpmpd_opp_turbo: opp9 {
> +							opp-level = <RPM_SMD_LEVEL_TURBO>;
> +						};
> +
> +						rpmpd_opp_turbo_no_cpr: opp10 {
> +							opp-level = <RPM_SMD_LEVEL_TURBO_NO_CPR>;
> +						};
> +
> +						rpmpd_opp_turbo_high: opp111 {
> +							opp-level = <RPM_SMD_LEVEL_TURBO_HIGH>;
> +						};
> +					};
> +				};
> +			};
> +		};
> +	};
> +
>  	reserved-memory {
>  		#address-cells = <2>;
>  		#size-cells = <2>;
> @@ -346,82 +422,6 @@ wcnss_smp2p_in: slave-kernel {
>  		};
>  	};
>  
> -	smd {
> -		compatible = "qcom,smd";
> -
> -		rpm {
> -			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
> -			qcom,ipc = <&apcs 8 0>;
> -			qcom,smd-edge = <15>;
> -
> -			rpm_requests: rpm-requests {
> -				compatible = "qcom,rpm-msm8976";
> -				qcom,smd-channels = "rpm_requests";
> -
> -				rpmcc: clock-controller {
> -					compatible = "qcom,rpmcc-msm8976", "qcom,rpmcc";
> -					clocks = <&xo_board>;
> -					clock-names = "xo";
> -					#clock-cells = <1>;
> -				};
> -
> -				rpmpd: power-controller {
> -					compatible = "qcom,msm8976-rpmpd";
> -					#power-domain-cells = <1>;
> -					operating-points-v2 = <&rpmpd_opp_table>;
> -
> -					rpmpd_opp_table: opp-table {
> -						compatible = "operating-points-v2";
> -
> -						rpmpd_opp_ret: opp1 {
> -							opp-level = <RPM_SMD_LEVEL_RETENTION>;
> -						};
> -
> -						rpmpd_opp_ret_plus: opp2 {
> -							opp-level = <RPM_SMD_LEVEL_RETENTION_PLUS>;
> -						};
> -
> -						rpmpd_opp_min_svs: opp3 {
> -							opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
> -						};
> -
> -						rpmpd_opp_low_svs: opp4 {
> -							opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
> -						};
> -
> -						rpmpd_opp_svs: opp5 {
> -							opp-level = <RPM_SMD_LEVEL_SVS>;
> -						};
> -
> -						rpmpd_opp_svs_plus: opp6 {
> -							opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
> -						};
> -
> -						rpmpd_opp_nom: opp7 {
> -							opp-level = <RPM_SMD_LEVEL_NOM>;
> -						};
> -
> -						rpmpd_opp_nom_plus: opp8 {
> -							opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
> -						};
> -
> -						rpmpd_opp_turbo: opp9 {
> -							opp-level = <RPM_SMD_LEVEL_TURBO>;
> -						};
> -
> -						rpmpd_opp_turbo_no_cpr: opp10 {
> -							opp-level = <RPM_SMD_LEVEL_TURBO_NO_CPR>;
> -						};
> -
> -						rpmpd_opp_turbo_high: opp111 {
> -							opp-level = <RPM_SMD_LEVEL_TURBO_HIGH>;
> -						};
> -					};
> -				};
> -			};
> -		};
> -	};
> -
>  	smsm {
>  		compatible = "qcom,smsm";
>  
> diff --git a/arch/arm64/boot/dts/qcom/msm8994.dtsi b/arch/arm64/boot/dts/qcom/msm8994.dtsi
> index 5a7923d7c62a..6168d0aeff57 100644
> --- a/arch/arm64/boot/dts/qcom/msm8994.dtsi
> +++ b/arch/arm64/boot/dts/qcom/msm8994.dtsi
> @@ -178,6 +178,56 @@ psci {
>  		method = "hvc";
>  	};
>  
> +	rpm: remoteproc-rpm {
> +		compatible = "qcom,msm8994-rpm-proc", "qcom,rpm-proc";
> +
> +		smd-edge {
> +			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
> +			qcom,ipc = <&apcs 8 0>;
> +			qcom,smd-edge = <15>;
> +			qcom,remote-pid = <6>;
> +
> +			rpm_requests: rpm-requests {
> +				compatible = "qcom,rpm-msm8994";
> +				qcom,smd-channels = "rpm_requests";
> +
> +				rpmcc: clock-controller {
> +					compatible = "qcom,rpmcc-msm8994", "qcom,rpmcc";
> +					#clock-cells = <1>;
> +				};
> +
> +				rpmpd: power-controller {
> +					compatible = "qcom,msm8994-rpmpd";
> +					#power-domain-cells = <1>;
> +					operating-points-v2 = <&rpmpd_opp_table>;
> +
> +					rpmpd_opp_table: opp-table {
> +						compatible = "operating-points-v2";
> +
> +						rpmpd_opp_ret: opp1 {
> +							opp-level = <1>;
> +						};
> +						rpmpd_opp_svs_krait: opp2 {
> +							opp-level = <2>;
> +						};
> +						rpmpd_opp_svs_soc: opp3 {
> +							opp-level = <3>;
> +						};
> +						rpmpd_opp_nom: opp4 {
> +							opp-level = <4>;
> +						};
> +						rpmpd_opp_turbo: opp5 {
> +							opp-level = <5>;
> +						};
> +						rpmpd_opp_super_turbo: opp6 {
> +							opp-level = <6>;
> +						};
> +					};
> +				};
> +			};
> +		};
> +	};
> +
>  	reserved-memory {
>  		#address-cells = <2>;
>  		#size-cells = <2>;
> @@ -237,55 +287,6 @@ reserved@6c00000 {
>  		};
>  	};
>  
> -	smd {
> -		compatible = "qcom,smd";
> -		rpm {
> -			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
> -			qcom,ipc = <&apcs 8 0>;
> -			qcom,smd-edge = <15>;
> -			qcom,remote-pid = <6>;
> -
> -			rpm_requests: rpm-requests {
> -				compatible = "qcom,rpm-msm8994";
> -				qcom,smd-channels = "rpm_requests";
> -
> -				rpmcc: clock-controller {
> -					compatible = "qcom,rpmcc-msm8994", "qcom,rpmcc";
> -					#clock-cells = <1>;
> -				};
> -
> -				rpmpd: power-controller {
> -					compatible = "qcom,msm8994-rpmpd";
> -					#power-domain-cells = <1>;
> -					operating-points-v2 = <&rpmpd_opp_table>;
> -
> -					rpmpd_opp_table: opp-table {
> -						compatible = "operating-points-v2";
> -
> -						rpmpd_opp_ret: opp1 {
> -							opp-level = <1>;
> -						};
> -						rpmpd_opp_svs_krait: opp2 {
> -							opp-level = <2>;
> -						};
> -						rpmpd_opp_svs_soc: opp3 {
> -							opp-level = <3>;
> -						};
> -						rpmpd_opp_nom: opp4 {
> -							opp-level = <4>;
> -						};
> -						rpmpd_opp_turbo: opp5 {
> -							opp-level = <5>;
> -						};
> -						rpmpd_opp_super_turbo: opp6 {
> -							opp-level = <6>;
> -						};
> -					};
> -				};
> -			};
> -		};
> -	};
> -
>  	smem {
>  		compatible = "qcom,smem";
>  		memory-region = <&smem_mem>;
> 

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

* Re: [PATCH 08/14] soc: qcom: smem: Add qcom_smem_is_available()
  2023-06-05 18:53   ` Konrad Dybcio
@ 2023-06-05 19:13     ` Stephan Gerhold
  0 siblings, 0 replies; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-05 19:13 UTC (permalink / raw)
  To: Konrad Dybcio
  Cc: Bjorn Andersson, Andy Gross, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc

On Mon, Jun 05, 2023 at 08:53:21PM +0200, Konrad Dybcio wrote:
> 
> 
> On 5.06.2023 09:08, Stephan Gerhold wrote:
> > Avoid having to look up a dummy item from SMEM to detect if it is
> > already available or if we need to defer probing.
> > 
> > Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> > ---
> >  drivers/soc/qcom/smem.c       | 9 +++++++++
> >  include/linux/soc/qcom/smem.h | 1 +
> >  2 files changed, 10 insertions(+)
> > 
> > diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
> > index b0d59e815c3b..3d93a6681494 100644
> > --- a/drivers/soc/qcom/smem.c
> > +++ b/drivers/soc/qcom/smem.c
> > @@ -359,6 +359,15 @@ static struct qcom_smem *__smem;
> >  /* Timeout (ms) for the trylock of remote spinlocks */
> >  #define HWSPINLOCK_TIMEOUT	1000
> >  
> > +/**
> > + * qcom_smem_is_available() - Checks if SMEM is available
> > + */
> Shouldn't kerneldoc explicitly say "returns x if y else z"?
> 

Seems like yes but I copy-pasted from other examples in this file and
there it is always missing. I'll add something simple in v2.

Thanks,
Stephan

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

* Re: [PATCH 09/14] rpmsg: qcom_smd: Use qcom_smem_is_available()
  2023-06-05 18:56   ` Konrad Dybcio
@ 2023-06-05 19:18     ` Stephan Gerhold
  2023-06-05 19:45       ` Konrad Dybcio
  0 siblings, 1 reply; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-05 19:18 UTC (permalink / raw)
  To: Konrad Dybcio
  Cc: Bjorn Andersson, Andy Gross, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc

On Mon, Jun 05, 2023 at 08:56:44PM +0200, Konrad Dybcio wrote:
> 
> 
> On 5.06.2023 09:08, Stephan Gerhold wrote:
> > Rather than looking up a dummy item from SMEM, use the new
> > qcom_smem_is_available() function to make the code more clear
> > (and reduce the overhead slightly).
> > 
> > Add the same check to qcom_smd_register_edge() as well to ensure that
> > it only succeeds if SMEM is already available - if a driver calls the
> > function and SMEM is not available yet then the initial state will be
> > read incorrectly and the RPMSG devices might never become available.
> > 
> > Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> > ---
> >  drivers/rpmsg/qcom_smd.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c
> > index 7b9c298aa491..43f601c84b4f 100644
> > --- a/drivers/rpmsg/qcom_smd.c
> > +++ b/drivers/rpmsg/qcom_smd.c
> > @@ -1479,6 +1479,9 @@ struct qcom_smd_edge *qcom_smd_register_edge(struct device *parent,
> >  	struct qcom_smd_edge *edge;
> >  	int ret;
> >  
> > +	if (!qcom_smem_is_available())
> > +		return ERR_PTR(-EPROBE_DEFER);
> > +
> >  	edge = kzalloc(sizeof(*edge), GFP_KERNEL);
> >  	if (!edge)
> >  		return ERR_PTR(-ENOMEM);
> > @@ -1553,12 +1556,9 @@ EXPORT_SYMBOL(qcom_smd_unregister_edge);
> >  static int qcom_smd_probe(struct platform_device *pdev)
> >  {
> >  	struct device_node *node;
> > -	void *p;
> >  
> > -	/* Wait for smem */
> > -	p = qcom_smem_get(QCOM_SMEM_HOST_ANY, smem_items[0].alloc_tbl_id, NULL);
> > -	if (PTR_ERR(p) == -EPROBE_DEFER)
> > -		return PTR_ERR(p);
> > +	if (!qcom_smem_is_available())
> > +		return -EPROBE_DEFER;
> >  
> >  	for_each_available_child_of_node(pdev->dev.of_node, node)
> >  		qcom_smd_register_edge(&pdev->dev, node);
> Hm.. we're not checking the return value here, at all.. Perhaps that
> could be improved and we could only check for smem presence inside
> qcom_smd_register_edge()?
> 

I think the goal here it to register as many of the edges as possible,
so we wouldn't necessarily want to abort if one of them fails. That's
why it's enough to check for only for a possible -EPROBE_DEFER first.

But more importantly after this series this is legacy code that exists
only for backwards compatibility with older DTBs. The probe function
won't be called for DTBs in mainline anymore. So I think it's not worth
to improve it much anymore. ;)

Thanks,
Stephan

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

* Re: [PATCH 12/14] arm64: dts: qcom: Add rpm-proc node for GLINK gplatforms
  2023-06-05  7:08 ` [PATCH 12/14] arm64: dts: qcom: Add rpm-proc node for GLINK gplatforms Stephan Gerhold
@ 2023-06-05 19:43   ` Konrad Dybcio
  2023-06-05 19:55     ` Stephan Gerhold
  0 siblings, 1 reply; 42+ messages in thread
From: Konrad Dybcio @ 2023-06-05 19:43 UTC (permalink / raw)
  To: Stephan Gerhold, Bjorn Andersson
  Cc: Andy Gross, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Mathieu Poirier, linux-arm-msm, devicetree, linux-kernel,
	linux-remoteproc



On 5.06.2023 09:08, Stephan Gerhold wrote:
> Rather than having the RPM GLINK channels as the only child of a dummy
> top-level rpm-glink node, switch to representing the RPM as remoteproc
> like all the other remoteprocs (modem DSP, ...).
> 
> This allows assigning additional subdevices to it like the MPM
> interrupt-controller or rpm-master-stats.
> 
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
>  arch/arm64/boot/dts/qcom/ipq6018.dtsi |  48 ++++++-----
>  arch/arm64/boot/dts/qcom/ipq9574.dtsi |  28 ++++---
>  arch/arm64/boot/dts/qcom/msm8996.dtsi | 113 ++++++++++++-------------
>  arch/arm64/boot/dts/qcom/msm8998.dtsi |  98 +++++++++++-----------
>  arch/arm64/boot/dts/qcom/qcm2290.dtsi | 126 ++++++++++++++--------------
>  arch/arm64/boot/dts/qcom/qcs404.dtsi  | 152 +++++++++++++++++-----------------
>  arch/arm64/boot/dts/qcom/sdm630.dtsi  | 132 +++++++++++++++--------------
>  arch/arm64/boot/dts/qcom/sm6115.dtsi  | 128 ++++++++++++++--------------
>  arch/arm64/boot/dts/qcom/sm6125.dtsi  | 140 ++++++++++++++++---------------
>  arch/arm64/boot/dts/qcom/sm6375.dtsi  | 126 ++++++++++++++--------------
>  10 files changed, 564 insertions(+), 527 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/qcom/ipq6018.dtsi b/arch/arm64/boot/dts/qcom/ipq6018.dtsi
> index 7355f266742a..fff4a4014bd8 100644
> --- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi
> +++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi
> @@ -146,6 +146,32 @@ psci: psci {
>  		method = "smc";
>  	};
>  
> +	rpm: remoteproc-rpm {
Krzysztof, is this fine or should this be just `remoteproc {`?

in any case:
Tested-by: Konrad Dybcio <konrad.dybcio@linaro.org> # SM6375

Konrad
> +		compatible = "qcom,ipq6018-rpm-proc", "qcom,rpm-proc";
> +
> +		glink-rpm {
> +			compatible = "qcom,glink-rpm";
> +			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
> +			qcom,rpm-msg-ram = <&rpm_msg_ram>;
> +			mboxes = <&apcs_glb 0>;
> +
> +			rpm_requests: rpm-requests {
> +				compatible = "qcom,rpm-ipq6018";
> +				qcom,glink-channels = "rpm_requests";
> +
> +				regulators {
> +					compatible = "qcom,rpm-mp5496-regulators";
> +
> +					ipq6018_s2: s2 {
> +						regulator-min-microvolt = <725000>;
> +						regulator-max-microvolt = <1062500>;
> +						regulator-always-on;
> +					};
> +				};
> +			};
> +		};
> +	};
> +
>  	reserved-memory {
>  		#address-cells = <2>;
>  		#size-cells = <2>;
> @@ -182,28 +208,6 @@ q6_region: memory@4ab00000 {
>  		};
>  	};
>  
> -	rpm-glink {
> -		compatible = "qcom,glink-rpm";
> -		interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
> -		qcom,rpm-msg-ram = <&rpm_msg_ram>;
> -		mboxes = <&apcs_glb 0>;
> -
> -		rpm_requests: rpm-requests {
> -			compatible = "qcom,rpm-ipq6018";
> -			qcom,glink-channels = "rpm_requests";
> -
> -			regulators {
> -				compatible = "qcom,rpm-mp5496-regulators";
> -
> -				ipq6018_s2: s2 {
> -					regulator-min-microvolt = <725000>;
> -					regulator-max-microvolt = <1062500>;
> -					regulator-always-on;
> -				};
> -			};
> -		};
> -	};
> -
>  	smem {
>  		compatible = "qcom,smem";
>  		memory-region = <&smem_region>;
> diff --git a/arch/arm64/boot/dts/qcom/ipq9574.dtsi b/arch/arm64/boot/dts/qcom/ipq9574.dtsi
> index 0baeb10bbdae..3222568ac4cf 100644
> --- a/arch/arm64/boot/dts/qcom/ipq9574.dtsi
> +++ b/arch/arm64/boot/dts/qcom/ipq9574.dtsi
> @@ -151,6 +151,22 @@ psci {
>  		method = "smc";
>  	};
>  
> +	rpm: remoteproc-rpm {
> +		compatible = "qcom,ipq9574-rpm-proc", "qcom,rpm-proc";
> +
> +		glink-rpm {
> +			compatible = "qcom,glink-rpm";
> +			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
> +			qcom,rpm-msg-ram = <&rpm_msg_ram>;
> +			mboxes = <&apcs_glb 0>;
> +
> +			rpm_requests: rpm-requests {
> +				compatible = "qcom,rpm-ipq9574";
> +				qcom,glink-channels = "rpm_requests";
> +			};
> +		};
> +	};
> +
>  	reserved-memory {
>  		#address-cells = <2>;
>  		#size-cells = <2>;
> @@ -169,18 +185,6 @@ smem@4aa00000 {
>  		};
>  	};
>  
> -	rpm-glink {
> -		compatible = "qcom,glink-rpm";
> -		interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
> -		qcom,rpm-msg-ram = <&rpm_msg_ram>;
> -		mboxes = <&apcs_glb 0>;
> -
> -		rpm_requests: rpm-requests {
> -			compatible = "qcom,rpm-ipq9574";
> -			qcom,glink-channels = "rpm_requests";
> -		};
> -	};
> -
>  	soc: soc@0 {
>  		compatible = "simple-bus";
>  		#address-cells = <1>;
> diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi
> index f75932cc2a30..50ede09d6368 100644
> --- a/arch/arm64/boot/dts/qcom/msm8996.dtsi
> +++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi
> @@ -398,6 +398,63 @@ psci {
>  		method = "smc";
>  	};
>  
> +	rpm: remoteproc-rpm {
> +		compatible = "qcom,msm8996-rpm-proc", "qcom,rpm-proc";
> +
> +		glink-rpm {
> +			compatible = "qcom,glink-rpm";
> +			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
> +			qcom,rpm-msg-ram = <&rpm_msg_ram>;
> +			mboxes = <&apcs_glb 0>;
> +
> +			rpm_requests: rpm-requests {
> +				compatible = "qcom,rpm-msm8996";
> +				qcom,glink-channels = "rpm_requests";
> +
> +				rpmcc: clock-controller {
> +					compatible = "qcom,rpmcc-msm8996", "qcom,rpmcc";
> +					#clock-cells = <1>;
> +					clocks = <&xo_board>;
> +					clock-names = "xo";
> +				};
> +
> +				rpmpd: power-controller {
> +					compatible = "qcom,msm8996-rpmpd";
> +					#power-domain-cells = <1>;
> +					operating-points-v2 = <&rpmpd_opp_table>;
> +
> +					rpmpd_opp_table: opp-table {
> +						compatible = "operating-points-v2";
> +
> +						rpmpd_opp1: opp1 {
> +							opp-level = <1>;
> +						};
> +
> +						rpmpd_opp2: opp2 {
> +							opp-level = <2>;
> +						};
> +
> +						rpmpd_opp3: opp3 {
> +							opp-level = <3>;
> +						};
> +
> +						rpmpd_opp4: opp4 {
> +							opp-level = <4>;
> +						};
> +
> +						rpmpd_opp5: opp5 {
> +							opp-level = <5>;
> +						};
> +
> +						rpmpd_opp6: opp6 {
> +							opp-level = <6>;
> +						};
> +					};
> +				};
> +			};
> +		};
> +	};
> +
>  	reserved-memory {
>  		#address-cells = <2>;
>  		#size-cells = <2>;
> @@ -472,62 +529,6 @@ mdata_mem: mpss-metadata {
>  		};
>  	};
>  
> -	rpm-glink {
> -		compatible = "qcom,glink-rpm";
> -
> -		interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
> -
> -		qcom,rpm-msg-ram = <&rpm_msg_ram>;
> -
> -		mboxes = <&apcs_glb 0>;
> -
> -		rpm_requests: rpm-requests {
> -			compatible = "qcom,rpm-msm8996";
> -			qcom,glink-channels = "rpm_requests";
> -
> -			rpmcc: clock-controller {
> -				compatible = "qcom,rpmcc-msm8996", "qcom,rpmcc";
> -				#clock-cells = <1>;
> -				clocks = <&xo_board>;
> -				clock-names = "xo";
> -			};
> -
> -			rpmpd: power-controller {
> -				compatible = "qcom,msm8996-rpmpd";
> -				#power-domain-cells = <1>;
> -				operating-points-v2 = <&rpmpd_opp_table>;
> -
> -				rpmpd_opp_table: opp-table {
> -					compatible = "operating-points-v2";
> -
> -					rpmpd_opp1: opp1 {
> -						opp-level = <1>;
> -					};
> -
> -					rpmpd_opp2: opp2 {
> -						opp-level = <2>;
> -					};
> -
> -					rpmpd_opp3: opp3 {
> -						opp-level = <3>;
> -					};
> -
> -					rpmpd_opp4: opp4 {
> -						opp-level = <4>;
> -					};
> -
> -					rpmpd_opp5: opp5 {
> -						opp-level = <5>;
> -					};
> -
> -					rpmpd_opp6: opp6 {
> -						opp-level = <6>;
> -					};
> -				};
> -			};
> -		};
> -	};
> -
>  	smem {
>  		compatible = "qcom,smem";
>  		memory-region = <&smem_mem>;
> diff --git a/arch/arm64/boot/dts/qcom/msm8998.dtsi b/arch/arm64/boot/dts/qcom/msm8998.dtsi
> index f0e943ff0046..bc51fa6a18aa 100644
> --- a/arch/arm64/boot/dts/qcom/msm8998.dtsi
> +++ b/arch/arm64/boot/dts/qcom/msm8998.dtsi
> @@ -321,68 +321,72 @@ psci {
>  		method = "smc";
>  	};
>  
> -	rpm-glink {
> -		compatible = "qcom,glink-rpm";
> +	rpm: remoteproc-rpm {
> +		compatible = "qcom,msm8998-rpm-proc", "qcom,rpm-proc";
>  
> -		interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
> -		qcom,rpm-msg-ram = <&rpm_msg_ram>;
> -		mboxes = <&apcs_glb 0>;
> +		glink-rpm {
> +			compatible = "qcom,glink-rpm";
>  
> -		rpm_requests: rpm-requests {
> -			compatible = "qcom,rpm-msm8998";
> -			qcom,glink-channels = "rpm_requests";
> +			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
> +			qcom,rpm-msg-ram = <&rpm_msg_ram>;
> +			mboxes = <&apcs_glb 0>;
>  
> -			rpmcc: clock-controller {
> -				compatible = "qcom,rpmcc-msm8998", "qcom,rpmcc";
> -				#clock-cells = <1>;
> -			};
> +			rpm_requests: rpm-requests {
> +				compatible = "qcom,rpm-msm8998";
> +				qcom,glink-channels = "rpm_requests";
>  
> -			rpmpd: power-controller {
> -				compatible = "qcom,msm8998-rpmpd";
> -				#power-domain-cells = <1>;
> -				operating-points-v2 = <&rpmpd_opp_table>;
> +				rpmcc: clock-controller {
> +					compatible = "qcom,rpmcc-msm8998", "qcom,rpmcc";
> +					#clock-cells = <1>;
> +				};
>  
> -				rpmpd_opp_table: opp-table {
> -					compatible = "operating-points-v2";
> +				rpmpd: power-controller {
> +					compatible = "qcom,msm8998-rpmpd";
> +					#power-domain-cells = <1>;
> +					operating-points-v2 = <&rpmpd_opp_table>;
>  
> -					rpmpd_opp_ret: opp1 {
> -						opp-level = <RPM_SMD_LEVEL_RETENTION>;
> -					};
> +					rpmpd_opp_table: opp-table {
> +						compatible = "operating-points-v2";
>  
> -					rpmpd_opp_ret_plus: opp2 {
> -						opp-level = <RPM_SMD_LEVEL_RETENTION_PLUS>;
> -					};
> +						rpmpd_opp_ret: opp1 {
> +							opp-level = <RPM_SMD_LEVEL_RETENTION>;
> +						};
>  
> -					rpmpd_opp_min_svs: opp3 {
> -						opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
> -					};
> +						rpmpd_opp_ret_plus: opp2 {
> +							opp-level = <RPM_SMD_LEVEL_RETENTION_PLUS>;
> +						};
>  
> -					rpmpd_opp_low_svs: opp4 {
> -						opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
> -					};
> +						rpmpd_opp_min_svs: opp3 {
> +							opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
> +						};
>  
> -					rpmpd_opp_svs: opp5 {
> -						opp-level = <RPM_SMD_LEVEL_SVS>;
> -					};
> +						rpmpd_opp_low_svs: opp4 {
> +							opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
> +						};
>  
> -					rpmpd_opp_svs_plus: opp6 {
> -						opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
> -					};
> +						rpmpd_opp_svs: opp5 {
> +							opp-level = <RPM_SMD_LEVEL_SVS>;
> +						};
>  
> -					rpmpd_opp_nom: opp7 {
> -						opp-level = <RPM_SMD_LEVEL_NOM>;
> -					};
> +						rpmpd_opp_svs_plus: opp6 {
> +							opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
> +						};
>  
> -					rpmpd_opp_nom_plus: opp8 {
> -						opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
> -					};
> +						rpmpd_opp_nom: opp7 {
> +							opp-level = <RPM_SMD_LEVEL_NOM>;
> +						};
>  
> -					rpmpd_opp_turbo: opp9 {
> -						opp-level = <RPM_SMD_LEVEL_TURBO>;
> -					};
> +						rpmpd_opp_nom_plus: opp8 {
> +							opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
> +						};
> +
> +						rpmpd_opp_turbo: opp9 {
> +							opp-level = <RPM_SMD_LEVEL_TURBO>;
> +						};
>  
> -					rpmpd_opp_turbo_plus: opp10 {
> -						opp-level = <RPM_SMD_LEVEL_BINNING>;
> +						rpmpd_opp_turbo_plus: opp10 {
> +							opp-level = <RPM_SMD_LEVEL_BINNING>;
> +						};
>  					};
>  				};
>  			};
> diff --git a/arch/arm64/boot/dts/qcom/qcm2290.dtsi b/arch/arm64/boot/dts/qcom/qcm2290.dtsi
> index b29bc4e4b837..ad1b721d1e1e 100644
> --- a/arch/arm64/boot/dts/qcom/qcm2290.dtsi
> +++ b/arch/arm64/boot/dts/qcom/qcm2290.dtsi
> @@ -137,6 +137,71 @@ psci {
>  		method = "smc";
>  	};
>  
> +	rpm: remoteproc-rpm {
> +		compatible = "qcom,qcm2290-rpm-proc", "qcom,rpm-proc";
> +
> +		glink-rpm {
> +			compatible = "qcom,glink-rpm";
> +			interrupts = <GIC_SPI 194 IRQ_TYPE_EDGE_RISING>;
> +			qcom,rpm-msg-ram = <&rpm_msg_ram>;
> +			mboxes = <&apcs_glb 0>;
> +
> +			rpm_requests: rpm-requests {
> +				compatible = "qcom,rpm-qcm2290";
> +				qcom,glink-channels = "rpm_requests";
> +
> +				rpmcc: clock-controller {
> +					compatible = "qcom,rpmcc-qcm2290", "qcom,rpmcc";
> +					clocks = <&xo_board>;
> +					clock-names = "xo";
> +					#clock-cells = <1>;
> +				};
> +
> +				rpmpd: power-controller {
> +					compatible = "qcom,qcm2290-rpmpd";
> +					#power-domain-cells = <1>;
> +					operating-points-v2 = <&rpmpd_opp_table>;
> +
> +					rpmpd_opp_table: opp-table {
> +						compatible = "operating-points-v2";
> +
> +						rpmpd_opp_min_svs: opp1 {
> +							opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
> +						};
> +
> +						rpmpd_opp_low_svs: opp2 {
> +							opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
> +						};
> +
> +						rpmpd_opp_svs: opp3 {
> +							opp-level = <RPM_SMD_LEVEL_SVS>;
> +						};
> +
> +						rpmpd_opp_svs_plus: opp4 {
> +							opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
> +						};
> +
> +						rpmpd_opp_nom: opp5 {
> +							opp-level = <RPM_SMD_LEVEL_NOM>;
> +						};
> +
> +						rpmpd_opp_nom_plus: opp6 {
> +							opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
> +						};
> +
> +						rpmpd_opp_turbo: opp7 {
> +							opp-level = <RPM_SMD_LEVEL_TURBO>;
> +						};
> +
> +						rpmpd_opp_turbo_plus: opp8 {
> +							opp-level = <RPM_SMD_LEVEL_TURBO_NO_CPR>;
> +						};
> +					};
> +				};
> +			};
> +		};
> +	};
> +
>  	reserved_memory: reserved-memory {
>  		#address-cells = <2>;
>  		#size-cells = <2>;
> @@ -227,67 +292,6 @@ rmtfs_mem: memory@89b01000 {
>  		};
>  	};
>  
> -	rpm-glink {
> -		compatible = "qcom,glink-rpm";
> -		interrupts = <GIC_SPI 194 IRQ_TYPE_EDGE_RISING>;
> -		qcom,rpm-msg-ram = <&rpm_msg_ram>;
> -		mboxes = <&apcs_glb 0>;
> -
> -		rpm_requests: rpm-requests {
> -			compatible = "qcom,rpm-qcm2290";
> -			qcom,glink-channels = "rpm_requests";
> -
> -			rpmcc: clock-controller {
> -				compatible = "qcom,rpmcc-qcm2290", "qcom,rpmcc";
> -				clocks = <&xo_board>;
> -				clock-names = "xo";
> -				#clock-cells = <1>;
> -			};
> -
> -			rpmpd: power-controller {
> -				compatible = "qcom,qcm2290-rpmpd";
> -				#power-domain-cells = <1>;
> -				operating-points-v2 = <&rpmpd_opp_table>;
> -
> -				rpmpd_opp_table: opp-table {
> -					compatible = "operating-points-v2";
> -
> -					rpmpd_opp_min_svs: opp1 {
> -						opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
> -					};
> -
> -					rpmpd_opp_low_svs: opp2 {
> -						opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
> -					};
> -
> -					rpmpd_opp_svs: opp3 {
> -						opp-level = <RPM_SMD_LEVEL_SVS>;
> -					};
> -
> -					rpmpd_opp_svs_plus: opp4 {
> -						opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
> -					};
> -
> -					rpmpd_opp_nom: opp5 {
> -						opp-level = <RPM_SMD_LEVEL_NOM>;
> -					};
> -
> -					rpmpd_opp_nom_plus: opp6 {
> -						opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
> -					};
> -
> -					rpmpd_opp_turbo: opp7 {
> -						opp-level = <RPM_SMD_LEVEL_TURBO>;
> -					};
> -
> -					rpmpd_opp_turbo_plus: opp8 {
> -						opp-level = <RPM_SMD_LEVEL_TURBO_NO_CPR>;
> -					};
> -				};
> -			};
> -		};
> -	};
> -
>  	smp2p-adsp {
>  		compatible = "qcom,smp2p";
>  		qcom,smem = <443>, <429>;
> diff --git a/arch/arm64/boot/dts/qcom/qcs404.dtsi b/arch/arm64/boot/dts/qcom/qcs404.dtsi
> index 972f753847e1..329363cace5a 100644
> --- a/arch/arm64/boot/dts/qcom/qcs404.dtsi
> +++ b/arch/arm64/boot/dts/qcom/qcs404.dtsi
> @@ -166,6 +166,84 @@ psci {
>  		method = "smc";
>  	};
>  
> +	rpm: remoteproc-rpm {
> +		compatible = "qcom,qcs404-rpm-proc", "qcom,rpm-proc";
> +
> +		glink-rpm {
> +			compatible = "qcom,glink-rpm";
> +
> +			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
> +			qcom,rpm-msg-ram = <&rpm_msg_ram>;
> +			mboxes = <&apcs_glb 0>;
> +
> +			rpm_requests: rpm-requests {
> +				compatible = "qcom,rpm-qcs404";
> +				qcom,glink-channels = "rpm_requests";
> +
> +				rpmcc: clock-controller {
> +					compatible = "qcom,rpmcc-qcs404", "qcom,rpmcc";
> +					#clock-cells = <1>;
> +					clocks = <&xo_board>;
> +					clock-names = "xo";
> +				};
> +
> +				rpmpd: power-controller {
> +					compatible = "qcom,qcs404-rpmpd";
> +					#power-domain-cells = <1>;
> +					operating-points-v2 = <&rpmpd_opp_table>;
> +
> +					rpmpd_opp_table: opp-table {
> +						compatible = "operating-points-v2";
> +
> +						rpmpd_opp_ret: opp1 {
> +							opp-level = <16>;
> +						};
> +
> +						rpmpd_opp_ret_plus: opp2 {
> +							opp-level = <32>;
> +						};
> +
> +						rpmpd_opp_min_svs: opp3 {
> +							opp-level = <48>;
> +						};
> +
> +						rpmpd_opp_low_svs: opp4 {
> +							opp-level = <64>;
> +						};
> +
> +						rpmpd_opp_svs: opp5 {
> +							opp-level = <128>;
> +						};
> +
> +						rpmpd_opp_svs_plus: opp6 {
> +							opp-level = <192>;
> +						};
> +
> +						rpmpd_opp_nom: opp7 {
> +							opp-level = <256>;
> +						};
> +
> +						rpmpd_opp_nom_plus: opp8 {
> +							opp-level = <320>;
> +						};
> +
> +						rpmpd_opp_turbo: opp9 {
> +							opp-level = <384>;
> +						};
> +
> +						rpmpd_opp_turbo_no_cpr: opp10 {
> +							opp-level = <416>;
> +						};
> +
> +						rpmpd_opp_turbo_plus: opp11 {
> +							opp-level = <512>;
> +						};
> +					};
> +				};
> +			};
> +		};
> +	};
> +
>  	reserved-memory {
>  		#address-cells = <2>;
>  		#size-cells = <2>;
> @@ -217,80 +295,6 @@ uefi_mem: memory@9f800000 {
>  		};
>  	};
>  
> -	rpm-glink {
> -		compatible = "qcom,glink-rpm";
> -
> -		interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
> -		qcom,rpm-msg-ram = <&rpm_msg_ram>;
> -		mboxes = <&apcs_glb 0>;
> -
> -		rpm_requests: rpm-requests {
> -			compatible = "qcom,rpm-qcs404";
> -			qcom,glink-channels = "rpm_requests";
> -
> -			rpmcc: clock-controller {
> -				compatible = "qcom,rpmcc-qcs404", "qcom,rpmcc";
> -				#clock-cells = <1>;
> -				clocks = <&xo_board>;
> -				clock-names = "xo";
> -			};
> -
> -			rpmpd: power-controller {
> -				compatible = "qcom,qcs404-rpmpd";
> -				#power-domain-cells = <1>;
> -				operating-points-v2 = <&rpmpd_opp_table>;
> -
> -				rpmpd_opp_table: opp-table {
> -					compatible = "operating-points-v2";
> -
> -					rpmpd_opp_ret: opp1 {
> -						opp-level = <16>;
> -					};
> -
> -					rpmpd_opp_ret_plus: opp2 {
> -						opp-level = <32>;
> -					};
> -
> -					rpmpd_opp_min_svs: opp3 {
> -						opp-level = <48>;
> -					};
> -
> -					rpmpd_opp_low_svs: opp4 {
> -						opp-level = <64>;
> -					};
> -
> -					rpmpd_opp_svs: opp5 {
> -						opp-level = <128>;
> -					};
> -
> -					rpmpd_opp_svs_plus: opp6 {
> -						opp-level = <192>;
> -					};
> -
> -					rpmpd_opp_nom: opp7 {
> -						opp-level = <256>;
> -					};
> -
> -					rpmpd_opp_nom_plus: opp8 {
> -						opp-level = <320>;
> -					};
> -
> -					rpmpd_opp_turbo: opp9 {
> -						opp-level = <384>;
> -					};
> -
> -					rpmpd_opp_turbo_no_cpr: opp10 {
> -						opp-level = <416>;
> -					};
> -
> -					rpmpd_opp_turbo_plus: opp11 {
> -						opp-level = <512>;
> -					};
> -				};
> -			};
> -		};
> -	};
> -
>  	smem {
>  		compatible = "qcom,smem";
>  
> diff --git a/arch/arm64/boot/dts/qcom/sdm630.dtsi b/arch/arm64/boot/dts/qcom/sdm630.dtsi
> index 897f2440c9c8..2dfaec074c24 100644
> --- a/arch/arm64/boot/dts/qcom/sdm630.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sdm630.dtsi
> @@ -359,6 +359,74 @@ psci {
>  		method = "smc";
>  	};
>  
> +	rpm: remoteproc-rpm {
> +		compatible = "qcom,sdm660-rpm-proc", "qcom,rpm-proc";
> +
> +		glink-rpm {
> +			compatible = "qcom,glink-rpm";
> +
> +			interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
> +			qcom,rpm-msg-ram = <&rpm_msg_ram>;
> +			mboxes = <&apcs_glb 0>;
> +
> +			rpm_requests: rpm-requests {
> +				compatible = "qcom,rpm-sdm660";
> +				qcom,glink-channels = "rpm_requests";
> +
> +				rpmcc: clock-controller {
> +					compatible = "qcom,rpmcc-sdm660", "qcom,rpmcc";
> +					#clock-cells = <1>;
> +				};
> +
> +				rpmpd: power-controller {
> +					compatible = "qcom,sdm660-rpmpd";
> +					#power-domain-cells = <1>;
> +					operating-points-v2 = <&rpmpd_opp_table>;
> +
> +					rpmpd_opp_table: opp-table {
> +						compatible = "operating-points-v2";
> +
> +						rpmpd_opp_ret: opp1 {
> +							opp-level = <RPM_SMD_LEVEL_RETENTION>;
> +						};
> +
> +						rpmpd_opp_ret_plus: opp2 {
> +							opp-level = <RPM_SMD_LEVEL_RETENTION_PLUS>;
> +						};
> +
> +						rpmpd_opp_min_svs: opp3 {
> +							opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
> +						};
> +
> +						rpmpd_opp_low_svs: opp4 {
> +							opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
> +						};
> +
> +						rpmpd_opp_svs: opp5 {
> +							opp-level = <RPM_SMD_LEVEL_SVS>;
> +						};
> +
> +						rpmpd_opp_svs_plus: opp6 {
> +							opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
> +						};
> +
> +						rpmpd_opp_nom: opp7 {
> +							opp-level = <RPM_SMD_LEVEL_NOM>;
> +						};
> +
> +						rpmpd_opp_nom_plus: opp8 {
> +							opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
> +						};
> +
> +						rpmpd_opp_turbo: opp9 {
> +							opp-level = <RPM_SMD_LEVEL_TURBO>;
> +						};
> +					};
> +				};
> +			};
> +		};
> +	};
> +
>  	reserved-memory {
>  		#address-cells = <2>;
>  		#size-cells = <2>;
> @@ -440,70 +508,6 @@ zap_shader_region: gpu@fed00000 {
>  		};
>  	};
>  
> -	rpm-glink {
> -		compatible = "qcom,glink-rpm";
> -
> -		interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
> -		qcom,rpm-msg-ram = <&rpm_msg_ram>;
> -		mboxes = <&apcs_glb 0>;
> -
> -		rpm_requests: rpm-requests {
> -			compatible = "qcom,rpm-sdm660";
> -			qcom,glink-channels = "rpm_requests";
> -
> -			rpmcc: clock-controller {
> -				compatible = "qcom,rpmcc-sdm660", "qcom,rpmcc";
> -				#clock-cells = <1>;
> -			};
> -
> -			rpmpd: power-controller {
> -				compatible = "qcom,sdm660-rpmpd";
> -				#power-domain-cells = <1>;
> -				operating-points-v2 = <&rpmpd_opp_table>;
> -
> -				rpmpd_opp_table: opp-table {
> -					compatible = "operating-points-v2";
> -
> -					rpmpd_opp_ret: opp1 {
> -						opp-level = <RPM_SMD_LEVEL_RETENTION>;
> -					};
> -
> -					rpmpd_opp_ret_plus: opp2 {
> -						opp-level = <RPM_SMD_LEVEL_RETENTION_PLUS>;
> -					};
> -
> -					rpmpd_opp_min_svs: opp3 {
> -						opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
> -					};
> -
> -					rpmpd_opp_low_svs: opp4 {
> -						opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
> -					};
> -
> -					rpmpd_opp_svs: opp5 {
> -						opp-level = <RPM_SMD_LEVEL_SVS>;
> -					};
> -
> -					rpmpd_opp_svs_plus: opp6 {
> -						opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
> -					};
> -
> -					rpmpd_opp_nom: opp7 {
> -						opp-level = <RPM_SMD_LEVEL_NOM>;
> -					};
> -
> -					rpmpd_opp_nom_plus: opp8 {
> -						opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
> -					};
> -
> -					rpmpd_opp_turbo: opp9 {
> -						opp-level = <RPM_SMD_LEVEL_TURBO>;
> -					};
> -				};
> -			};
> -		};
> -	};
> -
>  	smem: smem {
>  		compatible = "qcom,smem";
>  		memory-region = <&smem_region>;
> diff --git a/arch/arm64/boot/dts/qcom/sm6115.dtsi b/arch/arm64/boot/dts/qcom/sm6115.dtsi
> index 55118577bf92..d3ea67f7563d 100644
> --- a/arch/arm64/boot/dts/qcom/sm6115.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sm6115.dtsi
> @@ -341,6 +341,72 @@ CLUSTER_1_PD: power-domain-cpu-cluster1 {
>  		};
>  	};
>  
> +	rpm: remoteproc-rpm {
> +		compatible = "qcom,sm6115-rpm-proc", "qcom,rpm-proc";
> +
> +		glink-rpm {
> +			compatible = "qcom,glink-rpm";
> +
> +			interrupts = <GIC_SPI 194 IRQ_TYPE_EDGE_RISING>;
> +			qcom,rpm-msg-ram = <&rpm_msg_ram>;
> +			mboxes = <&apcs_glb 0>;
> +
> +			rpm_requests: rpm-requests {
> +				compatible = "qcom,rpm-sm6115";
> +				qcom,glink-channels = "rpm_requests";
> +
> +				rpmcc: clock-controller {
> +					compatible = "qcom,rpmcc-sm6115", "qcom,rpmcc";
> +					clocks = <&xo_board>;
> +					clock-names = "xo";
> +					#clock-cells = <1>;
> +				};
> +
> +				rpmpd: power-controller {
> +					compatible = "qcom,sm6115-rpmpd";
> +					#power-domain-cells = <1>;
> +					operating-points-v2 = <&rpmpd_opp_table>;
> +
> +					rpmpd_opp_table: opp-table {
> +						compatible = "operating-points-v2";
> +
> +						rpmpd_opp_min_svs: opp1 {
> +							opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
> +						};
> +
> +						rpmpd_opp_low_svs: opp2 {
> +							opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
> +						};
> +
> +						rpmpd_opp_svs: opp3 {
> +							opp-level = <RPM_SMD_LEVEL_SVS>;
> +						};
> +
> +						rpmpd_opp_svs_plus: opp4 {
> +							opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
> +						};
> +
> +						rpmpd_opp_nom: opp5 {
> +							opp-level = <RPM_SMD_LEVEL_NOM>;
> +						};
> +
> +						rpmpd_opp_nom_plus: opp6 {
> +							opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
> +						};
> +
> +						rpmpd_opp_turbo: opp7 {
> +							opp-level = <RPM_SMD_LEVEL_TURBO>;
> +						};
> +
> +						rpmpd_opp_turbo_plus: opp8 {
> +							opp-level = <RPM_SMD_LEVEL_TURBO_NO_CPR>;
> +						};
> +					};
> +				};
> +			};
> +		};
> +	};
> +
>  	reserved_memory: reserved-memory {
>  		#address-cells = <2>;
>  		#size-cells = <2>;
> @@ -440,68 +506,6 @@ rmtfs_mem: memory@89b01000 {
>  		};
>  	};
>  
> -	rpm-glink {
> -		compatible = "qcom,glink-rpm";
> -
> -		interrupts = <GIC_SPI 194 IRQ_TYPE_EDGE_RISING>;
> -		qcom,rpm-msg-ram = <&rpm_msg_ram>;
> -		mboxes = <&apcs_glb 0>;
> -
> -		rpm_requests: rpm-requests {
> -			compatible = "qcom,rpm-sm6115";
> -			qcom,glink-channels = "rpm_requests";
> -
> -			rpmcc: clock-controller {
> -				compatible = "qcom,rpmcc-sm6115", "qcom,rpmcc";
> -				clocks = <&xo_board>;
> -				clock-names = "xo";
> -				#clock-cells = <1>;
> -			};
> -
> -			rpmpd: power-controller {
> -				compatible = "qcom,sm6115-rpmpd";
> -				#power-domain-cells = <1>;
> -				operating-points-v2 = <&rpmpd_opp_table>;
> -
> -				rpmpd_opp_table: opp-table {
> -					compatible = "operating-points-v2";
> -
> -					rpmpd_opp_min_svs: opp1 {
> -						opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
> -					};
> -
> -					rpmpd_opp_low_svs: opp2 {
> -						opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
> -					};
> -
> -					rpmpd_opp_svs: opp3 {
> -						opp-level = <RPM_SMD_LEVEL_SVS>;
> -					};
> -
> -					rpmpd_opp_svs_plus: opp4 {
> -						opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
> -					};
> -
> -					rpmpd_opp_nom: opp5 {
> -						opp-level = <RPM_SMD_LEVEL_NOM>;
> -					};
> -
> -					rpmpd_opp_nom_plus: opp6 {
> -						opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
> -					};
> -
> -					rpmpd_opp_turbo: opp7 {
> -						opp-level = <RPM_SMD_LEVEL_TURBO>;
> -					};
> -
> -					rpmpd_opp_turbo_plus: opp8 {
> -						opp-level = <RPM_SMD_LEVEL_TURBO_NO_CPR>;
> -					};
> -				};
> -			};
> -		};
> -	};
> -
>  	smp2p-adsp {
>  		compatible = "qcom,smp2p";
>  		qcom,smem = <443>, <429>;
> diff --git a/arch/arm64/boot/dts/qcom/sm6125.dtsi b/arch/arm64/boot/dts/qcom/sm6125.dtsi
> index a596baa6ce3e..1d05ddf35e35 100644
> --- a/arch/arm64/boot/dts/qcom/sm6125.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sm6125.dtsi
> @@ -181,6 +181,78 @@ psci {
>  		method = "smc";
>  	};
>  
> +	remoteproc-rpm {
> +		compatible = "qcom,sm6125-rpm-proc", "qcom,rpm-proc";
> +
> +		glink-rpm {
> +			compatible = "qcom,glink-rpm";
> +
> +			interrupts = <GIC_SPI 194 IRQ_TYPE_EDGE_RISING>;
> +			qcom,rpm-msg-ram = <&rpm_msg_ram>;
> +			mboxes = <&apcs_glb 0>;
> +
> +			rpm_requests: rpm-requests {
> +				compatible = "qcom,rpm-sm6125";
> +				qcom,glink-channels = "rpm_requests";
> +
> +				rpmcc: clock-controller {
> +					compatible = "qcom,rpmcc-sm6125", "qcom,rpmcc";
> +					#clock-cells = <1>;
> +				};
> +
> +				rpmpd: power-controller {
> +					compatible = "qcom,sm6125-rpmpd";
> +					#power-domain-cells = <1>;
> +					operating-points-v2 = <&rpmpd_opp_table>;
> +
> +					rpmpd_opp_table: opp-table {
> +						compatible = "operating-points-v2";
> +
> +						rpmpd_opp_ret: opp1 {
> +							opp-level = <RPM_SMD_LEVEL_RETENTION>;
> +						};
> +
> +						rpmpd_opp_ret_plus: opp2 {
> +							opp-level = <RPM_SMD_LEVEL_RETENTION_PLUS>;
> +						};
> +
> +						rpmpd_opp_min_svs: opp3 {
> +							opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
> +						};
> +
> +						rpmpd_opp_low_svs: opp4 {
> +							opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
> +						};
> +
> +						rpmpd_opp_svs: opp5 {
> +							opp-level = <RPM_SMD_LEVEL_SVS>;
> +						};
> +
> +						rpmpd_opp_svs_plus: opp6 {
> +							opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
> +						};
> +
> +						rpmpd_opp_nom: opp7 {
> +							opp-level = <RPM_SMD_LEVEL_NOM>;
> +						};
> +
> +						rpmpd_opp_nom_plus: opp8 {
> +							opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
> +						};
> +
> +						rpmpd_opp_turbo: opp9 {
> +							opp-level = <RPM_SMD_LEVEL_TURBO>;
> +						};
> +
> +						rpmpd_opp_turbo_no_cpr: opp10 {
> +							opp-level = <RPM_SMD_LEVEL_TURBO_NO_CPR>;
> +						};
> +					};
> +				};
> +			};
> +		};
> +	};
> +
>  	reserved_memory: reserved-memory {
>  		#address-cells = <2>;
>  		#size-cells = <2>;
> @@ -292,74 +364,6 @@ qseecom_ta_mem: memory@13fc00000 {
>  		};
>  	};
>  
> -	rpm-glink {
> -		compatible = "qcom,glink-rpm";
> -
> -		interrupts = <GIC_SPI 194 IRQ_TYPE_EDGE_RISING>;
> -		qcom,rpm-msg-ram = <&rpm_msg_ram>;
> -		mboxes = <&apcs_glb 0>;
> -
> -		rpm_requests: rpm-requests {
> -			compatible = "qcom,rpm-sm6125";
> -			qcom,glink-channels = "rpm_requests";
> -
> -			rpmcc: clock-controller {
> -				compatible = "qcom,rpmcc-sm6125", "qcom,rpmcc";
> -				#clock-cells = <1>;
> -			};
> -
> -			rpmpd: power-controller {
> -				compatible = "qcom,sm6125-rpmpd";
> -				#power-domain-cells = <1>;
> -				operating-points-v2 = <&rpmpd_opp_table>;
> -
> -				rpmpd_opp_table: opp-table {
> -					compatible = "operating-points-v2";
> -
> -					rpmpd_opp_ret: opp1 {
> -						opp-level = <RPM_SMD_LEVEL_RETENTION>;
> -					};
> -
> -					rpmpd_opp_ret_plus: opp2 {
> -						opp-level = <RPM_SMD_LEVEL_RETENTION_PLUS>;
> -					};
> -
> -					rpmpd_opp_min_svs: opp3 {
> -						opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
> -					};
> -
> -					rpmpd_opp_low_svs: opp4 {
> -						opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
> -					};
> -
> -					rpmpd_opp_svs: opp5 {
> -						opp-level = <RPM_SMD_LEVEL_SVS>;
> -					};
> -
> -					rpmpd_opp_svs_plus: opp6 {
> -						opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
> -					};
> -
> -					rpmpd_opp_nom: opp7 {
> -						opp-level = <RPM_SMD_LEVEL_NOM>;
> -					};
> -
> -					rpmpd_opp_nom_plus: opp8 {
> -						opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
> -					};
> -
> -					rpmpd_opp_turbo: opp9 {
> -						opp-level = <RPM_SMD_LEVEL_TURBO>;
> -					};
> -
> -					rpmpd_opp_turbo_no_cpr: opp10 {
> -						opp-level = <RPM_SMD_LEVEL_TURBO_NO_CPR>;
> -					};
> -				};
> -			};
> -		};
> -	};
> -
>  	smem: smem {
>  		compatible = "qcom,smem";
>  		memory-region = <&smem_mem>;
> diff --git a/arch/arm64/boot/dts/qcom/sm6375.dtsi b/arch/arm64/boot/dts/qcom/sm6375.dtsi
> index f8d9c34d3b2f..9834c5089fe8 100644
> --- a/arch/arm64/boot/dts/qcom/sm6375.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sm6375.dtsi
> @@ -493,67 +493,71 @@ cmdline_region: cmdline@ffd00000 {
>  		};
>  	};
>  
> -	rpm-glink {
> -		compatible = "qcom,glink-rpm";
> -		interrupts-extended = <&ipcc IPCC_CLIENT_AOP
> -					     IPCC_MPROC_SIGNAL_GLINK_QMP
> -					     IRQ_TYPE_EDGE_RISING>;
> -		qcom,rpm-msg-ram = <&rpm_msg_ram>;
> -		mboxes = <&ipcc IPCC_CLIENT_AOP IPCC_MPROC_SIGNAL_GLINK_QMP>;
> -
> -		rpm_requests: rpm-requests {
> -			compatible = "qcom,rpm-sm6375";
> -			qcom,glink-channels = "rpm_requests";
> -
> -			rpmcc: clock-controller {
> -				compatible = "qcom,rpmcc-sm6375", "qcom,rpmcc";
> -				clocks = <&xo_board_clk>;
> -				clock-names = "xo";
> -				#clock-cells = <1>;
> -			};
> -
> -			rpmpd: power-controller {
> -				compatible = "qcom,sm6375-rpmpd";
> -				#power-domain-cells = <1>;
> -				operating-points-v2 = <&rpmpd_opp_table>;
> -
> -				rpmpd_opp_table: opp-table {
> -					compatible = "operating-points-v2";
> -
> -					rpmpd_opp_ret: opp1 {
> -						opp-level = <RPM_SMD_LEVEL_RETENTION>;
> -					};
> -
> -					rpmpd_opp_min_svs: opp2 {
> -						opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
> -					};
> -
> -					rpmpd_opp_low_svs: opp3 {
> -						opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
> -					};
> -
> -					rpmpd_opp_svs: opp4 {
> -						opp-level = <RPM_SMD_LEVEL_SVS>;
> -					};
> -
> -					rpmpd_opp_svs_plus: opp5 {
> -						opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
> -					};
> -
> -					rpmpd_opp_nom: opp6 {
> -						opp-level = <RPM_SMD_LEVEL_NOM>;
> -					};
> -
> -					rpmpd_opp_nom_plus: opp7 {
> -						opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
> -					};
> -
> -					rpmpd_opp_turbo: opp8 {
> -						opp-level = <RPM_SMD_LEVEL_TURBO>;
> -					};
> -
> -					rpmpd_opp_turbo_no_cpr: opp9 {
> -						opp-level = <RPM_SMD_LEVEL_TURBO_NO_CPR>;
> +	remoteproc-rpm {
> +		compatible = "qcom,sm6375-rpm-proc", "qcom,rpm-proc";
> +
> +		glink-rpm {
> +			compatible = "qcom,glink-rpm";
> +			interrupts-extended = <&ipcc IPCC_CLIENT_AOP
> +						     IPCC_MPROC_SIGNAL_GLINK_QMP
> +						     IRQ_TYPE_EDGE_RISING>;
> +			qcom,rpm-msg-ram = <&rpm_msg_ram>;
> +			mboxes = <&ipcc IPCC_CLIENT_AOP IPCC_MPROC_SIGNAL_GLINK_QMP>;
> +
> +			rpm_requests: rpm-requests {
> +				compatible = "qcom,rpm-sm6375";
> +				qcom,glink-channels = "rpm_requests";
> +
> +				rpmcc: clock-controller {
> +					compatible = "qcom,rpmcc-sm6375", "qcom,rpmcc";
> +					clocks = <&xo_board_clk>;
> +					clock-names = "xo";
> +					#clock-cells = <1>;
> +				};
> +
> +				rpmpd: power-controller {
> +					compatible = "qcom,sm6375-rpmpd";
> +					#power-domain-cells = <1>;
> +					operating-points-v2 = <&rpmpd_opp_table>;
> +
> +					rpmpd_opp_table: opp-table {
> +						compatible = "operating-points-v2";
> +
> +						rpmpd_opp_ret: opp1 {
> +							opp-level = <RPM_SMD_LEVEL_RETENTION>;
> +						};
> +
> +						rpmpd_opp_min_svs: opp2 {
> +							opp-level = <RPM_SMD_LEVEL_MIN_SVS>;
> +						};
> +
> +						rpmpd_opp_low_svs: opp3 {
> +							opp-level = <RPM_SMD_LEVEL_LOW_SVS>;
> +						};
> +
> +						rpmpd_opp_svs: opp4 {
> +							opp-level = <RPM_SMD_LEVEL_SVS>;
> +						};
> +
> +						rpmpd_opp_svs_plus: opp5 {
> +							opp-level = <RPM_SMD_LEVEL_SVS_PLUS>;
> +						};
> +
> +						rpmpd_opp_nom: opp6 {
> +							opp-level = <RPM_SMD_LEVEL_NOM>;
> +						};
> +
> +						rpmpd_opp_nom_plus: opp7 {
> +							opp-level = <RPM_SMD_LEVEL_NOM_PLUS>;
> +						};
> +
> +						rpmpd_opp_turbo: opp8 {
> +							opp-level = <RPM_SMD_LEVEL_TURBO>;
> +						};
> +
> +						rpmpd_opp_turbo_no_cpr: opp9 {
> +							opp-level = <RPM_SMD_LEVEL_TURBO_NO_CPR>;
> +						};
>  					};
>  				};
>  			};
> 

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

* Re: [PATCH 09/14] rpmsg: qcom_smd: Use qcom_smem_is_available()
  2023-06-05 19:18     ` Stephan Gerhold
@ 2023-06-05 19:45       ` Konrad Dybcio
  0 siblings, 0 replies; 42+ messages in thread
From: Konrad Dybcio @ 2023-06-05 19:45 UTC (permalink / raw)
  To: Stephan Gerhold
  Cc: Bjorn Andersson, Andy Gross, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc



On 5.06.2023 21:18, Stephan Gerhold wrote:
> On Mon, Jun 05, 2023 at 08:56:44PM +0200, Konrad Dybcio wrote:
>>
>>
>> On 5.06.2023 09:08, Stephan Gerhold wrote:
>>> Rather than looking up a dummy item from SMEM, use the new
>>> qcom_smem_is_available() function to make the code more clear
>>> (and reduce the overhead slightly).
>>>
>>> Add the same check to qcom_smd_register_edge() as well to ensure that
>>> it only succeeds if SMEM is already available - if a driver calls the
>>> function and SMEM is not available yet then the initial state will be
>>> read incorrectly and the RPMSG devices might never become available.
>>>
>>> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
>>> ---
>>>  drivers/rpmsg/qcom_smd.c | 10 +++++-----
>>>  1 file changed, 5 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c
>>> index 7b9c298aa491..43f601c84b4f 100644
>>> --- a/drivers/rpmsg/qcom_smd.c
>>> +++ b/drivers/rpmsg/qcom_smd.c
>>> @@ -1479,6 +1479,9 @@ struct qcom_smd_edge *qcom_smd_register_edge(struct device *parent,
>>>  	struct qcom_smd_edge *edge;
>>>  	int ret;
>>>  
>>> +	if (!qcom_smem_is_available())
>>> +		return ERR_PTR(-EPROBE_DEFER);
>>> +
>>>  	edge = kzalloc(sizeof(*edge), GFP_KERNEL);
>>>  	if (!edge)
>>>  		return ERR_PTR(-ENOMEM);
>>> @@ -1553,12 +1556,9 @@ EXPORT_SYMBOL(qcom_smd_unregister_edge);
>>>  static int qcom_smd_probe(struct platform_device *pdev)
>>>  {
>>>  	struct device_node *node;
>>> -	void *p;
>>>  
>>> -	/* Wait for smem */
>>> -	p = qcom_smem_get(QCOM_SMEM_HOST_ANY, smem_items[0].alloc_tbl_id, NULL);
>>> -	if (PTR_ERR(p) == -EPROBE_DEFER)
>>> -		return PTR_ERR(p);
>>> +	if (!qcom_smem_is_available())
>>> +		return -EPROBE_DEFER;
>>>  
>>>  	for_each_available_child_of_node(pdev->dev.of_node, node)
>>>  		qcom_smd_register_edge(&pdev->dev, node);
>> Hm.. we're not checking the return value here, at all.. Perhaps that
>> could be improved and we could only check for smem presence inside
>> qcom_smd_register_edge()?
>>
> 
> I think the goal here it to register as many of the edges as possible,
> so we wouldn't necessarily want to abort if one of them fails. That's
> why it's enough to check for only for a possible -EPROBE_DEFER first.
Hm I guess that's the better option, killing the entire platform (no
rpm = no anything) because one edge failed to register would be not
very user friendly..

> 
> But more importantly after this series this is legacy code that exists
> only for backwards compatibility with older DTBs. The probe function
> won't be called for DTBs in mainline anymore. So I think it's not worth
> to improve it much anymore. ;)
Right!

Konrad
> 
> Thanks,
> Stephan

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

* Re: [PATCH 10/14] soc: qcom: Add RPM processor/subsystem driver
  2023-06-05 19:06   ` Konrad Dybcio
@ 2023-06-05 19:51     ` Stephan Gerhold
  2023-06-05 19:55       ` Konrad Dybcio
  0 siblings, 1 reply; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-05 19:51 UTC (permalink / raw)
  To: Konrad Dybcio
  Cc: Bjorn Andersson, Andy Gross, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc

On Mon, Jun 05, 2023 at 09:06:54PM +0200, Konrad Dybcio wrote:
> 
> 
> On 5.06.2023 09:08, Stephan Gerhold wrote:
> > Add a simple driver for the qcom,rpm-proc compatible that registers the
> > "smd-edge" and populates other children defined in the device tree.
> > 
> > Note that the DT schema belongs to the remoteproc subsystem while this
> > driver is added inside soc/qcom. I argue that the RPM *is* a remoteproc,
> > but as an implementation detail in Linux it can currently not benefit
> > from anything provided by the remoteproc subsystem. The RPM firmware is
> > usually already loaded and started by earlier components in the boot
> > chain and is not meant to be ever restarted.
> > 
> > To avoid breaking existing kernel configurations the driver is always
> > built when smd-rpm.c is also built. They belong closely together anyway.
> > 
> > Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> > ---
> >  drivers/soc/qcom/Makefile   |  2 +-
> >  drivers/soc/qcom/rpm-proc.c | 76 +++++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 77 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile
> > index 99114c71092b..113b9ff2ad43 100644
> > --- a/drivers/soc/qcom/Makefile
> > +++ b/drivers/soc/qcom/Makefile
> > @@ -18,7 +18,7 @@ obj-$(CONFIG_QCOM_RPM_MASTER_STATS)	+= rpm_master_stats.o
> >  obj-$(CONFIG_QCOM_RPMH)		+= qcom_rpmh.o
> >  qcom_rpmh-y			+= rpmh-rsc.o
> >  qcom_rpmh-y			+= rpmh.o
> > -obj-$(CONFIG_QCOM_SMD_RPM)	+= smd-rpm.o
> > +obj-$(CONFIG_QCOM_SMD_RPM)	+= rpm-proc.o smd-rpm.o
> >  obj-$(CONFIG_QCOM_SMEM) +=	smem.o
> >  obj-$(CONFIG_QCOM_SMEM_STATE) += smem_state.o
> >  obj-$(CONFIG_QCOM_SMP2P)	+= smp2p.o
> > diff --git a/drivers/soc/qcom/rpm-proc.c b/drivers/soc/qcom/rpm-proc.c
> > new file mode 100644
> > index 000000000000..0652be7f7895
> > --- /dev/null
> > +++ b/drivers/soc/qcom/rpm-proc.c
> > @@ -0,0 +1,76 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +/* Copyright (c) 2021-2023, Stephan Gerhold <stephan@gerhold.net> */
> > +
> > +#include <linux/module.h>
> > +#include <linux/of.h>
> > +#include <linux/of_platform.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/rpmsg/qcom_smd.h>
> > +
> > +static int rpm_proc_probe(struct platform_device *pdev)
> > +{
> > +	struct qcom_smd_edge *edge = NULL;
> > +	struct device *dev = &pdev->dev;
> > +	struct device_node *edge_node;
> > +	int ret;
> > +
> > +	edge_node = of_get_child_by_name(dev->of_node, "smd-edge");
> > +	if (edge_node) {
> > +		edge = qcom_smd_register_edge(dev, edge_node);
> > +		if (IS_ERR(edge))
> > +			return dev_err_probe(dev, PTR_ERR(edge),
> > +					     "Failed to register smd-edge\n");
> Need of_node_put in both success and IS_ERR paths
> 

Oops. :/

> > +	}
> > +
> > +	ret = devm_of_platform_populate(dev);
> > +	if (ret) {
> > +		dev_err(dev, "Failed to populate children devices: %d\n", ret);
> I may be having a brain lag moment but I think it should be "child"
> singular, otherwise it sounds like they're devices for children!
> 

Uh somehow both sounds fine to me so I'll just change it in v2. :)

> > +		goto err;
> > +	}
> > +
> > +	platform_set_drvdata(pdev, edge);
> > +	return 0;
> > +err:
> > +	if (edge)
> > +		qcom_smd_unregister_edge(edge);
> > +	return ret;
> > +}
> > +
> > +static void rpm_proc_remove(struct platform_device *pdev)
> > +{
> > +	struct qcom_smd_edge *edge = platform_get_drvdata(pdev);
> > +
> > +	if (edge)
> > +		qcom_smd_unregister_edge(edge);
> > +}
> > +
> > +static const struct of_device_id rpm_proc_of_match[] = {
> > +	{ .compatible = "qcom,rpm-proc", },
> > +	{ /* sentinel */ }
> > +};
> > +MODULE_DEVICE_TABLE(of, rpm_proc_of_match);
> > +
> > +static struct platform_driver rpm_proc_driver = {
> > +	.probe = rpm_proc_probe,
> > +	.remove_new = rpm_proc_remove,
> > +	.driver = {
> > +		.name = "qcom-rpm-proc",
> > +		.of_match_table = rpm_proc_of_match,
> > +	},
> > +};
> > +
> > +static int __init rpm_proc_init(void)
> > +{
> > +	return platform_driver_register(&rpm_proc_driver);
> > +}
> > +arch_initcall(rpm_proc_init);
> Maybe we can go as early as core...
> 

SMEM is arch_initcall() so at least for the SMD case it can never
succeed probing in core_initcall() and would likely just cause
unnecessary probe deferrals. That's why I chose arch_initcall().

Are you sure anything will really benefit from core_initcall() here?

I'd just like to avoid making things worse by using a random way too
early initcall level. We have some really weird examples in the tree
currently, e.g.:
  - rpmpd: core_initcall()
  - smd-rpm: arch_initcall()
  - glink-rpm: subsys_initcall()
But they actually need to be loaded in opposite order...

Thanks,
Stephan

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

* Re: [PATCH 12/14] arm64: dts: qcom: Add rpm-proc node for GLINK gplatforms
  2023-06-05 19:43   ` Konrad Dybcio
@ 2023-06-05 19:55     ` Stephan Gerhold
  0 siblings, 0 replies; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-05 19:55 UTC (permalink / raw)
  To: Konrad Dybcio
  Cc: Bjorn Andersson, Andy Gross, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc

On Mon, Jun 05, 2023 at 09:43:50PM +0200, Konrad Dybcio wrote:
> On 5.06.2023 09:08, Stephan Gerhold wrote:
> > Rather than having the RPM GLINK channels as the only child of a dummy
> > top-level rpm-glink node, switch to representing the RPM as remoteproc
> > like all the other remoteprocs (modem DSP, ...).
> > 
> > This allows assigning additional subdevices to it like the MPM
> > interrupt-controller or rpm-master-stats.
> > 
> > Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> > ---
> >  arch/arm64/boot/dts/qcom/ipq6018.dtsi |  48 ++++++-----
> >  arch/arm64/boot/dts/qcom/ipq9574.dtsi |  28 ++++---
> >  arch/arm64/boot/dts/qcom/msm8996.dtsi | 113 ++++++++++++-------------
> >  arch/arm64/boot/dts/qcom/msm8998.dtsi |  98 +++++++++++-----------
> >  arch/arm64/boot/dts/qcom/qcm2290.dtsi | 126 ++++++++++++++--------------
> >  arch/arm64/boot/dts/qcom/qcs404.dtsi  | 152 +++++++++++++++++-----------------
> >  arch/arm64/boot/dts/qcom/sdm630.dtsi  | 132 +++++++++++++++--------------
> >  arch/arm64/boot/dts/qcom/sm6115.dtsi  | 128 ++++++++++++++--------------
> >  arch/arm64/boot/dts/qcom/sm6125.dtsi  | 140 ++++++++++++++++---------------
> >  arch/arm64/boot/dts/qcom/sm6375.dtsi  | 126 ++++++++++++++--------------
> >  10 files changed, 564 insertions(+), 527 deletions(-)
> > 
> > diff --git a/arch/arm64/boot/dts/qcom/ipq6018.dtsi b/arch/arm64/boot/dts/qcom/ipq6018.dtsi
> > index 7355f266742a..fff4a4014bd8 100644
> > --- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi
> > +++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi
> > @@ -146,6 +146,32 @@ psci: psci {
> >  		method = "smc";
> >  	};
> >  
> > +	rpm: remoteproc-rpm {
> Krzysztof, is this fine or should this be just `remoteproc {`?
> 

What if you have multiple remoteprocs? I took this naming convention
from sdm845.dtsi by the way:

	adsp_pas: remoteproc-adsp {
		compatible = "qcom,sdm845-adsp-pas";
	cdsp_pas: remoteproc-cdsp {
		compatible = "qcom,sdm845-cdsp-pas";

Thanks,
Stephan

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

* Re: [PATCH 10/14] soc: qcom: Add RPM processor/subsystem driver
  2023-06-05 19:51     ` Stephan Gerhold
@ 2023-06-05 19:55       ` Konrad Dybcio
  0 siblings, 0 replies; 42+ messages in thread
From: Konrad Dybcio @ 2023-06-05 19:55 UTC (permalink / raw)
  To: Stephan Gerhold
  Cc: Bjorn Andersson, Andy Gross, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc



On 5.06.2023 21:51, Stephan Gerhold wrote:
> On Mon, Jun 05, 2023 at 09:06:54PM +0200, Konrad Dybcio wrote:
>>
>>
>> On 5.06.2023 09:08, Stephan Gerhold wrote:
>>> Add a simple driver for the qcom,rpm-proc compatible that registers the
>>> "smd-edge" and populates other children defined in the device tree.
>>>
>>> Note that the DT schema belongs to the remoteproc subsystem while this
>>> driver is added inside soc/qcom. I argue that the RPM *is* a remoteproc,
>>> but as an implementation detail in Linux it can currently not benefit
>>> from anything provided by the remoteproc subsystem. The RPM firmware is
>>> usually already loaded and started by earlier components in the boot
>>> chain and is not meant to be ever restarted.
>>>
>>> To avoid breaking existing kernel configurations the driver is always
>>> built when smd-rpm.c is also built. They belong closely together anyway.
>>>
>>> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
>>> ---
[...]

> SMEM is arch_initcall() so at least for the SMD case it can never
> succeed probing in core_initcall() and would likely just cause
> unnecessary probe deferrals. That's why I chose arch_initcall().
> 
> Are you sure anything will really benefit from core_initcall() here?
> 
> I'd just like to avoid making things worse by using a random way too
> early initcall level. We have some really weird examples in the tree
> currently, e.g.:
>   - rpmpd: core_initcall()
>   - smd-rpm: arch_initcall()
>   - glink-rpm: subsys_initcall()
> But they actually need to be loaded in opposite order...
Yes, we should make some sort of dep graph and clean it up..

Konrad
> 
> Thanks,
> Stephan

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

* Re: [PATCH 10/14] soc: qcom: Add RPM processor/subsystem driver
  2023-06-05  7:08 ` [PATCH 10/14] soc: qcom: Add RPM processor/subsystem driver Stephan Gerhold
  2023-06-05 19:06   ` Konrad Dybcio
@ 2023-06-05 20:31   ` kernel test robot
  1 sibling, 0 replies; 42+ messages in thread
From: kernel test robot @ 2023-06-05 20:31 UTC (permalink / raw)
  To: Stephan Gerhold, Bjorn Andersson
  Cc: oe-kbuild-all, Andy Gross, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Mathieu Poirier,
	linux-arm-msm, devicetree, linux-kernel, linux-remoteproc,
	Stephan Gerhold

Hi Stephan,

kernel test robot noticed the following build errors:

[auto build test ERROR on 8d5a57ea6a0b1722725170e32e511701ca7c454c]

url:    https://github.com/intel-lab-lkp/linux/commits/Stephan-Gerhold/dt-bindings-soc-qcom-smd-rpm-Fix-sort-order/20230605-151438
base:   8d5a57ea6a0b1722725170e32e511701ca7c454c
patch link:    https://lore.kernel.org/r/20230531-rpm-rproc-v1-10-e0a3b6de1f14%40gerhold.net
patch subject: [PATCH 10/14] soc: qcom: Add RPM processor/subsystem driver
config: m68k-randconfig-r023-20230605 (https://download.01.org/0day-ci/archive/20230606/202306060446.CAOHuKLm-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 12.3.0
reproduce (this is a W=1 build):
        mkdir -p ~/bin
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/e08a6ffdb1d65902d0c4fed40968ff2e4d83a476
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Stephan-Gerhold/dt-bindings-soc-qcom-smd-rpm-Fix-sort-order/20230605-151438
        git checkout e08a6ffdb1d65902d0c4fed40968ff2e4d83a476
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=m68k olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306060446.CAOHuKLm-lkp@intel.com/

All errors (new ones prefixed by >>):

   m68k-linux-ld: drivers/soc/qcom/rpm-proc.o: in function `rpm_proc_remove':
>> rpm-proc.c:(.text+0x12): undefined reference to `qcom_smd_unregister_edge'

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH 01/14] dt-bindings soc: qcom: smd-rpm: Fix sort order
  2023-06-05  7:08 ` [PATCH 01/14] dt-bindings soc: qcom: smd-rpm: Fix sort order Stephan Gerhold
@ 2023-06-06  6:25   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-06  6:25 UTC (permalink / raw)
  To: Stephan Gerhold, Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc

On 05/06/2023 09:08, Stephan Gerhold wrote:
> Some of the enum entries are not properly ordered, fix that.
> 
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
>  Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


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

* Re: [PATCH 02/14] dt-bindings: soc: qcom: smd-rpm: Add MSM8909 to qcom,smd-channels
  2023-06-05  7:08 ` [PATCH 02/14] dt-bindings: soc: qcom: smd-rpm: Add MSM8909 to qcom,smd-channels Stephan Gerhold
@ 2023-06-06  6:26   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-06  6:26 UTC (permalink / raw)
  To: Stephan Gerhold, Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc

On 05/06/2023 09:08, Stephan Gerhold wrote:
> MSM8909 is using qcom,smd-channels but is missing in the list, add it
> there as well.
> 
> Fixes: 709d473dd5e1 ("dt-bindings: soc: qcom: smd-rpm: Add MSM8909")
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


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

* Re: [PATCH 03/14] dt-bindings: soc: qcom: smd-rpm: Add some more compatibles
  2023-06-05  7:08 ` [PATCH 03/14] dt-bindings: soc: qcom: smd-rpm: Add some more compatibles Stephan Gerhold
@ 2023-06-06  6:27   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-06  6:27 UTC (permalink / raw)
  To: Stephan Gerhold, Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc

On 05/06/2023 09:08, Stephan Gerhold wrote:
> To avoid several more small patches adding new RPM compatibles in the
> future, add MDM9607, MSM8610, MSM8917, MSM8937 and MSM8952 at once.
> All of these have been worked on over the time by some people and are
> definitely compatible as-is with the smd-rpm driver.
> 
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


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

* Re: [PATCH 05/14] dt-bindings: remoteproc: Add Qualcomm RPM processor/subsystem
  2023-06-05  7:08 ` [PATCH 05/14] dt-bindings: remoteproc: Add Qualcomm RPM processor/subsystem Stephan Gerhold
  2023-06-05  8:33   ` Rob Herring
@ 2023-06-06  6:36   ` Krzysztof Kozlowski
  2023-06-06  8:55     ` Stephan Gerhold
  1 sibling, 1 reply; 42+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-06  6:36 UTC (permalink / raw)
  To: Stephan Gerhold, Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc

On 05/06/2023 09:08, Stephan Gerhold wrote:
> On Qualcomm platforms, most subsystems (e.g. audio/modem DSP) are
> described as remote processors in the device tree, with a dedicated
> node where properties and services related to them can be described.
> 
> The Resource Power Manager (RPM) is also such a subsystem, with a
> remote processor that is running a special firmware. Unfortunately,
> the RPM never got a dedicated node representing it properly in the
> device tree. Most of the RPM services are described below a top-level
> /smd or /rpm-glink node.

Then what is rpm-requests? This is the true RPM. It looks like you now
duplicate half of it in a node above. Unless you want here to describe
ways to communicate with the RPM, not the RPM itself.


> However, SMD/GLINK is just one of the communication channels to the RPM
> firmware. For example, the MPM interrupt functionality provided by the
> RPM does not use SMD/GLINK but writes directly to a special memory
> region allocated by the RPM firmware in combination with a mailbox.
> Currently there is no good place in the device tree to describe this
> functionality. It doesn't belong below SMD/GLINK but it's not an
> independent top-level device either.
> 
> Introduce a new "qcom,rpm-proc" compatible that allows describing the
> RPM as a remote processor/subsystem like all others. The SMD/GLINK node
> is moved to a "smd-edge"/"glink-edge" subnode consistent with other
> existing bindings. Additional subnodes (e.g. interrupt-controller for
> MPM, rpm-master-stats) can be also added there.

If this was about to stay, you should also update the qcom,smd.yaml, so
there will be no duplication.

> 
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
>  .../bindings/remoteproc/qcom,rpm-proc.yaml         | 125 +++++++++++++++++++++
>  1 file changed, 125 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,rpm-proc.yaml b/Documentation/devicetree/bindings/remoteproc/qcom,rpm-proc.yaml
> new file mode 100644
> index 000000000000..c06dd4f66503
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/remoteproc/qcom,rpm-proc.yaml
> @@ -0,0 +1,125 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/remoteproc/qcom,rpm-proc.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Qualcomm Resource Power Manager (RPM) Processor/Subsystem
> +
> +maintainers:
> +  - Bjorn Andersson <andersson@kernel.org>
> +  - Konrad Dybcio <konrad.dybcio@linaro.org>
> +
> +description:
> +  Resource Power Manager (RPM) subsystem found in various Qualcomm platforms.
> +  The RPM allows each component in the system to vote for state of the system
> +  resources, such as clocks, regulators and bus frequencies. rpm-proc is the
> +  top-level device tree node that groups all the RPM functionality together.
> +
> +properties:
> +  compatible:
> +    items:
> +      - enum:
> +          - qcom,apq8084-rpm-proc
> +          - qcom,ipq6018-rpm-proc
> +          - qcom,ipq9574-rpm-proc
> +          - qcom,mdm9607-rpm-proc
> +          - qcom,msm8226-rpm-proc
> +          - qcom,msm8610-rpm-proc
> +          - qcom,msm8909-rpm-proc
> +          - qcom,msm8916-rpm-proc
> +          - qcom,msm8917-rpm-proc
> +          - qcom,msm8936-rpm-proc
> +          - qcom,msm8937-rpm-proc
> +          - qcom,msm8952-rpm-proc
> +          - qcom,msm8953-rpm-proc
> +          - qcom,msm8974-rpm-proc
> +          - qcom,msm8976-rpm-proc
> +          - qcom,msm8994-rpm-proc
> +          - qcom,msm8996-rpm-proc
> +          - qcom,msm8998-rpm-proc
> +          - qcom,qcm2290-rpm-proc
> +          - qcom,qcs404-rpm-proc
> +          - qcom,sdm660-rpm-proc
> +          - qcom,sm6115-rpm-proc
> +          - qcom,sm6125-rpm-proc
> +          - qcom,sm6375-rpm-proc
> +      - const: qcom,rpm-proc
> +
> +  smd-edge:
> +    $ref: /schemas/remoteproc/qcom,smd-edge.yaml#
> +    description:
> +      Qualcomm Shared Memory subnode which represents communication edge,
> +      channels and devices related to the RPM subsystem.
> +
> +  glink-rpm:
> +    $ref: /schemas/remoteproc/qcom,glink-rpm-edge.yaml#
> +    description:
> +      Qualcomm G-Link subnode which represents communication edge,
> +      channels and devices related to the RPM subsystem.
> +
> +  interrupt-controller:
> +    type: object
> +    $ref: /schemas/interrupt-controller/qcom,mpm.yaml#
> +    description:
> +      MSM Power Manager (MPM) interrupt controller that monitors interrupts
> +      when the system is asleep.

Isn't this a service of RPM?

> +
> +  master-stats:
> +    $ref: /schemas/soc/qcom/qcom,rpm-master-stats.yaml#
> +    description:
> +      Subsystem-level low-power mode statistics provided by RPM.

The same question.

> +
> +required:
> +  - compatible
> +
> +oneOf:
> +  - required:
> +      - smd-edge
> +  - required:
> +      - glink-rpm
> +
> +additionalProperties: false
> +
> +examples:
> +  # SMD
> +  - |
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    remoteproc-rpm {

remoteproc

> +      compatible = "qcom,msm8916-rpm-proc", "qcom,rpm-proc";
> +
> +      smd-edge {
> +        interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
> +        qcom,ipc = <&apcs 8 0>;
> +        qcom,smd-edge = <15>;
> +
> +        rpm-requests {
> +          compatible = "qcom,rpm-msm8916";
> +          qcom,smd-channels = "rpm_requests";
> +          /* ... */
> +        };
> +      };
> +    };
> +  # GLINK
> +  - |
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    remoteproc-rpm {

remoteproc

> +      compatible = "qcom,qcm2290-rpm-proc", "qcom,rpm-proc";
> +
> +      glink-rpm {
> +        compatible = "qcom,glink-rpm";
> +        interrupts = <GIC_SPI 194 IRQ_TYPE_EDGE_RISING>;
> +        qcom,rpm-msg-ram = <&rpm_msg_ram>;
> +        mboxes = <&apcs_glb 0>;
> +
> +        rpm-requests {
> +          compatible = "qcom,rpm-qcm2290";
> +          qcom,glink-channels = "rpm_requests";
> +          /* ... */
> +        };
> +      };
> +    };
> 

Best regards,
Krzysztof


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

* Re: [PATCH 06/14] dt-bindings: soc: qcom: smd-rpm: Use qcom,rpm-proc in example
  2023-06-05  7:08 ` [PATCH 06/14] dt-bindings: soc: qcom: smd-rpm: Use qcom,rpm-proc in example Stephan Gerhold
  2023-06-05  8:33   ` Rob Herring
@ 2023-06-06  6:37   ` Krzysztof Kozlowski
  2023-06-06  9:06     ` Stephan Gerhold
  1 sibling, 1 reply; 42+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-06  6:37 UTC (permalink / raw)
  To: Stephan Gerhold, Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Mathieu Poirier, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc

On 05/06/2023 09:08, Stephan Gerhold wrote:
> Use the new top-level rpm-proc node instead of having a dummy top-level
> /smd node that only contains the RPM but not other remote processors.
> 
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
>  Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml b/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml
> index c6930706bfa9..06e574239bd4 100644
> --- a/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml
> +++ b/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml
> @@ -120,10 +120,10 @@ examples:
>      #include <dt-bindings/interrupt-controller/arm-gic.h>
>      #include <dt-bindings/interrupt-controller/irq.h>
>  
> -    smd {
> -        compatible = "qcom,smd";
> +    remoteproc-rpm {

remoteproc

> +        compatible = "qcom,msm8916-rpm-proc", "qcom,rpm-proc";
>  
> -        rpm {
> +        smd-edge {

What about binding updates?

Anyway, this should be squashed with previous one.

>              interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
>              qcom,ipc = <&apcs 8 0>;
>              qcom,smd-edge = <15>;
> 

Best regards,
Krzysztof


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

* Re: [PATCH 05/14] dt-bindings: remoteproc: Add Qualcomm RPM processor/subsystem
  2023-06-06  6:36   ` Krzysztof Kozlowski
@ 2023-06-06  8:55     ` Stephan Gerhold
  2023-06-07  8:32       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-06  8:55 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Bjorn Andersson, Andy Gross, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Mathieu Poirier,
	linux-arm-msm, devicetree, linux-kernel, linux-remoteproc

<On Tue, Jun 06, 2023 at 08:36:10AM +0200, Krzysztof Kozlowski wrote:
> On 05/06/2023 09:08, Stephan Gerhold wrote:
> > On Qualcomm platforms, most subsystems (e.g. audio/modem DSP) are
> > described as remote processors in the device tree, with a dedicated
> > node where properties and services related to them can be described.
> > 
> > The Resource Power Manager (RPM) is also such a subsystem, with a
> > remote processor that is running a special firmware. Unfortunately,
> > the RPM never got a dedicated node representing it properly in the
> > device tree. Most of the RPM services are described below a top-level
> > /smd or /rpm-glink node.
> 
> Then what is rpm-requests? This is the true RPM. It looks like you now
> duplicate half of it in a node above. Unless you want here to describe
> ways to communicate with the RPM, not the RPM itself.
>

I think you're confusing hardware and firmware here. The rpm-proc node
represents the RPM hardware block (or perhaps the RPM firmware overall),
while rpm-requests is just *one* communication interface provided by the
RPM firmware. Here is a rough picture of the RPM "subsystem" I'm trying
to describe:

                +--------------------------------------------+      
                |       RPM subsystem (qcom,rpm-proc)        |      
                |                                            |      
          reset | +---------------+     +-----+  +-----+     |      
        --------->|               |     | MPM |  | CPR | ... |      
 IPC interrupts | | ARM Cortex-M3 |     +-----+  +-----+     |      
----------------->|               |---     |        |        |      
                | +---------------+  |---------------------- |      
                | +---------------+  |                       |      
                | |   Code RAM    |--|  +------------------+ |      
                | +---------------+  |  |                  | |      
                | +---------------+  |  |   Message RAM    | |      
                | |   Data RAM    |--|--|                  | |      
                | +---------------+  |  +------------------+ |      
                +--------------------|-----------------------+      
                                     v                              
                                    NoC                             

(Somewhat adapted from Figure 8-1 RPM overview in the APQ8016E Technical
 Reference Manual, but I added some extra stuff.)

As you can see neither "SMD" nor "rpm-requests" exist in hardware.
Again, it's just one communication protocol implemented by the RPM
firmware running on the Cortex-M3 processor, much like a webserver
running on a PC.

When the SoC is started only the hardware block exists. Usually a
component in the boot chain loads firmware into the code/data RAM and
then de-asserts the reset line to start the Cortex-M3 processor.

This is not guaranteed to happen. For example, I have a special firmware
version where the firmware is only loaded but not brought out of reset.
In this case Linux is responsible to de-assert the reset line.
In follow-up patches I add that to the outer qcom,rpm-proc node:

	remoteproc {
		compatible = "qcom,msm8916-rpm-proc", "qcom,rpm-proc";
		resets = <&gcc GCC_RPM_RESET>;
		iommus = <&apps_smmu 0x0040>;

		smd-edge {
			/* ... */
			rpm-requests {
				qcom,smd-channels = "rpm_requests";
			};
		};
	};

This reset line cannot be described on the rpm-requests node. Until the
firmware is started there is no such thing as "SMD" or "rpm-requests".

When the RPM firmware is started it sets up some data structures in the
message RAM and then begins serving requests, perhaps like this:

               +----------------------------------+                                    
               |          ARM Cortex-M3           |                                    
               | +------------------------------+ |  +--------------------------------+
               | |  RPM Firmware                | |  |          Message RAM           |
 IPC Interrupt | | +----------------------+     | |  | +----------------------------+ |
------------------>| SMD Server           |     | |  | | SMD Data Structures & FIFO | |
               | | | +--------------+     |     | |  | | +--------------+           | |
               | | | | rpm_requests | ... |     | |  | | | rpm_requests |    ...    | |
               | | | +--------------+     | ... | |  | | +--------------+           | |
               | | +----------------------+     | |  | +----------------------------+ |
               | +------------------------------+ |  |                ...             |
               +----------------------------------+  +--------------------------------+

The "smd-edge" node represents the SMD part and "rpm_requests" is one
of the communication channels that can be used to talk to the RPM firmware.

Everything below rpm-requests: clocks, regulators, power domains are
pure firmware constructions. They do not exist in the RPM hardware block,
the firmware just acts as a proxy to collect votes from different
clients and then configures the actual hardware.
 
> 
> > However, SMD/GLINK is just one of the communication channels to the RPM
> > firmware. For example, the MPM interrupt functionality provided by the
> > RPM does not use SMD/GLINK but writes directly to a special memory
> > region allocated by the RPM firmware in combination with a mailbox.
> > Currently there is no good place in the device tree to describe this
> > functionality. It doesn't belong below SMD/GLINK but it's not an
> > independent top-level device either.
> > 
> > Introduce a new "qcom,rpm-proc" compatible that allows describing the
> > RPM as a remote processor/subsystem like all others. The SMD/GLINK node
> > is moved to a "smd-edge"/"glink-edge" subnode consistent with other
> > existing bindings. Additional subnodes (e.g. interrupt-controller for
> > MPM, rpm-master-stats) can be also added there.
> 
> If this was about to stay, you should also update the qcom,smd.yaml, so
> there will be no duplication.
> 

qcom,smd.yaml is deprecated in the next patch (PATCH 07/14).

> > 
> > Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> > ---
> >  .../bindings/remoteproc/qcom,rpm-proc.yaml         | 125 +++++++++++++++++++++
> >  1 file changed, 125 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,rpm-proc.yaml b/Documentation/devicetree/bindings/remoteproc/qcom,rpm-proc.yaml
> > new file mode 100644
> > index 000000000000..c06dd4f66503
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/remoteproc/qcom,rpm-proc.yaml
> > @@ -0,0 +1,125 @@
> > [...]
> > +  interrupt-controller:
> > +    type: object
> > +    $ref: /schemas/interrupt-controller/qcom,mpm.yaml#
> > +    description:
> > +      MSM Power Manager (MPM) interrupt controller that monitors interrupts
> > +      when the system is asleep.
> 
> Isn't this a service of RPM?
> 
> > +
> > +  master-stats:
> > +    $ref: /schemas/soc/qcom/qcom,rpm-master-stats.yaml#
> > +    description:
> > +      Subsystem-level low-power mode statistics provided by RPM.
> 
> The same question.
> 

Yes, they are services of the RPM firmware. But they have no relation to
the SMD/GLINK channel.

To clarify this I extend my picture from above with MPM:

                 +----------------------------------+                                    
                 |          ARM Cortex-M3           |                                    
                 | +------------------------------+ |  +--------------------------------+
                 | |  RPM Firmware                | |  |          Message RAM           |
 IPC Interrupt 0 | | +----------------------+     | |  | +----------------------------+ |
 ------------------->| SMD Server           |     | |  | | SMD Data Structures & FIFO | |
                 | | | +--------------+     |     | |  | | +--------------+           | |
                 | | | | rpm_requests | ... |     | |  | | | rpm_requests |    ...    | |
                 | | | +--------------+     | ... | |  | | +--------------+           | |
                 | | +----------------------+     | |  | +----------------------------+ |
 IPC Interrupt 1 | | +----------------------+     | |  | +----------------------------+ |
 ------------------->| MPM virtualization   |<-----------| MPM register copy (vMPM)   | |
                 | | +----------------------+     | |  | +----------------------------+ |
                 | +-----------|------------------+ |  |              ...               |
                 +-------------v--------------------+  +--------------------------------+
                       +--------------+                                                  
                       | MPM Hardware |                                                  
                       +--------------+                                                  

As you can see, SMD and MPM are siblings. The MPM functionality
implemented by the RPM firmware is not a child of the SMD server.

It's a bit like a webserver and emailserver running on the same PC.
Two separate services accessible via different ports and protocols.

Thanks,
Stephan

NOTE: All of this is just my interpretation based on the public hints
that exist. I have no access to internal documentation or source code
that would prove that all of this is correct.

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

* Re: [PATCH 06/14] dt-bindings: soc: qcom: smd-rpm: Use qcom,rpm-proc in example
  2023-06-06  6:37   ` Krzysztof Kozlowski
@ 2023-06-06  9:06     ` Stephan Gerhold
  2023-06-06  9:17       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 42+ messages in thread
From: Stephan Gerhold @ 2023-06-06  9:06 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Bjorn Andersson, Andy Gross, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Mathieu Poirier,
	linux-arm-msm, devicetree, linux-kernel, linux-remoteproc

On Tue, Jun 06, 2023 at 08:37:04AM +0200, Krzysztof Kozlowski wrote:
> On 05/06/2023 09:08, Stephan Gerhold wrote:
> > Use the new top-level rpm-proc node instead of having a dummy top-level
> > /smd node that only contains the RPM but not other remote processors.
> > 
> > Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> > ---
> >  Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml b/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml
> > index c6930706bfa9..06e574239bd4 100644
> > --- a/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml
> > +++ b/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml
> > @@ -120,10 +120,10 @@ examples:
> > [...]
> > +        compatible = "qcom,msm8916-rpm-proc", "qcom,rpm-proc";
> >  
> > -        rpm {
> > +        smd-edge {
> 
> What about binding updates?
>

The binding for this is in PATCH 05/14. The old binding replaced here is
deprecated in PATCH 07/14.
 
> Anyway, this should be squashed with previous one.
> 

Sure, I can squash in v2.

Thanks,
Stephan

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

* Re: [PATCH 06/14] dt-bindings: soc: qcom: smd-rpm: Use qcom,rpm-proc in example
  2023-06-06  9:06     ` Stephan Gerhold
@ 2023-06-06  9:17       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-06  9:17 UTC (permalink / raw)
  To: Stephan Gerhold
  Cc: Bjorn Andersson, Andy Gross, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Mathieu Poirier,
	linux-arm-msm, devicetree, linux-kernel, linux-remoteproc

On 06/06/2023 11:06, Stephan Gerhold wrote:
> On Tue, Jun 06, 2023 at 08:37:04AM +0200, Krzysztof Kozlowski wrote:
>> On 05/06/2023 09:08, Stephan Gerhold wrote:
>>> Use the new top-level rpm-proc node instead of having a dummy top-level
>>> /smd node that only contains the RPM but not other remote processors.
>>>
>>> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
>>> ---
>>>  Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml | 6 +++---
>>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml b/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml
>>> index c6930706bfa9..06e574239bd4 100644
>>> --- a/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml
>>> +++ b/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml
>>> @@ -120,10 +120,10 @@ examples:
>>> [...]
>>> +        compatible = "qcom,msm8916-rpm-proc", "qcom,rpm-proc";
>>>  
>>> -        rpm {
>>> +        smd-edge {
>>
>> What about binding updates?
>>
> 
> The binding for this is in PATCH 05/14. The old binding replaced here is
> deprecated in PATCH 07/14.

So changing example without changing binding is not an atomic change.

Best regards,
Krzysztof


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

* Re: [PATCH 05/14] dt-bindings: remoteproc: Add Qualcomm RPM processor/subsystem
  2023-06-06  8:55     ` Stephan Gerhold
@ 2023-06-07  8:32       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-07  8:32 UTC (permalink / raw)
  To: Stephan Gerhold
  Cc: Bjorn Andersson, Andy Gross, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Mathieu Poirier,
	linux-arm-msm, devicetree, linux-kernel, linux-remoteproc

On 06/06/2023 10:55, Stephan Gerhold wrote:
> <On Tue, Jun 06, 2023 at 08:36:10AM +0200, Krzysztof Kozlowski wrote:
>> On 05/06/2023 09:08, Stephan Gerhold wrote:
>>> On Qualcomm platforms, most subsystems (e.g. audio/modem DSP) are
>>> described as remote processors in the device tree, with a dedicated
>>> node where properties and services related to them can be described.
>>>
>>> The Resource Power Manager (RPM) is also such a subsystem, with a
>>> remote processor that is running a special firmware. Unfortunately,
>>> the RPM never got a dedicated node representing it properly in the
>>> device tree. Most of the RPM services are described below a top-level
>>> /smd or /rpm-glink node.
>>
>> Then what is rpm-requests? This is the true RPM. It looks like you now
>> duplicate half of it in a node above. Unless you want here to describe
>> ways to communicate with the RPM, not the RPM itself.
>>
> 
> I think you're confusing hardware and firmware here. The rpm-proc node
> represents the RPM hardware block (or perhaps the RPM firmware overall),
> while rpm-requests is just *one* communication interface provided by the
> RPM firmware. Here is a rough picture of the RPM "subsystem" I'm trying
> to describe:
> 
>                 +--------------------------------------------+      
>                 |       RPM subsystem (qcom,rpm-proc)        |      
>                 |                                            |      
>           reset | +---------------+     +-----+  +-----+     |      
>         --------->|               |     | MPM |  | CPR | ... |      
>  IPC interrupts | | ARM Cortex-M3 |     +-----+  +-----+     |      
> ----------------->|               |---     |        |        |      
>                 | +---------------+  |---------------------- |      
>                 | +---------------+  |                       |      
>                 | |   Code RAM    |--|  +------------------+ |      
>                 | +---------------+  |  |                  | |      
>                 | +---------------+  |  |   Message RAM    | |      
>                 | |   Data RAM    |--|--|                  | |      
>                 | +---------------+  |  +------------------+ |      
>                 +--------------------|-----------------------+      
>                                      v                              
>                                     NoC                             
> 
> (Somewhat adapted from Figure 8-1 RPM overview in the APQ8016E Technical
>  Reference Manual, but I added some extra stuff.)
> 
> As you can see neither "SMD" nor "rpm-requests" exist in hardware.
> Again, it's just one communication protocol implemented by the RPM
> firmware running on the Cortex-M3 processor, much like a webserver
> running on a PC.
> 
> When the SoC is started only the hardware block exists. Usually a
> component in the boot chain loads firmware into the code/data RAM and
> then de-asserts the reset line to start the Cortex-M3 processor.
> 
> This is not guaranteed to happen. For example, I have a special firmware
> version where the firmware is only loaded but not brought out of reset.
> In this case Linux is responsible to de-assert the reset line.
> In follow-up patches I add that to the outer qcom,rpm-proc node:
> 
> 	remoteproc {
> 		compatible = "qcom,msm8916-rpm-proc", "qcom,rpm-proc";
> 		resets = <&gcc GCC_RPM_RESET>;
> 		iommus = <&apps_smmu 0x0040>;
> 
> 		smd-edge {
> 			/* ... */
> 			rpm-requests {
> 				qcom,smd-channels = "rpm_requests";
> 			};
> 		};
> 	};
> 
> This reset line cannot be described on the rpm-requests node. Until the
> firmware is started there is no such thing as "SMD" or "rpm-requests".

OK, that makes sense, thank you for clarifying. It would be nice to
include it in the binding description (especially that you already wrote
it for me in the email :) ).

> 
> When the RPM firmware is started it sets up some data structures in the
> message RAM and then begins serving requests, perhaps like this:
> 
>                +----------------------------------+                                    
>                |          ARM Cortex-M3           |                                    
>                | +------------------------------+ |  +--------------------------------+
>                | |  RPM Firmware                | |  |          Message RAM           |
>  IPC Interrupt | | +----------------------+     | |  | +----------------------------+ |
> ------------------>| SMD Server           |     | |  | | SMD Data Structures & FIFO | |
>                | | | +--------------+     |     | |  | | +--------------+           | |
>                | | | | rpm_requests | ... |     | |  | | | rpm_requests |    ...    | |
>                | | | +--------------+     | ... | |  | | +--------------+           | |
>                | | +----------------------+     | |  | +----------------------------+ |
>                | +------------------------------+ |  |                ...             |
>                +----------------------------------+  +--------------------------------+
> 
> The "smd-edge" node represents the SMD part and "rpm_requests" is one
> of the communication channels that can be used to talk to the RPM firmware.
> 
> Everything below rpm-requests: clocks, regulators, power domains are
> pure firmware constructions. They do not exist in the RPM hardware block,
> the firmware just acts as a proxy to collect votes from different
> clients and then configures the actual hardware.

OK

>  
>>
>>> However, SMD/GLINK is just one of the communication channels to the RPM
>>> firmware. For example, the MPM interrupt functionality provided by the
>>> RPM does not use SMD/GLINK but writes directly to a special memory
>>> region allocated by the RPM firmware in combination with a mailbox.
>>> Currently there is no good place in the device tree to describe this
>>> functionality. It doesn't belong below SMD/GLINK but it's not an
>>> independent top-level device either.
>>>
>>> Introduce a new "qcom,rpm-proc" compatible that allows describing the
>>> RPM as a remote processor/subsystem like all others. The SMD/GLINK node
>>> is moved to a "smd-edge"/"glink-edge" subnode consistent with other
>>> existing bindings. Additional subnodes (e.g. interrupt-controller for
>>> MPM, rpm-master-stats) can be also added there.
>>
>> If this was about to stay, you should also update the qcom,smd.yaml, so
>> there will be no duplication.
>>
> 
> qcom,smd.yaml is deprecated in the next patch (PATCH 07/14).

Please squash it, because it is logically one change - you rework one
solution and deprecate other.

> 
>>>
>>> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
>>> ---
>>>  .../bindings/remoteproc/qcom,rpm-proc.yaml         | 125 +++++++++++++++++++++
>>>  1 file changed, 125 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,rpm-proc.yaml b/Documentation/devicetree/bindings/remoteproc/qcom,rpm-proc.yaml
>>> new file mode 100644
>>> index 000000000000..c06dd4f66503
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/remoteproc/qcom,rpm-proc.yaml
>>> @@ -0,0 +1,125 @@
>>> [...]
>>> +  interrupt-controller:
>>> +    type: object
>>> +    $ref: /schemas/interrupt-controller/qcom,mpm.yaml#
>>> +    description:
>>> +      MSM Power Manager (MPM) interrupt controller that monitors interrupts
>>> +      when the system is asleep.
>>
>> Isn't this a service of RPM?
>>
>>> +
>>> +  master-stats:
>>> +    $ref: /schemas/soc/qcom/qcom,rpm-master-stats.yaml#
>>> +    description:
>>> +      Subsystem-level low-power mode statistics provided by RPM.
>>
>> The same question.
>>
> 
> Yes, they are services of the RPM firmware. But they have no relation to
> the SMD/GLINK channel.
> 
> To clarify this I extend my picture from above with MPM:
> 
>                  +----------------------------------+                                    
>                  |          ARM Cortex-M3           |                                    
>                  | +------------------------------+ |  +--------------------------------+
>                  | |  RPM Firmware                | |  |          Message RAM           |
>  IPC Interrupt 0 | | +----------------------+     | |  | +----------------------------+ |
>  ------------------->| SMD Server           |     | |  | | SMD Data Structures & FIFO | |
>                  | | | +--------------+     |     | |  | | +--------------+           | |
>                  | | | | rpm_requests | ... |     | |  | | | rpm_requests |    ...    | |
>                  | | | +--------------+     | ... | |  | | +--------------+           | |
>                  | | +----------------------+     | |  | +----------------------------+ |
>  IPC Interrupt 1 | | +----------------------+     | |  | +----------------------------+ |
>  ------------------->| MPM virtualization   |<-----------| MPM register copy (vMPM)   | |
>                  | | +----------------------+     | |  | +----------------------------+ |
>                  | +-----------|------------------+ |  |              ...               |
>                  +-------------v--------------------+  +--------------------------------+
>                        +--------------+                                                  
>                        | MPM Hardware |                                                  
>                        +--------------+                                                  
> 
> As you can see, SMD and MPM are siblings. The MPM functionality
> implemented by the RPM firmware is not a child of the SMD server.

OK, also please include it in the description.

> 
> It's a bit like a webserver and emailserver running on the same PC.
> Two separate services accessible via different ports and protocols.
> 
> Thanks,
> Stephan
> 
> NOTE: All of this is just my interpretation based on the public hints
> that exist. I have no access to internal documentation or source code
> that would prove that all of this is correct.

Sounds good enough for me :). Thank you.

Best regards,
Krzysztof


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

end of thread, other threads:[~2023-06-07  8:33 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-05  7:08 [PATCH 00/14] Add dedicated device tree node for RPM processor/subsystem Stephan Gerhold
2023-06-05  7:08 ` [PATCH 01/14] dt-bindings soc: qcom: smd-rpm: Fix sort order Stephan Gerhold
2023-06-06  6:25   ` Krzysztof Kozlowski
2023-06-05  7:08 ` [PATCH 02/14] dt-bindings: soc: qcom: smd-rpm: Add MSM8909 to qcom,smd-channels Stephan Gerhold
2023-06-06  6:26   ` Krzysztof Kozlowski
2023-06-05  7:08 ` [PATCH 03/14] dt-bindings: soc: qcom: smd-rpm: Add some more compatibles Stephan Gerhold
2023-06-06  6:27   ` Krzysztof Kozlowski
2023-06-05  7:08 ` [PATCH 04/14] soc: qcom: smd-rpm: Match rpmsg channel instead of compatible Stephan Gerhold
2023-06-05 18:49   ` Konrad Dybcio
2023-06-05  7:08 ` [PATCH 05/14] dt-bindings: remoteproc: Add Qualcomm RPM processor/subsystem Stephan Gerhold
2023-06-05  8:33   ` Rob Herring
2023-06-05  9:16     ` Stephan Gerhold
2023-06-06  6:36   ` Krzysztof Kozlowski
2023-06-06  8:55     ` Stephan Gerhold
2023-06-07  8:32       ` Krzysztof Kozlowski
2023-06-05  7:08 ` [PATCH 06/14] dt-bindings: soc: qcom: smd-rpm: Use qcom,rpm-proc in example Stephan Gerhold
2023-06-05  8:33   ` Rob Herring
2023-06-05  9:20     ` Stephan Gerhold
2023-06-06  6:37   ` Krzysztof Kozlowski
2023-06-06  9:06     ` Stephan Gerhold
2023-06-06  9:17       ` Krzysztof Kozlowski
2023-06-05  7:08 ` [PATCH 07/14] dt-bindings: qcom: smd: Mark as deprecated Stephan Gerhold
2023-06-05  7:08 ` [PATCH 08/14] soc: qcom: smem: Add qcom_smem_is_available() Stephan Gerhold
2023-06-05 18:53   ` Konrad Dybcio
2023-06-05 19:13     ` Stephan Gerhold
2023-06-05  7:08 ` [PATCH 09/14] rpmsg: qcom_smd: Use qcom_smem_is_available() Stephan Gerhold
2023-06-05 18:56   ` Konrad Dybcio
2023-06-05 19:18     ` Stephan Gerhold
2023-06-05 19:45       ` Konrad Dybcio
2023-06-05  7:08 ` [PATCH 10/14] soc: qcom: Add RPM processor/subsystem driver Stephan Gerhold
2023-06-05 19:06   ` Konrad Dybcio
2023-06-05 19:51     ` Stephan Gerhold
2023-06-05 19:55       ` Konrad Dybcio
2023-06-05 20:31   ` kernel test robot
2023-06-05  7:08 ` [PATCH 11/14] arm64: dts: qcom: Add rpm-proc node for SMD platforms Stephan Gerhold
2023-06-05 19:07   ` Konrad Dybcio
2023-06-05  7:08 ` [PATCH 12/14] arm64: dts: qcom: Add rpm-proc node for GLINK gplatforms Stephan Gerhold
2023-06-05 19:43   ` Konrad Dybcio
2023-06-05 19:55     ` Stephan Gerhold
2023-06-05  7:08 ` [PATCH 13/14] ARM: dts: qcom: Add rpm-proc node for SMD platforms Stephan Gerhold
2023-06-05  7:08 ` [PATCH 14/14] ARM: dts: qcom: apq8064: Drop redundant /smd node Stephan Gerhold
2023-06-05 19:00   ` Konrad Dybcio

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