Skip to content

Commit 973ad54

Browse files
committed
Merge tag 'dma-mapping-6.3-2023-04-08' of git://git.infradead.org/users/hch/dma-mapping
Pull dma-mapping fix from Christoph Hellwig: - fix a braino in the swiotlb alignment check fix (Petr Tesarik) * tag 'dma-mapping-6.3-2023-04-08' of git://git.infradead.org/users/hch/dma-mapping: swiotlb: fix a braino in the alignment check fix
2 parents 1a8a804 + bbb73a1 commit 973ad54

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kernel/dma/swiotlb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ static int swiotlb_do_find_slots(struct device *dev, int area_index,
623623
phys_to_dma_unencrypted(dev, mem->start) & boundary_mask;
624624
unsigned long max_slots = get_max_slots(boundary_mask);
625625
unsigned int iotlb_align_mask =
626-
dma_get_min_align_mask(dev) & ~(IO_TLB_SIZE - 1);
626+
dma_get_min_align_mask(dev) | alloc_align_mask;
627627
unsigned int nslots = nr_slots(alloc_size), stride;
628628
unsigned int offset = swiotlb_align_offset(dev, orig_addr);
629629
unsigned int index, slots_checked, count = 0, i;
@@ -639,8 +639,8 @@ static int swiotlb_do_find_slots(struct device *dev, int area_index,
639639
* allocations.
640640
*/
641641
if (alloc_size >= PAGE_SIZE)
642-
iotlb_align_mask &= PAGE_MASK;
643-
iotlb_align_mask &= alloc_align_mask;
642+
iotlb_align_mask |= ~PAGE_MASK;
643+
iotlb_align_mask &= ~(IO_TLB_SIZE - 1);
644644

645645
/*
646646
* For mappings with an alignment requirement don't bother looping to

0 commit comments

Comments
 (0)