Skip to content

Commit a12f1ac

Browse files
Dimon-Zhaoshemminger
authored andcommitted
net/nbl: check IOVA mode in Linux coexistence
Add IOVA mode check in Coexistence. Signed-off-by: Dimon Zhao <[email protected]>
1 parent c9726a7 commit a12f1ac

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

doc/guides/nics/nbl.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ Anolis community:
7070
Alternatively, you can contact us to obtain the `nbl_core` code and installation package.
7171

7272

73+
Coexistence Between DPDK And Kernel Driver
74+
------------------------------------------
75+
76+
When the device is bound to the `nbl_core` driver and IOMMU is in passthrough mode,
77+
it is necessary to force I/O virtual address (IOVA)
78+
to be mapped to physical address (PA)
79+
with the EAL command line option ``--iova-mode=pa``.
80+
81+
7382
Prerequisites
7483
-------------
7584

drivers/net/nbl/nbl_common/nbl_userdev.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -679,11 +679,20 @@ int nbl_pci_map_device(struct nbl_adapter *adapter)
679679

680680
NBL_USERDEV_INIT_COMMON(common);
681681
iova_mode = rte_eal_iova_mode();
682+
683+
snprintf(pathname, sizeof(pathname), "/dev/nbl_userdev/" PCI_PRI_FMT, loc->domain,
684+
loc->bus, loc->devid, loc->function);
685+
686+
/* check iommu passthrough mode */
687+
if (!access(pathname, F_OK) && iova_mode != RTE_IOVA_PA) {
688+
NBL_LOG(ERR, "%s IOMMU is in passthrough mode, must select IOVA as PA"
689+
" with --iova-mode=pa", pci_dev->device.name);
690+
ret = -1;
691+
return ret;
692+
}
693+
682694
if (iova_mode == RTE_IOVA_PA) {
683695
/* check iommu disable */
684-
snprintf(pathname, sizeof(pathname),
685-
"/dev/nbl_userdev/" PCI_PRI_FMT, loc->domain,
686-
loc->bus, loc->devid, loc->function);
687696
common->devfd = open(pathname, O_RDWR);
688697
if (common->devfd >= 0)
689698
goto mmap;

0 commit comments

Comments
 (0)