swiotlb: determine potential physical address limit
authorPetr Tesarik <petr.tesarik.ext@huawei.com>
Tue, 1 Aug 2023 06:24:02 +0000 (08:24 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 1 Aug 2023 16:02:24 +0000 (18:02 +0200)
commitad96ce3252dbab773cb343220662df3d84dd8e80
tree6040e0ce1f17a95c5b8f035214cfddf2c0c0296b
parent79636caad3618e2b38457f6e298c9b31ba82b489
swiotlb: determine potential physical address limit

The value returned by default_swiotlb_limit() should be constant, because
it is used to decide whether DMA can be used. To allow allocating memory
pools on the fly, use the maximum possible physical address rather than the
highest address used by the default pool.

For swiotlb_init_remap(), this is either an arch-specific limit used by
memblock_alloc_low(), or the highest directly mapped physical address if
the initialization flags include SWIOTLB_ANY. For swiotlb_init_late(), the
highest address is determined by the GFP flags.

Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
include/linux/swiotlb.h
kernel/dma/swiotlb.c