linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] crypto: Add Allwinner Security System crypto accelerator
Date: Fri, 23 May 2014 12:46:10 +0200	[thread overview]
Message-ID: <201405231246.10365.arnd@arndb.de> (raw)
In-Reply-To: <537E3E2F.7000407@gmail.com>

On Thursday 22 May 2014, Corentin LABBE wrote:
> Le 22/05/2014 17:28, Arnd Bergmann a ?crit :
> > On Thursday 22 May 2014 17:09:56 LABBE Corentin wrote:
> >> Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
> > 
> > My feeling is that this should either be one driver that provides
> > all five algorithms unconditionally, or five drivers that are each
> > separate loadable modules and based on top of a common module
> > that only exports functions but has no active logic itself
> 
> I agree for the split.
> It was my first intention but I feared to add too many files.
> So I propose to split in 6, sunxi-ss-hash.c, sunxi-ss-des.c, sunxi-ss-aes.c, sunxi-ss-rng.c, sunxi-ss-common.c and sunxi-ss.h
> Does can I add a sunxi-ss directory in drivers/crypto ?

Yes, I think a subdirectory would be best.


> >> +	/* If we have more than one SG, we cannot use kmap_atomic since
> >> +	 * we hold the mapping too long*/
> >> +	src_addr = kmap(sg_page(in_sg)) + in_sg->offset;
> >> +	if (src_addr == NULL) {
> >> +		dev_err(ss_ctx->dev, "KMAP error for src SG\n");
> >> +		return -1;
> >> +	}
> >> +	dst_addr = kmap(sg_page(out_sg)) + out_sg->offset;
> >> +	if (dst_addr == NULL) {
> >> +		kunmap(src_addr);
> >> +		dev_err(ss_ctx->dev, "KMAP error for dst SG\n");
> >> +		return -1;
> >> +	}
> >> +	src32 = (u32 *)src_addr;
> >> +	dst32 = (u32 *)dst_addr;
> >> +	ileft = nbytes / 4;
> >> +	oleft = nbytes / 4;
> >> +	sgileft = in_sg->length / 4;
> >> +	sgoleft = out_sg->length / 4;
> >> +	do {
> >> +		tmp = readl_relaxed(ss_ctx->base + SUNXI_SS_FCSR);
> >> +		rx_cnt = SS_RXFIFO_SPACES(tmp);
> >> +		tx_cnt = SS_TXFIFO_SPACES(tmp);
> >> +		todo = min3(rx_cnt, ileft, sgileft);
> >> +		if (todo > 0) {
> >> +			ileft -= todo;
> >> +			sgileft -= todo;
> >> +		}
> >> +		while (todo > 0) {
> >> +			writel_relaxed(*src32++, ss_ctx->base + SS_RXFIFO);
> >> +			todo--;
> >> +		}
> > 
> > I wonder if this is meant to be used in combination with a dma engine
> > rather than accessed with writel/readl.
> 
> You could do both, but the dmaengine driver is under development.
> When it will be ready, I will add DMA support.
> But my intention is to keep both mode, since poll mode is better than DMA for small request.

Ok, I see.

> > How does the original driver do it?
> 
> There are no original driver, this driver is the first for the Security System.

Ah, I thought there was one in the allwinner BSP kernel.

	Arnd

  reply	other threads:[~2014-05-23 10:46 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-22 15:09 crypto: Add Allwinner Security System crypto accelerator LABBE Corentin
2014-05-22 15:09 ` [PATCH 1/3] dt: Add DT bindings documentation for SUNXI Security System LABBE Corentin
2014-05-24 11:21   ` Marek Vasut
2014-05-24 19:20     ` Tomasz Figa
2014-05-24 19:43       ` Marek Vasut
2014-05-24 19:51         ` Tomasz Figa
2014-05-24 19:59           ` Marek Vasut
2014-05-25 13:09             ` Maxime Ripard
2014-05-25 13:07         ` Maxime Ripard
2014-05-22 15:09 ` [PATCH 2/3] ARM: sun7i: dt: Add Security System to A20 SoC DTS LABBE Corentin
2014-05-24 11:23   ` Marek Vasut
2014-05-22 15:09 ` [PATCH 3/3] crypto: Add Allwinner Security System crypto accelerator LABBE Corentin
2014-05-22 15:28   ` Arnd Bergmann
2014-05-22 18:13     ` Corentin LABBE
2014-05-23 10:46       ` Arnd Bergmann [this message]
2014-05-24 11:26         ` Marek Vasut
2014-05-24 12:00   ` Marek Vasut
2014-05-25 11:58     ` Corentin LABBE
2014-05-25 14:30       ` Marek Vasut
2014-07-23 13:57     ` Herbert Xu
2014-07-23 14:07       ` Marek Vasut
2014-07-23 14:13         ` Herbert Xu
2014-07-23 15:51           ` Marek Vasut
2014-07-23 18:52             ` Corentin LABBE
2014-07-23 19:38               ` Marek Vasut
2014-07-24  1:40                 ` Herbert Xu

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=201405231246.10365.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).