* [PATCH] swiotlb: Check nslabs after initialization in the swiotlb_init_remap()
@ 2022-07-13 8:24 Tianyu Lan
2022-07-13 11:23 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Tianyu Lan @ 2022-07-13 8:24 UTC (permalink / raw)
To: hch, m.szyprowski, robin.murphy; +Cc: Tianyu Lan, iommu, linux-kernel
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] swiotlb: Check nslabs after initialization in the swiotlb_init_remap()
2022-07-13 8:24 [PATCH] swiotlb: Check nslabs after initialization in the swiotlb_init_remap() Tianyu Lan
@ 2022-07-13 11:23 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2022-07-13 11:23 UTC (permalink / raw)
To: Tianyu Lan
Cc: hch, m.szyprowski, robin.murphy, Tianyu Lan, iommu, linux-kernel
Thanks, I've folded this in.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-13 11:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-13 8:24 [PATCH] swiotlb: Check nslabs after initialization in the swiotlb_init_remap() Tianyu Lan
2022-07-13 11:23 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox