From: Alex Williamson <alex.williamson@redhat.com>
To: Auger Eric <eric.auger@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
qemu-devel@nongnu.org, peterx@redhat.com, aik@ozlabs.ru
Subject: Re: [Qemu-devel] [PATCH 3/3] vfio/pci: Add ioeventfd support
Date: Thu, 15 Mar 2018 15:07:01 -0600 [thread overview]
Message-ID: <20180315150701.41f77280@w520.home> (raw)
In-Reply-To: <ca07aa34-c0c4-3a79-be4f-4143a10d97c3@redhat.com>
On Tue, 13 Mar 2018 14:12:34 +0100
Auger Eric <eric.auger@redhat.com> wrote:
> On 28/02/18 21:15, Alex Williamson wrote:
> > +long vfio_pci_ioeventfd(struct vfio_pci_device *vdev, loff_t offset,
> > + uint64_t data, int count, int fd)
> > +{
> > + struct pci_dev *pdev = vdev->pdev;
> > + loff_t pos = offset & VFIO_PCI_OFFSET_MASK;
> > + int ret, bar = VFIO_PCI_OFFSET_TO_INDEX(offset);
> > + struct vfio_pci_ioeventfd *ioeventfd;
> > + int (*handler)(void *addr, void *value);
> > +
> > + /* Only support ioeventfds into BARs */
> > + if (bar > VFIO_PCI_BAR5_REGION_INDEX)
> > + return -EINVAL;
> > +
> > + if (pos + count > pci_resource_len(pdev, bar))
> > + return -EINVAL;
> > +
> > + /* Disallow ioeventfds working around MSI-X table writes */
> > + if (bar == vdev->msix_bar &&
> > + !(pos + count <= vdev->msix_offset ||
> > + pos >= vdev->msix_offset + vdev->msix_size))
> > + return -EINVAL;
> > +
> > + switch (count) {
> > + case 1:
> > + handler = &vfio_pci_ioeventfd_handler8;
> > + break;
> > + case 2:
> > + handler = &vfio_pci_ioeventfd_handler16;
> > + break;
> > + case 4:
> > + handler = &vfio_pci_ioeventfd_handler32;
> > + break;
> > +#ifdef iowrite64
> > + case 8:
> > + handler = &vfio_pci_ioeventfd_handler64;
> > + break;
> from a user point of view, it is straightforward this setup will be
> rejected? This is not documented in the uapi at the moment.
I added a mention in the uapi, do you see any need for more?
Essentially I consider this an entirely optional accelerator, bus
drivers are free to implement as much or little as they want.
Userspace can clearly make due without it, we've gone this long, and
it's easy to reject cases we don't want to support. Thanks,
Alex
next prev parent reply other threads:[~2018-03-15 21:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-28 20:14 [Qemu-devel] [PATCH 0/3] vfio/pci: ioeventfd support Alex Williamson
2018-02-28 20:14 ` [Qemu-devel] [PATCH 1/3] vfio/pci: Pull BAR mapping setup from read-write path Alex Williamson
2018-03-07 7:11 ` Peter Xu
2018-03-13 12:21 ` Auger Eric
2018-02-28 20:14 ` [Qemu-devel] [PATCH 2/3] vfio/pci: Use endian neutral helpers Alex Williamson
2018-02-28 20:15 ` [Qemu-devel] [PATCH 3/3] vfio/pci: Add ioeventfd support Alex Williamson
2018-03-06 6:54 ` kbuild test robot
2018-03-07 5:56 ` Peter Xu
2018-03-15 21:12 ` Alex Williamson
2018-03-13 13:12 ` Auger Eric
2018-03-15 21:07 ` Alex Williamson [this message]
2018-03-02 7:08 ` [Qemu-devel] [PATCH 0/3] vfio/pci: " Tian, Kevin
2018-03-02 18:02 ` Alex Williamson
2018-03-03 0:43 ` Tian, Kevin
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=20180315150701.41f77280@w520.home \
--to=alex.williamson@redhat.com \
--cc=aik@ozlabs.ru \
--cc=eric.auger@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).