Re: [PATCH 06/23] dmaengine: sdxi: Allocate DMA pools
From: Frank Li
Date: Mon Apr 20 2026 - 03:04:03 EST
On Fri, Apr 10, 2026 at 08:07:16AM -0500, Nathan Lynch wrote:
> Each SDXI context consists of several control structures in system
> memory:
>
> * Descriptor ring
> * Access key (AKey) table
> * Context control block (CXT_CTL)
> * Context status block (CXT_STS)
> * Write index
>
> Of these, the write index, context control and context status blocks
> are small enough to justify DMA pools.
>
> SDXI descriptors may optionally have 32-byte completion status
> blocks (CST_BLK) associated with them that software can poll for
> completion.
>
> Introduce the C structures for context control, context status, and
> completion status blocks. Create a DMA pool for each of these objects
> as well as write indexes during SDXI function initialization.
>
> Co-developed-by: Wei Huang <wei.huang2@xxxxxxx>
> Signed-off-by: Wei Huang <wei.huang2@xxxxxxx>
> Signed-off-by: Nathan Lynch <nathan.lynch@xxxxxxx>
> ---
> drivers/dma/sdxi/device.c | 34 +++++++++++++++++++++++++++++++++-
> drivers/dma/sdxi/hw.h | 28 ++++++++++++++++++++++++++++
> drivers/dma/sdxi/sdxi.h | 5 +++++
> 3 files changed, 66 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/sdxi/device.c b/drivers/dma/sdxi/device.c
> index 7e772ce81365..80bd1bbd9c7c 100644
> --- a/drivers/dma/sdxi/device.c
> +++ b/drivers/dma/sdxi/device.c
> @@ -9,6 +9,7 @@
> #include <linux/delay.h>
> #include <linux/device.h>
> #include <linux/dma-mapping.h>
> +#include <linux/dmapool.h>
> #include <linux/log2.h>
> #include <linux/slab.h>
>
> @@ -188,6 +189,37 @@ static int sdxi_fn_activate(struct sdxi_dev *sdxi)
> return 0;
> }
>
> +static int sdxi_create_dma_pool(struct sdxi_dev *sdxi, struct dma_pool **pool,
> + const char *name, size_t size)
> +{
> + *pool = dmam_pool_create(name, sdxi_to_dev(sdxi), size, size, 0);
> + return *pool ? 0 : -ENOMEM;
> +}
This helper funciton is not help much!
Frank