lz4: Use ARM64 v8 ASM to accelerate decompression

Change-Id: I2c14ffc6ee9dcc0f2170f9f90169a08505dc43ed
Signed-off-by: Tashfin Shakeer Rhythm <tashfinshakeerrhythm@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This commit is contained in:
Tashfin Shakeer Rhythm 2023-02-22 19:09:38 +06:00 committed by Richard Raya
parent 539a2175c0
commit 7bd5b033d5
4 changed files with 23 additions and 2 deletions

View File

@ -94,7 +94,13 @@ static int lz4_compress_crypto(struct crypto_tfm *tfm, const u8 *src,
static int __lz4_decompress_crypto(const u8 *src, unsigned int slen,
u8 *dst, unsigned int *dlen, void *ctx)
{
int out_len = LZ4_decompress_safe(src, dst, slen, *dlen);
int out_len;
#if defined(CONFIG_ARM64) && defined(CONFIG_KERNEL_MODE_NEON)
out_len = LZ4_arm64_decompress_safe(src, dst, slen, *dlen, false);
#else
out_len = LZ4_decompress_safe(src, dst, slen, *dlen);
#endif
if (out_len < 0)
return -EINVAL;

View File

@ -95,7 +95,13 @@ static int lz4hc_compress_crypto(struct crypto_tfm *tfm, const u8 *src,
static int __lz4hc_decompress_crypto(const u8 *src, unsigned int slen,
u8 *dst, unsigned int *dlen, void *ctx)
{
int out_len = LZ4_decompress_safe(src, dst, slen, *dlen);
int out_len;
#if defined(CONFIG_ARM64) && defined(CONFIG_KERNEL_MODE_NEON)
out_len = LZ4_arm64_decompress_safe(src, dst, slen, *dlen, false);
#else
out_len = LZ4_decompress_safe(src, dst, slen, *dlen);
#endif
if (out_len < 0)
return -EINVAL;

View File

@ -661,4 +661,8 @@ int LZ4_decompress_safe_continue(LZ4_streamDecode_t *LZ4_streamDecode,
//int LZ4_decompress_fast_usingDict(const char *source, char *dest,
// int originalSize, const char *dictStart, int dictSize);
ssize_t LZ4_arm64_decompress_safe(const void *source, void *dest, size_t inputSize, size_t outputSize, bool dip);
ssize_t LZ4_arm64_decompress_safe_partial(const void *source, void *dest, size_t inputSize, size_t outputSize, bool dip);
#endif

View File

@ -1018,8 +1018,13 @@ int LZ4_decompress_safe_continue(LZ4_streamDecode_t *LZ4_streamDecode,
if (lz4sd->prefixSize == 0) {
/* The first call, no dictionary yet. */
assert(lz4sd->extDictSize == 0);
#if defined(CONFIG_ARM64) && defined(CONFIG_KERNEL_MODE_NEON)
result = LZ4_arm64_decompress_safe(source, dest, compressedSize,
maxOutputSize, false);
#else
result = LZ4_decompress_safe(source, dest, compressedSize,
maxOutputSize);
#endif
if (result <= 0)
return result;
lz4sd->prefixSize = (size_t)result;