bus/pci: add RTE_PCI_DRV_NEED_IOVA_AS_PA flag
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest1 patch 0 repliesNew
- v11 patch 1 replySuperseded
Changes in v2 from the cover letter
Add a new PCI driver flag, RTE_PCI_DRV_NEED_IOVA_AS_PA, that allows a driver to tell the PCI bus layer it cannot work with IOVA as VA and must use IOVA as PA.
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/1 | bus/pci: add RTE_PCI_DRV_NEED_IOVA_AS_PA flagdrivers/ drivers/ drivers/ | +16 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH v2 0/1] bus/pci: add RTE_PCI_DRV_NEED_IOVA_AS_PA flag
From: Jie Liu <[email protected]>
V2:
Add a new PCI driver flag, RTE_PCI_DRV_NEED_IOVA_AS_PA, that allows a driver to tell the PCI bus layer 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.
If a driver sets both RTE_PCI_DRV_NEED_IOVA_AS_VA and RTE_PCI_DRV_NEED_IOVA_AS_PA at the same time, a warning is emitted and the conflicting requirement is ignored (RTE_IOVA_DC), because the two flags are mutually exclusive.
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 | 13 +++++++++++++ drivers/bus/pci/pci_common.c | 3 +-- 3 files changed, 16 insertions(+), 2 deletions(-)
Signature · 1 line
2.52.0