<div dir="ltr">FYI The DTS failure for this series on patchwork for the MTU testsuite is coming from a different patch than this one. Once I have that resolved, I will put in a retest for this series which will clear up that MTU testsuite failure.</div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Mon, Sep 8, 2025 at 12:35 PM Shani Peretz <<a href="mailto:shperetz@nvidia.com">shperetz@nvidia.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">When --iova-mode is explicitly specified in command line, DMA mask<br>
constraints were not being validated, leading to potential runtime<br>
failures when device DMA capabilities are exceeded.<br>
<br>
The issue occurred because rte_bus_get_iommu_class() was only called<br>
during IOVA mode auto-detection, but this function has the important<br>
side effect of triggering DMA mask detection (e.g., Intel IOMMU<br>
address width checking via pci_device_iommu_support_va()).<br>
<br>
This created an inconsistency, when choosing explicit mode,<br>
the DMA checks are bypassed, but when choosing auto-detection mode,<br>
the constraints are checked and enforced.<br>
<br>
The fix moves rte_bus_get_iommu_class() outside the conditional logic<br>
to ensure it's always called during EAL initialization.<br>
<br>
Fixes: 4374ebc24bc1 ("malloc: modify error message for DMA mask check")<br>
Cc: <a href="mailto:stable@dpdk.org" target="_blank">stable@dpdk.org</a><br>
<br>
Signed-off-by: Shani Peretz <<a href="mailto:shperetz@nvidia.com" target="_blank">shperetz@nvidia.com</a>><br>
---<br>
lib/eal/freebsd/eal.c | 6 +++++-<br>
lib/eal/linux/eal.c | 5 ++++-<br>
lib/eal/windows/eal.c | 5 ++++-<br>
3 files changed, 13 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c<br>
index c1ab8d86d2..0f957919d3 100644<br>
--- a/lib/eal/freebsd/eal.c<br>
+++ b/lib/eal/freebsd/eal.c<br>
@@ -670,12 +670,16 @@ rte_eal_init(int argc, char **argv)<br>
* with a message describing the cause.<br>
*/<br>
has_phys_addr = internal_conf->no_hugetlbfs == 0;<br>
+<br>
+ /* Always call rte_bus_get_iommu_class() to trigger DMA mask detection and validation */<br>
+ enum rte_iova_mode bus_iova_mode = rte_bus_get_iommu_class();<br>
+<br>
iova_mode = internal_conf->iova_mode;<br>
if (iova_mode == RTE_IOVA_DC) {<br>
EAL_LOG(DEBUG, "Specific IOVA mode is not requested, autodetecting");<br>
if (has_phys_addr) {<br>
EAL_LOG(DEBUG, "Selecting IOVA mode according to bus requests");<br>
- iova_mode = rte_bus_get_iommu_class();<br>
+ iova_mode = bus_iova_mode;<br>
if (iova_mode == RTE_IOVA_DC) {<br>
if (!RTE_IOVA_IN_MBUF) {<br>
iova_mode = RTE_IOVA_VA;<br>
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c<br>
index 52efb8626b..3a0c9c9db6 100644<br>
--- a/lib/eal/linux/eal.c<br>
+++ b/lib/eal/linux/eal.c<br>
@@ -1042,10 +1042,13 @@ rte_eal_init(int argc, char **argv)<br>
<br>
phys_addrs = rte_eal_using_phys_addrs() != 0;<br>
<br>
+ /* Always call rte_bus_get_iommu_class() to trigger DMA mask detection and validation */<br>
+ enum rte_iova_mode bus_iova_mode = rte_bus_get_iommu_class();<br>
+<br>
/* if no EAL option "--iova-mode=<pa|va>", use bus IOVA scheme */<br>
if (internal_conf->iova_mode == RTE_IOVA_DC) {<br>
/* autodetect the IOVA mapping mode */<br>
- enum rte_iova_mode iova_mode = rte_bus_get_iommu_class();<br>
+ enum rte_iova_mode iova_mode = bus_iova_mode;<br>
<br>
if (iova_mode == RTE_IOVA_DC) {<br>
EAL_LOG(DEBUG, "Buses did not request a specific IOVA mode.");<br>
diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c<br>
index 4f0a164d9b..2502ec3c3d 100644<br>
--- a/lib/eal/windows/eal.c<br>
+++ b/lib/eal/windows/eal.c<br>
@@ -348,12 +348,15 @@ rte_eal_init(int argc, char **argv)<br>
has_phys_addr = false;<br>
}<br>
<br>
+ /* Always call rte_bus_get_iommu_class() to trigger DMA mask detection and validation */<br>
+ enum rte_iova_mode bus_iova_mode = rte_bus_get_iommu_class();<br>
+<br>
iova_mode = internal_conf->iova_mode;<br>
if (iova_mode == RTE_IOVA_DC) {<br>
EAL_LOG(DEBUG, "Specific IOVA mode is not requested, autodetecting");<br>
if (has_phys_addr) {<br>
EAL_LOG(DEBUG, "Selecting IOVA mode according to bus requests");<br>
- iova_mode = rte_bus_get_iommu_class();<br>
+ iova_mode = bus_iova_mode;<br>
if (iova_mode == RTE_IOVA_DC) {<br>
if (!RTE_IOVA_IN_MBUF) {<br>
iova_mode = RTE_IOVA_VA;<br>
-- <br>
2.34.1<br>
<br>
</blockquote></div>