Skip to content

Commit 1a7c685

Browse files
Marek Vasutherbertx
authored andcommitted
crypto: mxs-dcp - Align the bounce buffers
The DCP needs the bounce buffers, DMA descriptors and result buffers aligned to 64 bytes (yet another hardware limitation). Make sure they are aligned by properly aligning the structure which contains them during allocation. Signed-off-by: Marek Vasut <[email protected]> Cc: David S. Miller <[email protected]> Cc: Fabio Estevam <[email protected]> Cc: Herbert Xu <[email protected]> Cc: Shawn Guo <[email protected]> Cc: Tom Lendacky <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 26f25b2 commit 1a7c685

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/crypto/mxs-dcp.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
#define DCP_MAX_CHANS 4
3030
#define DCP_BUF_SZ PAGE_SIZE
3131

32+
#define DCP_ALIGNMENT 64
33+
3234
/* DCP DMA descriptor. */
3335
struct dcp_dma_desc {
3436
uint32_t next_cmd_addr;
@@ -947,12 +949,16 @@ static int mxs_dcp_probe(struct platform_device *pdev)
947949
}
948950

949951
/* Allocate coherent helper block. */
950-
sdcp->coh = devm_kzalloc(dev, sizeof(*sdcp->coh), GFP_KERNEL);
952+
sdcp->coh = devm_kzalloc(dev, sizeof(*sdcp->coh) + DCP_ALIGNMENT,
953+
GFP_KERNEL);
951954
if (!sdcp->coh) {
952955
ret = -ENOMEM;
953956
goto err_mutex;
954957
}
955958

959+
/* Re-align the structure so it fits the DCP constraints. */
960+
sdcp->coh = PTR_ALIGN(sdcp->coh, DCP_ALIGNMENT);
961+
956962
/* Restart the DCP block. */
957963
ret = stmp_reset_block(sdcp->base);
958964
if (ret)

0 commit comments

Comments
 (0)