From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Sibi Sankar <quic_sibis@quicinc.com>, andersson@kernel.org
Cc: agross@kernel.org, linux-arm-msm@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
krzysztof.kozlowski+dt@linaro.org, robh+dt@kernel.org,
konrad.dybcio@somainline.org, robimarko@gmail.com,
quic_gurus@quicinc.com, quic_rjendra@quicinc.com
Subject: Re: [PATCH V5 2/2] firmware: qcom: scm: Add wait-queue handling logic
Date: Thu, 24 Nov 2022 12:21:49 +0100 [thread overview]
Message-ID: <fc2774de-22d3-0326-a438-c5e804837d77@linaro.org> (raw)
In-Reply-To: <20221123204615.25358-3-quic_sibis@quicinc.com>
On 23/11/2022 21:46, Sibi Sankar wrote:
> From: Guru Das Srinagesh <quic_gurus@quicinc.com>
>
> When the firmware (FW) supports multiple requests per VM, multiple requests
> from the same/different VM can reach the firmware at the same time. Since
> the firmware currently being used has limited resources, it guards them
> with a resource lock and puts requests on a wait-queue internally and
> signals to HLOS that it is doing so. It does this by returning a new return
> value in addition to success or error: SCM_WAITQ_SLEEP. A sleeping SCM call
> can be woken up by an interrupt that the FW raises.
Just two nitpicks while browsing the code...
> static int qcom_scm_probe(struct platform_device *pdev)
> {
> struct qcom_scm *scm;
> unsigned long clks;
> - int ret;
> + int irq, ret;
>
> scm = devm_kzalloc(&pdev->dev, sizeof(*scm), GFP_KERNEL);
> if (!scm)
> @@ -1399,9 +1486,29 @@ static int qcom_scm_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> + platform_set_drvdata(pdev, scm);
> +
> __scm = scm;
> __scm->dev = &pdev->dev;
>
> + spin_lock_init(&__scm->waitq.idr_lock);
> + idr_init(&__scm->waitq.idr);
> + init_completion(&__scm->waitq.waitq_comp);
> +
> + irq = platform_get_irq(pdev, 0);
> + if (irq < 0) {
> + if (irq != -ENXIO)
> + return irq;
> + } else {
> + ret = devm_request_threaded_irq(__scm->dev, irq, NULL, qcom_scm_irq_handler,
> + IRQF_ONESHOT, "qcom-scm", __scm);
> + if (ret < 0) {
> + dev_err(scm->dev, "Failed to request qcom-scm irq: %d\n", ret);
> + idr_destroy(&__scm->waitq.idr);
> + return ret;
return dev_err_probe().
> + }
> + }
> +
> __get_convention();
>
> /*
> @@ -1417,6 +1524,12 @@ static int qcom_scm_probe(struct platform_device *pdev)
>
> static void qcom_scm_shutdown(struct platform_device *pdev)
> {
> + unsigned long flags;
> +
> + spin_lock_irqsave(&__scm->waitq.idr_lock, flags);
> + idr_destroy(&__scm->waitq.idr);
> + spin_unlock_irqrestore(&__scm->waitq.idr_lock, flags);
> +
> /* Clean shutdown, disable download mode to allow normal restart */
> if (download_mode)
> qcom_scm_set_download_mode(false);
> diff --git a/drivers/firmware/qcom_scm.h b/drivers/firmware/qcom_scm.h
> index db3d08a01209..323cb49d4976 100644
> --- a/drivers/firmware/qcom_scm.h
> +++ b/drivers/firmware/qcom_scm.h
> @@ -60,6 +60,10 @@ struct qcom_scm_res {
> u64 result[MAX_QCOM_SCM_RETS];
> };
>
> +struct qcom_scm;
> +extern struct completion *qcom_scm_lookup_wq(struct qcom_scm *scm, u32 wq_ctx);
> +extern int scm_get_wq_ctx(u32 *wq_ctx, u32 *flags, u32 *more_pending);
No need for externs for new entries.
Best regards,
Krzysztof
prev parent reply other threads:[~2022-11-24 11:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-23 20:46 [PATCH V5 0/2] SCM: Add support for wait-queue aware firmware Sibi Sankar
2022-11-23 20:46 ` [PATCH V5 1/2] dt-bindings: firmware: qcom-scm: Add optional interrupt Sibi Sankar
2022-11-24 11:13 ` Krzysztof Kozlowski
2022-11-28 5:57 ` Sibi Sankar
2022-11-28 8:30 ` Krzysztof Kozlowski
2022-11-29 10:05 ` Sibi Sankar
2022-11-29 10:45 ` Krzysztof Kozlowski
2022-11-23 20:46 ` [PATCH V5 2/2] firmware: qcom: scm: Add wait-queue handling logic Sibi Sankar
2022-11-24 11:21 ` Krzysztof Kozlowski [this message]
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=fc2774de-22d3-0326-a438-c5e804837d77@linaro.org \
--to=krzysztof.kozlowski@linaro.org \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=konrad.dybcio@somainline.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_gurus@quicinc.com \
--cc=quic_rjendra@quicinc.com \
--cc=quic_sibis@quicinc.com \
--cc=robh+dt@kernel.org \
--cc=robimarko@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 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).