linux/tools/testing/selftests/powerpc/nx-gzip
Haren Myneni f0479c4bcb selftests/powerpc: Use proper error code to check fault address
ERR_NX_TRANSLATION(CSB.CC=5) is for internal to VAS for fault handling
and should not used by OS. ERR_NX_AT_FAULT(CSB.CC=250) is the proper
error code should be reported by OS when NX encounters address
translation failure.

This patch uses CC=250 to determine the fault address when the request
is not successful.

Signed-off-by: Haren Myneni <haren@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/0315251705baff94f678c33178491b5008723511.camel@linux.ibm.com
2020-07-15 23:10:17 +10:00
..
include selftests/powerpc: Add header files for NX compresion/decompression 2020-04-21 22:51:34 +10:00
99-nx-gzip.rules selftests/powerpc: Add README for GZIP engine tests 2020-04-21 22:51:34 +10:00
Makefile selftests/powerpc: Add NX-GZIP engine decompress testcase 2020-04-21 22:51:34 +10:00
README selftests/powerpc: Add README for GZIP engine tests 2020-04-21 22:51:34 +10:00
gunz_test.c selftests/powerpc: Use proper error code to check fault address 2020-07-15 23:10:17 +10:00
gzfht_test.c selftests/powerpc: Use proper error code to check fault address 2020-07-15 23:10:17 +10:00
gzip_vas.c selftests/powerpc: Add NX-GZIP engine compress testcase 2020-04-21 22:51:34 +10:00
nx-gzip-test.sh selftests/powerpc: Add NX-GZIP engine decompress testcase 2020-04-21 22:51:34 +10:00

README

Test the nx-gzip function:
=========================

Verify that following device exists:
  /dev/crypto/nx-gzip
If you get a permission error run as sudo or set the device permissions:
   sudo chmod go+rw /dev/crypto/nx-gzip
However, chmod may not survive across boots. You may create a udev file such
as:
   /etc/udev/rules.d/99-nx-gzip.rules


To manually build and run:
$ gcc -O3 -I./include -o gzfht_test gzfht_test.c gzip_vas.c
$ gcc -O3 -I./include -o gunz_test gunz_test.c gzip_vas.c


Compress any file using Fixed Huffman mode. Output will have a .nx.gz suffix:
$ ./gzfht_test gzip_vas.c
file gzip_vas.c read, 6413 bytes
compressed 6413 to 3124 bytes total, crc32 checksum = abd15e8a


Uncompress the previous output. Output will have a .nx.gunzip suffix:
./gunz_test gzip_vas.c.nx.gz
gzHeader FLG 0
00 00 00 00 04 03
gzHeader MTIME, XFL, OS ignored
computed checksum abd15e8a isize 0000190d
stored   checksum abd15e8a isize 0000190d
decomp is complete: fclose


Compare two files:
$ sha1sum gzip_vas.c.nx.gz.nx.gunzip gzip_vas.c
bf43e3c0c3651f5f22b6f9784cd9b1eeab4120b6  gzip_vas.c.nx.gz.nx.gunzip
bf43e3c0c3651f5f22b6f9784cd9b1eeab4120b6  gzip_vas.c


Note that the code here are intended for testing the nx-gzip hardware function.
They are not intended for demonstrating performance or compression ratio.
By being simplistic these selftests expect to allocate the entire set of source
and target pages in the memory so it needs enough memory to work.
For more information and source code consider using:
https://github.com/libnxz/power-gzip