[U-Boot] [PATCH 1/4 v3] Exynos: Add hardware accelerated SHA 256

Akshay Saraswat akshay.s at samsung.com
Wed Mar 6 16:00:01 CET 2013


Hi Kim,

>On Fri, 1 Mar 2013 11:16:22 -0500
>Akshay Saraswat <akshay.s at samsung.com> wrote:
>
>> SHA-256 and SHA-1 accelerated using ACE hardware.
>
>curious about the rationale: how much faster is this than software?
>

Time taken by s/w and h/w sha256 are as given below:
Size: 0x1000
s/w - 11 ticks
h/w - 10 ticks

Size: 0x2000
s/w - 11 ticks
h/w - 10 ticks

Size: 0x4000
s/w - 13 ticks
h/w - 10 ticks

Size: 0x8000
s/w - 16 ticks
h/w - 10 ticks

Size: 0x800000
s/w - 1775 ticks
h/w - 45 ticks

Size: 0x400000
s/w - 893 ticks
h/w - 27 ticks

Size: 0x200000
s/w - 451 ticks
h/w - 18 ticks

Size: 0x8000000
s/w - 28270 ticks
h/w - 110 ticks

Size: 0x40000000
s/w - 225896 ticks
h/w - 110 ticks

>> ---
>> Changes since v2:
>> 	- Added falling back to software sha256 in case length exceeds buffer limit.
>> 	- Reduced one tab at lines 533, 559 and 571 in this patch.
>> 	- Removed space after a cast at line 506 in this patch.
>> 	- Removed blank line at line 561 in this patch.
>> 	- Removed space before semicolon at line 576 in this patch.
>
>you should retain the list of changes since v1 here.  Read:
>
>http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions
>
>> +/* Hash status */
>> +#define ACE_HASH_BUFRDY_MASK		(1 << 0)
>> +#define ACE_HASH_BUFRDY_OFF		(0 << 0)
>> +#define ACE_HASH_BUFRDY_ON		(1 << 0)
>> +#define ACE_HASH_SEEDSETTING_MASK	(1 << 1)
>> +#define ACE_HASH_SEEDSETTING_OFF	(0 << 1)
>> +#define ACE_HASH_SEEDSETTING_ON		(1 << 1)
>> +#define ACE_HASH_PRNGBUSY_MASK		(1 << 2)
>> +#define ACE_HASH_PRNGBUSY_OFF		(0 << 2)
>> +#define ACE_HASH_PRNGBUSY_ON		(1 << 2)
>> +#define ACE_HASH_PARTIALDONE_MASK	(1 << 4)
>> +#define ACE_HASH_PARTIALDONE_OFF	(0 << 4)
>> +#define ACE_HASH_PARTIALDONE_ON		(1 << 4)
>
>based on the nomenclature of the above definitions, this hardware
>obviously has support for breaking up hash requests into multiple
>buffer submissions, so do that, and not this:
>
>> +	} else if (buf_len > BUF_LIMIT) {
>> +		/*
>> +		 * ACE H/W cannot compute hash value for buffer > 8 MB.
>> +		 * Falling back to software.
>> +		 */
>> +		if (hash_type == ACE_SHA_TYPE_SHA1)
>> +			sha1_csum_wd(pbuf, buf_len, pout, CHUNKSZ_SHA1);
>> +		else
>> +			sha256_csum_wd(pbuf, buf_len, pout, CHUNKSZ_SHA256);
>> +		return 0;
>> +	}
>
>Kim
>

Regards,
Akshay Saraswat


More information about the U-Boot mailing list