crypto: iaa - Add support for deflate-iaa compression algorithm
This patch registers the deflate-iaa deflate compression algorithm and hooks it up to the IAA hardware using the 'fixed' compression mode introduced in the previous patch. Because the IAA hardware has a 4k history-window limitation, only buffers <= 4k, or that have been compressed using a <= 4k history window, are technically compliant with the deflate spec, which allows for a window of up to 32k. Because of this limitation, the IAA fixed mode deflate algorithm is given its own algorithm name, 'deflate-iaa'. With this change, the deflate-iaa crypto algorithm is registered and operational, and compression and decompression operations are fully enabled following the successful binding of the first IAA workqueue to the iaa_crypto sub-driver. when there are no IAA workqueues bound to the driver, the IAA crypto algorithm can be unregistered by removing the module. A new iaa_crypto 'verify_compress' driver attribute is also added, allowing the user to toggle compression verification. If set, each compress will be internally decompressed and the contents verified, returning error codes if unsuccessful. This can be toggled with 0/1: echo 0 > /sys/bus/dsa/drivers/crypto/verify_compress The default setting is '1' - verify all compresses. The verify_compress value setting at the time the algorithm is registered is captured in the algorithm's crypto_ctx and used for all compresses when using the algorithm. [ Based on work originally by George Powley, Jing Lin and Kyung Min Park ] Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
b190447e0f
commit
2ec6761df8
|
@ -4796,6 +4796,16 @@ static const struct alg_test_desc alg_test_descs[] = {
|
|||
.decomp = __VECS(deflate_decomp_tv_template)
|
||||
}
|
||||
}
|
||||
}, {
|
||||
.alg = "deflate-iaa",
|
||||
.test = alg_test_comp,
|
||||
.fips_allowed = 1,
|
||||
.suite = {
|
||||
.comp = {
|
||||
.comp = __VECS(deflate_comp_tv_template),
|
||||
.decomp = __VECS(deflate_decomp_tv_template)
|
||||
}
|
||||
}
|
||||
}, {
|
||||
.alg = "dh",
|
||||
.test = alg_test_kpp,
|
||||
|
|
|
@ -10,15 +10,42 @@
|
|||
|
||||
#define IDXD_SUBDRIVER_NAME "crypto"
|
||||
|
||||
#define IAA_DECOMP_ENABLE BIT(0)
|
||||
#define IAA_DECOMP_FLUSH_OUTPUT BIT(1)
|
||||
#define IAA_DECOMP_CHECK_FOR_EOB BIT(2)
|
||||
#define IAA_DECOMP_STOP_ON_EOB BIT(3)
|
||||
#define IAA_DECOMP_SUPPRESS_OUTPUT BIT(9)
|
||||
|
||||
#define IAA_COMP_FLUSH_OUTPUT BIT(1)
|
||||
#define IAA_COMP_APPEND_EOB BIT(2)
|
||||
|
||||
#define IAA_COMPLETION_TIMEOUT 1000000
|
||||
|
||||
#define IAA_ANALYTICS_ERROR 0x0a
|
||||
#define IAA_ERROR_DECOMP_BUF_OVERFLOW 0x0b
|
||||
#define IAA_ERROR_COMP_BUF_OVERFLOW 0x19
|
||||
#define IAA_ERROR_WATCHDOG_EXPIRED 0x24
|
||||
|
||||
#define IAA_COMP_MODES_MAX 2
|
||||
|
||||
#define FIXED_HDR 0x2
|
||||
#define FIXED_HDR_SIZE 3
|
||||
|
||||
#define IAA_COMP_FLAGS (IAA_COMP_FLUSH_OUTPUT | \
|
||||
IAA_COMP_APPEND_EOB)
|
||||
|
||||
#define IAA_DECOMP_FLAGS (IAA_DECOMP_ENABLE | \
|
||||
IAA_DECOMP_FLUSH_OUTPUT | \
|
||||
IAA_DECOMP_CHECK_FOR_EOB | \
|
||||
IAA_DECOMP_STOP_ON_EOB)
|
||||
|
||||
/* Representation of IAA workqueue */
|
||||
struct iaa_wq {
|
||||
struct list_head list;
|
||||
|
||||
struct idxd_wq *wq;
|
||||
int ref;
|
||||
bool remove;
|
||||
|
||||
struct iaa_device *iaa_device;
|
||||
};
|
||||
|
@ -119,4 +146,13 @@ int add_iaa_compression_mode(const char *name,
|
|||
|
||||
void remove_iaa_compression_mode(const char *name);
|
||||
|
||||
enum iaa_mode {
|
||||
IAA_MODE_FIXED,
|
||||
};
|
||||
|
||||
struct iaa_compression_ctx {
|
||||
enum iaa_mode mode;
|
||||
bool verify_compress;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue