History

swiotlb: Update is_swiotlb_buffer to add a struct device argument

Update is_swiotlb_buffer to add a struct device argument. This will be useful later to allow for different pools.

Claire Chang committed 5 years ago

Commit 7fd856a1 parent 69031f55 files · +17 −16Browse files

Showing the changes to kernel (2 of 5 files). Show all

Unified · Split

2 files
  1. kernel/dma/direct.c +3 −3
  2. kernel/dma/direct.h +3 −3
kernel/dma/direct.c+3−3
@@ -343,7 +343,7 @@ void dma_direct_sync_sg_for_device(struct device *dev, · 342 unmodified lines
343 for_each_sg(sgl, sg, nents, i) {343 for_each_sg(sgl, sg, nents, i) {
344 phys_addr_t paddr = dma_to_phys(dev, sg_dma_address(sg));344 phys_addr_t paddr = dma_to_phys(dev, sg_dma_address(sg));
345 345
346 if (unlikely(is_swiotlb_buffer(paddr)))346 if (unlikely(is_swiotlb_buffer(dev, paddr)))
347 swiotlb_sync_single_for_device(dev, paddr, sg->length,347 swiotlb_sync_single_for_device(dev, paddr, sg->length,
348 dir);348 dir);
349 349
@@ -369,7 +369,7 @@ void dma_direct_sync_sg_for_cpu(struct device *dev, · 19 unmodified lines
369 if (!dev_is_dma_coherent(dev))369 if (!dev_is_dma_coherent(dev))
370 arch_sync_dma_for_cpu(paddr, sg->length, dir);370 arch_sync_dma_for_cpu(paddr, sg->length, dir);
371 371
372 if (unlikely(is_swiotlb_buffer(paddr)))372 if (unlikely(is_swiotlb_buffer(dev, paddr)))
373 swiotlb_sync_single_for_cpu(dev, paddr, sg->length,373 swiotlb_sync_single_for_cpu(dev, paddr, sg->length,
374 dir);374 dir);
375 375
@@ -504,7 +504,7 @@ size_t dma_direct_max_mapping_size(struct device *dev) · 128 unmodified lines
504bool dma_direct_need_sync(struct device *dev, dma_addr_t dma_addr)504bool dma_direct_need_sync(struct device *dev, dma_addr_t dma_addr)
505{505{
506 return !dev_is_dma_coherent(dev) ||506 return !dev_is_dma_coherent(dev) ||
507 is_swiotlb_buffer(dma_to_phys(dev, dma_addr));507 is_swiotlb_buffer(dev, dma_to_phys(dev, dma_addr));
508}508}
509 509
510/**510/**
kernel/dma/direct.h+3−3
@@ -56,7 +56,7 @@ static inline void dma_direct_sync_single_for_device(struct device *dev, · 55 unmodified lines
56{56{
57 phys_addr_t paddr = dma_to_phys(dev, addr);57 phys_addr_t paddr = dma_to_phys(dev, addr);
58 58
59 if (unlikely(is_swiotlb_buffer(paddr)))59 if (unlikely(is_swiotlb_buffer(dev, paddr)))
60 swiotlb_sync_single_for_device(dev, paddr, size, dir);60 swiotlb_sync_single_for_device(dev, paddr, size, dir);
61 61
62 if (!dev_is_dma_coherent(dev))62 if (!dev_is_dma_coherent(dev))
@@ -73,7 +73,7 @@ static inline void dma_direct_sync_single_for_cpu(struct device *dev, · 10 unmodified lines
73 arch_sync_dma_for_cpu_all();73 arch_sync_dma_for_cpu_all();
74 }74 }
75 75
76 if (unlikely(is_swiotlb_buffer(paddr)))76 if (unlikely(is_swiotlb_buffer(dev, paddr)))
77 swiotlb_sync_single_for_cpu(dev, paddr, size, dir);77 swiotlb_sync_single_for_cpu(dev, paddr, size, dir);
78 78
79 if (dir == DMA_FROM_DEVICE)79 if (dir == DMA_FROM_DEVICE)
@@ -113,7 +113,7 @@ static inline void dma_direct_unmap_page(struct device *dev, dma_addr_t addr, · 33 unmodified lines
113 if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))113 if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
114 dma_direct_sync_single_for_cpu(dev, addr, size, dir);114 dma_direct_sync_single_for_cpu(dev, addr, size, dir);
115 115
116 if (unlikely(is_swiotlb_buffer(phys)))116 if (unlikely(is_swiotlb_buffer(dev, phys)))
117 swiotlb_tbl_unmap_single(dev, phys, size, dir, attrs);117 swiotlb_tbl_unmap_single(dev, phys, size, dir, attrs);
118}118}
119#endif /* _KERNEL_DMA_DIRECT_H */119#endif /* _KERNEL_DMA_DIRECT_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t