[v2] vfio: fix workaround of BAR0 mapping
Checks
Commit Message
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 <t.yoshimura8869@gmail.com>
---
Fixed checkpatch warnings
drivers/bus/pci/linux/pci_vfio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On 12-Jul-18 4:08 AM, Takeshi Yoshimura wrote:
> 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 <t.yoshimura8869@gmail.com>
> ---
Minimum support kernel version in DPDK is 3.2, we cannot rely on
functionality provided by the recent kernel versions.
It would be better if you modified the check at line 350 instead (or
added a new check, specifically testing for whether BAR size is less
than page size).
@@ -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.