[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56123493.9000602@scylladb.com>
Date: Mon, 5 Oct 2015 11:28:03 +0300
From: Avi Kivity <avi@...lladb.com>
To: Greg KH <gregkh@...uxfoundation.org>,
Vlad Zolotarov <vladz@...udius-systems.com>
Cc: linux-kernel@...r.kernel.org, mst@...hat.com, hjk@...sjkoch.de,
corbet@....net, bruce.richardson@...el.com,
avi@...udius-systems.com, gleb@...udius-systems.com,
stephen@...workplumber.org, alexander.duyck@...il.com
Subject: Re: [PATCH v3 2/3] uio_pci_generic: add MSI/MSI-X support
On 10/05/2015 06:11 AM, Greg KH wrote:
> On Sun, Oct 04, 2015 at 11:43:17PM +0300, Vlad Zolotarov wrote:
>> Add support for MSI and MSI-X interrupt modes:
>> - Interrupt mode selection order is:
>> INT#X (for backward compatibility) -> MSI-X -> MSI.
>> - Add ioctl() commands:
>> - UIO_PCI_GENERIC_INT_MODE_GET: query the current interrupt mode.
>> - UIO_PCI_GENERIC_IRQ_NUM_GET: query the maximum number of IRQs.
>> - UIO_PCI_GENERIC_IRQ_SET: bind the IRQ to eventfd (similar to vfio).
>> - Add mappings to all bars (memory and portio): some devices have
>> registers related to MSI/MSI-X handling outside BAR0.
>>
>> Signed-off-by: Vlad Zolotarov <vladz@...udius-systems.com>
>> ---
>> New in v3:
>> - Add __iomem qualifier to temp buffer receiving ioremap value.
>>
>> New in v2:
>> - Added #include <linux/uaccess.h> to uio_pci_generic.c
>>
>> Signed-off-by: Vlad Zolotarov <vladz@...udius-systems.com>
>> ---
>> drivers/uio/uio_pci_generic.c | 410 +++++++++++++++++++++++++++++++++++++---
>> include/linux/uio_pci_generic.h | 36 ++++
>> 2 files changed, 423 insertions(+), 23 deletions(-)
>> create mode 100644 include/linux/uio_pci_generic.h
>>
>> diff --git a/drivers/uio/uio_pci_generic.c b/drivers/uio/uio_pci_generic.c
>> index d0b508b..6b8b1789 100644
>> --- a/drivers/uio/uio_pci_generic.c
>> +++ b/drivers/uio/uio_pci_generic.c
>> @@ -22,16 +22,32 @@
>> #include <linux/device.h>
>> #include <linux/module.h>
>> #include <linux/pci.h>
>> +#include <linux/msi.h>
>> #include <linux/slab.h>
>> #include <linux/uio_driver.h>
>> +#include <linux/uio_pci_generic.h>
>> +#include <linux/eventfd.h>
>> +#include <linux/uaccess.h>
>>
>> #define DRIVER_VERSION "0.01.0"
>> #define DRIVER_AUTHOR "Michael S. Tsirkin <mst@...hat.com>"
>> #define DRIVER_DESC "Generic UIO driver for PCI 2.3 devices"
>>
>> +struct msix_info {
>> + int num_irqs;
>> + struct msix_entry *table;
>> + struct uio_msix_irq_ctx {
>> + struct eventfd_ctx *trigger; /* MSI-x vector to eventfd */
> Why are you using eventfd for msi vectors? What's the reason for
> needing this?
>
> You haven't documented how this api works at all, you are going to have
> to a lot more work to justify this, as this greatly increases the
> complexity of the user/kernel api in unknown ways.
>
>
Of course it has to be documented, but this just follows vfio.
Eventfd is a natural enough representation of an interrupt; both kvm and
vfio use it, and are also able to share the eventfd, allowing a vfio
interrupt to generate a kvm interrupt, without userspace intervention,
and one day without even kernel intervention.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists