All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/3] Add interconnect support to the SCM interface
@ 2022-05-23  7:00 Sibi Sankar
  2022-05-23  7:00 ` [RFC 1/3] dt-bindings: firmware: qcom-scm: Add interconnects property Sibi Sankar
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Sibi Sankar @ 2022-05-23  7:00 UTC (permalink / raw)
  To: bjorn.andersson
  Cc: agross, linux-arm-msm, devicetree, linux-kernel,
	krzysztof.kozlowski+dt, robh+dt, quic_psodagud, eberman,
	Sibi Sankar

Some of the SMC calls required by remoteproc PAS driver on SM8450 SoCs
get a performance benefit from having a max vote to the crypto->ddr path.
Add support for bandwidth (bw) voting for those SMC calls when the
interconnects property is specified. Marking this as an RFC since the path
could either be specified in the individual remoteprocs or directly in the
scm interface.

Sibi Sankar (3):
  dt-bindings: firmware: qcom-scm: Add interconnects property
  firmware: qcom_scm: Add bw voting support to the SCM interface
  arm64: dts: qcom: sm8450: Add interconnect requirements for SCM

 .../devicetree/bindings/firmware/qcom,scm.txt      |  1 +
 arch/arm64/boot/dts/qcom/sm8450.dtsi               |  1 +
 drivers/firmware/qcom_scm.c                        | 69 ++++++++++++++++++++++
 3 files changed, 71 insertions(+)

-- 
2.7.4


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

* [RFC 1/3] dt-bindings: firmware: qcom-scm: Add interconnects property
  2022-05-23  7:00 [RFC 0/3] Add interconnect support to the SCM interface Sibi Sankar
@ 2022-05-23  7:00 ` Sibi Sankar
  2022-06-02 13:03   ` Rob Herring
  2022-05-23  7:00 ` [RFC 2/3] firmware: qcom_scm: Add bw voting support to the SCM interface Sibi Sankar
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Sibi Sankar @ 2022-05-23  7:00 UTC (permalink / raw)
  To: bjorn.andersson
  Cc: agross, linux-arm-msm, devicetree, linux-kernel,
	krzysztof.kozlowski+dt, robh+dt, quic_psodagud, eberman,
	Sibi Sankar

Add interconnects as an optional property for SM8450 SoCs.

Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com>
---

Since the interconnect requirements could either be specified in the
individual remoteprocs or directly in the scm interface, will perform
the yaml conversion in the next re-spin based on the consensus.

 Documentation/devicetree/bindings/firmware/qcom,scm.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/firmware/qcom,scm.txt b/Documentation/devicetree/bindings/firmware/qcom,scm.txt
index 0f4e5ab26477..4de3e055bc94 100644
--- a/Documentation/devicetree/bindings/firmware/qcom,scm.txt
+++ b/Documentation/devicetree/bindings/firmware/qcom,scm.txt
@@ -43,6 +43,7 @@ Required properties:
   clock and "bus" for the bus clock per the requirements of the compatible.
 - qcom,dload-mode: phandle to the TCSR hardware block and offset of the
 		   download mode control register (optional)
+- interconnects: Specifies the bandwidth requirements of the SCM interface (optional)
 
 Example for MSM8916:
 
-- 
2.7.4


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

* [RFC 2/3] firmware: qcom_scm: Add bw voting support to the SCM interface
  2022-05-23  7:00 [RFC 0/3] Add interconnect support to the SCM interface Sibi Sankar
  2022-05-23  7:00 ` [RFC 1/3] dt-bindings: firmware: qcom-scm: Add interconnects property Sibi Sankar
@ 2022-05-23  7:00 ` Sibi Sankar
  2022-05-23  7:00 ` [RFC 3/3] arm64: dts: qcom: sm8450: Add interconnect requirements for SCM Sibi Sankar
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Sibi Sankar @ 2022-05-23  7:00 UTC (permalink / raw)
  To: bjorn.andersson
  Cc: agross, linux-arm-msm, devicetree, linux-kernel,
	krzysztof.kozlowski+dt, robh+dt, quic_psodagud, eberman,
	Sibi Sankar

The SMC calls required by remoteproc PAS driver on SM8450 SoCs get a
performance benefit from having a max vote to the crypto->ddr path.
Add support for bandwidth (bw) voting for those SMC calls when the
interconnects property is specified.

Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com>
---
 drivers/firmware/qcom_scm.c | 69 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c
index 3163660fa8e2..1de22d411e51 100644
--- a/drivers/firmware/qcom_scm.c
+++ b/drivers/firmware/qcom_scm.c
@@ -7,6 +7,7 @@
 #include <linux/cpumask.h>
 #include <linux/export.h>
 #include <linux/dma-mapping.h>
+#include <linux/interconnect.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/qcom_scm.h>
@@ -31,8 +32,13 @@ struct qcom_scm {
 	struct clk *core_clk;
 	struct clk *iface_clk;
 	struct clk *bus_clk;
+	struct icc_path *path;
 	struct reset_controller_dev reset;
 
+	/* control access to the interconnect path */
+	struct mutex scm_bw_lock;
+	int scm_vote_count;
+
 	u64 dload_mode_addr;
 };
 
@@ -99,6 +105,42 @@ static void qcom_scm_clk_disable(void)
 	clk_disable_unprepare(__scm->bus_clk);
 }
 
+static int qcom_scm_bw_enable(void)
+{
+	int ret = 0;
+
+	if (!__scm->path)
+		return 0;
+
+	if (IS_ERR(__scm->path))
+		return -EINVAL;
+
+	mutex_lock(&__scm->scm_bw_lock);
+	if (!__scm->scm_vote_count) {
+		ret = icc_set_bw(__scm->path, 0, UINT_MAX);
+		if (ret < 0) {
+			dev_err(__scm->dev, "failed to set bandwidth request\n");
+			goto err_bw;
+		}
+	}
+	__scm->scm_vote_count++;
+err_bw:
+	mutex_unlock(&__scm->scm_bw_lock);
+
+	return ret;
+}
+
+static void qcom_scm_bw_disable(void)
+{
+	if (IS_ERR_OR_NULL(__scm->path))
+		return;
+
+	mutex_lock(&__scm->scm_bw_lock);
+	if (__scm->scm_vote_count-- == 1)
+		icc_set_bw(__scm->path, 0, 0);
+	mutex_unlock(&__scm->scm_bw_lock);
+}
+
 enum qcom_scm_convention qcom_scm_convention = SMC_CONVENTION_UNKNOWN;
 static DEFINE_SPINLOCK(scm_query_lock);
 
@@ -444,10 +486,15 @@ int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size,
 	if (ret)
 		goto out;
 
+	ret = qcom_scm_bw_enable();
+	if (ret)
+		return ret;
+
 	desc.args[1] = mdata_phys;
 
 	ret = qcom_scm_call(__scm->dev, &desc, &res);
 
+	qcom_scm_bw_disable();
 	qcom_scm_clk_disable();
 
 out:
@@ -507,7 +554,12 @@ int qcom_scm_pas_mem_setup(u32 peripheral, phys_addr_t addr, phys_addr_t size)
 	if (ret)
 		return ret;
 
+	ret = qcom_scm_bw_enable();
+	if (ret)
+		return ret;
+
 	ret = qcom_scm_call(__scm->dev, &desc, &res);
+	qcom_scm_bw_disable();
 	qcom_scm_clk_disable();
 
 	return ret ? : res.result[0];
@@ -537,7 +589,12 @@ int qcom_scm_pas_auth_and_reset(u32 peripheral)
 	if (ret)
 		return ret;
 
+	ret = qcom_scm_bw_enable();
+	if (ret)
+		return ret;
+
 	ret = qcom_scm_call(__scm->dev, &desc, &res);
+	qcom_scm_bw_disable();
 	qcom_scm_clk_disable();
 
 	return ret ? : res.result[0];
@@ -566,8 +623,13 @@ int qcom_scm_pas_shutdown(u32 peripheral)
 	if (ret)
 		return ret;
 
+	ret = qcom_scm_bw_enable();
+	if (ret)
+		return ret;
+
 	ret = qcom_scm_call(__scm->dev, &desc, &res);
 
+	qcom_scm_bw_disable();
 	qcom_scm_clk_disable();
 
 	return ret ? : res.result[0];
@@ -1277,8 +1339,15 @@ static int qcom_scm_probe(struct platform_device *pdev)
 	if (ret < 0)
 		return ret;
 
+	mutex_init(&scm->scm_bw_lock);
+
 	clks = (unsigned long)of_device_get_match_data(&pdev->dev);
 
+	scm->path = devm_of_icc_get(&pdev->dev, NULL);
+	if (IS_ERR(scm->path))
+		return dev_err_probe(&pdev->dev, PTR_ERR(scm->path),
+				     "failed to acquire interconnect path\n");
+
 	scm->core_clk = devm_clk_get(&pdev->dev, "core");
 	if (IS_ERR(scm->core_clk)) {
 		if (PTR_ERR(scm->core_clk) == -EPROBE_DEFER)
-- 
2.7.4


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

* [RFC 3/3] arm64: dts: qcom: sm8450: Add interconnect requirements for SCM
  2022-05-23  7:00 [RFC 0/3] Add interconnect support to the SCM interface Sibi Sankar
  2022-05-23  7:00 ` [RFC 1/3] dt-bindings: firmware: qcom-scm: Add interconnects property Sibi Sankar
  2022-05-23  7:00 ` [RFC 2/3] firmware: qcom_scm: Add bw voting support to the SCM interface Sibi Sankar
@ 2022-05-23  7:00 ` Sibi Sankar
  2022-06-30  2:47 ` [RFC 0/3] Add interconnect support to the SCM interface Bjorn Andersson
  2022-07-03  3:56 ` (subset) " Bjorn Andersson
  4 siblings, 0 replies; 7+ messages in thread
From: Sibi Sankar @ 2022-05-23  7:00 UTC (permalink / raw)
  To: bjorn.andersson
  Cc: agross, linux-arm-msm, devicetree, linux-kernel,
	krzysztof.kozlowski+dt, robh+dt, quic_psodagud, eberman,
	Sibi Sankar

Add interconnects requirements for the SCM interface on SM8450 SoCs.

Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com>
---
 arch/arm64/boot/dts/qcom/sm8450.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/qcom/sm8450.dtsi b/arch/arm64/boot/dts/qcom/sm8450.dtsi
index 4e796f27d6fc..6fdbad34d012 100644
--- a/arch/arm64/boot/dts/qcom/sm8450.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8450.dtsi
@@ -258,6 +258,7 @@
 	firmware {
 		scm: scm {
 			compatible = "qcom,scm-sm8450", "qcom,scm";
+			interconnects = <&aggre2_noc MASTER_CRYPTO 0 &mc_virt SLAVE_EBI1 0>;
 			#reset-cells = <1>;
 		};
 	};
-- 
2.7.4


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

* Re: [RFC 1/3] dt-bindings: firmware: qcom-scm: Add interconnects property
  2022-05-23  7:00 ` [RFC 1/3] dt-bindings: firmware: qcom-scm: Add interconnects property Sibi Sankar
@ 2022-06-02 13:03   ` Rob Herring
  0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2022-06-02 13:03 UTC (permalink / raw)
  To: Sibi Sankar
  Cc: linux-arm-msm, linux-kernel, quic_psodagud, bjorn.andersson,
	agross, krzysztof.kozlowski+dt, eberman, robh+dt, devicetree

On Mon, 23 May 2022 12:30:56 +0530, Sibi Sankar wrote:
> Add interconnects as an optional property for SM8450 SoCs.
> 
> Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com>
> ---
> 
> Since the interconnect requirements could either be specified in the
> individual remoteprocs or directly in the scm interface, will perform
> the yaml conversion in the next re-spin based on the consensus.
> 
>  Documentation/devicetree/bindings/firmware/qcom,scm.txt | 1 +
>  1 file changed, 1 insertion(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [RFC 0/3] Add interconnect support to the SCM interface
  2022-05-23  7:00 [RFC 0/3] Add interconnect support to the SCM interface Sibi Sankar
                   ` (2 preceding siblings ...)
  2022-05-23  7:00 ` [RFC 3/3] arm64: dts: qcom: sm8450: Add interconnect requirements for SCM Sibi Sankar
@ 2022-06-30  2:47 ` Bjorn Andersson
  2022-07-03  3:56 ` (subset) " Bjorn Andersson
  4 siblings, 0 replies; 7+ messages in thread
From: Bjorn Andersson @ 2022-06-30  2:47 UTC (permalink / raw)
  To: Sibi Sankar
  Cc: agross, linux-arm-msm, devicetree, linux-kernel,
	krzysztof.kozlowski+dt, robh+dt, quic_psodagud, eberman

On Mon 23 May 02:00 CDT 2022, Sibi Sankar wrote:

> Some of the SMC calls required by remoteproc PAS driver on SM8450 SoCs
> get a performance benefit from having a max vote to the crypto->ddr path.
> Add support for bandwidth (bw) voting for those SMC calls when the
> interconnects property is specified. Marking this as an RFC since the path
> could either be specified in the individual remoteprocs or directly in the
> scm interface.
> 

I find it reasonable to state that the clocking needs for the CE relates
to the SCM and not the remoteproc, and it's in line with the management
of CE clocks from the SCM driver.

Regards,
Bjorn

> Sibi Sankar (3):
>   dt-bindings: firmware: qcom-scm: Add interconnects property
>   firmware: qcom_scm: Add bw voting support to the SCM interface
>   arm64: dts: qcom: sm8450: Add interconnect requirements for SCM
> 
>  .../devicetree/bindings/firmware/qcom,scm.txt      |  1 +
>  arch/arm64/boot/dts/qcom/sm8450.dtsi               |  1 +
>  drivers/firmware/qcom_scm.c                        | 69 ++++++++++++++++++++++
>  3 files changed, 71 insertions(+)
> 
> -- 
> 2.7.4
> 

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

* Re: (subset) [RFC 0/3] Add interconnect support to the SCM interface
  2022-05-23  7:00 [RFC 0/3] Add interconnect support to the SCM interface Sibi Sankar
                   ` (3 preceding siblings ...)
  2022-06-30  2:47 ` [RFC 0/3] Add interconnect support to the SCM interface Bjorn Andersson
@ 2022-07-03  3:56 ` Bjorn Andersson
  4 siblings, 0 replies; 7+ messages in thread
From: Bjorn Andersson @ 2022-07-03  3:56 UTC (permalink / raw)
  To: Sibi Sankar
  Cc: quic_psodagud, linux-arm-msm, linux-kernel, devicetree, eberman,
	krzysztof.kozlowski+dt, agross, robh+dt

On Mon, 23 May 2022 12:30:55 +0530, Sibi Sankar wrote:
> Some of the SMC calls required by remoteproc PAS driver on SM8450 SoCs
> get a performance benefit from having a max vote to the crypto->ddr path.
> Add support for bandwidth (bw) voting for those SMC calls when the
> interconnects property is specified. Marking this as an RFC since the path
> could either be specified in the individual remoteprocs or directly in the
> scm interface.
> 
> [...]

Applied, thanks!

[3/3] arm64: dts: qcom: sm8450: Add interconnect requirements for SCM
      commit: 4c9fb8e89849db0f12fbfd4ad6a6ce036251a200

Best regards,
-- 
Bjorn Andersson <bjorn.andersson@linaro.org>

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

end of thread, other threads:[~2022-07-03  4:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-23  7:00 [RFC 0/3] Add interconnect support to the SCM interface Sibi Sankar
2022-05-23  7:00 ` [RFC 1/3] dt-bindings: firmware: qcom-scm: Add interconnects property Sibi Sankar
2022-06-02 13:03   ` Rob Herring
2022-05-23  7:00 ` [RFC 2/3] firmware: qcom_scm: Add bw voting support to the SCM interface Sibi Sankar
2022-05-23  7:00 ` [RFC 3/3] arm64: dts: qcom: sm8450: Add interconnect requirements for SCM Sibi Sankar
2022-06-30  2:47 ` [RFC 0/3] Add interconnect support to the SCM interface Bjorn Andersson
2022-07-03  3:56 ` (subset) " Bjorn Andersson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.