mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-09-11 06:52:31 -04:00
dma: swiotlb: pass mapping attributes by reference
Change swiotlb_tbl_map_single() to take the DMA mapping attributes by reference and update the direct callers accordingly. This is a preparatory change for a follow-up patch which updates the attributes based on the selected swiotlb pool. Keeping the signature change separate makes the follow-up patch easier to review. No functional change in this patch. Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Tested-by: Michael Kelley <mhklinux@outlook.com> Tested-by: Mostafa Saleh <smostafa@google.com> Reviewed-by: Petr Tesarik <ptesarik@suse.com> Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@kernel.org> Link: https://lore.kernel.org/r/20260717180442.110954-13-aneesh.kumar@kernel.org Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
This commit is contained in:
committed by
Marek Szyprowski
parent
8277a12d0d
commit
7fcad5e371
@@ -1180,7 +1180,7 @@ static phys_addr_t iommu_dma_map_swiotlb(struct device *dev, phys_addr_t phys,
|
||||
trace_swiotlb_bounced(dev, phys, size);
|
||||
|
||||
phys = swiotlb_tbl_map_single(dev, phys, size, iova_mask(iovad), dir,
|
||||
attrs);
|
||||
&attrs);
|
||||
|
||||
/*
|
||||
* Untrusted devices should not see padding areas with random leftover
|
||||
|
||||
@@ -243,7 +243,7 @@ static dma_addr_t xen_swiotlb_map_phys(struct device *dev, phys_addr_t phys,
|
||||
*/
|
||||
trace_swiotlb_bounced(dev, dev_addr, size);
|
||||
|
||||
map = swiotlb_tbl_map_single(dev, phys, size, 0, dir, attrs);
|
||||
map = swiotlb_tbl_map_single(dev, phys, size, 0, dir, &attrs);
|
||||
if (map == (phys_addr_t)DMA_MAPPING_ERROR)
|
||||
return DMA_MAPPING_ERROR;
|
||||
|
||||
|
||||
@@ -238,7 +238,7 @@ static inline phys_addr_t default_swiotlb_limit(void)
|
||||
|
||||
phys_addr_t swiotlb_tbl_map_single(struct device *hwdev, phys_addr_t phys,
|
||||
size_t mapping_size, unsigned int alloc_aligned_mask,
|
||||
enum dma_data_direction dir, unsigned long attrs);
|
||||
enum dma_data_direction dir, unsigned long *attrs);
|
||||
dma_addr_t swiotlb_map(struct device *dev, phys_addr_t phys,
|
||||
size_t size, enum dma_data_direction dir, unsigned long attrs);
|
||||
|
||||
|
||||
@@ -1396,7 +1396,7 @@ static unsigned long mem_used(struct io_tlb_mem *mem)
|
||||
*/
|
||||
phys_addr_t swiotlb_tbl_map_single(struct device *dev, phys_addr_t orig_addr,
|
||||
size_t mapping_size, unsigned int alloc_align_mask,
|
||||
enum dma_data_direction dir, unsigned long attrs)
|
||||
enum dma_data_direction dir, unsigned long *attrs)
|
||||
{
|
||||
struct io_tlb_mem *mem = dev->dma_io_tlb_mem;
|
||||
unsigned int offset;
|
||||
@@ -1430,7 +1430,7 @@ phys_addr_t swiotlb_tbl_map_single(struct device *dev, phys_addr_t orig_addr,
|
||||
size = ALIGN(mapping_size + offset, alloc_align_mask + 1);
|
||||
index = swiotlb_find_slots(dev, orig_addr, size, alloc_align_mask, &pool);
|
||||
if (index == -1) {
|
||||
if (!(attrs & DMA_ATTR_NO_WARN))
|
||||
if (!(*attrs & DMA_ATTR_NO_WARN))
|
||||
dev_warn_ratelimited(dev,
|
||||
"swiotlb buffer is full (sz: %zd bytes), total %lu (slots), used %lu (slots)\n",
|
||||
size, mem->nslabs, mem_used(mem));
|
||||
@@ -1609,7 +1609,7 @@ dma_addr_t swiotlb_map(struct device *dev, phys_addr_t paddr, size_t size,
|
||||
|
||||
trace_swiotlb_bounced(dev, phys_to_dma(dev, paddr), size);
|
||||
|
||||
swiotlb_addr = swiotlb_tbl_map_single(dev, paddr, size, 0, dir, attrs);
|
||||
swiotlb_addr = swiotlb_tbl_map_single(dev, paddr, size, 0, dir, &attrs);
|
||||
if (swiotlb_addr == (phys_addr_t)DMA_MAPPING_ERROR)
|
||||
return DMA_MAPPING_ERROR;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user