From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1AED142D7C; Wed, 28 Jun 2023 08:37:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B269442D2C; Wed, 28 Jun 2023 08:37:13 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id A936042D0E; Wed, 28 Jun 2023 08:37:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687934232; x=1719470232; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nDm6essXk3Ke995eHbajHRC0GOEoKaIbjA8c5hG+3Xc=; b=FAI+zGDaiGIEqCd19yZz87jT+FEjZfLl/RK9COkTVz1uQVc7HZKZGThI FOiWes7EM1l4RbVFoN96o+3xz1MXDXdovLsgJzELYXuL0E1PGciEhTMW7 27VhAB8Qaor/MNdjEzQKdJD6P11mYeFf0HYJkPd4aoqeg3AO3pMC6etSX jcgSiDlf/IQX6Vmr/ctrtoaDlMw17YEHq9dQCa9NkQzMFlOAfLCu7bXXl uYqVVJqBndftn9bX2YW5T4CodtoZQv7yot2TxkYMKfdIX8tejITEQi9vY DBETNLjCl/6XkzOU4qMEYaKs5tVXV6qHmBnHhaijoBmaQpq6mg1m58uqQ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10754"; a="364313989" X-IronPort-AV: E=Sophos;i="6.01,164,1684825200"; d="scan'208";a="364313989" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2023 23:37:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10754"; a="890939766" X-IronPort-AV: E=Sophos;i="6.01,164,1684825200"; d="scan'208";a="890939766" Received: from dpdk-limiao-icelake.sh.intel.com ([10.67.111.26]) by orsmga005.jf.intel.com with ESMTP; 27 Jun 2023 23:37:09 -0700 From: Miao Li To: dev@dpdk.org Cc: stable@dpdk.org, Anatoly Burakov , Jonas Pfefferle Subject: [PATCH 2/2] bus/pci: add IO port region check before region map Date: Wed, 28 Jun 2023 06:36:51 +0000 Message-Id: <20230628063651.178604-2-miao.li@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230628063651.178604-1-miao.li@intel.com> References: <20230628063651.178604-1-miao.li@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch adds IO port region check to skip region map when doing IO port map for legacy device in sencondary process. Fixes: 33604c31354a ("vfio: refactor PCI BAR mapping") Cc: stable@dpdk.org Signed-off-by: Miao Li --- drivers/bus/pci/linux/pci_vfio.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c index e634de8322..dd4ca46120 100644 --- a/drivers/bus/pci/linux/pci_vfio.c +++ b/drivers/bus/pci/linux/pci_vfio.c @@ -1099,6 +1099,15 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev) maps = vfio_res->maps; for (i = 0; i < vfio_res->nb_maps; i++) { + /* chk for io port region */ + ret = pci_vfio_is_ioport_bar(dev, vfio_dev_fd, i); + if (ret < 0) { + goto err_vfio_dev_fd; + } else if (ret) { + RTE_LOG(INFO, EAL, "Ignore mapping IO port bar(%d)\n", i); + continue; + } + if (maps[i].nr_areas > 0) { ret = pci_vfio_sparse_mmap_bar(vfio_dev_fd, vfio_res, i, MAP_FIXED); if (ret < 0) { -- 2.25.1