Skip to content

Commit 72f51a4

Browse files
committed
loongarch/crc32: expose CRC32 functions through lib
Move the loongarch 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/loongarch/crypto/crc32-loongarch.c to arch/loongarch/lib/crc32-loongarch.c, view this commit with 'git show -M10'. Reviewed-by: Ard Biesheuvel <[email protected]> Reviewed-by: WangYuli <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Eric Biggers <[email protected]>
1 parent 1e1b6db commit 72f51a4

File tree

7 files changed

+138
-312
lines changed

7 files changed

+138
-312
lines changed

arch/loongarch/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ config LOONGARCH
1515
select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
1616
select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
1717
select ARCH_HAS_CPU_FINALIZE_INIT
18+
select ARCH_HAS_CRC32
1819
select ARCH_HAS_CURRENT_STACK_POINTER
1920
select ARCH_HAS_DEBUG_VM_PGTABLE
2021
select ARCH_HAS_FAST_MULTIPLIER

arch/loongarch/configs/loongson3_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,6 @@ CONFIG_CRYPTO_USER_API_HASH=m
10401040
CONFIG_CRYPTO_USER_API_SKCIPHER=m
10411041
CONFIG_CRYPTO_USER_API_RNG=m
10421042
CONFIG_CRYPTO_USER_API_AEAD=m
1043-
CONFIG_CRYPTO_CRC32_LOONGARCH=m
10441043
CONFIG_CRYPTO_DEV_VIRTIO=m
10451044
CONFIG_DMA_CMA=y
10461045
CONFIG_DMA_NUMA_CMA=y

arch/loongarch/crypto/Kconfig

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,4 @@
22

33
menu "Accelerated Cryptographic Algorithms for CPU (loongarch)"
44

5-
config CRYPTO_CRC32_LOONGARCH
6-
tristate "CRC32c and CRC32"
7-
select CRC32
8-
select CRYPTO_HASH
9-
help
10-
CRC32c and CRC32 CRC algorithms
11-
12-
Architecture: LoongArch with CRC32 instructions
13-
145
endmenu

arch/loongarch/crypto/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,3 @@
22
#
33
# Makefile for LoongArch crypto files..
44
#
5-
6-
obj-$(CONFIG_CRYPTO_CRC32_LOONGARCH) += crc32-loongarch.o

arch/loongarch/crypto/crc32-loongarch.c

Lines changed: 0 additions & 300 deletions
This file was deleted.

arch/loongarch/lib/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ obj-$(CONFIG_ARCH_SUPPORTS_INT128) += tishift.o
1111
obj-$(CONFIG_CPU_HAS_LSX) += xor_simd.o xor_simd_glue.o
1212

1313
obj-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o
14+
15+
obj-$(CONFIG_CRC32_ARCH) += crc32-loongarch.o

0 commit comments

Comments
 (0)