From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752418AbbJEHlo (ORCPT ); Mon, 5 Oct 2015 03:41:44 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:34595 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751864AbbJEHlm (ORCPT ); Mon, 5 Oct 2015 03:41:42 -0400 Subject: Re: [PATCH v3 2/3] uio_pci_generic: add MSI/MSI-X support To: Greg KH References: <1443991398-23761-1-git-send-email-vladz@cloudius-systems.com> <1443991398-23761-3-git-send-email-vladz@cloudius-systems.com> <20151005031159.GB27303@kroah.com> Cc: linux-kernel@vger.kernel.org, mst@redhat.com, hjk@hansjkoch.de, corbet@lwn.net, bruce.richardson@intel.com, avi@cloudius-systems.com, gleb@cloudius-systems.com, stephen@networkplumber.org, alexander.duyck@gmail.com From: Vlad Zolotarov Message-ID: <561229B3.7000109@cloudius-systems.com> Date: Mon, 5 Oct 2015 10:41:39 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <20151005031159.GB27303@kroah.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/05/15 06:11, 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 >> --- >> New in v3: >> - Add __iomem qualifier to temp buffer receiving ioremap value. >> >> New in v2: >> - Added #include to uio_pci_generic.c >> >> Signed-off-by: Vlad Zolotarov >> --- >> 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 >> #include >> #include >> +#include >> #include >> #include >> +#include >> +#include >> +#include >> >> #define DRIVER_VERSION "0.01.0" >> #define DRIVER_AUTHOR "Michael S. Tsirkin " >> #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? A small correction - for MSI-X vectors. There may be only one MSI vector per PCI function and if it's used it would use the same interface as a legacy INT#x interrupt uses at the moment. So, for MSI-X case the reason is that there may be (in most cases there will be) more than one interrupt vector. Thus, as I've explained in a PATCH1 thread we need a way to indicated each of them separately. eventfd seems like a good way of doing so. If u have better ideas, pls., share. > > 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. I actually do documented it a bit. Pls., check PATCH3 out. I admit that I could do a better job by for instance providing a code example. I'll improve this in v4 once we agree on all other details. thanks, vlad > > greg k-h