Skip to contentSkip to conversation

BUG kernel 6.12.19 defautl_swiotlb_limit() returns wrong value for CONFIG_SWIOTLB_DYNAMIC=y effects atm only under XEN dom0

DISCUSSION James Dingwall 2 participants 2 messages Sep 18 DMA mapping helpers

lore
Share & tools
lore

James Dingwall

author Tested-by
#0 lore raw

Hi,

I've been having a problem with a Dell HBA330 SCSI controller (mpt3sas) when booting under Xen and CONFIG_SWIOTLB_DYNAMIC=y is set. I had a similar issue with a megaraid_sas card that I previously posted about:

https://lkml.iu.edu/hypermail/linux/kernel/2407.3/08254.html

In that case we rebuilt the kernel with CONFIG_SWIOTLB_DYNAMIC=n. While investigating the current problem I came across a patch that was posted on the xen-devel list:

https://lists.xen.org/archives/html/xen-devel/2025-05/msg00991.html

I have applied that to the Ubuntu 7.0.0-31 kernel sources which has resolved the controller initialisation error I was encountering and the system now boots as expected.

[    3.921136] mpt3sas_cm0: no suitable DMA mask for 0000:03:00.0
[    3.921275] mpt3sas_cm0: failure at drivers/scsi/mpt3sas/mpt3sas_scsih.c:13610/_scsih_probe()!

I've included the patch below, I don't have the author's real address for the s-o-b. I'm able to test alternative fixes if there are any issues with this one.

Thanks,
James

kernel/dma/swiotlb.c +10 -1
index abcf3fa63a56..742e6cbbe852 100644
@@ -1654,7 +1654,16 @@ phys_addr_t default_swiotlb_base(void)
 phys_addr_t default_swiotlb_limit(void)
 {
 #ifdef CONFIG_SWIOTLB_DYNAMIC
-	return io_tlb_default_mem.phys_limit;
+	struct io_tlb_mem *mem = &io_tlb_default_mem;
+	phys_addr_t retval = mem->defpool.end;
+	struct io_tlb_pool *pool;
+	rcu_read_lock();
+	list_for_each_entry_rcu(pool, &mem->pools, node) {
+		if (pool->end > retval)
+			retval = pool->end;
+	}
+	rcu_read_unlock();
+	return retval - 1;
 #else
 	return io_tlb_default_mem.defpool.end - 1;
 #endif
maintainer
#1 lore raw
Quoted 16 lines · James Dingwall

I've been having a problem with a Dell HBA330 SCSI controller (mpt3sas) when booting under Xen and CONFIG_SWIOTLB_DYNAMIC=y is set. I had a similar issue with a megaraid_sas card that I previously posted about:

https://lkml.iu.edu/hypermail/linux/kernel/2407.3/08254.html

In that case we rebuilt the kernel with CONFIG_SWIOTLB_DYNAMIC=n. While investigating the current problem I came across a patch that was posted on the xen-devel list:

https://protect2.fireeye.com/v1/url?k=202f9c3b-7fb4525f-202e1774-000babda0201-d2724d878716e4ba&q=1&e=538195f2-f8bd-499e-8576-5e3d7c8ebca6&u=https%3A%2F%2Flists.xen.org%2Farchives%2Fhtml%2Fxen-devel%2F2025-05%2Fmsg00991.html

I have applied that to the Ubuntu 7.0.0-31 kernel sources which has resolved the controller initialisation error I was encountering and the system now boots as expected.

Quoted 6 lines
[    3.921136] mpt3sas_cm0: no suitable DMA mask for 0000:03:00.0
[    3.921275] mpt3sas_cm0: failure at drivers/scsi/mpt3sas/mpt3sas_scsih.c:13610/_scsih_probe()!

I've included the patch below, I don't have the author's real address for the s-o-b. I'm able to test alternative fixes if there are any issues with this one.

https://lore.kernel.org/xen-devel/[email protected]/

Andreas: could You send Your fix with a bit more elaborated description and to the proper recipients (hint: use scripts/get_maintainer.pl tool), so it can be reviewed and potentially applied?

Best regards

Signature · 2 lines
Marek Szyprowski, PhD
Samsung R&D Institute Poland