Add ACE HW support for SHA256 and SHA1
Subsystems (4)
v5 cover Add ACE HW support for SHA256 and SHA1
This patch set adds hardware acceleration for SHA 256 with the help of ACE.
Changes since v1:
- Patch-1: Fixed few nits.
- Patch-2: Removed not required config.
- Patch-3: Added sha256 to hash command instead of new sha256 command.
Changes since v2:
- Patch-1:
- Added falling back to software sha256 in case length exceeds buffer limit.
- Reduced one tab at lines 533, 559 and 571 in the patch.
- Removed space after a cast at line 506 in the patch.
- Removed blank line at line 561 in the patch.
- Removed space before semicolon at line 576 in the patch.
- Patch-2:
- Added "SHA1" in the comment for config.
- Patch-3:
- Added new nodes for SHA1 and SHA256 in struct hash_algo for the case when ACE is enabled.
- Added new declaration for function pointer hash_func_ws with different return type.
- Patch-4:
- New patch to enable config for hash command.
Changes since v3:
- Patch-1:
- Removed buffer limit since there are 2 regs for address hash_msg_size_high and low. That means buffer length could go upto 2^64 bits which is practically
- Removed falling back to software sha256 because there is no buffer limit.
- Removed "/ 4" to sha1 and sha256 lengths and added increment to 4 in for loop at line 573.
- Timed out still kept to be 100 ms since this is enough for hardware to switch status to idle from busy. In case it couldn't that means h/w is faulty.
- Patch-2:
- Added "Acked-by: Simon Glass <[email protected]>".
- Patch-3:
- New patch.
- Patch-4:
- Changed command names to lower case in algo struct.
- Added generic ace_sha config.
- Patch-5: Added acked-by Simon Glass
- Added new generic config for ace_sha to enable ace support in hash.c.
Changes since v4:
- Patch-1:
- Added include for clk.h.
- Added define for MAX_FREQ.
- Added timeout calculation as per frequency.
- Changed "i+=4" to "i++" and "len" to "len/4" in for loop at line 591 in this patch.
- Added two new functions ace_sha256 and ace_sha1.
- Patch-2: None.
- Patch-3:
- Changed function names in struct algo.
- Replaced ACE_SHA_TYPE to CHUNSZ in struct algo.
- Patch-4: Added "Acked-by: Simon Glass <[email protected]>".
Akshay Saraswat (4):
Exynos: Add hardware accelerated SHA 256
Exynos: config: Enable ACE HW for SHA 256 for Exynos
gen: Add ACE acceleration to hash
Exynos: config: Enable hash command
Makefile | 1 + arch/arm/include/asm/arch-exynos/cpu.h | 4 + common/hash.c | 14 ++ drivers/crypto/Makefile | 47 +++++ drivers/crypto/ace_sfr.h | 310 +++++++++++++++++++++++++++++++++ drivers/crypto/ace_sha.c | 138 +++++++++++++++ include/ace_sha.h | 67 +++++++ include/configs/exynos5250-dt.h | 5 + 8 files changed, 586 insertions(+) create mode 100644 drivers/crypto/Makefile create mode 100644 drivers/crypto/ace_sfr.h create mode 100644 drivers/crypto/ace_sha.c create mode 100644 include/ace_sha.h
Signature · 1 line
1.8.0
PATCH v5 1/4 Exynos: Add hardware accelerated SHA256 and SHA1
SHA-256 and SHA-1 accelerated using ACE hardware.
---
Changes since v1:
- Moved code to drivers/crypto.
- Fixed few other nits.
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.
Changes since v3:
- Removed buffer limit since there are 2 regs for address hash_msg_size_high and low. That means buffer length could go upto 2^64 bits which is practically
- Removed falling back to software sha256 because there is no buffer limit.
- Removed "/ 4" to sha1 and sha256 lengths and added increment to 4 in for loop at line 573.
- Timed out still kept to be 100 ms since this is enough for hardware to switch status to idle from busy. In case it couldn't that means h/w is faulty.
Changes since v4:
- Added include for clk.h.
- Added define for MAX_FREQ.
- Added timeout calculation as per frequency.
- Changed "i+=4" to "i++" and "len" to "len/4" in for loop at line 591 in this patch.
- Added two new functions ace_sha256 and ace_sha1.
Makefile | 1 + arch/arm/include/asm/arch-exynos/cpu.h | 4 + drivers/crypto/Makefile | 47 +++++ drivers/crypto/ace_sfr.h | 310 +++++++++++++++++++++++++++++++++ drivers/crypto/ace_sha.c | 138 +++++++++++++++ include/ace_sha.h | 67 +++++++ 6 files changed, 567 insertions(+) create mode 100644 drivers/crypto/Makefile create mode 100644 drivers/crypto/ace_sfr.h create mode 100644 drivers/crypto/ace_sha.c create mode 100644 include/ace_sha.h
Makefile +1 -0
@@ -272,6 +272,7 @@ LIBS-y += disk/libdisk.o LIBS-y += drivers/bios_emulator/libatibiosemu.o LIBS-y += drivers/block/libblock.o LIBS-$(CONFIG_BOOTCOUNT_LIMIT) += drivers/bootcount/libbootcount.o +LIBS-y += drivers/crypto/libcrypto.o LIBS-y += drivers/dma/libdma.o LIBS-y += drivers/fpga/libfpga.o LIBS-y += drivers/gpio/libgpio.o
arch/arm/include/asm/arch-exynos/cpu.h +4 -0
@@ -62,6 +62,7 @@#define EXYNOS4_GPIO_PART4_BASE DEVICE_NOT_AVAILABLE#define EXYNOS4_DP_BASE DEVICE_NOT_AVAILABLE#define EXYNOS4_SPI_ISP_BASE DEVICE_NOT_AVAILABLE +#define EXYNOS4_ACE_SFR_BASE DEVICE_NOT_AVAILABLE/* EXYNOS4X12 */ #define EXYNOS4X12_GPIO_PART3_BASE 0x03860000
@@ -95,6 +96,7 @@#define EXYNOS4X12_I2S_BASE DEVICE_NOT_AVAILABLE#define EXYNOS4X12_SPI_BASE DEVICE_NOT_AVAILABLE#define EXYNOS4X12_SPI_ISP_BASE DEVICE_NOT_AVAILABLE +#define EXYNOS4X12_ACE_SFR_BASE DEVICE_NOT_AVAILABLE/* EXYNOS5 Common*/ #define EXYNOS5_I2C_SPACING 0x10000
@@ -106,6 +108,7 @@#define EXYNOS5_SWRESET 0x10040400#define EXYNOS5_SYSREG_BASE 0x10050000#define EXYNOS5_WATCHDOG_BASE 0x101D0000 +#define EXYNOS5_ACE_SFR_BASE 0x10830000#define EXYNOS5_DMC_PHY0_BASE 0x10C00000#define EXYNOS5_DMC_PHY1_BASE 0x10C10000#define EXYNOS5_GPIO_PART3_BASE 0x10D10000
@@ -205,6 +208,7 @@ static inline unsigned int samsung_get_base_##device(void) \ SAMSUNG_BASE(adc, ADC_BASE) SAMSUNG_BASE(clock, CLOCK_BASE) +SAMSUNG_BASE(ace_sfr, ACE_SFR_BASE) SAMSUNG_BASE(dp, DP_BASE) SAMSUNG_BASE(sysreg, SYSREG_BASE)SAMSUNG_BASE (fimd,FIMD_BASE )
drivers/crypto/Makefile new file +47 -0
47 lines not on this page · raw message
drivers/crypto/ace_sfr.h new file +310 -0
310 lines not on this page · raw message
drivers/crypto/ace_sha.c new file +138 -0
138 lines not on this page · raw message
include/ace_sha.h new file +67 -0
67 lines not on this page · raw message
Signature · 1 line
1.8.0
PATCH v5 1/4 Exynos: Add hardware accelerated SHA256 and SHA1
Quoted 4 lines · Akshay Saraswat
SHA-256 and SHA-1 accelerated using ACE hardware.
Signed-off-by ARUN MANKUZHI <[email protected]>Signed-off-by Akshay Saraswat <[email protected]>
Quoted 39 lines
---
Changes since v1:
- Moved code todrivers/crypto.
- Fixed few other nits.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.Changes since v3:
- Removed buffer limit since there are 2 regs for addresshash_msg_size_highand low. That means buffer length could go upto 2^64 bits which is practically
- Removed falling back to software sha256 because there is no buffer limit.
- Removed "/ 4" to sha1 and sha256 lengths and added increment to 4 in for loop at line 573.
- Timed out still kept to be 100 ms since this is enough for hardware to switch status to idle from busy. In case it couldn't that means h/w is faulty.Changes since v4:
- Added include forclk.h.
- Added define forMAX_FREQ.
- Added timeout calculation as per frequency.
- Changed "i+=4" to "i++" and "len" to "len/4" in for loop at line 591 in this patch.
- Added two new functionsace_sha256andace_sha1.Makefile | 1 + arch/arm/include/asm/arch-exynos/cpu.h | 4 + drivers/crypto/Makefile | 47 +++++ drivers/crypto/ace_sfr.h | 310 +++++++++++++++++++++++++++++++++ drivers/crypto/ace_sha.c | 138 +++++++++++++++ include/ace_sha.h | 67 +++++++ 6 files changed, 567 insertions(+) create mode 100644 drivers/crypto/Makefile create mode 100644 drivers/crypto/ace_sfr.h create mode 100644 drivers/crypto/ace_sha.c create mode 100644 include/ace_sha.h
PATCH v5 2/4 Exynos: config: Enable ACE HW for SHA 256 for Exynos
In reply to Akshay SaraswatThis enables SHA 256 for exynos.
---
Changes since v1:
- Removed not required config.
Changes sice v2:
- Added "SHA1" in the comment for config.
Changes sice v3:
- Added "Acked-by: Simon Glass <[email protected]>".
Changes sice v4:
- None.
include/configs/exynos5250-dt.h | 3 +++ 1 file changed, 3 insertions(+)
include/configs/exynos5250-dt.h +3 -0
@@ -45,6 +45,9 @@/* Keep L2 Cache Disabled */ #define CONFIG_SYS_DCACHE_OFF +/* Enable ACE acceleration for SHA1 and SHA256 */ +#define CONFIG_EXYNOS_ACE_SHA +#define CONFIG_SYS_SDRAM_BASE 0x40000000#define CONFIG_SYS_TEXT_BASE 0x43E00000
Signature · 1 line
1.8.0
PATCH v5 3/4 gen: Add ACE acceleration to hash
In reply to Akshay SaraswatACE H/W acceleration support is added to hash
which can be used to test SHA 256 hash algorithm.
---
Changes since v1:
- Added sha256 support to "hash" command instead of new sha256 command.
Changes sice v2:
- Added new nodes for SHA1 and SHA256 in struct hash_algo for the case when ACE is enabled.
- Added new declaration for function pointer hash_func_ws with different return type.
Changes sice v3:
- Changed command names to lower case in algo struct.
- Added generic ace_sha config.
Changes sice v4:
- Changed function names in struct algo.
- Replaced ACE_SHA_TYPE to CHUNSZ in struct algo.
common/hash.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
common/hash.c +14 -0
@@ -28,12 +28,26 @@#include <hash.h> #include <sha1.h> #include <sha256.h> +#include <ace_sha.h> /* * These are the hash algorithms we support. Chips which support accelerated * crypto could perhaps add named version of these algorithms here. */ static struct hash_algo hash_algo[] = { +#ifdef CONFIG_ACE_SHA + { + "sha1", + SHA1_SUM_LEN, + ace_sha1, + CHUNKSZ_SHA1, + }, { + "sha256", + SHA256_SUM_LEN, + ace_sha256, + CHUNKSZ_SHA256, + }, +#endif #ifdef CONFIG_SHA1 { "SHA1",
Signature · 1 line
1.8.0
PATCH v5 3/4 gen: Add ACE acceleration to hash
Quoted 6 lines · On Wed, 6 Mar 2013 09:18:55 -0500 Akshay Saraswat <[email protected]> wrote:
ACE H/W acceleration support is added to hash
which can be used to test SHA 256 hash algorithm.Signed-off-by ARUN MANKUZHI <[email protected]>Signed-off-by Akshay Saraswat <[email protected]>---
this doesn't even apply any more:
Applying: gen: Add ACE acceleration to hash
error: patch failed: common/hash.c:28
error: common/hash.c: patch does not apply Patch failed at 0001 gen: Add ACE acceleration to hash
Kim
PATCH v5 3/4 gen: Add ACE acceleration to hash
In reply to Akshay SaraswatQuoted 5 lines · Akshay Saraswat
ACE H/W acceleration support is added to hash
which can be used to test SHA 256 hash algorithm.Signed-off-by ARUN MANKUZHI <[email protected]>Signed-off-by Akshay Saraswat <[email protected]>
PATCH v5 4/4 Exynos: config: Enable hash command
In reply to Akshay SaraswatThis enables hash command.
Tested with command "hash sha256 0x40008000 0x2B 0x40009000". Used mm and md to write a standard string to memory location 0x40008000 and ran the above command to verify the output.
---
Changes since v2:
- New patch to enable config for hash command.
Changes since v3:
- Added new generic config for ace_sha to enable ace support in hash.c.
Changes since v4:
- Added "Acked-by: Simon Glass <[email protected]>".
include/configs/exynos5250-dt.h | 2 ++ 1 file changed, 2 insertions(+)
include/configs/exynos5250-dt.h +2 -0
@@ -47,6 +47,7 @@/* Enable ACE acceleration for SHA1 and SHA256 */ #define CONFIG_EXYNOS_ACE_SHA +#define CONFIG_ACE_SHA #define CONFIG_SYS_SDRAM_BASE 0x40000000#define CONFIG_SYS_TEXT_BASE 0x43E00000
@@ -116,6 +117,7 @@#define CONFIG_CMD_EXT2 #define CONFIG_CMD_FAT #define CONFIG_CMD_NET +#define CONFIG_CMD_HASH #define CONFIG_BOOTDELAY 3#define CONFIG_ZERO_BOOTDELAY_CHECK
Signature · 1 line
1.8.0