From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=p43vby1MxxLTAZKQPZXTR/iAYczVDe1Oqk79NOB5NWo=; b=MItT+XYdEUS9BkB6iTNCnvun/l2VtxiQXEMRdBaif3a6jWp7xnOA0es/Kju9yccSWk FwaTWUTbmTmxNtRWarw/t5uuDFvREg+Pv0mhGpMylGEsG1SbFupgGkSDY/nUdQoYo0cz fay6P9rw1eV+AlHxbLtcXcJol8ThtMZ8di5V1lnBoUguaIC6ZiXMSyIRalG/lEnBc1fF /6xXMXv1BAFJkZhJaxW/+4qC5Q9TWH+o3nUBOcKsw+I4gGbx9weelkSJ50A8Yfe+G6b7 zl/C2BTcdRZX9FPoQR3jjcAHGv+lIf8ISU8M3GUJc+rVbpyZ+3GVhF2/kv2nV+NbjXyh eLBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=p43vby1MxxLTAZKQPZXTR/iAYczVDe1Oqk79NOB5NWo=; b=M2PeNb9HDaf8wQuHOKMeCH9DYrczhaLpRNJt2u/VCsZy4EsyTnKBYPXOYJDI01Panw xbkKsYCX9OC6E3YbbJ1vEXfnFiQTX7ZoTLx81tVP2poxfGVuFlFHVmUWhg99vE6oEJUX tDu/8Lqrxvlo+4sjLfQq8LpZdOYp3hI7Df60YUn5Je3wJeJ+OpHfdyrVDkmdcYUdMfu3 5g3Lt/l2wMOsW5hNG/zr64SnFrXQdwPyKnrjrktkyEYPKwrh+PtSA3P7OjIMRPqYNsJz INmABrpoCN11kTtDkhDVNceE7m0Xzn9uGhr79Ag2QaZNFk6WRsoo4XAF5VbqU4BCmuij Bj0Q== X-Gm-Message-State: AOUpUlELvCLpdxxHv89wkrBgAOkrdY55N1B1Th2Tq3qIVmrbievixTN2 acLacVhCQaMuz8n4Vq7gkGZGig== X-Google-Smtp-Source: AAOMgpdKXL1uy96wtgb4zvno9G1anIFV3B22lQa7XsyGgcPJoblKUBWtawOKTDPyC4pLoIG9gP4v7A== X-Received: by 2002:a17:902:b604:: with SMTP id b4-v6mr495107pls.18.1531364942463; Wed, 11 Jul 2018 20:09:02 -0700 (PDT) Received: from takeshi-no-air.dhcp.hakozaki.ibm.com (sg-fw-ice-redblue-p6.sagamino.jp.ibm.com. [203.141.91.15]) by smtp.gmail.com with ESMTPSA id 65-v6sm30283520pfq.81.2018.07.11.20.09.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Jul 2018 20:09:01 -0700 (PDT) From: Takeshi Yoshimura To: dev@dpdk.org Cc: Takeshi Yoshimura Date: Thu, 12 Jul 2018 12:08:33 +0900 Message-Id: <20180712030833.4887-1-t.yoshimura8869@gmail.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180712024455.4807-1-t.yoshimura8869@gmail.com> References: <20180712024455.4807-1-t.yoshimura8869@gmail.com> Subject: [dpdk-dev] [PATCH v2] vfio: fix workaround of BAR0 mapping 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: , X-List-Received-Date: Thu, 12 Jul 2018 03:09:03 -0000 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