From: Guru Das Srinagesh <quic_gurus@quicinc.com>
To: Rajendra Nayak <quic_rjendra@quicinc.com>
Cc: Andy Gross <agross@kernel.org>,
Bjorn Andersson <bjorn.andersson@linaro.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
<linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
"David Heidelberg" <david@ixit.cz>,
Robert Marko <robimarko@gmail.com>,
Elliot Berman <quic_eberman@quicinc.com>
Subject: Re: [PATCH v2 4/5] firmware: qcom: scm: Add wait-queue helper functions
Date: Thu, 25 Aug 2022 12:22:01 -0700 [thread overview]
Message-ID: <20220825192201.GA9699@quicinc.com> (raw)
In-Reply-To: <456915bf-b7ff-efaa-72aa-62fd05344270@quicinc.com>
On Aug 11 2022 11:13, Rajendra Nayak wrote:
>
> On 8/11/2022 8:30 AM, Guru Das Srinagesh wrote:
> >On Aug 02 2022 17:07, Rajendra Nayak wrote:
> >>
> >>On 7/23/2022 4:07 AM, Guru Das Srinagesh wrote:
> >>>When the firmware (FW) supports multiple requests per VM, and the VM
> >>>also supports it via the `allow-multi-call` device tree flag, the
> >>>floodgates are thrown open for them to all reach the firmware at the
> >>>same time.
> >
> >[...]
> >
> >>> 2) SCM_WAITQ_WAKE:
> >>>
> >>> When an SCM call receives this return value instead of success
> >>> or error, FW wishes to signal HLOS to wake up a (different)
> >>> previously sleeping call.
> >>>
> >>> FW tells HLOS which call to wake up via the additional return
> >>> values `wq_ctx`, `smc_call_ctx` and `flags`. The first two have
> >>> already been explained above.
> >>>
> >>> `flags` can be either WAKE_ONE or WAKE_ALL. Meaning, wake either
> >>> one, or all, of the SCM calls that HLOS is associating with the
> >>> given `wq_ctx`.
> >>>
> >>>A sleeping SCM call can be woken up by either an interrupt that FW
> >>>raises, or via a SCM_WAITQ_WAKE return value for a new SCM call.
> >>
> >>Do you know why the FW was not designed to always use an interrupt?
> >>That would have made the handling of this in kernel a lot less complicated.
> >
> >Because:
> >
> >1. Our firmware in TrustZone cannot raise interrupts on its own - it needs the
> >hypervisor to do that.
> >
> >2. Thus, in platforms where there is no hypervisor, there is no interrupt
> >possible - only SMC_WAITQ_WAKE.
> >
> >Therefore, relying only on an interrupt would render the driver unable to
> >support platforms without a hypervisor, which we didn't want to do.
>
> Thanks Guru for the clarification, however what problem are we really solving
> with this on platforms _without_ a hypervisor?
>
> Your cover letter said
> 'The problem this feature is fixing is as follows. In a scenario where there is
> a VM in addition to HLOS (and an underlying hypervisor):'
>
> So I assumed this was primarily for platforms _with_ a VM/Hypervisor?
>
> I understand that even with just the HLOS and no VM, if we can get these requests
> processed concurrently it still adds value, but eventually Trustzone will
> still process these requests sequentially right?
The Trustzone (TZ) firmware doesn't process all requests sequentially - there are a
few that require a "callback" back to HLOS. In such cases, the original SCM
call releases the TZ serialization lock, thereby allowing a new call to enter
TZ. It is better to have requests sleep and wake via WAITQ_SLEEP and WAITQ_WAKE
rather than the alternative - retrying an arbitrary amount of times via -EBUSY.
next prev parent reply other threads:[~2022-08-25 19:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-22 22:37 [PATCH v2 0/5] SCM: Add support for wait-queue aware firmware Guru Das Srinagesh
2022-07-22 22:37 ` [PATCH v2 1/5] dt-bindings: firmware: qcom-scm: Add "allow-multi-call" property Guru Das Srinagesh
2022-10-28 17:04 ` Krzysztof Kozlowski
2022-07-22 22:37 ` [PATCH v2 2/5] firmware: qcom: scm: Optionally remove SCM call serialization Guru Das Srinagesh
2022-07-22 22:37 ` [PATCH v2 3/5] dt-bindings: firmware: qcom-scm: Add optional interrupt Guru Das Srinagesh
2022-07-22 22:37 ` [PATCH v2 4/5] firmware: qcom: scm: Add wait-queue helper functions Guru Das Srinagesh
2022-08-02 11:37 ` Rajendra Nayak
2022-08-11 3:00 ` Guru Das Srinagesh
2022-08-11 5:43 ` Rajendra Nayak
2022-08-25 19:22 ` Guru Das Srinagesh [this message]
2022-07-22 22:37 ` [PATCH v2 5/5] firmware: qcom: scm: Add wait-queue handling logic Guru Das Srinagesh
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=20220825192201.GA9699@quicinc.com \
--to=quic_gurus@quicinc.com \
--cc=agross@kernel.org \
--cc=bjorn.andersson@linaro.org \
--cc=david@ixit.cz \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=quic_eberman@quicinc.com \
--cc=quic_rjendra@quicinc.com \
--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).