From patchwork Mon Sep 28 06:34:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alvin Zhang X-Patchwork-Id: 78968 X-Patchwork-Delegate: david.marchand@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 2A57DA04C0; Mon, 28 Sep 2020 08:38:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 68BF71BCE1; Mon, 28 Sep 2020 08:38:09 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 43D241BCD7; Mon, 28 Sep 2020 08:38:07 +0200 (CEST) IronPort-SDR: AhEV+RapP3cx9PEBfD3UyZFut0yhKXYdxDSqZQOPwfjtIU0Cmmo8+16rOM3+Uad4MzuyInyqr8 0rSvxpMkK8sg== X-IronPort-AV: E=McAfee;i="6000,8403,9757"; a="159327607" X-IronPort-AV: E=Sophos;i="5.77,312,1596524400"; d="scan'208";a="159327607" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2020 23:38:04 -0700 IronPort-SDR: nSIVfsupEh0jcK4sL/wXCuNQcX0ZzVLPiYfa6Y2lT9h7PpmlZZiIHIHg7cNM52pPzIT2nG8dyZ k9pVPRTMaZfQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,312,1596524400"; d="scan'208";a="324188642" Received: from shwdenpg235.ccr.corp.intel.com ([10.240.182.60]) by orsmga002.jf.intel.com with ESMTP; 27 Sep 2020 23:38:02 -0700 From: alvinx.zhang@intel.com To: david.marchand@redhat.com, arybchenko@solarflare.com Cc: dev@dpdk.org, Alvin Zhang , stable@dpdk.org Date: Mon, 28 Sep 2020 14:34:29 +0800 Message-Id: <20200928063429.14148-1-alvinx.zhang@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] bus/pci: fix mapping of PCI resources 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: Alvin Zhang When mapping PCI bar resources around the MSI-X table, if the size of the first part is 0, the second part should also be mapped if its size is not 0. Fixes: e200535c1ca3 ("mem: drop mapping API workaround") Cc: stable@dpdk.org Signed-off-by: Alvin Zhang Tested-by: Ling, Wei --- drivers/bus/pci/linux/pci_vfio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c index 34b5da8..37bfda8 100644 --- a/drivers/bus/pci/linux/pci_vfio.c +++ b/drivers/bus/pci/linux/pci_vfio.c @@ -565,7 +565,7 @@ } /* if there's a second part, try to map it */ - if (map_addr != NULL + if ((map_addr != NULL || memreg[0].size == 0) && memreg[1].offset && memreg[1].size) { void *second_addr = RTE_PTR_ADD(bar_addr, (uintptr_t)(memreg[1].offset -