[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v2 7/7] util/vfio-helpers: Allow opening device requesting fo
From: |
Philippe Mathieu-Daudé |
Subject: |
[RFC PATCH v2 7/7] util/vfio-helpers: Allow opening device requesting for multiple IRQs |
Date: |
Thu, 13 Aug 2020 19:29:57 +0200 |
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>
---
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;
--
2.21.3
- [RFC PATCH v2 0/7] util/vfio-helpers: Add support for multiple IRQs, Philippe Mathieu-Daudé, 2020/08/13
- [RFC PATCH v2 1/7] util/vfio-helpers: Store eventfd using int32_t type, Philippe Mathieu-Daudé, 2020/08/13
- [RFC PATCH v2 2/7] util/vfio-helpers: Move IRQ 'type' from pci_init_irq() to open_pci(), Philippe Mathieu-Daudé, 2020/08/13
- [RFC PATCH v2 3/7] util/vfio-helpers: Introduce 'irq_count' variable, Philippe Mathieu-Daudé, 2020/08/13
- [RFC PATCH v2 4/7] util/vfio-helpers: Check the device allow up to 'irq_count' IRQs, Philippe Mathieu-Daudé, 2020/08/13
- [RFC PATCH v2 5/7] util/vfio-helpers: Support multiple eventfd, Philippe Mathieu-Daudé, 2020/08/13
- [RFC PATCH v2 6/7] util/vfio-helpers: Allow to set EventNotifier to particular IRQ, Philippe Mathieu-Daudé, 2020/08/13
- [RFC PATCH v2 7/7] util/vfio-helpers: Allow opening device requesting for multiple IRQs,
Philippe Mathieu-Daudé <=