mbox series

[v2,0/6] Enable Qualcomm Crypto Engine on sdm845

Message ID 20201119155233.3974286-1-thara.gopinath@linaro.org
Headers show
Series Enable Qualcomm Crypto Engine on sdm845 | expand

Message

Thara Gopinath Nov. 19, 2020, 3:52 p.m. UTC
Qualcomm crypto engine supports hardware accelerated algorithms for
encryption and authentication. Enable support for aes,des,3des encryption
algorithms and sha1,sha256, hmac(sha1),hmac(sha256) authentication
algorithms on sdm845.The patch series has been tested using the kernel
crypto testing module tcrypto.ko.

v1->v2:
- Rebased to linux-next v5.10-rc4.
- Fixed subject line format in all patches as per Bjorn's feedback.

Thara Gopinath (6):
  dt-binding:clock: Add entry for crypto engine RPMH clock resource
  clk:qcom:rpmh: Add CE clock on sdm845.
  drivers:crypto:qce: Enable support for crypto engine on sdm845.
  drivers:crypto:qce: Fix SHA result buffer corruption issues.
  dts:qcom:sdm845: Add dt entries to support crypto engine.
  devicetree:bindings:crypto: Extend qcom-qce binding to add support for
    crypto engine version 5.4

 .../devicetree/bindings/crypto/qcom-qce.txt   |  4 ++-
 arch/arm64/boot/dts/qcom/sdm845.dtsi          | 30 +++++++++++++++++++
 drivers/clk/qcom/clk-rpmh.c                   |  2 ++
 drivers/crypto/qce/core.c                     | 17 ++++++++++-
 drivers/crypto/qce/sha.c                      |  2 +-
 include/dt-bindings/clock/qcom,rpmh.h         |  1 +
 6 files changed, 53 insertions(+), 3 deletions(-)

Comments

Eric Biggers Nov. 19, 2020, 10:44 p.m. UTC | #1
On Thu, Nov 19, 2020 at 10:52:27AM -0500, Thara Gopinath wrote:
> Qualcomm crypto engine supports hardware accelerated algorithms for
> encryption and authentication. Enable support for aes,des,3des encryption
> algorithms and sha1,sha256, hmac(sha1),hmac(sha256) authentication
> algorithms on sdm845.The patch series has been tested using the kernel
> crypto testing module tcrypto.ko.

Can you please test CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y too?  Implementations of
crypto algorithms shouldn't be enabled unless they are passing all tests.

Also, did you compare the performance of this hardware to ARMv8 CE?  I thought
that QCE (at least on other SoCs) isn't very useful because ARMv8 CE is faster.

- Eric
Thara Gopinath Nov. 24, 2020, 2:42 a.m. UTC | #2
On 11/19/20 5:44 PM, Eric Biggers wrote:
> On Thu, Nov 19, 2020 at 10:52:27AM -0500, Thara Gopinath wrote:
>> Qualcomm crypto engine supports hardware accelerated algorithms for
>> encryption and authentication. Enable support for aes,des,3des encryption
>> algorithms and sha1,sha256, hmac(sha1),hmac(sha256) authentication
>> algorithms on sdm845.The patch series has been tested using the kernel
>> crypto testing module tcrypto.ko.
> 
> Can you please test CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y too?  Implementations of
> crypto algorithms shouldn't be enabled unless they are passing all tests.

Hi Eric,
Yes. I will get around to this probably next week.

> 
> Also, did you compare the performance of this hardware to ARMv8 CE?  I thought
> that QCE (at least on other SoCs) isn't very useful because ARMv8 CE is faster.

That is surprising. No I did not compare performance. But I see the 
Qualcomm crypto engine driver enabled and used in the downstream tree 
for this platform. I see no reason for it not to be in mainline and to 
be maintained as an out of tree solution. I will try to run some 
performance benchmarks soon.

> 
> - Eric
>
Stephen Boyd Nov. 25, 2020, 2:05 a.m. UTC | #3
Quoting Thara Gopinath (2020-11-19 07:52:29)
> Qualcomm CE clock resource that is managed by BCM is required
> by crypto driver to access the core clock.
> 
> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> Signed-off-by: Thara Gopinath <thara.gopinath@linaro.org>
> ---

Applied to clk-next
Stephen Boyd Nov. 25, 2020, 2:05 a.m. UTC | #4
Quoting Thara Gopinath (2020-11-19 07:52:31)
> Partial hash was being copied into the final result buffer without the
> entire message block processed. Depending on how the end user processes
> this result buffer, errors vary from result buffer corruption to result
> buffer poisoing. Fix this issue by ensuring that only the final hash value
> is copied into the result buffer.
> 
> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> Signed-off-by: Thara Gopinath <thara.gopinath@linaro.org>
> ---

Any Fixes tag?
Herbert Xu Nov. 27, 2020, 6:25 a.m. UTC | #5
On Thu, Nov 19, 2020 at 10:52:27AM -0500, Thara Gopinath wrote:
> Qualcomm crypto engine supports hardware accelerated algorithms for
> encryption and authentication. Enable support for aes,des,3des encryption
> algorithms and sha1,sha256, hmac(sha1),hmac(sha256) authentication
> algorithms on sdm845.The patch series has been tested using the kernel
> crypto testing module tcrypto.ko.
> 
> v1->v2:
> - Rebased to linux-next v5.10-rc4.
> - Fixed subject line format in all patches as per Bjorn's feedback.
> 
> Thara Gopinath (6):
>   dt-binding:clock: Add entry for crypto engine RPMH clock resource
>   clk:qcom:rpmh: Add CE clock on sdm845.
>   drivers:crypto:qce: Enable support for crypto engine on sdm845.
>   drivers:crypto:qce: Fix SHA result buffer corruption issues.
>   dts:qcom:sdm845: Add dt entries to support crypto engine.
>   devicetree:bindings:crypto: Extend qcom-qce binding to add support for
>     crypto engine version 5.4
> 
>  .../devicetree/bindings/crypto/qcom-qce.txt   |  4 ++-
>  arch/arm64/boot/dts/qcom/sdm845.dtsi          | 30 +++++++++++++++++++
>  drivers/clk/qcom/clk-rpmh.c                   |  2 ++
>  drivers/crypto/qce/core.c                     | 17 ++++++++++-
>  drivers/crypto/qce/sha.c                      |  2 +-
>  include/dt-bindings/clock/qcom,rpmh.h         |  1 +
>  6 files changed, 53 insertions(+), 3 deletions(-)

Patches 3-4 applied.  Thanks.