[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20251121232807.40491-1-21cnbao@gmail.com>
Date: Sat, 22 Nov 2025 07:28:07 +0800
From: Barry Song <21cnbao@...il.com>
To: m.szyprowski@...sung.com
Cc: 21cnbao@...il.com,
ada.coupriediaz@....com,
anshuman.khandual@....com,
ardb@...nel.org,
catalin.marinas@....com,
iommu@...ts.linux.dev,
linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org,
maz@...nel.org,
robin.murphy@....com,
ryan.roberts@....com,
surenb@...gle.com,
v-songbaohua@...o.com,
will@...nel.org,
zhengtangquan@...o.com
Subject: Re: [RFC PATCH 5/5] dma-mapping: Allow batched DMA sync operations if supported by the arch
On Sat, Nov 22, 2025 at 12:09 AM Marek Szyprowski <m.szyprowski@...sung.com> wrote:
>
> Hi Barry,
>
[...]
> This version looks a bit better to me. Similar batching could be added
> also to dma_iova_link()/dma_iova_sync() paths.
Thanks, Marek. I will respin a new version. For dma_iova, I assume you meant
something like the following?
diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index 7944a3af4545..7bb6ed663236 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -1837,7 +1837,7 @@ static int __dma_iova_link(struct device *dev, dma_addr_t addr,
int prot = dma_info_to_prot(dir, coherent, attrs);
if (!coherent && !(attrs & (DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_MMIO)))
- arch_sync_dma_for_device(phys, size, dir);
+ arch_sync_dma_for_device_batch_add(phys, size, dir);
return iommu_map_nosync(iommu_get_dma_domain(dev), addr, phys, size,
prot, GFP_ATOMIC);
@@ -1980,6 +1980,8 @@ int dma_iova_sync(struct device *dev, struct dma_iova_state *state,
dma_addr_t addr = state->addr + offset;
size_t iova_start_pad = iova_offset(iovad, addr);
+ if (!dev_is_dma_coherent(dev))
+ arch_sync_dma_batch_flush();
return iommu_sync_map(domain, addr - iova_start_pad,
iova_align(iovad, size + iova_start_pad));
}
If so, I don't really have such hardware to test. I wonder if I can make it as
patch 6/6 when respinning, and still mark it as RFC v2. Or should I leave it as
is and expect someone with the hardware to test and send it?
Thanks
Barry
Powered by blists - more mailing lists