All of lore.kernel.org
 help / color / mirror / Atom feed
From: Corentin LABBE <clabbe.montjoie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	pawel.moll-5wv7dgnIgG8@public.gmane.org,
	mark.rutland-5wv7dgnIgG8@public.gmane.org,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org,
	galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org,
	linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
	herbert-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
	joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org,
	mchehab-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org,
	crope-X3B1VOXEql0@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-crypto-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Re: [PATCH v5 4/4] crypto: Add Allwinner Security System crypto accelerator
Date: Fri, 24 Oct 2014 20:50:23 +0200	[thread overview]
Message-ID: <544A9F6F.4090607@gmail.com> (raw)
In-Reply-To: <2751026.4HEPlZfN7W@wuerfel>

Le 22/10/2014 11:00, Arnd Bergmann a écrit :
> On Sunday 19 October 2014 16:16:22 LABBE Corentin wrote:
>> Add support for the Security System included in Allwinner SoC A20.
>> The Security System is a hardware cryptographic accelerator that support AES/MD5/SHA1/DES/3DES/PRNG algorithms.
>>
>> Signed-off-by: LABBE Corentin <clabbe.montjoie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> Please wrap lines in the changelog after about 70 characters.
> 

Oups I just see the corresponding part in submittingpatches.txt
Sorry

>> --- /dev/null
>> +++ b/drivers/crypto/sunxi-ss/sunxi-ss-cipher.c
>> @@ -0,0 +1,489 @@
> 
>> +#include "sunxi-ss.h"
>> +
>> +extern struct sunxi_ss_ctx *ss;
> 
> 'extern' declarations belong into header files, not .c files. It would
> be even better to avoid this completely and carry the pointer to the
> context in an object that gets passed around. In general we want drivers
> to be written in a way that allows having multiple instances of the
> device, which the global pointer prevents.
> 

As I already said I think the driver will never be used with multiple instance.
But since many people want this pointer dead, I will work on it.

>> +
>> +	src32 = (u32 *)src_addr;
>> +	dst32 = (u32 *)dst_addr;
> 
> 
> You appear to be missing '__iomem' annotations for the mmio pointers.
> Please always run your code through the 'sparse' checker using 'make C=1'
> to catch and fix this and other erros.
> 

Ok, but with which version of sparse do you have such a warning. I use the 0.5.0 version and I got no warning at all.

>> +	ileft = areq->nbytes / 4;
>> +	oleft = areq->nbytes / 4;
>> +	i = 0;
>> +	do {
>> +		if (ileft > 0 && rx_cnt > 0) {
>> +			todo = min(rx_cnt, ileft);
>> +			ileft -= todo;
>> +			do {
>> +				writel_relaxed(*src32++,
>> +						ss->base +
>> +						SS_RXFIFO);
>> +				todo--;
>> +			} while (todo > 0);
>> +		}
> 
> This looks like it should be using writesl() instead of the 
> writel_relaxed() loop. That should not only be faster but it will
> also change the byte ordering if you are running a big-endian
> kernel.
> 
> Since this is a FIFO register, the ordering that writesl uses
> is likely the correct one.

Great, the code is much cleaner with it. (with up to 10% speed gain)

Thanks

Corentin


-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

WARNING: multiple messages have this Message-ID (diff)
From: clabbe.montjoie@gmail.com (Corentin LABBE)
To: linux-arm-kernel@lists.infradead.org
Subject: [linux-sunxi] Re: [PATCH v5 4/4] crypto: Add Allwinner Security System crypto accelerator
Date: Fri, 24 Oct 2014 20:50:23 +0200	[thread overview]
Message-ID: <544A9F6F.4090607@gmail.com> (raw)
In-Reply-To: <2751026.4HEPlZfN7W@wuerfel>

Le 22/10/2014 11:00, Arnd Bergmann a ?crit :
> On Sunday 19 October 2014 16:16:22 LABBE Corentin wrote:
>> Add support for the Security System included in Allwinner SoC A20.
>> The Security System is a hardware cryptographic accelerator that support AES/MD5/SHA1/DES/3DES/PRNG algorithms.
>>
>> Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
> 
> Please wrap lines in the changelog after about 70 characters.
> 

Oups I just see the corresponding part in submittingpatches.txt
Sorry

>> --- /dev/null
>> +++ b/drivers/crypto/sunxi-ss/sunxi-ss-cipher.c
>> @@ -0,0 +1,489 @@
> 
>> +#include "sunxi-ss.h"
>> +
>> +extern struct sunxi_ss_ctx *ss;
> 
> 'extern' declarations belong into header files, not .c files. It would
> be even better to avoid this completely and carry the pointer to the
> context in an object that gets passed around. In general we want drivers
> to be written in a way that allows having multiple instances of the
> device, which the global pointer prevents.
> 

As I already said I think the driver will never be used with multiple instance.
But since many people want this pointer dead, I will work on it.

>> +
>> +	src32 = (u32 *)src_addr;
>> +	dst32 = (u32 *)dst_addr;
> 
> 
> You appear to be missing '__iomem' annotations for the mmio pointers.
> Please always run your code through the 'sparse' checker using 'make C=1'
> to catch and fix this and other erros.
> 

Ok, but with which version of sparse do you have such a warning. I use the 0.5.0 version and I got no warning at all.

>> +	ileft = areq->nbytes / 4;
>> +	oleft = areq->nbytes / 4;
>> +	i = 0;
>> +	do {
>> +		if (ileft > 0 && rx_cnt > 0) {
>> +			todo = min(rx_cnt, ileft);
>> +			ileft -= todo;
>> +			do {
>> +				writel_relaxed(*src32++,
>> +						ss->base +
>> +						SS_RXFIFO);
>> +				todo--;
>> +			} while (todo > 0);
>> +		}
> 
> This looks like it should be using writesl() instead of the 
> writel_relaxed() loop. That should not only be faster but it will
> also change the byte ordering if you are running a big-endian
> kernel.
> 
> Since this is a FIFO register, the ordering that writesl uses
> is likely the correct one.

Great, the code is much cleaner with it. (with up to 10% speed gain)

Thanks

Corentin

WARNING: multiple messages have this Message-ID (diff)
From: Corentin LABBE <clabbe.montjoie@gmail.com>
To: linux-sunxi@googlegroups.com, linux-arm-kernel@lists.infradead.org
Cc: robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com,
	ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
	maxime.ripard@free-electrons.com, linux@arm.linux.org.uk,
	herbert@gondor.apana.org.au, davem@davemloft.net,
	grant.likely@linaro.org, akpm@linux-foundation.org,
	gregkh@linuxfoundation.org, joe@perches.com,
	mchehab@osg.samsung.com, crope@iki.fi,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-crypto@vger.kernel.org
Subject: Re: [linux-sunxi] Re: [PATCH v5 4/4] crypto: Add Allwinner Security System crypto accelerator
Date: Fri, 24 Oct 2014 20:50:23 +0200	[thread overview]
Message-ID: <544A9F6F.4090607@gmail.com> (raw)
In-Reply-To: <2751026.4HEPlZfN7W@wuerfel>

Le 22/10/2014 11:00, Arnd Bergmann a écrit :
> On Sunday 19 October 2014 16:16:22 LABBE Corentin wrote:
>> Add support for the Security System included in Allwinner SoC A20.
>> The Security System is a hardware cryptographic accelerator that support AES/MD5/SHA1/DES/3DES/PRNG algorithms.
>>
>> Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
> 
> Please wrap lines in the changelog after about 70 characters.
> 

Oups I just see the corresponding part in submittingpatches.txt
Sorry

>> --- /dev/null
>> +++ b/drivers/crypto/sunxi-ss/sunxi-ss-cipher.c
>> @@ -0,0 +1,489 @@
> 
>> +#include "sunxi-ss.h"
>> +
>> +extern struct sunxi_ss_ctx *ss;
> 
> 'extern' declarations belong into header files, not .c files. It would
> be even better to avoid this completely and carry the pointer to the
> context in an object that gets passed around. In general we want drivers
> to be written in a way that allows having multiple instances of the
> device, which the global pointer prevents.
> 

As I already said I think the driver will never be used with multiple instance.
But since many people want this pointer dead, I will work on it.

>> +
>> +	src32 = (u32 *)src_addr;
>> +	dst32 = (u32 *)dst_addr;
> 
> 
> You appear to be missing '__iomem' annotations for the mmio pointers.
> Please always run your code through the 'sparse' checker using 'make C=1'
> to catch and fix this and other erros.
> 

Ok, but with which version of sparse do you have such a warning. I use the 0.5.0 version and I got no warning at all.

>> +	ileft = areq->nbytes / 4;
>> +	oleft = areq->nbytes / 4;
>> +	i = 0;
>> +	do {
>> +		if (ileft > 0 && rx_cnt > 0) {
>> +			todo = min(rx_cnt, ileft);
>> +			ileft -= todo;
>> +			do {
>> +				writel_relaxed(*src32++,
>> +						ss->base +
>> +						SS_RXFIFO);
>> +				todo--;
>> +			} while (todo > 0);
>> +		}
> 
> This looks like it should be using writesl() instead of the 
> writel_relaxed() loop. That should not only be faster but it will
> also change the byte ordering if you are running a big-endian
> kernel.
> 
> Since this is a FIFO register, the ordering that writesl uses
> is likely the correct one.

Great, the code is much cleaner with it. (with up to 10% speed gain)

Thanks

Corentin



  reply	other threads:[~2014-10-24 18:50 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-19 14:16 [PATCH v5] crypto: Add Allwinner Security System crypto accelerator LABBE Corentin
2014-10-19 14:16 ` LABBE Corentin
2014-10-19 14:16 ` LABBE Corentin
     [not found] ` <1413728182-13569-1-git-send-email-clabbe.montjoie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-10-19 14:16   ` [PATCH v5 1/4] ARM: sun7i: dt: Add Security System to A20 SoC DTS LABBE Corentin
2014-10-19 14:16     ` LABBE Corentin
2014-10-19 14:16     ` LABBE Corentin
2014-10-19 14:16   ` [PATCH v5 2/4] ARM: sunxi: dt: Add DT bindings documentation for SUNXI Security System LABBE Corentin
2014-10-19 14:16     ` LABBE Corentin
2014-10-19 14:16     ` LABBE Corentin
     [not found]     ` <1413728182-13569-3-git-send-email-clabbe.montjoie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-10-20 12:02       ` Koen Kooi
2014-10-20 12:02         ` [linux-sunxi] " Koen Kooi
2014-10-20 12:02         ` Koen Kooi
2014-10-19 14:16   ` [PATCH v5 3/4] MAINTAINERS: Add myself as maintainer of Allwinner " LABBE Corentin
2014-10-19 14:16     ` LABBE Corentin
2014-10-19 14:16     ` LABBE Corentin
2014-10-19 14:16   ` [PATCH v5 4/4] crypto: Add Allwinner Security System crypto accelerator LABBE Corentin
2014-10-19 14:16     ` LABBE Corentin
2014-10-19 14:16     ` LABBE Corentin
2014-10-20 23:28     ` Vladimir Zapolskiy
2014-10-20 23:28       ` Vladimir Zapolskiy
2014-10-20 23:52       ` Joe Perches
2014-10-20 23:52         ` Joe Perches
     [not found]         ` <1413849173.5407.6.camel-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
2014-10-21 16:39           ` Corentin LABBE
2014-10-21 16:39             ` Corentin LABBE
2014-10-21 16:39             ` Corentin LABBE
     [not found]       ` <54459AA5.2030705-ChpfBGZJDbMAvxtiuMwx3w@public.gmane.org>
2014-10-21 16:25         ` Corentin LABBE
2014-10-21 16:25           ` Corentin LABBE
2014-10-21 16:25           ` Corentin LABBE
     [not found]           ` <54468902.1040802-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-10-21 17:27             ` Vladimir Zapolskiy
2014-10-21 17:27               ` Vladimir Zapolskiy
2014-10-21 17:27               ` Vladimir Zapolskiy
2014-10-22  9:00     ` Arnd Bergmann
2014-10-22  9:00     ` Arnd Bergmann
2014-10-22  9:00       ` Arnd Bergmann
2014-10-24 18:50       ` Corentin LABBE [this message]
2014-10-24 18:50         ` [linux-sunxi] " Corentin LABBE
2014-10-24 18:50         ` Corentin LABBE
     [not found]     ` <1413728182-13569-5-git-send-email-clabbe.montjoie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-10-21 19:11       ` Maxime Ripard
2014-10-21 19:11         ` Maxime Ripard
2014-10-21 19:11         ` Maxime Ripard
2014-10-24 18:52         ` Corentin LABBE
2014-10-24 18:52           ` Corentin LABBE
2014-10-24 18:52           ` Corentin LABBE
     [not found]           ` <544A9FEA.6020304-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-10-30 17:19             ` Maxime Ripard
2014-10-30 17:19               ` Maxime Ripard
2014-10-30 17:19               ` Maxime Ripard
2014-10-31  7:20               ` Herbert Xu
2014-10-31  7:20                 ` Herbert Xu
2014-10-31  7:20                 ` Herbert Xu
     [not found]                 ` <20141031072030.GA7563-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2014-10-31  8:13                   ` Maxime Ripard
2014-10-31  8:13                     ` Maxime Ripard
2014-10-31  8:13                     ` Maxime Ripard
2014-10-31  8:18                     ` Herbert Xu
2014-10-31  8:18                       ` Herbert Xu
2014-10-31  8:18                       ` Herbert Xu
     [not found]                       ` <20141031081803.GA8012-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2014-10-31  9:57                         ` Maxime Ripard
2014-10-31  9:57                           ` Maxime Ripard
2014-10-31  9:57                           ` Maxime Ripard
2014-10-31 10:05                           ` Herbert Xu
2014-10-31 10:05                             ` Herbert Xu
     [not found]                             ` <20141031100522.GA8655-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2014-11-03  9:34                               ` Maxime Ripard
2014-11-03  9:34                                 ` Maxime Ripard
2014-11-03  9:34                                 ` Maxime Ripard
2014-11-03 10:35                                 ` Herbert Xu
2014-11-03 10:35                                   ` Herbert Xu
     [not found]                                   ` <20141103103528.GA30154-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2014-11-06 14:26                                     ` Maxime Ripard
2014-11-06 14:26                                       ` Maxime Ripard
2014-11-06 14:26                                       ` Maxime Ripard
2014-11-06 14:32                                       ` Herbert Xu
2014-11-06 14:32                                         ` Herbert Xu
     [not found]                                         ` <20141106143217.GA3636-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2014-11-16 17:13                                           ` Maxime Ripard
2014-11-16 17:13                                             ` Maxime Ripard
2014-11-16 17:13                                             ` Maxime Ripard
2014-10-22  9:00       ` Arnd Bergmann
2014-10-22  9:00     ` Arnd Bergmann
2014-10-22  9:00     ` Arnd Bergmann
2014-11-06 14:13     ` Herbert Xu
2014-11-06 14:13       ` 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=544A9F6F.4090607@gmail.com \
    --to=clabbe.montjoie-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=crope-X3B1VOXEql0@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=herbert-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org \
    --cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
    --cc=joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-crypto-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
    --cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=mchehab-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org \
    --cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.