[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 15/16] block/nvme: Switch to using the MSIX API
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 15/16] block/nvme: Switch to using the MSIX API |
Date: |
Tue, 20 Oct 2020 19:24:27 +0200 |
In preparation of using multiple IRQs, switch to using the recently
introduced MSIX API. Instead of allocating and assigning IRQ in
a single step, we now have to use two distinct calls.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
block/nvme.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/block/nvme.c b/block/nvme.c
index 428cda620df..a5518ad5bac 100644
--- a/block/nvme.c
+++ b/block/nvme.c
@@ -691,6 +691,7 @@ static int nvme_init(BlockDriverState *bs, const char
*device, int namespace,
Error *local_err = NULL;
volatile NvmeBar *regs = NULL;
size_t min_page_size = 4096;
+ unsigned irq_count = MSIX_IRQ_COUNT;
qemu_co_mutex_init(&s->dma_map_lock);
qemu_co_queue_init(&s->dma_flush_queue);
@@ -784,8 +785,17 @@ static int nvme_init(BlockDriverState *bs, const char
*device, int namespace,
}
}
- ret = qemu_vfio_pci_init_irq(s->vfio, s->irq_notifier,
- VFIO_PCI_MSIX_IRQ_INDEX, errp);
+ ret = qemu_vfio_pci_msix_init_irqs(s->vfio, &irq_count, errp);
+ if (ret) {
+ if (ret == -EOVERFLOW) {
+ error_append_hint(errp, "%u IRQs requested but only %u
available\n",
+ MSIX_IRQ_COUNT, irq_count);
+ }
+ goto out;
+ }
+
+ ret = qemu_vfio_pci_msix_set_irq(s->vfio, MSIX_SHARED_IRQ_IDX,
+ s->irq_notifier, errp);
if (ret) {
goto out;
}
--
2.26.2
- [PATCH 09/16] util/vfio-helpers: Convert vfio_dump_mapping to trace events, (continued)
- [PATCH 09/16] util/vfio-helpers: Convert vfio_dump_mapping to trace events, Philippe Mathieu-Daudé, 2020/10/20
- [PATCH 10/16] util/vfio-helpers: Let qemu_vfio_dma_map() propagate Error, Philippe Mathieu-Daudé, 2020/10/20
- [PATCH 11/16] util/vfio-helpers: Let qemu_vfio_do_mapping() propagate Error, Philippe Mathieu-Daudé, 2020/10/20
- [PATCH 12/16] util/vfio-helpers: Let qemu_vfio_verify_mappings() use error_report(), Philippe Mathieu-Daudé, 2020/10/20
- [PATCH 13/16] util/vfio-helpers: Introduce qemu_vfio_pci_msix_init_irqs(), Philippe Mathieu-Daudé, 2020/10/20
- [PATCH 15/16] block/nvme: Switch to using the MSIX API,
Philippe Mathieu-Daudé <=
- [PATCH 14/16] util/vfio-helpers: Introduce qemu_vfio_pci_msix_set_irq(), Philippe Mathieu-Daudé, 2020/10/20
- [PATCH 16/16] util/vfio-helpers: Remove now unused qemu_vfio_pci_init_irq(), Philippe Mathieu-Daudé, 2020/10/20