Skip to content

Commit

Permalink
mips/crc32: expose CRC32 functions through lib
Browse files Browse the repository at this point in the history
Move the mips CRC32 assembly code into the lib directory and wire it up
to the library interface.  This allows it to be used without going
through the crypto API.  It remains usable via the crypto API too via
the shash algorithms that use the library interface.  Thus all the
arch-specific "shash" code becomes unnecessary and is removed.

Note: to see the diff from arch/mips/crypto/crc32-mips.c to
arch/mips/lib/crc32-mips.c, view this commit with 'git show -M10'.

Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20241202010844.144356-8-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
  • Loading branch information
Eric Biggers committed Dec 2, 2024
1 parent 72f51a4 commit 289c270
Show file tree
Hide file tree
Showing 10 changed files with 195 additions and 374 deletions.
5 changes: 1 addition & 4 deletions arch/mips/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1995,11 +1995,11 @@ config CPU_MIPSR5
config CPU_MIPSR6
bool
default y if CPU_MIPS32_R6 || CPU_MIPS64_R6
select ARCH_HAS_CRC32
select CPU_HAS_RIXI
select CPU_HAS_DIEI if !CPU_DIEI_BROKEN
select HAVE_ARCH_BITREVERSE
select MIPS_ASID_BITS_VARIABLE
select MIPS_CRC_SUPPORT
select MIPS_SPRAM

config TARGET_ISA_REV
Expand Down Expand Up @@ -2475,9 +2475,6 @@ config MIPS_ASID_BITS
config MIPS_ASID_BITS_VARIABLE
bool

config MIPS_CRC_SUPPORT
bool

# R4600 erratum. Due to the lack of errata information the exact
# technical details aren't known. I've experimentally found that disabling
# interrupts during indexed I-cache flushes seems to be sufficient to deal
Expand Down
1 change: 0 additions & 1 deletion arch/mips/configs/eyeq5_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ CONFIG_NFS_V4=y
CONFIG_NFS_V4_1=y
CONFIG_NFS_V4_2=y
CONFIG_ROOT_NFS=y
CONFIG_CRYPTO_CRC32_MIPS=y
CONFIG_FRAME_WARN=1024
CONFIG_DEBUG_FS=y
# CONFIG_RCU_TRACE is not set
Expand Down
1 change: 0 additions & 1 deletion arch/mips/configs/eyeq6_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ CONFIG_NFS_V4=y
CONFIG_NFS_V4_1=y
CONFIG_NFS_V4_2=y
CONFIG_ROOT_NFS=y
CONFIG_CRYPTO_CRC32_MIPS=y
CONFIG_FRAME_WARN=1024
CONFIG_DEBUG_FS=y
# CONFIG_RCU_TRACE is not set
Expand Down
2 changes: 0 additions & 2 deletions arch/mips/configs/generic/32r6.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
CONFIG_CPU_MIPS32_R6=y
CONFIG_HIGHMEM=y

CONFIG_CRYPTO_CRC32_MIPS=y
1 change: 0 additions & 1 deletion arch/mips/configs/generic/64r6.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ CONFIG_MIPS32_O32=y
CONFIG_MIPS32_N32=y

CONFIG_CPU_HAS_MSA=y
CONFIG_CRYPTO_CRC32_MIPS=y
CONFIG_VIRTUALIZATION=y
9 changes: 0 additions & 9 deletions arch/mips/crypto/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@

menu "Accelerated Cryptographic Algorithms for CPU (mips)"

config CRYPTO_CRC32_MIPS
tristate "CRC32c and CRC32"
depends on MIPS_CRC_SUPPORT
select CRYPTO_HASH
help
CRC32c and CRC32 CRC algorithms

Architecture: mips

config CRYPTO_POLY1305_MIPS
tristate "Hash functions: Poly1305"
depends on MIPS
Expand Down
2 changes: 0 additions & 2 deletions arch/mips/crypto/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# Makefile for MIPS crypto files..
#

obj-$(CONFIG_CRYPTO_CRC32_MIPS) += crc32-mips.o

obj-$(CONFIG_CRYPTO_CHACHA_MIPS) += chacha-mips.o
chacha-mips-y := chacha-core.o chacha-glue.o
AFLAGS_chacha-core.o += -O2 # needed to fill branch delay slots
Expand Down
Loading

0 comments on commit 289c270

Please sign in to comment.