linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: qce - Add suspend and resume support
@ 2025-06-06 10:58 quic_utiwari
  2025-06-06 15:07 ` Stephan Gerhold
  2025-06-08  0:13 ` Bjorn Andersson
  0 siblings, 2 replies; 3+ messages in thread
From: quic_utiwari @ 2025-06-06 10:58 UTC (permalink / raw)
  To: Thara Gopinath, Herbert Xu, David S . Miller
  Cc: linux-crypto, linux-arm-msm, linux-kernel, bartosz.golaszewski,
	quic_neersoni

From: Udit Tiwari <quic_utiwari@quicinc.com>

Add basic suspend and resume callbacks to the QCE platform driver to
manage interconnect bandwidth during system sleep and wake-up cycles.

Signed-off-by: Udit Tiwari <quic_utiwari@quicinc.com>
---
 drivers/crypto/qce/core.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
index e95e84486d9a..2566bdad5d4a 100644
--- a/drivers/crypto/qce/core.c
+++ b/drivers/crypto/qce/core.c
@@ -249,6 +249,21 @@ static int qce_crypto_probe(struct platform_device *pdev)
 	return devm_qce_register_algs(qce);
 }
 
+static int qce_crypto_suspend(struct platform_device *pdev, pm_message_t state)
+{
+	struct qce_device *qce = platform_get_drvdata(pdev);
+
+	return icc_set_bw(qce->mem_path, 0, 0);
+}
+
+static int qce_crypto_resume(struct platform_device *pdev)
+{
+	struct qce_device *qce = platform_get_drvdata(pdev);
+
+	return icc_set_bw(qce->mem_path, QCE_DEFAULT_MEM_BANDWIDTH,
+		QCE_DEFAULT_MEM_BANDWIDTH);
+}
+
 static const struct of_device_id qce_crypto_of_match[] = {
 	{ .compatible = "qcom,crypto-v5.1", },
 	{ .compatible = "qcom,crypto-v5.4", },
@@ -259,6 +274,8 @@ MODULE_DEVICE_TABLE(of, qce_crypto_of_match);
 
 static struct platform_driver qce_crypto_driver = {
 	.probe = qce_crypto_probe,
+	.suspend = qce_crypto_suspend,
+	.resume = qce_crypto_resume,
 	.driver = {
 		.name = KBUILD_MODNAME,
 		.of_match_table = qce_crypto_of_match,
-- 
2.34.1


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

* Re: [PATCH] crypto: qce - Add suspend and resume support
  2025-06-06 10:58 [PATCH] crypto: qce - Add suspend and resume support quic_utiwari
@ 2025-06-06 15:07 ` Stephan Gerhold
  2025-06-08  0:13 ` Bjorn Andersson
  1 sibling, 0 replies; 3+ messages in thread
From: Stephan Gerhold @ 2025-06-06 15:07 UTC (permalink / raw)
  To: quic_utiwari
  Cc: Thara Gopinath, Herbert Xu, David S . Miller, linux-crypto,
	linux-arm-msm, linux-kernel, bartosz.golaszewski, quic_neersoni

On Fri, Jun 06, 2025 at 04:28:08PM +0530, quic_utiwari@quicinc.com wrote:
> From: Udit Tiwari <quic_utiwari@quicinc.com>
> 
> Add basic suspend and resume callbacks to the QCE platform driver to
> manage interconnect bandwidth during system sleep and wake-up cycles.
> 
> Signed-off-by: Udit Tiwari <quic_utiwari@quicinc.com>

Can you add runtime PM support instead, so we can also reduce the
bandwidth/power consumption at runtime when QCE is not used?

Also, what about the clocks? They should also be disabled, not just the
bandwidth.

Thanks,
Stephan

> ---
>  drivers/crypto/qce/core.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
> index e95e84486d9a..2566bdad5d4a 100644
> --- a/drivers/crypto/qce/core.c
> +++ b/drivers/crypto/qce/core.c
> @@ -249,6 +249,21 @@ static int qce_crypto_probe(struct platform_device *pdev)
>  	return devm_qce_register_algs(qce);
>  }
>  
> +static int qce_crypto_suspend(struct platform_device *pdev, pm_message_t state)
> +{
> +	struct qce_device *qce = platform_get_drvdata(pdev);
> +
> +	return icc_set_bw(qce->mem_path, 0, 0);
> +}
> +
> +static int qce_crypto_resume(struct platform_device *pdev)
> +{
> +	struct qce_device *qce = platform_get_drvdata(pdev);
> +
> +	return icc_set_bw(qce->mem_path, QCE_DEFAULT_MEM_BANDWIDTH,
> +		QCE_DEFAULT_MEM_BANDWIDTH);
> +}
> +
>  static const struct of_device_id qce_crypto_of_match[] = {
>  	{ .compatible = "qcom,crypto-v5.1", },
>  	{ .compatible = "qcom,crypto-v5.4", },
> @@ -259,6 +274,8 @@ MODULE_DEVICE_TABLE(of, qce_crypto_of_match);
>  
>  static struct platform_driver qce_crypto_driver = {
>  	.probe = qce_crypto_probe,
> +	.suspend = qce_crypto_suspend,
> +	.resume = qce_crypto_resume,
>  	.driver = {
>  		.name = KBUILD_MODNAME,
>  		.of_match_table = qce_crypto_of_match,
> -- 
> 2.34.1
> 

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

* Re: [PATCH] crypto: qce - Add suspend and resume support
  2025-06-06 10:58 [PATCH] crypto: qce - Add suspend and resume support quic_utiwari
  2025-06-06 15:07 ` Stephan Gerhold
@ 2025-06-08  0:13 ` Bjorn Andersson
  1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2025-06-08  0:13 UTC (permalink / raw)
  To: quic_utiwari
  Cc: Thara Gopinath, Herbert Xu, David S . Miller, linux-crypto,
	linux-arm-msm, linux-kernel, bartosz.golaszewski, quic_neersoni

On Fri, Jun 06, 2025 at 04:28:08PM +0530, quic_utiwari@quicinc.com wrote:
> From: Udit Tiwari <quic_utiwari@quicinc.com>
> 
> Add basic suspend and resume callbacks to the QCE platform driver to
> manage interconnect bandwidth during system sleep and wake-up cycles.

Please follow
https://docs.kernel.org/process/submitting-patches.html#describe-your-changes
and start your commit message with a problem description. Why do we want
to "manage interconnect bandwidth"?

> 
> Signed-off-by: Udit Tiwari <quic_utiwari@quicinc.com>
> ---
>  drivers/crypto/qce/core.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
> index e95e84486d9a..2566bdad5d4a 100644
> --- a/drivers/crypto/qce/core.c
> +++ b/drivers/crypto/qce/core.c
> @@ -249,6 +249,21 @@ static int qce_crypto_probe(struct platform_device *pdev)
>  	return devm_qce_register_algs(qce);
>  }
>  
> +static int qce_crypto_suspend(struct platform_device *pdev, pm_message_t state)
> +{
> +	struct qce_device *qce = platform_get_drvdata(pdev);
> +
> +	return icc_set_bw(qce->mem_path, 0, 0);

Couldn't you be using icc_disable(); here?

> +}
> +
> +static int qce_crypto_resume(struct platform_device *pdev)
> +{
> +	struct qce_device *qce = platform_get_drvdata(pdev);
> +
> +	return icc_set_bw(qce->mem_path, QCE_DEFAULT_MEM_BANDWIDTH,
> +		QCE_DEFAULT_MEM_BANDWIDTH);

icc_enable();


That said, as already requested, please also drop these votes at runtime
when the block is unused.

> +}
> +
>  static const struct of_device_id qce_crypto_of_match[] = {
>  	{ .compatible = "qcom,crypto-v5.1", },
>  	{ .compatible = "qcom,crypto-v5.4", },
> @@ -259,6 +274,8 @@ MODULE_DEVICE_TABLE(of, qce_crypto_of_match);
>  
>  static struct platform_driver qce_crypto_driver = {
>  	.probe = qce_crypto_probe,
> +	.suspend = qce_crypto_suspend,
> +	.resume = qce_crypto_resume,

Please implement .driver.pm instead.

Regards,
Bjorn

>  	.driver = {
>  		.name = KBUILD_MODNAME,
>  		.of_match_table = qce_crypto_of_match,
> -- 
> 2.34.1
> 

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

end of thread, other threads:[~2025-06-08  0:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-06 10:58 [PATCH] crypto: qce - Add suspend and resume support quic_utiwari
2025-06-06 15:07 ` Stephan Gerhold
2025-06-08  0:13 ` Bjorn Andersson

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