From: Alex Williamson <alex.williamson@redhat.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH kernel v3] vfio-pci: Allow mapping MSIX BAR
Date: Wed, 20 Dec 2017 12:02:24 -0700 [thread overview]
Message-ID: <20171220120224.3709abc5@t450s.home> (raw)
In-Reply-To: <20171213023131.41233-1-aik@ozlabs.ru>
On Wed, 13 Dec 2017 13:31:31 +1100
Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
> By default VFIO disables mapping of MSIX BAR to the userspace as
> the userspace may program it in a way allowing spurious interrupts;
> instead the userspace uses the VFIO_DEVICE_SET_IRQS ioctl.
> In order to eliminate guessing from the userspace about what is
> mmapable, VFIO also advertises a sparse list of regions allowed to mmap.
>
> This works fine as long as the system page size equals to the MSIX
> alignment requirement which is 4KB. However with a bigger page size
> the existing code prohibits mapping non-MSIX parts of a page with MSIX
> structures so these parts have to be emulated via slow reads/writes on
> a VFIO device fd. If these emulated bits are accessed often, this has
> serious impact on performance.
>
> This allows mmap of the entire BAR containing MSIX vector table.
>
> This removes the sparse capability for PCI devices as it becomes useless.
>
> As the userspace needs to know for sure whether mmapping of the MSIX
> vector containing data can succeed, this adds a new capability -
> VFIO_REGION_INFO_CAP_MSIX_MAPPABLE - which explicitly tells the userspace
> that the entire BAR can be mmapped.
>
> This does not touch the MSIX mangling in the BAR read/write handlers as
> we are doing this just to enable direct access to non MSIX registers.
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> Changes:
> v3:
> * rebased on top of "vfio: Simplify capability helper"
>
> v2:
> * rewritten vfio_info_add_capability() to provide same interface for
> VFIO_REGION_INFO_CAP_MSIX_MAPPABLE as for other caps.
> ---
> include/uapi/linux/vfio.h | 10 +++++++
> drivers/vfio/pci/vfio_pci.c | 65 +++++++--------------------------------------
> 2 files changed, 19 insertions(+), 56 deletions(-)
Applied to v4.16/vfio. Thanks,
Alex
prev parent reply other threads:[~2017-12-20 19:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-13 2:31 [PATCH kernel v3] vfio-pci: Allow mapping MSIX BAR Alexey Kardashevskiy
2017-12-20 19:02 ` Alex Williamson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171220120224.3709abc5@t450s.home \
--to=alex.williamson@redhat.com \
--cc=aik@ozlabs.ru \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox