Skip to content

Commit 1521c60

Browse files
author
Christoph Hellwig
committed
swiotlb: don't panic when the swiotlb buffer can't be allocated
For historical reasons the switlb code paniced when the metadata could not be allocated, but just printed a warning when the actual main swiotlb buffer could not be allocated. Restore this somewhat unexpected behavior as changing it caused a boot failure on the Microchip RISC-V PolarFire SoC Icicle kit. Fixes: 6424e31 ("swiotlb: remove swiotlb_init_with_tbl and swiotlb_init_late_with_tbl") Reported-by: Conor Dooley <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Stefano Stabellini <[email protected]> Acked-by: Conor Dooley <[email protected]> Tested-by: Conor Dooley <[email protected]>
1 parent 84bc4f1 commit 1521c60

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

kernel/dma/swiotlb.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,10 @@ void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags,
254254
tlb = memblock_alloc(bytes, PAGE_SIZE);
255255
else
256256
tlb = memblock_alloc_low(bytes, PAGE_SIZE);
257-
if (!tlb)
258-
panic("%s: failed to allocate tlb structure\n", __func__);
257+
if (!tlb) {
258+
pr_warn("%s: failed to allocate tlb structure\n", __func__);
259+
return;
260+
}
259261

260262
if (remap && remap(tlb, nslabs) < 0) {
261263
memblock_free(tlb, PAGE_ALIGN(bytes));

0 commit comments

Comments
 (0)