All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Bartosz Golaszewski" <bartosz.golaszewski@oss.qualcomm.com>,
	"Thara Gopinath" <thara.gopinath@gmail.com>,
	"Herbert Xu" <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	"Stanimir Varbanov" <svarbanov@mm-sol.com>,
	"Eneas U de Queiroz" <cotequeiroz@gmail.com>,
	"Kuldeep Singh" <kuldeep.singh@oss.qualcomm.com>,
	"Eric Biggers" <ebiggers@kernel.org>,
	"Demi Marie Obenour" <demiobenour@gmail.com>,
	"Bjorn Andersson" <andersson@kernel.org>,
	"Konrad Dybcio" <konradybcio@kernel.org>,
	"Russell King" <linux@armlinux.org.uk>,
	"Abel Vesa" <abelvesa@kernel.org>
Cc: linux-crypto@vger.kernel.org, brgl@kernel.org
Subject: Re: [PATCH v13] crypto: qce - split the crypto driver into core and crypto parts
Date: Fri, 27 Nov 2026 18:00:47 +0000	[thread overview]
Message-ID: <sashiko-outbox-238022@kernel.org> (raw)
In-Reply-To: <20261127-qce-fix-self-tests-v13-1-80b601792901@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] soc: qcom: missing Kconfig dependency and default for
  QCOM_CRYPTO_CORE
- [Low] crypto: qce: undocumented runtime PM fix in qce_handle_queue()
- [Low] soc: qcom: qce-core: redundant platform MODULE_ALIAS in
  qce-core.c
--

commit 4da044e24ff7154ba3b99469082d955ba8f5a0b0
Author: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

crypto: qce - split the crypto driver into core and crypto parts

This commit splits the Qualcomm Crypto Engine driver into a core platform
driver in drivers/soc/qcom/ that manages the memory interconnect vote via
runtime PM and registers auxiliary child devices, and an auxiliary driver in
drivers/crypto/qce/ for the crypto offloader functionality.

> diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
> index ddb4df3d227f8..7c72f9bd36b9d 100644
> --- a/drivers/crypto/qce/core.c
> +++ b/drivers/crypto/qce/core.c
[ ... ]
> @@ -92,12 +91,7 @@ static int qce_handle_queue(struct qce_device *qce,
>  			    struct crypto_async_request *req)
>  {
>  	struct crypto_async_request *async_req, *backlog;
> -	int ret, err;
> -
> -	PM_RUNTIME_ACQUIRE_AUTOSUSPEND(qce->dev, pm);
> -	ret = PM_RUNTIME_ACQUIRE_ERR(&pm);
> -	if (ret)
> -		return ret;
> +	int ret = 0, err;
>  
>  	scoped_guard(mutex, &qce->lock) {
>  		if (req)
> @@ -121,8 +115,21 @@ static int qce_handle_queue(struct qce_device *qce,
>  			crypto_request_complete(backlog, -EINPROGRESS);
>  	}
>  
> +	/*
> +	 * Hold the device resumed across that whole window instead of just
> +	 * across this function, or autosuspend could gate the engine clocks
> +	 * while the DMA is still in flight.
> +	 */
> +	err = pm_runtime_resume_and_get(qce->dev);
> +	if (err) {
> +		qce->result = err;
> +		schedule_work(&qce->done_work);
> +		return ret;
> +	}
> +
>  	err = qce_handle_request(async_req);
>  	if (err) {
> +		pm_runtime_put_autosuspend(qce->dev);
>  		qce->result = err;
>  		schedule_work(&qce->done_work);
>  	}
> @@ -155,6 +162,7 @@ static int qce_async_request_enqueue(struct qce_device *qce,
>  
>  static void qce_async_request_done(struct qce_device *qce, int ret)
>  {
> +	pm_runtime_put_autosuspend(qce->dev);
>  	qce->result = ret;
>  	schedule_work(&qce->done_work);
>  }

[Severity: Low]
This isn't a bug in the code, but the commit message does not mention this
functional fix in qce_handle_queue() and qce_async_request_done(), which
holds the runtime PM reference across the in-flight DMA transfer instead of
dropping it when qce_handle_queue() returns (and initializes ret to 0).
Could this be noted in the changelog?

> diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
> index 535c8619197b3..67d54d5211ff2 100644
> --- a/drivers/soc/qcom/Kconfig
> +++ b/drivers/soc/qcom/Kconfig
> @@ -121,6 +121,17 @@ config QCOM_PMIC_GLINK
>  	  Say yes here to support USB-C and battery status on modern Qualcomm
>  	  platforms.
>  
> +config QCOM_CRYPTO_CORE
> +	tristate "Qualcomm Crypto Engine core driver"
> +	depends on PM
> +	select AUXILIARY_BUS
> +	help
> +	  Core driver for the Qualcomm Crypto Engine. Say yes here to enable
> +	  the top-level driver that binds to the devicetree node representing
> +	  the QCE, registers the sub-devices implementing actual QCE
> +	  functionalities and sets up runtime PM allowing the interconnects to
> +	  scale down.
> +

[Severity: Medium]
Should QCOM_CRYPTO_CORE have a default (such as default m if ARCH_QCOM), and
should CRYPTO_DEV_QCE in drivers/crypto/Kconfig depend on or select
QCOM_CRYPTO_CORE?

Without a default, updating an existing configuration via olddefconfig leaves
QCOM_CRYPTO_CORE disabled, so nothing binds to the QCE devicetree node to
scale down the memory interconnect bandwidth.  And if CRYPTO_DEV_QCE is
enabled without QCOM_CRYPTO_CORE, the qce.crypto auxiliary device is never
created and qcrypto cannot probe.

Also, the help text for CRYPTO_DEV_QCE in drivers/crypto/Kconfig still states
that qcrypto scales down the interconnect bandwidth, which is now handled by
qce-core.

> diff --git a/drivers/soc/qcom/qce-core.c b/drivers/soc/qcom/qce-core.c
> new file mode 100644
> index 0000000000000..1f249a22e8366
> --- /dev/null
> +++ b/drivers/soc/qcom/qce-core.c
[ ... ]
> +static const struct of_device_id qce_core_of_match[] = {
> +	{ .compatible = "qcom,crypto-v5.1" },
> +	{ .compatible = "qcom,crypto-v5.4" },
> +	{ .compatible = "qcom,qce" },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, qce_core_of_match);
> +
> +static struct platform_driver qce_core_driver = {
> +	.probe = qce_core_probe,
> +	.driver = {
> +		.name = KBUILD_MODNAME,
> +		.of_match_table = qce_core_of_match,
> +		.pm = pm_ptr(&qce_core_pm_ops),
> +	},
> +};
> +module_platform_driver(qce_core_driver);
> +
> +MODULE_LICENSE("GPL");
> +MODULE_DESCRIPTION("Qualcomm crypto engine core driver");
> +MODULE_ALIAS("platform:" KBUILD_MODNAME);
> +MODULE_AUTHOR("Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>");

[Severity: Low]
As reported by Krzysztof Kozlowski on v12 [1], is MODULE_ALIAS() needed here
given that qce_core_driver binds via devicetree and already exports
qce_core_of_match with MODULE_DEVICE_TABLE()?

[1] https://lore.kernel.org/r/7818fa09-8f9c-4d42-b746-0ec74ee1aa08@kernel.org

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261127-qce-fix-self-tests-v13-1-80b601792901@oss.qualcomm.com?part=1

  reply	other threads:[~2026-11-27 18:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 17:38 [PATCH v13] crypto: qce - split the crypto driver into core and crypto parts Bartosz Golaszewski
2026-11-27 18:00 ` sashiko-bot [this message]
2026-11-27 21:35 ` Demi Marie Obenour
2026-11-27 22:04   ` Rob Clark
2026-11-30 17:32 ` Jesse Casco

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-238022@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=abelvesa@kernel.org \
    --cc=andersson@kernel.org \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=brgl@kernel.org \
    --cc=cotequeiroz@gmail.com \
    --cc=davem@davemloft.net \
    --cc=demiobenour@gmail.com \
    --cc=ebiggers@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=konradybcio@kernel.org \
    --cc=kuldeep.singh@oss.qualcomm.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=svarbanov@mm-sol.com \
    --cc=thara.gopinath@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.