Skip to content

Commit e5bc76b

Browse files
Jan Kuligavinodkoul
authored andcommitted
dmaengine: xilinx: xdma: Ease dma_pool alignment requirements
According to the XDMA datasheet (PG195), the address of any descriptor must be 32 byte aligned. The datasheet also states that a contiguous block of descriptors must not cross a 4k address boundary. Therefore, it is possible to ease the pressure put on the dma_pool allocator just by requiring sufficient alignment and boundary values. Add proper macro definition and change the values passed into the dma_pool_create(). Signed-off-by: Jan Kuliga <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 7a9c7f4 commit e5bc76b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

drivers/dma/xilinx/xdma-regs.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ struct xdma_hw_desc {
6464
__le64 next_desc;
6565
};
6666

67-
#define XDMA_DESC_SIZE sizeof(struct xdma_hw_desc)
68-
#define XDMA_DESC_BLOCK_SIZE (XDMA_DESC_SIZE * XDMA_DESC_ADJACENT)
69-
#define XDMA_DESC_BLOCK_ALIGN 4096
67+
#define XDMA_DESC_SIZE sizeof(struct xdma_hw_desc)
68+
#define XDMA_DESC_BLOCK_SIZE (XDMA_DESC_SIZE * XDMA_DESC_ADJACENT)
69+
#define XDMA_DESC_BLOCK_ALIGN 32
70+
#define XDMA_DESC_BLOCK_BOUNDARY 4096
7071

7172
/*
7273
* Channel registers

drivers/dma/xilinx/xdma.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -741,9 +741,8 @@ static int xdma_alloc_chan_resources(struct dma_chan *chan)
741741
return -EINVAL;
742742
}
743743

744-
xdma_chan->desc_pool = dma_pool_create(dma_chan_name(chan),
745-
dev, XDMA_DESC_BLOCK_SIZE,
746-
XDMA_DESC_BLOCK_ALIGN, 0);
744+
xdma_chan->desc_pool = dma_pool_create(dma_chan_name(chan), dev, XDMA_DESC_BLOCK_SIZE,
745+
XDMA_DESC_BLOCK_ALIGN, XDMA_DESC_BLOCK_BOUNDARY);
747746
if (!xdma_chan->desc_pool) {
748747
xdma_err(xdev, "unable to allocate descriptor pool");
749748
return -ENOMEM;

0 commit comments

Comments
 (0)