qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Fam Zheng <fam@euphon.net>,
	qemu-block@nongnu.org, qemu-devel@nongnu.org,
	Max Reitz <mreitz@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [RFC PATCH v2 7/7] util/vfio-helpers: Allow opening device requesting for multiple IRQs
Date: Thu, 13 Aug 2020 15:31:08 -0600	[thread overview]
Message-ID: <20200813153108.722e4788@x1.home> (raw)
In-Reply-To: <20200813172957.8289-8-philmd@redhat.com>

On Thu, 13 Aug 2020 19:29:57 +0200
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:

> Now that our helper is ready for handling multiple IRQs, let
> qemu_vfio_open_pci() take an 'irq_count' argument.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---

As with patch 2/ tying IRQ setup with the opening of a device seems
wrong.  Get the device open, then create an interface to configure the
interrupt.  Thanks,

Alex


>  include/qemu/vfio-helpers.h | 2 +-
>  block/nvme.c                | 5 ++++-
>  util/vfio-helpers.c         | 4 ++--
>  3 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/include/qemu/vfio-helpers.h b/include/qemu/vfio-helpers.h
> index 5c2d8ee5b3..4773b116df 100644
> --- a/include/qemu/vfio-helpers.h
> +++ b/include/qemu/vfio-helpers.h
> @@ -16,7 +16,7 @@
>  typedef struct QEMUVFIOState QEMUVFIOState;
>  
>  QEMUVFIOState *qemu_vfio_open_pci(const char *device, int irq_type,
> -                                  Error **errp);
> +                                  unsigned irq_count, Error **errp);
>  void qemu_vfio_close(QEMUVFIOState *s);
>  int qemu_vfio_dma_map(QEMUVFIOState *s, void *host, size_t size,
>                        bool temporary, uint64_t *iova_list);
> diff --git a/block/nvme.c b/block/nvme.c
> index a5ef571492..2d7aac3903 100644
> --- a/block/nvme.c
> +++ b/block/nvme.c
> @@ -106,6 +106,9 @@ QEMU_BUILD_BUG_ON(offsetof(NVMeRegs, doorbells) != 0x1000);
>  #define INDEX_ADMIN     0
>  #define INDEX_IO(n)     (1 + n)
>  
> +/* This driver shares a single MSIX IRQ for the admin and I/O queues */
> +#define MSIX_IRQ_COUNT  1
> +
>  struct BDRVNVMeState {
>      AioContext *aio_context;
>      QEMUVFIOState *vfio;
> @@ -712,7 +715,7 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
>      }
>  
>      s->vfio = qemu_vfio_open_pci(device, VFIO_PCI_MSIX_IRQ_INDEX,
> -                                 errp);
> +                                 MSIX_IRQ_COUNT, errp);
>      if (!s->vfio) {
>          ret = -EINVAL;
>          goto out;
> diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c
> index 7a934d1a1b..36fafef0d3 100644
> --- a/util/vfio-helpers.c
> +++ b/util/vfio-helpers.c
> @@ -450,12 +450,12 @@ static void qemu_vfio_open_common(QEMUVFIOState *s)
>   * Open a PCI device, e.g. "0000:00:01.0".
>   */
>  QEMUVFIOState *qemu_vfio_open_pci(const char *device, int irq_type,
> -                                  Error **errp)
> +                                  unsigned irq_count, Error **errp)
>  {
>      int r;
>      QEMUVFIOState *s = g_new0(QEMUVFIOState, 1);
>  
> -    r = qemu_vfio_init_pci(s, device, irq_type, 1, errp);
> +    r = qemu_vfio_init_pci(s, device, irq_type, irq_count, errp);
>      if (r) {
>          g_free(s);
>          return NULL;



      reply	other threads:[~2020-08-13 21:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-13 17:29 [RFC PATCH v2 0/7] util/vfio-helpers: Add support for multiple IRQs Philippe Mathieu-Daudé
2020-08-13 17:29 ` [RFC PATCH v2 1/7] util/vfio-helpers: Store eventfd using int32_t type Philippe Mathieu-Daudé
2020-08-13 17:29 ` [RFC PATCH v2 2/7] util/vfio-helpers: Move IRQ 'type' from pci_init_irq() to open_pci() Philippe Mathieu-Daudé
2020-08-13 21:30   ` Alex Williamson
2020-08-13 17:29 ` [RFC PATCH v2 3/7] util/vfio-helpers: Introduce 'irq_count' variable Philippe Mathieu-Daudé
2020-08-13 17:29 ` [RFC PATCH v2 4/7] util/vfio-helpers: Check the device allow up to 'irq_count' IRQs Philippe Mathieu-Daudé
2020-08-13 21:30   ` Alex Williamson
2020-08-13 17:29 ` [RFC PATCH v2 5/7] util/vfio-helpers: Support multiple eventfd Philippe Mathieu-Daudé
2020-08-13 17:29 ` [RFC PATCH v2 6/7] util/vfio-helpers: Allow to set EventNotifier to particular IRQ Philippe Mathieu-Daudé
2020-08-13 21:31   ` Alex Williamson
2020-08-13 17:29 ` [RFC PATCH v2 7/7] util/vfio-helpers: Allow opening device requesting for multiple IRQs Philippe Mathieu-Daudé
2020-08-13 21:31   ` 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=20200813153108.722e4788@x1.home \
    --to=alex.williamson@redhat.com \
    --cc=fam@euphon.net \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).