summaryrefslogtreecommitdiff
path: root/kernel/dma
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-04-29 09:28:59 +0300
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2021-04-29 21:46:06 +0300
commitdfc06b389a4f54e78c03abecd5b42ab6ea8d492a (patch)
tree883c428c958faa90f88c7eb4b1b2822f7c51908a /kernel/dma
parent95b079d8215b83b37fa59341fda92fcb9392f14a (diff)
downloadlinux-dfc06b389a4f54e78c03abecd5b42ab6ea8d492a.tar.xz
swiotlb: don't override user specified size in swiotlb_adjust_size
If the user already specified a swiotlb size on the command line, swiotlb_adjust_size should not overwrite it. Fixes: 2cbc2776efe4 ("swiotlb: remove swiotlb_nr_tbl") Reported-by: Tom Lendacky <thomas.lendacky@amd.com> Tested-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'kernel/dma')
-rw-r--r--kernel/dma/swiotlb.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index 8635a57f88e9..8ca7d505d61c 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -118,6 +118,8 @@ void __init swiotlb_adjust_size(unsigned long size)
* architectures such as those supporting memory encryption to
* adjust/expand SWIOTLB size for their use.
*/
+ if (default_nslabs != IO_TLB_DEFAULT_SIZE >> IO_TLB_SHIFT)
+ return;
size = ALIGN(size, IO_TLB_SIZE);
default_nslabs = ALIGN(size >> IO_TLB_SHIFT, IO_TLB_SEGSIZE);
pr_info("SWIOTLB bounce buffer size adjusted to %luMB", size >> 20);