From: JiaJie Ho <jiajie.ho@starfivetech.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S . Miller" <davem@davemloft.net>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Emil Renner Berthing <kernel@esmil.dk>,
Conor Dooley <conor.dooley@microchip.com>,
"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-riscv@lists.infradead.org"
<linux-riscv@lists.infradead.org>
Subject: RE: [PATCH v2 4/4] crypto: starfive - Add hash and HMAC support
Date: Thu, 9 Feb 2023 09:33:06 +0000 [thread overview]
Message-ID: <88a62a7a11814d629e2198583a0349b6@EXMBX168.cuchost.com> (raw)
In-Reply-To: <Y+S5fBjZQZli9nBg@gondor.apana.org.au>
> -----Original Message-----
> From: Herbert Xu <herbert@gondor.apana.org.au>
> Sent: 9 February, 2023 5:15 PM
> To: JiaJie Ho <jiajie.ho@starfivetech.com>
> Cc: David S . Miller <davem@davemloft.net>; Rob Herring
> <robh+dt@kernel.org>; Krzysztof Kozlowski
> <krzysztof.kozlowski+dt@linaro.org>; Emil Renner Berthing
> <kernel@esmil.dk>; Conor Dooley <conor.dooley@microchip.com>; linux-
> crypto@vger.kernel.org; devicetree@vger.kernel.org; linux-
> kernel@vger.kernel.org; linux-riscv@lists.infradead.org
> Subject: Re: [PATCH v2 4/4] crypto: starfive - Add hash and HMAC support
>
> On Mon, Jan 30, 2023 at 11:42:42PM +0800, Jia Jie Ho wrote:
> >
> > + cryp->hash_data = (void *)__get_free_pages(GFP_KERNEL |
> GFP_DMA32,
> > +pages);
>
> Why do you copy everything before you feed it to the hardware?
> If the issue is alignment then surely you should only to copy a small amount
> of header (and perhaps trailer) for that?
>
The DMA can only support 32-bit addressing.
So, I am copying everything in case kernel allocated memory region >32-bit for a user app.
> > +static int starfive_hash_export(struct ahash_request *req, void *out)
> > +{
> > + struct starfive_cryp_request_ctx *rctx = ahash_request_ctx(req);
> > +
> > + memcpy(out, rctx, sizeof(*rctx));
> > +
> > + return 0;
> > +}
>
> You are supposed to extract the entire hardware state after each operation
> and store that in the request context. Since your request context doesn't
> appear to contain any hash state, this can't possibly work.
>
> Does your hardware allow the non-finalised hash state to be exported, and
> re-imported later? If not then you can only implement support for digest and
> must use a fallback for everything else.
The hardware doesn't support this. I'll add the fallback in the next version.
Thanks for taking time reviewing this patch series.
Regards,
Jia Jie
next prev parent reply other threads:[~2023-02-09 9:33 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-30 15:42 [PATCH v2 0/4] crypto: starfive - Add drivers for crypto engine Jia Jie Ho
2023-01-30 15:42 ` [PATCH v2 1/4] dt-bindings: crypto: Add StarFive crypto module Jia Jie Ho
2023-02-01 1:44 ` Rob Herring
2023-01-30 15:42 ` [PATCH v2 2/4] crypto: starfive - Add crypto engine support Jia Jie Ho
2023-01-30 15:42 ` [PATCH v2 3/4] riscv: dts: starfive: Add crypto and DMA node for VisionFive 2 Jia Jie Ho
2023-03-07 21:48 ` Palmer Dabbelt
2023-01-30 15:42 ` [PATCH v2 4/4] crypto: starfive - Add hash and HMAC support Jia Jie Ho
2023-02-09 9:14 ` Herbert Xu
2023-02-09 9:33 ` JiaJie Ho [this message]
2023-02-09 9:43 ` Herbert Xu
2023-02-10 1:05 ` JiaJie Ho
2023-02-14 6:12 ` Christoph Hellwig
2023-02-14 7:11 ` JiaJie Ho
2023-02-10 2:40 ` Herbert Xu
2023-02-14 6:12 ` Christoph Hellwig
2023-02-09 9:46 ` Herbert Xu
2023-02-10 1:39 ` JiaJie Ho
2023-02-08 15:10 ` [PATCH v2 0/4] crypto: starfive - Add drivers for crypto engine JiaJie Ho
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=88a62a7a11814d629e2198583a0349b6@EXMBX168.cuchost.com \
--to=jiajie.ho@starfivetech.com \
--cc=conor.dooley@microchip.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=kernel@esmil.dk \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=robh+dt@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®