aboutsummaryrefslogtreecommitdiffstats
diff options
authorStephen Rothwell <sfr@canb.auug.org.au>2022-06-28 09:10:44 +1000
committerStephen Rothwell <sfr@canb.auug.org.au>2022-06-28 09:10:44 +1000
commit45f5ba2d8da370dfe89afc8cf194f3c50d2cd063 (patch)
tree06f4f0cc726d3252f7abe8172fdca4aaafe1aef6
parentc009fd5428b8dddbc1d56d8a58cbf5b57617be9e (diff)
parent0bf28fc40d89b1a3e00d1b79473bad4e9ca20ad1 (diff)
downloadlinux-next-45f5ba2d8da370dfe89afc8cf194f3c50d2cd063.tar.gz
Merge branch 'for-next' of git://git.infradead.org/users/hch/dma-mapping.git
-rw-r--r--Documentation/x86/x86_64/boot-options.rst8
-rw-r--r--include/linux/swiotlb.h1
-rw-r--r--kernel/dma/swiotlb.c8
3 files changed, 11 insertions, 6 deletions
diff --git a/Documentation/x86/x86_64/boot-options.rst b/Documentation/x86/x86_64/boot-options.rst
index 03ec9cf011812..cbd14124a667c 100644
--- a/Documentation/x86/x86_64/boot-options.rst
+++ b/Documentation/x86/x86_64/boot-options.rst
@@ -287,11 +287,13 @@ iommu options only relevant to the AMD GART hardware IOMMU:
iommu options only relevant to the software bounce buffering (SWIOTLB) IOMMU
implementation:
- swiotlb=<pages>[,force]
- <pages>
- Prereserve that many 128K pages for the software IO bounce buffering.
+ swiotlb=<slots>[,force,noforce]
+ <slots>
+ Prereserve that many 2K slots for the software IO bounce buffering.
force
Force all IO through the software TLB.
+ noforce
+ Do not initialize the software TLB.
Miscellaneous
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index 7ed35dd3de6e7..bdc58a0e20b19 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -60,7 +60,6 @@ dma_addr_t swiotlb_map(struct device *dev, phys_addr_t phys,
size_t size, enum dma_data_direction dir, unsigned long attrs);
#ifdef CONFIG_SWIOTLB
-extern enum swiotlb_force swiotlb_force;
/**
* struct io_tlb_mem - IO TLB Memory Pool Descriptor
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index cb50f8d383606..1758b724c7a8d 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -242,6 +242,9 @@ void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags,
if (swiotlb_force_disable)
return;
+ if (nslabs < IO_TLB_MIN_SLABS)
+ panic("%s: nslabs = %lu too small\n", __func__, nslabs);
+
/*
* By default allocate the bounce buffer memory from low memory, but
* allow to pick a location everywhere for hypervisors with guest
@@ -254,7 +257,8 @@ retry:
else
tlb = memblock_alloc_low(bytes, PAGE_SIZE);
if (!tlb) {
- pr_warn("%s: failed to allocate tlb structure\n", __func__);
+ pr_warn("%s: Failed to allocate %zu bytes tlb structure\n",
+ __func__, bytes);
return;
}
@@ -282,7 +286,7 @@ retry:
void __init swiotlb_init(bool addressing_limit, unsigned int flags)
{
- return swiotlb_init_remap(addressing_limit, flags, NULL);
+ swiotlb_init_remap(addressing_limit, flags, NULL);
}
/*