From: Md Sadre Alam <quic_mdalam@quicinc.com>
To: Bjorn Andersson <andersson@kernel.org>
Cc: Caleb Connolly <caleb.connolly@linaro.org>, <vkoul@kernel.org>,
<robh@kernel.org>, <krzk+dt@kernel.org>, <conor+dt@kernel.org>,
<konradybcio@kernel.org>, <thara.gopinath@gmail.com>,
<herbert@gondor.apana.org.au>, <davem@davemloft.net>,
<gustavoars@kernel.org>, <u.kleine-koenig@pengutronix.de>,
<kees@kernel.org>, <agross@kernel.org>,
<linux-arm-msm@vger.kernel.org>, <dmaengine@vger.kernel.org>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-crypto@vger.kernel.org>, <quic_srichara@quicinc.com>,
<quic_varada@quicinc.com>, <quic_utiwari@quicinc.com>
Subject: Re: [PATCH v2 00/16] Add cmd descriptor support
Date: Fri, 6 Sep 2024 12:36:17 +0530 [thread overview]
Message-ID: <346d4d20-d42d-46eb-b25a-8fb9d0390892@quicinc.com> (raw)
In-Reply-To: <3vfiwr4uwaejksihd32qb7ryf3euts6urjfqwzhptkivpvo5tv@u4l2mkuoh3ln>
On 8/16/2024 9:15 PM, Bjorn Andersson wrote:
> On Fri, Aug 16, 2024 at 05:33:43PM GMT, Md Sadre Alam wrote:
>> On 8/15/2024 6:38 PM, Caleb Connolly wrote:
> [..]
>>> On 15/08/2024 10:57, Md Sadre Alam wrote:
> [..]
>>>>
>>>> tested with "tcrypt.ko" and "kcapi" tool.
>>>>
>>>> Need help to test these all the patches on msm platform
>>>
>>> DT changes here are only for a few IPQ platforms, please explain in the cover letter if this is some IPQ specific feature which doesn't exist on other platforms, or if you're only enabling it on IPQ.
>>
>> This feature is BAM hardware feature so its applicable for all the QCOM Soc where bam is there. Its not IPQ specific. Will add all the explanation in cover letter in next patch
>
> Please configure your email client such that your replies follow the
> typical style of mail list discussions. I believe go/upstream has
> instructions for this.
Ok
>
>>>
>>> Some broad strokes testing instructions (at the very least) and requirements (testing on what hardware?) aren't made obvious at all here.
>>
>> Sure will update in cover letter in next patch.
>
> I'm interested in these instructions as well, but no need to wait for
> another version to provide these instructions. Please just reply here
> (and then include them if there are future versions)
Requirements:
In QCE crypto driver we are accessing the crypto engine registers directly via CPU read/write so its possible
if other subsystem possibly Trust Zone also tries to perform some crypto operations simultaneously, a race
condition will be created and this could result in undefined behavior.
To avoid this behavior we need to use BAM HW LOCK/UNLOCK feature on BAM pipes, and this LOCK/UNLOCK will
be set via sending a command descriptor, where the HLOS/TZ QCE crypto driver prepares a command descriptor
with a dummy write operation on one of the QCE crypto engine register and pass the LOCK/UNLOCK flag along
with it.
This feature tested with tcrypt.ko and "libkcapi" with all the AES algorithm supported by QCE crypto engine.
Tested on IPQ9574 and qcm6490.LE chipset.
insmod tcrypt.ko mode=101
insmod tcrypt.ko mode=102
insmod tcrypt.ko mode=155
insmod tcrypt.ko mode=180
insmod tcrypt.ko mode=181
insmod tcrypt.ko mode=182
insmod tcrypt.ko mode=185
insmod tcrypt.ko mode=186
insmod tcrypt.ko mode=212
insmod tcrypt.ko mode=216
insmod tcrypt.ko mode=403
insmod tcrypt.ko mode=404
insmod tcrypt.ko mode=500
insmod tcrypt.ko mode=501
insmod tcrypt.ko mode=502
insmod tcrypt.ko mode=600
insmod tcrypt.ko mode=601
insmod tcrypt.ko mode=602
Encryption command line:
./kcapi -x 1 -e -c "cbc(aes)" -k
8d7dd9b0170ce0b5f2f8e1aa768e01e91da8bfc67fd486d081b28254c99eb423 -i
7fbc02ebf5b93322329df9bfccb635af -p 48981da18e4bb9ef7e2e3162d16b1910
* 8b19050f66582cb7f7e4b6c873819b71
*
Decryption command line:
* $ ./kcapi -x 1 -c "cbc(aes)" -k
3023b2418ea59a841757dcf07881b3a8def1c97b659a4dad -i
95aa5b68130be6fcf5cabe7d9f898a41 -q c313c6b50145b69a77b33404cb422598
* 836de0065f9d6f6a3dd2c53cd17e33a
* $ ./kcapi -x 3 -c sha256 -p 38f86d
* cc42f645c5aa76ac3154b023359b665375fc3ae42f025fe961fb0f65205ad70e
* $ ./kcapi -x 3 -c sha256 -p bbb300ac5eda9d
* 61f7b48577a613fbdfe0d6d90b49985e07a42c99e7a439b6efb76d5ec71b3d30
./kcapi -x 12 -c "hmac(sha256)" -k
0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b -i
000102030405060708090a0b0c -p f0f1f2f3f4f5f6f7f8f9 -b 42
*
3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf3400720
8d5b887185865
Paraller test with two different EE's (Execution Environment)
EE1 (Trust Zone) EE2 (HLOS)
There is a TZ application which "libkcapi" or "tcrypt.ko" will run in continous loop
will do continious enc/dec with to do enc/dec with different algorithm supported
different AES algorithm supported QCE crypto engine.
by QCE crypto engine.
1) dummy write with LOCK bit set 1) dummy write with LOCK bit set
2) bam will lock all other pipes which not 2) bam will lock all other pipes which not
belongs to current EE's, i.e HLOS pipe belongs to current EE's, i.e tz pipe and
and keep handling current pipe only. keep handling current pipe only.
3) tz prepare data descriptor and submit to CE5 3) hlos prepare data descriptor and submit to CE5
4) dummy write with UNLOCK bit set 4) dummy write with UNLOCK bit set
5) bam will release all the locked pipes 5) bam will release all the locked pipes
Upon encountering a descriptor with Lock bit set, the BAM will lock all other pipes not related to the current pipe group,
and keep handling the current pipe only until it sees the Un-Lock set (then it will release all locked pipes). The actual
locking is done on the new descriptor fetching for publishing, i.e. locked pipe will not fetch new descriptors even if it
got event/events adding more descriptors for this pipe.
>
> Regards,
> Bjorn
next prev parent reply other threads:[~2024-09-06 7:11 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-15 8:57 Md Sadre Alam
2024-08-15 8:57 ` [PATCH v2 01/16] dt-bindings: dma: qcom,bam: Add bam pipe lock Md Sadre Alam
2024-08-16 15:53 ` Bjorn Andersson
2024-08-21 4:54 ` Md Sadre Alam
2024-08-17 9:08 ` Krzysztof Kozlowski
2024-08-21 16:34 ` Md Sadre Alam
2024-08-22 6:27 ` Krzysztof Kozlowski
2024-08-22 11:45 ` Md Sadre Alam
2024-08-23 9:07 ` Krzysztof Kozlowski
2024-08-24 7:07 ` Md Sadre Alam
2024-08-23 15:39 ` Manivannan Sadhasivam
2024-08-24 7:04 ` Md Sadre Alam
2024-08-15 8:57 ` [PATCH v2 02/16] dmaengine: qcom: bam_dma: add bam_pipe_lock dt property Md Sadre Alam
2024-08-17 9:08 ` Krzysztof Kozlowski
2024-08-21 16:36 ` Md Sadre Alam
2024-08-15 8:57 ` [PATCH v2 03/16] dmaengine: qcom: bam_dma: add LOCK & UNLOCK flag support Md Sadre Alam
2024-08-16 16:22 ` Bjorn Andersson
2024-08-21 16:31 ` Md Sadre Alam
2024-08-15 8:57 ` [PATCH v2 04/16] crypto: qce - Add support for crypto address read Md Sadre Alam
2024-08-17 9:10 ` Krzysztof Kozlowski
2024-08-21 16:40 ` Md Sadre Alam
2024-08-15 8:57 ` [PATCH v2 05/16] crypto: qce - Add bam dma support for crypto register r/w Md Sadre Alam
2024-08-15 8:57 ` [PATCH v2 06/16] crypto: qce - Convert register r/w for skcipher via BAM/DMA Md Sadre Alam
2024-08-15 8:57 ` [PATCH v2 07/16] crypto: qce - Convert register r/w for sha " Md Sadre Alam
2024-08-15 8:57 ` [PATCH v2 08/16] crypto: qce - Convert register r/w for aead " Md Sadre Alam
2024-08-15 8:57 ` [PATCH v2 09/16] crypto: qce - Add LOCK and UNLOCK flag support Md Sadre Alam
2024-08-15 8:57 ` [PATCH v2 10/16] crypto: qce - Add support for lock aquire,lock release api Md Sadre Alam
2024-08-16 16:38 ` Bjorn Andersson
2024-08-21 5:14 ` Md Sadre Alam
2024-08-15 8:57 ` [PATCH v2 11/16] crypto: qce - Add support for lock/unlock in skcipher Md Sadre Alam
2024-08-15 8:57 ` [PATCH v2 12/16] crypto: qce - Add support for lock/unlock in sha Md Sadre Alam
2024-08-15 8:57 ` [PATCH v2 13/16] crypto: qce - Add support for lock/unlock in aead Md Sadre Alam
2024-08-15 8:57 ` [PATCH v2 14/16] arm64: dts: qcom: ipq9574: enable bam pipe locking/unlocking Md Sadre Alam
2024-08-16 16:40 ` Bjorn Andersson
2024-08-21 5:16 ` Md Sadre Alam
2024-08-15 8:57 ` [PATCH v2 15/16] arm64: dts: qcom: ipq8074: " Md Sadre Alam
2024-08-15 8:57 ` [PATCH v2 16/16] arm64: dts: qcom: ipq6018: " Md Sadre Alam
2024-08-15 13:08 ` [PATCH v2 00/16] Add cmd descriptor support Caleb Connolly
2024-08-16 12:03 ` Md Sadre Alam
2024-08-16 15:45 ` Bjorn Andersson
2024-09-06 7:06 ` Md Sadre Alam [this message]
2024-08-16 16:01 ` Bjorn Andersson
2024-08-21 4:57 ` Md Sadre Alam
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=346d4d20-d42d-46eb-b25a-8fb9d0390892@quicinc.com \
--to=quic_mdalam@quicinc.com \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=caleb.connolly@linaro.org \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=gustavoars@kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=kees@kernel.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_srichara@quicinc.com \
--cc=quic_utiwari@quicinc.com \
--cc=quic_varada@quicinc.com \
--cc=robh@kernel.org \
--cc=thara.gopinath@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=vkoul@kernel.org \
/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®