From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Vikash Garodia <quic_vgarodia@quicinc.com>,
Dikshita Agarwal <quic_dikshita@quicinc.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Abhinav Kumar <abhinav.kumar@linux.dev>,
linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-media@vger.kernel.org, linux-remoteproc@vger.kernel.org
Subject: Re: [PATCH v2 04/11] firmware: qcom_scm: Simplify qcom_scm_pas_init_image()
Date: Thu, 21 Aug 2025 15:36:26 +0100 [thread overview]
Message-ID: <10d91d9d-b6d6-4a83-a697-909f97abc503@linaro.org> (raw)
In-Reply-To: <20250819165447.4149674-5-mukesh.ojha@oss.qualcomm.com>
On 19/08/2025 17:54, Mukesh Ojha wrote:
> Simplify qcom_scm_pas_init_image() by making the memory
> allocation, copy and free work in a separate function
> then the actual SMC call.
then is temporal
than is disjunctive
you mean than here, not then.
>
> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
> ---
> drivers/firmware/qcom/qcom_scm.c | 59 ++++++++++++++++++--------------
> 1 file changed, 34 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c
> index 9a5b34f5bacb..7827699e277c 100644
> --- a/drivers/firmware/qcom/qcom_scm.c
> +++ b/drivers/firmware/qcom/qcom_scm.c
> @@ -584,6 +584,38 @@ void *qcom_scm_pas_ctx_init(struct device *dev, u32 peripheral, phys_addr_t mem_
> }
> EXPORT_SYMBOL_GPL(qcom_scm_pas_ctx_init);
>
> +static int __qcom_scm_pas_init_image(u32 peripheral, dma_addr_t mdata_phys,
> + void *metadata, size_t size,
> + struct qcom_scm_res *res)
> +{
> + int ret;
> + struct qcom_scm_desc desc = {
> + .svc = QCOM_SCM_SVC_PIL,
> + .cmd = QCOM_SCM_PIL_PAS_INIT_IMAGE,
> + .arginfo = QCOM_SCM_ARGS(2, QCOM_SCM_VAL, QCOM_SCM_RW),
> + .args[0] = peripheral,
> + .owner = ARM_SMCCC_OWNER_SIP,
> + };
A minor detail but please reverse christmas tree your defintions and try
to make int ret come last.
> +
> + ret = qcom_scm_clk_enable();
> + if (ret)
> + return ret;
> +
> + ret = qcom_scm_bw_enable();
> + if (ret)
> + goto disable_clk;
> +
> + desc.args[1] = mdata_phys;
> +
> + ret = qcom_scm_call(__scm->dev, &desc, res);
> + qcom_scm_bw_disable();
> +
> +disable_clk:
> + qcom_scm_clk_disable();
> +
> + return ret;
> +}
> +
> /**
> * qcom_scm_pas_init_image() - Initialize peripheral authentication service
> * state machine for a given peripheral, using the
> @@ -604,17 +636,10 @@ EXPORT_SYMBOL_GPL(qcom_scm_pas_ctx_init);
> int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size,
> struct qcom_scm_pas_metadata *ctx)
> {
> + struct qcom_scm_res res;
> dma_addr_t mdata_phys;
> void *mdata_buf;
> int ret;
> - struct qcom_scm_desc desc = {
> - .svc = QCOM_SCM_SVC_PIL,
> - .cmd = QCOM_SCM_PIL_PAS_INIT_IMAGE,
> - .arginfo = QCOM_SCM_ARGS(2, QCOM_SCM_VAL, QCOM_SCM_RW),
> - .args[0] = peripheral,
> - .owner = ARM_SMCCC_OWNER_SIP,
> - };
> - struct qcom_scm_res res;
>
> /*
> * During the scm call memory protection will be enabled for the meta
> @@ -635,23 +660,7 @@ int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size,
>
> memcpy(mdata_buf, metadata, size);
>
> - ret = qcom_scm_clk_enable();
> - if (ret)
> - goto out;
> -
> - ret = qcom_scm_bw_enable();
> - if (ret)
> - goto disable_clk;
> -
> - desc.args[1] = mdata_phys;
> -
> - ret = qcom_scm_call(__scm->dev, &desc, &res);
> - qcom_scm_bw_disable();
> -
> -disable_clk:
> - qcom_scm_clk_disable();
> -
> -out:
> + ret = __qcom_scm_pas_init_image(peripheral, mdata_phys, mdata_buf, size, &res);
> if (ret < 0 || !ctx) {
> dma_free_coherent(__scm->dev, size, mdata_buf, mdata_phys);
> } else if (ctx) {
With those changes.
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
next prev parent reply other threads:[~2025-08-21 14:36 UTC|newest]
Thread overview: 81+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-19 16:54 [PATCH v2 00/11] Peripheral Image Loader support for Qualcomm SoCs running Linux host at EL2 Mukesh Ojha
2025-08-19 16:54 ` [PATCH v2 01/11] firmware: qcom_scm: Introduce PAS context initialization helper Mukesh Ojha
2025-08-19 17:17 ` Pavan Kondeti
2025-08-20 6:19 ` Mukesh Ojha
2025-08-20 11:40 ` Bryan O'Donoghue
2025-08-20 12:28 ` Mukesh Ojha
2025-09-13 14:54 ` Bryan O'Donoghue
2025-08-19 16:54 ` [PATCH v2 02/11] soc: qcom: mdtloader: Add context aware qcom_mdt_pas_load() helper Mukesh Ojha
2025-08-20 11:48 ` Bryan O'Donoghue
2025-08-20 12:25 ` Mukesh Ojha
2025-09-03 15:03 ` Bryan O'Donoghue
2025-09-04 9:52 ` Mukesh Ojha
2025-09-04 10:15 ` Bryan O'Donoghue
2025-09-04 11:43 ` Mukesh Ojha
2025-08-19 16:54 ` [PATCH v2 03/11] firmware: qcom_scm: Add a prep version of auth_and_reset function Mukesh Ojha
2025-08-20 12:03 ` Bryan O'Donoghue
2025-08-20 12:24 ` Mukesh Ojha
2025-08-19 16:54 ` [PATCH v2 04/11] firmware: qcom_scm: Simplify qcom_scm_pas_init_image() Mukesh Ojha
2025-08-21 14:36 ` Bryan O'Donoghue [this message]
2025-08-21 16:29 ` Mukesh Ojha
2025-08-19 16:54 ` [PATCH v2 05/11] firmware: qcom_scm: Add shmbridge support to pas_init/release function Mukesh Ojha
2025-08-21 15:23 ` Bryan O'Donoghue
2025-08-21 17:03 ` Mukesh Ojha
2025-08-22 16:52 ` Mukesh Ojha
2025-08-22 23:13 ` Bryan O'Donoghue
2025-08-19 16:54 ` [PATCH v2 06/11] remoteproc: Move resource table data structure to its own header Mukesh Ojha
2025-08-20 8:12 ` Stephan Gerhold
2025-08-20 15:18 ` Mukesh Ojha
2025-08-20 15:31 ` Stephan Gerhold
2025-08-22 7:56 ` Mukesh Ojha
2025-08-20 16:32 ` Mukesh Ojha
2025-08-20 16:53 ` Stephan Gerhold
2025-08-22 9:21 ` Mukesh Ojha
2025-08-22 8:35 ` Krzysztof Kozlowski
2025-08-22 9:30 ` Mukesh Ojha
2025-08-19 16:54 ` [PATCH v2 07/11] firmware: qcom_scm: Add qcom_scm_pas_get_rsc_table() to get resource table Mukesh Ojha
2025-08-21 15:05 ` Krzysztof Kozlowski
2025-08-21 17:20 ` Mukesh Ojha
2025-08-22 6:22 ` Krzysztof Kozlowski
2025-08-22 7:21 ` Mukesh Ojha
2025-08-22 8:30 ` Krzysztof Kozlowski
2025-08-19 16:54 ` [PATCH v2 08/11] soc: qcom: mdt_loader: Add helper functions to map and unmap resources Mukesh Ojha
2025-08-19 16:54 ` [PATCH v2 09/11] remoteproc: pas: Extend parse_fw callback to parse resource table Mukesh Ojha
2025-08-20 8:36 ` Stephan Gerhold
2025-08-20 11:14 ` Mukesh Ojha
2025-08-20 13:07 ` Stephan Gerhold
2025-08-21 14:49 ` Krzysztof Kozlowski
2025-08-21 17:41 ` Mukesh Ojha
2025-08-19 16:54 ` [PATCH v2 10/11] remoteproc: qcom: pas: Enable Secure PAS support with IOMMU managed by Linux Mukesh Ojha
2025-08-20 8:40 ` Stephan Gerhold
2025-08-20 12:03 ` Mukesh Ojha
2025-08-19 16:54 ` [PATCH v2 11/11] media: iris: " Mukesh Ojha
2025-08-20 8:46 ` Stephan Gerhold
2025-08-20 11:56 ` Mukesh Ojha
2025-08-20 13:39 ` Stephan Gerhold
2025-08-22 4:26 ` Vikash Garodia
2025-08-22 8:46 ` Stephan Gerhold
2025-08-22 15:06 ` Mukesh Ojha
2025-08-22 16:26 ` Stephan Gerhold
2025-08-22 16:40 ` Mukesh Ojha
2025-08-23 20:43 ` Stephan Gerhold
2025-08-25 11:19 ` Mukesh Ojha
2025-09-08 8:23 ` Stephan Gerhold
2025-09-09 12:19 ` Mukesh Ojha
2025-09-09 14:03 ` Bryan O'Donoghue
2025-08-20 11:33 ` Bryan O'Donoghue
2025-08-20 12:00 ` Mukesh Ojha
2025-08-22 8:45 ` Krzysztof Kozlowski
2025-08-22 15:13 ` Mukesh Ojha
2025-08-23 15:41 ` Krzysztof Kozlowski
2025-08-23 15:46 ` Krzysztof Kozlowski
2025-08-23 15:52 ` Krzysztof Kozlowski
2025-08-20 11:03 ` [PATCH v2 00/11] Peripheral Image Loader support for Qualcomm SoCs running Linux host at EL2 Bryan O'Donoghue
2025-08-20 11:22 ` Mukesh Ojha
2025-09-03 11:56 ` Konrad Dybcio
2025-09-03 13:31 ` Bryan O'Donoghue
2025-09-03 14:02 ` Dmitry Baryshkov
2025-09-03 14:05 ` Bryan O'Donoghue
2025-09-03 14:13 ` Bryan O'Donoghue
2025-09-03 14:21 ` Bryan O'Donoghue
2025-09-03 14:28 ` Dmitry Baryshkov
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=10d91d9d-b6d6-4a83-a697-909f97abc503@linaro.org \
--to=bryan.odonoghue@linaro.org \
--cc=abhinav.kumar@linux.dev \
--cc=andersson@kernel.org \
--cc=konradybcio@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=mchehab@kernel.org \
--cc=mukesh.ojha@oss.qualcomm.com \
--cc=quic_dikshita@quicinc.com \
--cc=quic_vgarodia@quicinc.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®