Skip to content

bus/pci: add RTE_PCI_DRV_NEED_IOVA_AS_PA flag

[email protected] dpdk-dev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1bus/pci: add RTE_PCI_DRV_NEED_IOVA_AS_PA flagdrivers/bus/pci/bus_pci_driver.h drivers/bus/pci/linux/pci.c drivers/bus/pci/pci_common.c+7 -23 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH v1 0/1] bus/pci: add RTE_PCI_DRV_NEED_IOVA_AS_PA flag

From: liufeng1 <[email protected]>

This series adds a new PCI driver flag, RTE_PCI_DRV_NEED_IOVA_AS_PA, which allows a PCI driver to tell the PCI bus layer that it cannot work with IOVA as VA and must use IOVA as PA.

The existing RTE_PCI_DRV_NEED_IOVA_AS_VA flag already provides the opposite requirement. Some PCI devices, however, are managed by a kernel driver that uses an identity-mapped IOMMU domain (e.g. when the kernel is booted with iommu=pt). The user-space PMD for such devices must use IOVA as PA, because the DMA addresses programmed by DPDK must match the identity mapping programmed by the kernel driver.

Without this flag, a PCI driver bound to a non-VFIO/UIO kernel driver has no way to force IOVA as PA. pci_device_iova_mode() returns RTE_IOVA_DC for those devices, and rte_eal_init() then sees an enabled IOMMU and selects RTE_IOVA_VA, which breaks identity-domain PMDs and forces users to pass --iova-mode=pa on the command line.

When RTE_PCI_DRV_NEED_IOVA_AS_PA is set, pci_device_iova_mode() returns RTE_IOVA_PA for the device. The requirement is propagated through rte_pci_get_iommu_class() to rte_bus_get_iommu_class(), so rte_eal_init() selects IOVA as PA automatically.

This is a generic mechanism: any PCI driver whose underlying kernel driver uses an identity IOMMU domain can set the flag.

liufeng1 (1):
bus/pci: add RTE_PCI_DRV_NEED_IOVA_AS_PA flag

 drivers/bus/pci/bus_pci_driver.h | 2 ++
 drivers/bus/pci/linux/pci.c      | 4 ++++
 drivers/bus/pci/pci_common.c     | 3 +--
 3 files changed, 7 insertions(+), 2 deletions(-)
Signature · 1 line
2.52.0