Skip to content

Commit b2f46fd

Browse files
committed
async_tx: add support for asynchronous GF multiplication
[ Based on an original patch by Yuri Tikhonov ] This adds support for doing asynchronous GF multiplication by adding two additional functions to the async_tx API: async_gen_syndrome() does simultaneous XOR and Galois field multiplication of sources. async_syndrome_val() validates the given source buffers against known P and Q values. When a request is made to run async_pq against more than the hardware maximum number of supported sources we need to reuse the previous generated P and Q values as sources into the next operation. Care must be taken to remove Q from P' and P from Q'. For example to perform a 5 source pq op with hardware that only supports 4 sources at a time the following approach is taken: p, q = PQ(src0, src1, src2, src3, COEF({01}, {02}, {04}, {08})) p', q' = PQ(p, q, q, src4, COEF({00}, {01}, {00}, {10})) p' = p + q + q + src4 = p + src4 q' = {00}*p + {01}*q + {00}*q + {10}*src4 = q + {10}*src4 Note: 4 is the minimum acceptable maxpq otherwise we punt to synchronous-software path. The DMA_PREP_CONTINUE flag indicates to the driver to reuse p and q as sources (in the above manner) and fill the remaining slots up to maxpq with the new sources/coefficients. Note1: Some devices have native support for P+Q continuation and can skip this extra work. Devices with this capability can advertise it with dma_set_maxpq. It is up to each driver how to handle the DMA_PREP_CONTINUE flag. Note2: The api supports disabling the generation of P when generating Q, this is ignored by the synchronous path but is implemented by some dma devices to save unnecessary writes. In this case the continuation algorithm is simplified to only reuse Q as a source. Cc: H. Peter Anvin <hpa@zytor.com> Cc: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Yuri Tikhonov <yur@emcraft.com> Signed-off-by: Ilya Yanok <yanok@emcraft.com> Reviewed-by: Andre Noll <maan@systemlinux.org> Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 95475e5 commit b2f46fd

10 files changed

Lines changed: 493 additions & 9 deletions

File tree

‎Documentation/crypto/async-tx-api.txt‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ xor - xor a series of source buffers and write the result to a
6464
xor_val - xor a series of source buffers and set a flag if the
6565
result is zero. The implementation attempts to prevent
6666
writes to memory
67+
pq - generate the p+q (raid6 syndrome) from a series of source buffers
68+
pq_val - validate that a p and or q buffer are in sync with a given series of
69+
sources
6770

6871
3.3 Descriptor management:
6972
The return value is non-NULL and points to a 'descriptor' when the operation

‎arch/arm/mach-iop13xx/setup.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ void __init iop13xx_platform_init(void)
506506
dma_cap_set(DMA_MEMSET, plat_data->cap_mask);
507507
dma_cap_set(DMA_MEMCPY_CRC32C, plat_data->cap_mask);
508508
dma_cap_set(DMA_INTERRUPT, plat_data->cap_mask);
509-
dma_cap_set(DMA_PQ_XOR, plat_data->cap_mask);
509+
dma_cap_set(DMA_PQ, plat_data->cap_mask);
510510
dma_cap_set(DMA_PQ_UPDATE, plat_data->cap_mask);
511511
dma_cap_set(DMA_PQ_VAL, plat_data->cap_mask);
512512
break;

‎crypto/async_tx/Kconfig‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ config ASYNC_MEMSET
1414
tristate
1515
select ASYNC_CORE
1616

17+
config ASYNC_PQ
18+
tristate
19+
select ASYNC_CORE
20+

‎crypto/async_tx/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ obj-$(CONFIG_ASYNC_CORE) += async_tx.o
22
obj-$(CONFIG_ASYNC_MEMCPY) += async_memcpy.o
33
obj-$(CONFIG_ASYNC_MEMSET) += async_memset.o
44
obj-$(CONFIG_ASYNC_XOR) += async_xor.o
5+
obj-$(CONFIG_ASYNC_PQ) += async_pq.o

0 commit comments

Comments
 (0)