From: Tianyu Lan <ltykernel@gmail.com>
To: hch@infradead.org, m.szyprowski@samsung.com, robin.murphy@arm.com
Cc: Tianyu Lan <tiala@microsoft.com>,
iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: [PATCH] swiotlb: Check nslabs after initialization in the swiotlb_init_remap()
Date: Wed, 13 Jul 2022 04:24:54 -0400 [thread overview]
Message-ID: <20220713082454.700487-1-ltykernel@gmail.com> (raw)
From: Tianyu Lan <tiala@microsoft.com>
The check of nslabs less than IO_TLB_MIN_SLABS should be later than
initialization. Fix it.
Signed-off-by: Tianyu Lan <tiala@microsoft.com>
---
kernel/dma/swiotlb.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index 0ffb23c0e0e8..c39483bf067d 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -308,9 +308,6 @@ 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);
-
/*
* default_nslabs maybe changed when adjust area number.
* So allocate bounce buffer after adjusting area number.
@@ -320,6 +317,9 @@ void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags,
nslabs = default_nslabs;
+ 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
--
2.25.1
next reply other threads:[~2022-07-13 8:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-13 8:24 Tianyu Lan [this message]
2022-07-13 11:23 ` [PATCH] swiotlb: Check nslabs after initialization in the swiotlb_init_remap() Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220713082454.700487-1-ltykernel@gmail.com \
--to=ltykernel@gmail.com \
--cc=hch@infradead.org \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=robin.murphy@arm.com \
--cc=tiala@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox