[dpdk-dev] [PATCH v5 3/3] PCI: don't use vfio ioctl call to access PIO resource
谢华伟(此时此刻)
huawei.xhw at alibaba-inc.com
Thu Oct 22 17:51:25 CEST 2020
From: "huawei.xhw" <huawei.xhw at alibaba-inc.com>
VFIO should use the same way to map/read/write PORT IO as UIO, for
virtio PMD.
Signed-off-by: huawei.xhw <huawei.xhw at alibaba-inc.com>
---
drivers/bus/pci/linux/pci.c | 8 ++++----
drivers/bus/pci/linux/pci_uio.c | 4 +++-
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 0dc99e9..2ed9f2b 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -687,7 +687,7 @@ int rte_pci_write_config(const struct rte_pci_device *device,
#ifdef VFIO_PRESENT
case RTE_PCI_KDRV_VFIO:
if (pci_vfio_is_enabled())
- ret = pci_vfio_ioport_map(dev, bar, p);
+ ret = pci_uio_ioport_map(dev, bar, p);
break;
#endif
case RTE_PCI_KDRV_IGB_UIO:
@@ -711,7 +711,7 @@ int rte_pci_write_config(const struct rte_pci_device *device,
switch (p->dev->kdrv) {
#ifdef VFIO_PRESENT
case RTE_PCI_KDRV_VFIO:
- pci_vfio_ioport_read(p, data, len, offset);
+ pci_uio_ioport_read(p, data, len, offset);
break;
#endif
case RTE_PCI_KDRV_IGB_UIO:
@@ -730,7 +730,7 @@ int rte_pci_write_config(const struct rte_pci_device *device,
switch (p->dev->kdrv) {
#ifdef VFIO_PRESENT
case RTE_PCI_KDRV_VFIO:
- pci_vfio_ioport_write(p, data, len, offset);
+ pci_uio_ioport_write(p, data, len, offset);
break;
#endif
case RTE_PCI_KDRV_IGB_UIO:
@@ -751,7 +751,7 @@ int rte_pci_write_config(const struct rte_pci_device *device,
#ifdef VFIO_PRESENT
case RTE_PCI_KDRV_VFIO:
if (pci_vfio_is_enabled())
- ret = pci_vfio_ioport_unmap(p);
+ ret = pci_uio_ioport_unmap(p);
break;
#endif
case RTE_PCI_KDRV_IGB_UIO:
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index c19382f..463792b 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -429,7 +429,9 @@
}
/* FIXME only for primary process ? */
- if (dev->intr_handle.type == RTE_INTR_HANDLE_UNKNOWN) {
+ if (dev->intr_handle.type == RTE_INTR_HANDLE_UNKNOWN &&
+ (dev->kdrv == RTE_PCI_KDRV_IGB_UIO ||
+ dev->kdrv == RTE_PCI_KDRV_UIO_GENERIC)) {
int uio_num = pci_get_uio_dev(dev, dirname, sizeof(dirname), 0);
if (uio_num < 0) {
RTE_LOG(ERR, EAL, "cannot open %s: %s\n",
--
1.8.3.1
More information about the dev
mailing list