From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takeshi Yoshimura Subject: [PATCH v2] vfio: fix workaround of BAR0 mapping Date: Thu, 12 Jul 2018 12:08:33 +0900 Message-ID: <20180712030833.4887-1-t.yoshimura8869@gmail.com> References: <20180712024455.4807-1-t.yoshimura8869@gmail.com> Cc: Takeshi Yoshimura To: dev@dpdk.org Return-path: Received: from mail-pl0-f67.google.com (mail-pl0-f67.google.com [209.85.160.67]) by dpdk.org (Postfix) with ESMTP id 638061B39E for ; Thu, 12 Jul 2018 05:09:03 +0200 (CEST) Received: by mail-pl0-f67.google.com with SMTP id f4-v6so5830923plb.9 for ; Wed, 11 Jul 2018 20:09:03 -0700 (PDT) In-Reply-To: <20180712024455.4807-1-t.yoshimura8869@gmail.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The workaround of BAR0 mapping does not work if BAR0 area is smaller than page size (64KB in ppc). In addition, we no longer need the workaround in recent Linux because VFIO allows MSIX mapping (*). This fix is just to skip the workaround if BAR0 is smarller than a page. (*): "vfio-pci: Allow mapping MSIX BAR", https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/ commit/id=a32295c612c57990d17fb0f41e7134394b2f35f6 Fixes: 90a1633b2347 ("eal/linux: allow to map BARs with MSI-X tables") Signed-off-by: Takeshi Yoshimura --- Fixed checkpatch warnings drivers/bus/pci/linux/pci_vfio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c index aeeaa9ed8..b8f4a11f4 100644 --- a/drivers/bus/pci/linux/pci_vfio.c +++ b/drivers/bus/pci/linux/pci_vfio.c @@ -337,7 +337,8 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res, /* Skip this BAR */ return 0; - if (msix_table->bar_index == bar_index) { + if (msix_table->bar_index == bar_index && + bar->size > (uint64_t)PAGE_SIZE) { /* * VFIO will not let us map the MSI-X table, * but we can map around it. -- 2.17.1