All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vfio: fix workaround of BAR0 mapping
@ 2018-07-12  2:44 Takeshi Yoshimura
  2018-07-12  3:08 ` [PATCH v2] " Takeshi Yoshimura
  0 siblings, 1 reply; 14+ messages in thread
From: Takeshi Yoshimura @ 2018-07-12  2:44 UTC (permalink / raw)
  To: dev; +Cc: Takeshi Yoshimura

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 <t.yoshimura8869@gmail.com>
---
 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

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-07-30 10:03 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-12  2:44 [PATCH] vfio: fix workaround of BAR0 mapping Takeshi Yoshimura
2018-07-12  3:08 ` [PATCH v2] " Takeshi Yoshimura
2018-07-12  9:10   ` Burakov, Anatoly
2018-07-13 10:11   ` [PATCH v3] " Takeshi Yoshimura
2018-07-13 11:00     ` Burakov, Anatoly
2018-07-13 11:08       ` Burakov, Anatoly
2018-07-17  8:21         ` Takeshi Yoshimura
2018-07-17  8:22   ` [PATCH v4] " Takeshi Yoshimura
2018-07-17 10:08     ` Burakov, Anatoly
2018-07-20  8:13   ` [PATCH v5] vfio: fix workaround of BAR mapping Takeshi Yoshimura
2018-07-26  9:35     ` Thomas Monjalon
2018-07-29  8:44       ` Jerin Jacob
2018-07-30  8:51         ` Burakov, Anatoly
2018-07-30 10:03           ` Burakov, Anatoly

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.