mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
powerpc/kernel/iommu: Use largepool as a last resort when !largealloc
As of today, doing iommu_range_alloc() only for !largealloc (npages <= 15) will only be able to use 3/4 of the available pages, given pages on largepool not being available for !largealloc. This could mean some drivers not being able to fully use all the available pages for the DMA window. Add pages on largepool as a last resort for !largealloc, making all pages of the DMA window available. Signed-off-by: Leonardo Bras <leobras.c@gmail.com> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20210318174414.684630-2-leobras.c@gmail.com
This commit is contained in:
parent
3c0468d445
commit
fc5590fd56
1 changed files with 9 additions and 0 deletions
|
@ -296,6 +296,15 @@ static unsigned long iommu_range_alloc(struct device *dev,
|
|||
pass++;
|
||||
goto again;
|
||||
|
||||
} else if (pass == tbl->nr_pools + 1) {
|
||||
/* Last resort: try largepool */
|
||||
spin_unlock(&pool->lock);
|
||||
pool = &tbl->large_pool;
|
||||
spin_lock(&pool->lock);
|
||||
pool->hint = pool->start;
|
||||
pass++;
|
||||
goto again;
|
||||
|
||||
} else {
|
||||
/* Give up */
|
||||
spin_unlock_irqrestore(&(pool->lock), flags);
|
||||
|
|
Loading…
Reference in a new issue