From patchwork Thu Oct 22 15:51:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?6LCi5Y2O5LyfKOatpOaXtuatpOWIu++8iQ==?= X-Patchwork-Id: 81815 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EE6BDA04DD; Thu, 22 Oct 2020 17:52:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 830ADAC61; Thu, 22 Oct 2020 17:51:44 +0200 (CEST) Received: from out0-145.mail.aliyun.com (out0-145.mail.aliyun.com [140.205.0.145]) by dpdk.org (Postfix) with ESMTP id 5A016AC48 for ; Thu, 22 Oct 2020 17:51:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alibaba-inc.com; s=default; t=1603381894; h=From:To:Subject:Date:Message-Id; bh=0LrVduElJIgm1/oCAgsnOBUUTvaUgQr5wfFP4MqhV7A=; b=Mmo8HLckWk5PEclJIeaO2Pv0bW+GOyqzrHiUjzQclijP7jzmoJs7v0e73jdRfAcOuswfBPUMy0z1akLqozbHMlFGrgqoba/GyInGSOxiXHnYxWmKx7GCn/x4tqJeYHOyCTjj2H4bBK41bZ+XREqdWAvW7urJcKsHtJgpeqhrFnE= X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R131e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=ay29a033018047213; MF=huawei.xhw@alibaba-inc.com; NM=1; PH=DS; RN=9; SR=0; TI=SMTPD_---.In.51nB_1603381889; Received: from rs3a10040.et2sqa.z1.et2sqa.tbsite.net(mailfrom:huawei.xhw@alibaba-inc.com fp:SMTPD_---.In.51nB_1603381889) by smtp.aliyun-inc.com(127.0.0.1); Thu, 22 Oct 2020 23:51:33 +0800 From: " =?utf-8?b?6LCi5Y2O5LyfKOatpOaXtuatpOWIu++8iQ==?= " To: ferruh.yigit@intel.com Cc: , , , , , , , " =?utf-8?b?6LCi5Y2O5LyfKOatpA==?= =?utf-8?b?5pe25q2k5Yi777yJ?= " Date: Thu, 22 Oct 2020 23:51:25 +0800 Message-Id: <1603381885-88819-4-git-send-email-huawei.xhw@alibaba-inc.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1603381885-88819-1-git-send-email-huawei.xhw@alibaba-inc.com> References: <68ecd941-9c56-4de7-fae2-2ad15bdfd81a@alibaba-inc.com> <1603381885-88819-1-git-send-email-huawei.xhw@alibaba-inc.com> Subject: [dpdk-dev] [PATCH v5 3/3] PCI: don't use vfio ioctl call to access PIO resource X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: "huawei.xhw" VFIO should use the same way to map/read/write PORT IO as UIO, for virtio PMD. Signed-off-by: huawei.xhw --- 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",