mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
Revert "Revert "swiotlb: clean up swiotlb_tbl_unmap_single""
This reverts commit 28a2f5f10f.
Bring back the commit in 5.10.35 that broke the kabi.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ibebda0f5aeecc6ba2fe45902870b783e3e9cbb0f
This commit is contained in:
committed by
Todd Kjos
parent
2893baee79
commit
8ebef45db5
@@ -610,28 +610,29 @@ void swiotlb_tbl_unmap_single(struct device *hwdev, phys_addr_t tlb_addr,
|
|||||||
* with slots below and above the pool being returned.
|
* with slots below and above the pool being returned.
|
||||||
*/
|
*/
|
||||||
spin_lock_irqsave(&io_tlb_lock, flags);
|
spin_lock_irqsave(&io_tlb_lock, flags);
|
||||||
{
|
if (index + nslots < ALIGN(index + 1, IO_TLB_SEGSIZE))
|
||||||
count = ((index + nslots) < ALIGN(index + 1, IO_TLB_SEGSIZE) ?
|
count = io_tlb_list[index + nslots];
|
||||||
io_tlb_list[index + nslots] : 0);
|
else
|
||||||
/*
|
count = 0;
|
||||||
* Step 1: return the slots to the free list, merging the
|
|
||||||
* slots with superceeding slots
|
|
||||||
*/
|
|
||||||
for (i = index + nslots - 1; i >= index; i--) {
|
|
||||||
io_tlb_list[i] = ++count;
|
|
||||||
io_tlb_orig_addr[i] = INVALID_PHYS_ADDR;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Step 2: merge the returned slots with the preceding slots,
|
|
||||||
* if available (non zero)
|
|
||||||
*/
|
|
||||||
for (i = index - 1;
|
|
||||||
io_tlb_offset(i) != IO_TLB_SEGSIZE - 1 &&
|
|
||||||
io_tlb_list[i]; i--)
|
|
||||||
io_tlb_list[i] = ++count;
|
|
||||||
|
|
||||||
io_tlb_used -= nslots;
|
/*
|
||||||
|
* Step 1: return the slots to the free list, merging the slots with
|
||||||
|
* superceeding slots
|
||||||
|
*/
|
||||||
|
for (i = index + nslots - 1; i >= index; i--) {
|
||||||
|
io_tlb_list[i] = ++count;
|
||||||
|
io_tlb_orig_addr[i] = INVALID_PHYS_ADDR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Step 2: merge the returned slots with the preceding slots, if
|
||||||
|
* available (non zero)
|
||||||
|
*/
|
||||||
|
for (i = index - 1;
|
||||||
|
io_tlb_offset(i) != IO_TLB_SEGSIZE - 1 && io_tlb_list[i];
|
||||||
|
i--)
|
||||||
|
io_tlb_list[i] = ++count;
|
||||||
|
io_tlb_used -= nslots;
|
||||||
spin_unlock_irqrestore(&io_tlb_lock, flags);
|
spin_unlock_irqrestore(&io_tlb_lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user