Skip to content

Commit 66930e7

Browse files
committed
Merge branch 'stable/for-linus-5.10-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb into for-next/iommu/vt-d
Merge swiotlb updates from Konrad, as we depend on the updated function prototype for swiotlb_tbl_map_single(), which dropped the 'tbl_dma_addr' argument in -rc4. * 'stable/for-linus-5.10-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb: swiotlb: remove the tbl_dma_addr argument to swiotlb_tbl_map_single swiotlb: fix "x86: Don't panic if can not alloc buffer for swiotlb"
2 parents 68dd9d8 + fc0021a commit 66930e7

File tree

4 files changed

+17
-23
lines changed

4 files changed

+17
-23
lines changed

drivers/iommu/intel/iommu.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3818,9 +3818,8 @@ bounce_map_single(struct device *dev, phys_addr_t paddr, size_t size,
38183818
* page aligned, we don't need to use a bounce page.
38193819
*/
38203820
if (!IS_ALIGNED(paddr | size, VTD_PAGE_SIZE)) {
3821-
tlb_addr = swiotlb_tbl_map_single(dev,
3822-
phys_to_dma_unencrypted(dev, io_tlb_start),
3823-
paddr, size, aligned_size, dir, attrs);
3821+
tlb_addr = swiotlb_tbl_map_single(dev, paddr, size,
3822+
aligned_size, dir, attrs);
38243823
if (tlb_addr == DMA_MAPPING_ERROR) {
38253824
goto swiotlb_error;
38263825
} else {

drivers/xen/swiotlb-xen.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,7 @@ static dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
395395
*/
396396
trace_swiotlb_bounced(dev, dev_addr, size, swiotlb_force);
397397

398-
map = swiotlb_tbl_map_single(dev, virt_to_phys(xen_io_tlb_start),
399-
phys, size, size, dir, attrs);
398+
map = swiotlb_tbl_map_single(dev, phys, size, size, dir, attrs);
400399
if (map == (phys_addr_t)DMA_MAPPING_ERROR)
401400
return DMA_MAPPING_ERROR;
402401

include/linux/swiotlb.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,9 @@ enum dma_sync_target {
4545
SYNC_FOR_DEVICE = 1,
4646
};
4747

48-
extern phys_addr_t swiotlb_tbl_map_single(struct device *hwdev,
49-
dma_addr_t tbl_dma_addr,
50-
phys_addr_t phys,
51-
size_t mapping_size,
52-
size_t alloc_size,
53-
enum dma_data_direction dir,
54-
unsigned long attrs);
48+
phys_addr_t swiotlb_tbl_map_single(struct device *hwdev, phys_addr_t phys,
49+
size_t mapping_size, size_t alloc_size,
50+
enum dma_data_direction dir, unsigned long attrs);
5551

5652
extern void swiotlb_tbl_unmap_single(struct device *hwdev,
5753
phys_addr_t tlb_addr,

kernel/dma/swiotlb.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ int __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose)
229229
io_tlb_orig_addr[i] = INVALID_PHYS_ADDR;
230230
}
231231
io_tlb_index = 0;
232+
no_iotlb_memory = false;
232233

233234
if (verbose)
234235
swiotlb_print_info();
@@ -260,9 +261,11 @@ swiotlb_init(int verbose)
260261
if (vstart && !swiotlb_init_with_tbl(vstart, io_tlb_nslabs, verbose))
261262
return;
262263

263-
if (io_tlb_start)
264+
if (io_tlb_start) {
264265
memblock_free_early(io_tlb_start,
265266
PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT));
267+
io_tlb_start = 0;
268+
}
266269
pr_warn("Cannot allocate buffer");
267270
no_iotlb_memory = true;
268271
}
@@ -360,6 +363,7 @@ swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs)
360363
io_tlb_orig_addr[i] = INVALID_PHYS_ADDR;
361364
}
362365
io_tlb_index = 0;
366+
no_iotlb_memory = false;
363367

364368
swiotlb_print_info();
365369

@@ -441,14 +445,11 @@ static void swiotlb_bounce(phys_addr_t orig_addr, phys_addr_t tlb_addr,
441445
}
442446
}
443447

444-
phys_addr_t swiotlb_tbl_map_single(struct device *hwdev,
445-
dma_addr_t tbl_dma_addr,
446-
phys_addr_t orig_addr,
447-
size_t mapping_size,
448-
size_t alloc_size,
449-
enum dma_data_direction dir,
450-
unsigned long attrs)
448+
phys_addr_t swiotlb_tbl_map_single(struct device *hwdev, phys_addr_t orig_addr,
449+
size_t mapping_size, size_t alloc_size,
450+
enum dma_data_direction dir, unsigned long attrs)
451451
{
452+
dma_addr_t tbl_dma_addr = phys_to_dma_unencrypted(hwdev, io_tlb_start);
452453
unsigned long flags;
453454
phys_addr_t tlb_addr;
454455
unsigned int nslots, stride, index, wrap;
@@ -667,9 +668,8 @@ dma_addr_t swiotlb_map(struct device *dev, phys_addr_t paddr, size_t size,
667668
trace_swiotlb_bounced(dev, phys_to_dma(dev, paddr), size,
668669
swiotlb_force);
669670

670-
swiotlb_addr = swiotlb_tbl_map_single(dev,
671-
phys_to_dma_unencrypted(dev, io_tlb_start),
672-
paddr, size, size, dir, attrs);
671+
swiotlb_addr = swiotlb_tbl_map_single(dev, paddr, size, size, dir,
672+
attrs);
673673
if (swiotlb_addr == (phys_addr_t)DMA_MAPPING_ERROR)
674674
return DMA_MAPPING_ERROR;
675675

0 commit comments

Comments
 (0)