mirror of
https://github.com/torvalds/linux.git
synced 2026-01-25 15:03:52 +08:00
xen: swiotlb: Open code map_resource callback
General dma_direct_map_resource() is going to be removed in next patch, so simply open-code it in xen driver. Reviewed-by: Juergen Gross <jgross@suse.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Link: https://lore.kernel.org/r/e9c66a92e818f416875441b6711963f9782dbbeb.1757423202.git.leonro@nvidia.com
This commit is contained in:
committed by
Marek Szyprowski
parent
18c9cbb042
commit
bf0ecb3c32
@@ -392,6 +392,25 @@ xen_swiotlb_sync_sg_for_device(struct device *dev, struct scatterlist *sgl,
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return whether the given device DMA address mask can be supported
|
||||
* properly. For example, if your device can only drive the low 24-bits
|
||||
@@ -426,5 +445,5 @@ const struct dma_map_ops xen_swiotlb_dma_ops = {
|
||||
.alloc_pages_op = dma_common_alloc_pages,
|
||||
.free_pages = dma_common_free_pages,
|
||||
.max_mapping_size = swiotlb_max_mapping_size,
|
||||
.map_resource = dma_direct_map_resource,
|
||||
.map_resource = xen_swiotlb_direct_map_resource,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user