[PATCH v3 3/4] ARM: dma-mapping: Switch to physical address mapping callbacks
Leon Romanovsky
leon at kernel.org
Wed Sep 17 12:46:17 PDT 2025
On Wed, Sep 17, 2025 at 04:08:46PM -0300, Jason Gunthorpe wrote:
> On Wed, Sep 17, 2025 at 09:46:25PM +0300, Leon Romanovsky wrote:
> > Let's take as an example MIPS/jazzdma, should we call to vdma_alloc()
> > in DMA_ATTR_MMIO case?
>
> Yes, that is right, this is an iommu, so it has to be programmed.
>
> > or directly return "phys" as it is done in other
> > architectures?
>
> Which?
XEN does that.
https://git.kernel.org/pub/scm/linux/kernel/git/mszyprowski/linux.git/tree/drivers/xen/swiotlb-xen.c?h=dma-mapping-for-next#n395
static dma_addr_t xen_swiotlb_direct_map_resource(struct device *dev,
phys_addr_t paddr,
size_t size,
enum dma_data_direction dir,
unsigned long attrs)
{
dma_addr_t dma_addr = paddr;
if (unlikely(!dma_capable(dev, dma_addr, size, false))) {
dev_err_once(dev,
"DMA addr %pad+%zu overflow (mask %llx, bus limit %llx).\n",
&dma_addr, size, *dev->dma_mask, dev->bus_dma_limit);
WARN_ON_ONCE(1);
return DMA_MAPPING_ERROR;
}
return dma_addr;
}
>
> > > vdpa can support ATTR_MMIO with the same iommu prot MMIO adjustment,
> > > that would be a good additional patch.
> >
> > There is "bounce page" in VDPA, it sounds like swiotlb to me, which
> > doesn't work with MMIO.
>
> Oh OK, it eventually does call pfn_to_page().. This isn't the case I
> thought it was, there is another one that just routes to iommu_map
>
> Jason
>
More information about the linux-arm-kernel
mailing list