From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl0-f66.google.com (mail-pl0-f66.google.com [209.85.160.66]) by dpdk.org (Postfix) with ESMTP id 1ABE81B474 for ; Thu, 12 Jul 2018 04:45:01 +0200 (CEST) Received: by mail-pl0-f66.google.com with SMTP id 6-v6so10000126plb.0 for ; Wed, 11 Jul 2018 19:45:00 -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; bh=HbB1kmABjGnPzs4s65rS4uPlfi8ImZj7rOBaWnZuTHk=; b=berwMuySx5hDwPW55S0FwPRy857dKM6+sDzNYH9dL16CgDLdEfitvZ3DokwxOArQKh d0q3j6nbNLwjFW/8TDEFCO1Pf4XQUzm2AUTX7HTUN6wWpcb8VEul18jT+BJQl21UJ8a0 a8wzc5iqXvqbTAAnzBE6MT/81lEXCh6lt9PEe1kQdBvp1F4pF3yJ0gSfCwC193VWztQ4 BHgj0DPBzR4Z4hhs8SjbtDZih0qj+PKsCoCAY27yw9CTA6KSHxtLydfA0uqndLk5zGx/ bD+47ZeCw4EAUUZ9Iffvna9ONLEnAk704cOGXNHZT7azVWUEew/Ji/BTFqN2jjuLGyc1 ktRQ== 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; bh=HbB1kmABjGnPzs4s65rS4uPlfi8ImZj7rOBaWnZuTHk=; b=UiFkYBMjpP7q1EpKqOqa21QVH3M1EO8gFdw3+UiGkMwtXZNwyBVAbj+7+4vmO7Pjlw oi7yOpVtajOAW2q5oyMEE4+I29Dg4GdY6Ep1nIn4OWC9Art2YzuwTS3VNwq936NQgix6 dFXHFbVISKO98eB922dcg8vO8vJe/NmseFdosqPgJkWx2+DtyU9xZ0GkTQHQ2mSrZpOy jo4Q8fMCUnfQf4y2ASUTDqmhX4h6uUopM9NTUdbqSsyvpTD9cJE5ZjIz8QxdEi/oz2jm joDFy4/V9w9WDD8caLL6/fNGPcgQSVrbPxmvPVWy7Yexu3R+WOEoFyB6xjKN+CfItcms 3wbw== X-Gm-Message-State: AOUpUlExPd/t4qpnzo/Nw3y8Nwam7i19jBZzlOQi8LcN7X62KULpBH4H fGH1EauosVTIKCk3uARG4WJyjQ== X-Google-Smtp-Source: AAOMgpfz0RFb8KQcVMcKwTJRwqHIJmtLfi3m7uM61ZBtypHlGzRAw8HBRUm4i4HYSUI92726Wn8glA== X-Received: by 2002:a17:902:9687:: with SMTP id n7-v6mr394283plp.33.1531363500190; Wed, 11 Jul 2018 19:45:00 -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 m15-v6sm51512963pfj.171.2018.07.11.19.44.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Jul 2018 19:44:59 -0700 (PDT) From: Takeshi Yoshimura To: dev@dpdk.org Cc: Takeshi Yoshimura Date: Thu, 12 Jul 2018 11:44:55 +0900 Message-Id: <20180712024455.4807-1-t.yoshimura8869@gmail.com> X-Mailer: git-send-email 2.15.1 Subject: [dpdk-dev] [PATCH] 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 02:45:01 -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/drivers/vfio/pci/vfio_pci.c?h=v4.18-rc3&id=a32295c612c57990d17fb0f41e7134394b2f35f6 Fixes: 90a1633b2347 ("eal/linux: allow to map BARs with MSI-X tables") Signed-off-by: Takeshi Yoshimura --- 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 aeeaa9ed8..facda64bb 100644 --- a/drivers/bus/pci/linux/pci_vfio.c +++ b/drivers/bus/pci/linux/pci_vfio.c @@ -337,7 +337,7 @@ 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 && (uint64_t)PAGE_SIZE < bar->size) { /* * VFIO will not let us map the MSI-X table, * but we can map around it. -- 2.17.1