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 787AD42D60; Thu, 29 Jun 2023 04:27:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D297F42D12; Thu, 29 Jun 2023 04:27:04 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 2AB90406B7; Thu, 29 Jun 2023 04:27:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688005623; x=1719541623; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qp+WWECIcwwN89NkpLvVd8lRyRzRcX9/Z9CiIrGxAZI=; b=ZV39U/30nRghNo1QUBtgjWpioPGb63qdraibaWl642T7icSUv+PKy+Sh xISPdr/Uo5JhIRCe1G5TldMiao4OXtufF/padHpEMWJMYENKA3uAAnnnB RbrpcwP3UPoO1h74RfzVhHS/kHy60Njixrz8eFQc+gG1PgvdIWR7r622+ J7WzAQgAja13htFTEGt4YgrHK2qlDtm3rOf6ftzQ1wqG7Mb3TwfrLtFQJ 5JSKJOci8+9rAliExQo04d5Vaex9VazSUjj6gpSaQac0HxYuSoJCmfMGv Ol0pS11pwIjeDN2q7ErHcoDe5LD2Sjwyya74HB+UeHbg1QG0z6Ym9kiPO g==; X-IronPort-AV: E=McAfee;i="6600,9927,10755"; a="362047101" X-IronPort-AV: E=Sophos;i="6.01,167,1684825200"; d="scan'208";a="362047101" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2023 19:27:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10755"; a="861747267" X-IronPort-AV: E=Sophos;i="6.01,167,1684825200"; d="scan'208";a="861747267" Received: from dpdk-limiao-icelake.sh.intel.com ([10.67.111.26]) by fmsmga001.fm.intel.com with ESMTP; 28 Jun 2023 19:27:01 -0700 From: Miao Li To: dev@dpdk.org Cc: stable@dpdk.org, Anatoly Burakov , Jonas Pfefferle Subject: [PATCH v2 2/2] bus/pci: add IO port region check before region map Date: Thu, 29 Jun 2023 02:26:53 +0000 Message-Id: <20230629022653.263046-2-miao.li@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230629022653.263046-1-miao.li@intel.com> References: <20230628063651.178604-1-miao.li@intel.com> <20230629022653.263046-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 secondary 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