Re: [RFC PATCH v4 5/6] drivers/migrate_offload: add DMA batch copy driver (dcbm)
From: Gregory Price
Date: Mon Mar 09 2026 - 14:12:43 EST
On Mon, Mar 09, 2026 at 12:07:31PM +0000, Shivank Garg wrote:
> diff --git a/drivers/migrate_offload/Kconfig b/drivers/migrate_offload/Kconfig
> new file mode 100644
> index 000000000000..0bbaedbae4ad
> --- /dev/null
> +++ b/drivers/migrate_offload/Kconfig
> @@ -0,0 +1,8 @@
> +config DCBM_DMA
> + bool "DMA Core Batch Migrator"
Should this be tri-state or is built-in the only valid state?
> +static int setup_sg_tables(struct dma_work *work, struct list_head **src_pos,
> + struct list_head **dst_pos, int nr)
> +{
... snip ..
> + dev = dmaengine_get_dma_device(work->chan);
> + if (!dev) {
> + ret = -ENODEV;
> + goto err_free_dst_table;
> + }
> + ret = dma_map_sgtable(dev, work->src_sgt, DMA_TO_DEVICE,
> + DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_NO_KERNEL_MAPPING);
> + if (ret)
> + goto err_free_dst_table;
> + ret = dma_map_sgtable(dev, work->dst_sgt, DMA_FROM_DEVICE,
> + DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_NO_KERNEL_MAPPING);
> + if (ret)
> + goto err_unmap_src;
> +
> + if (work->src_sgt->nents != work->dst_sgt->nents) {
> + ret = -EINVAL;
> + goto err_unmap_dst;
> + }
Fairly new to dma space, but I thought the dma stuff could merge pages
on iommu systems. Wouldn't this check hit fairly often?
~Gregory