swiotlb: use the right nslabs-derived sizes in swiotlb_init_late
authorChristoph Hellwig <hch@lst.de>
Wed, 11 May 2022 06:24:10 +0000 (08:24 +0200)
committerChristoph Hellwig <hch@lst.de>
Fri, 13 May 2022 10:49:27 +0000 (12:49 +0200)
commit1b8e5d1a53696d92374acce2b19a649427f1ec1e
tree2cfd32b0c4fc1fa4206212b791983f394e55980e
parenta5e891321a219679d5a2828150a7dda29a47d8a6
swiotlb: use the right nslabs-derived sizes in swiotlb_init_late

nslabs can shrink when allocations or the remap don't succeed, so make
sure to use it for all sizing.  For that remove the bytes value that
can get stale and replace it with local calculations and a boolean to
indicate if the originally requested size could not be allocated.

Fixes: 6424e31b1c05 ("swiotlb: remove swiotlb_init_with_tbl and swiotlb_init_late_with_tbl")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
kernel/dma/swiotlb.c