Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\dma\swiotlb.c Create Date:2022-07-28 10:36:18
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:lb_addr is the physical address of the bounce buffer to unmap.

Proto:void swiotlb_tbl_unmap_single(struct device *hwdev, phys_addr_t tlb_addr, size_t mapping_size, size_t alloc_size, enum dma_data_direction dir, unsigned long attrs)

Type:void

Parameter:

TypeParameterName
struct device *hwdev
phys_addr_ttlb_addr
size_tmapping_size
size_talloc_size
enum dma_data_directiondir
unsigned longattrs
585  nslots = @a is a power of 2 value (alloc_size, 1 << log of the size of each IO TLB slab. The number of slabs is command line* controllable.) >> log of the size of each IO TLB slab. The number of slabs is command line* controllable.
586  index = tlb_addr - Used to do a quick range check in swiotlb_tbl_unmap_single and* swiotlb_tbl_sync_single_*, to see if the memory was in fact allocated by this* API. >> log of the size of each IO TLB slab. The number of slabs is command line* controllable.
587  orig_addr = io_tlb_orig_addr[index]
592  If orig_addr != We need to save away the original address corresponding to a mapped entry* for the sync operations. && Not (attrs & DMA_ATTR_SKIP_CPU_SYNC: Allows platform code to skip synchronization of* the CPU cache for the given buffer assuming that it has been already* transferred to 'device' domain.) && ( dir == DMA_FROM_DEVICE || dir == DMA_BIDIRECTIONAL ) Then Bounce: copy the swiotlb buffer from or back to the original dma location
603  spin_lock_irqsave( & Protect the above data structures in the map and unmap calls, flags)
605  count = If index + nslots < @a is a power of 2 value (index + 1, Maximum allowable number of contiguous slabs to map,* must be a power of 2. What is the appropriate value ?* The complexity of {map,unmap}_single is linearly dependent on this value.) Then This is a free list describing the number of free entries available from* each index[index + nslots] Else 0
611  When i >= index cycle
619  When OFFSET(i, Maximum allowable number of contiguous slabs to map,* must be a power of 2. What is the appropriate value ?* The complexity of {map,unmap}_single is linearly dependent on this value.) != Maximum allowable number of contiguous slabs to map,* must be a power of 2. What is the appropriate value ?* The complexity of {map,unmap}_single is linearly dependent on this value. - 1 && This is a free list describing the number of free entries available from* each index[i] cycle This is a free list describing the number of free entries available from* each index[i] = ++count
622  The number of used IO TLB block -= nslots
624  spin_unlock_irqrestore( & Protect the above data structures in the map and unmap calls, flags)
Caller
NameDescribe
swiotlb_mapCreate a swiotlb mapping for the buffer at @phys, and in case of DMAing* to the device copy the data into it as well.