diff options
-rw-r--r-- | README.md | 11 | ||||
-rw-r--r-- | lib/libmuser.c | 13 | ||||
-rw-r--r-- | lib/muser.h | 4 |
3 files changed, 21 insertions, 7 deletions
@@ -41,6 +41,17 @@ future we plan to make libmuser multi-threaded. The application can be implemented in whatever way is convenient, e.g. as a Python script using bindings, on the cloud, etc. There's also experimental support for polling. +There is also an ongoing effort to define a protocol based on VFIO that will be +officially supported by QEMU so the kernel module won't be necessary. This +protocol (tentatively named VFIO-over-socket and soon to be renamed to +vfio-user) has been discussed as an RFC in qemu-devel: +https://lists.gnu.org/archive/html/qemu-devel/2020-03/msg07900.html, +and is now in the process of being reviewed: +https://www.mail-archive.com/qemu-devel@nongnu.org/msg723773.html. +In the RFC email thread it is explained how to run the GPIO sample without the +MUSER kernel module, where to get sources etc. Please refer to the RFC email +thread for more information. + Memory Mapping the Device ------------------------- diff --git a/lib/libmuser.c b/lib/libmuser.c index e9fb8ce..29022af 100644 --- a/lib/libmuser.c +++ b/lib/libmuser.c @@ -2648,12 +2648,13 @@ lm_mmap(lm_ctx_t *lm_ctx, off_t offset, size_t length) lm_ctx->fd, offset); } -static int validate_irq_vector(lm_ctx_t *lm_ctx, uint32_t vector) +static int validate_irq_subindex(lm_ctx_t *lm_ctx, uint32_t subindex) { - if ((lm_ctx == NULL) || (vector >= lm_ctx->irqs.max_ivs)) { - lm_log(lm_ctx, LM_ERR, "bad IRQ %d, max=%d\n", vector, + if ((lm_ctx == NULL) || (subindex >= lm_ctx->irqs.max_ivs)) { + lm_log(lm_ctx, LM_ERR, "bad IRQ %d, max=%d\n", subindex, lm_ctx->irqs.max_ivs); + /* FIXME should return -errno */ errno = EINVAL; return -1; } @@ -2667,13 +2668,14 @@ lm_irq_trigger(lm_ctx_t *lm_ctx, uint32_t subindex) int ret; eventfd_t val = 1; - ret = validate_irq_vector(lm_ctx, subindex); + ret = validate_irq_subindex(lm_ctx, subindex); if (ret < 0) { return ret; } if (lm_ctx->irqs.efds[subindex] == -1) { lm_log(lm_ctx, LM_ERR, "no fd for interrupt %d\n", subindex); + /* FIXME should return -errno */ errno = ENOENT; return -1; } @@ -2687,7 +2689,7 @@ lm_irq_message(lm_ctx_t *lm_ctx, uint32_t subindex) int ret, msg_id = 1; struct vfio_user_irq_info irq_info; - ret = validate_irq_vector(lm_ctx, subindex); + ret = validate_irq_subindex(lm_ctx, subindex); if (ret < 0) { return -1; } @@ -2698,6 +2700,7 @@ lm_irq_message(lm_ctx_t *lm_ctx, uint32_t subindex) &irq_info, sizeof irq_info, NULL, 0, NULL, NULL, 0); if (ret < 0) { + /* FIXME should return -errno */ errno = -ret; return -1; } diff --git a/lib/muser.h b/lib/muser.h index 949680c..a39d477 100644 --- a/lib/muser.h +++ b/lib/muser.h @@ -445,8 +445,8 @@ lm_ctx_poll(lm_ctx_t *lm_ctx); /** * Triggers an interrupt. * - * libmuser takes care of using the IRQ type (INTx, MSI/X), the caller only - * needs to specify the sub-index. + * libmuser takes care of using the correct IRQ type (IRQ index: INTx or MSI/X), + * the caller only needs to specify the sub-index. * * @lm_ctx: the libmuser context to trigger interrupt * @subindex: vector subindex to trigger interrupt on |