aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChangpeng Liu <changpeng.liu@intel.com>2020-06-02 16:17:30 +0800
committerThanos Makatos <thanos.makatos@nutanix.com>2020-06-12 08:17:58 -0700
commita254553dac576a36f5d13125ee6c27a7e59bcd32 (patch)
tree578f79e8bfbc74c601a966e04f0c63d4a80478a8
parent758f3b892af7951c6b3c7d6168870884163a5b29 (diff)
downloadlibvfio-user-a254553dac576a36f5d13125ee6c27a7e59bcd32.zip
libvfio-user-a254553dac576a36f5d13125ee6c27a7e59bcd32.tar.gz
libvfio-user-a254553dac576a36f5d13125ee6c27a7e59bcd32.tar.bz2
muser: use the correct PCI_COMMAND interrupt disable(ID) bit
When PCI_COMMAND interrupt disable bit set to 1, it means disable the pin-based INTx interrupt. For NVMe controller, it will use INTx first, and then switch to MSIX, the interrupt vector 0 is both valid for INTx and MSIX, so here we remove the check when posting an interrupt, just check the interrupt fd is valid or not. Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> (cherry picked from commit 8ab7ca7d04365a7c39cd12ea45f8b9f7fa0afd47)
-rw-r--r--lib/libmuser.c13
-rw-r--r--lib/libmuser_pci.c4
2 files changed, 2 insertions, 15 deletions
diff --git a/lib/libmuser.c b/lib/libmuser.c
index bceb8e7..8f2f8d3 100644
--- a/lib/libmuser.c
+++ b/lib/libmuser.c
@@ -1408,19 +1408,6 @@ lm_irq_trigger(lm_ctx_t *lm_ctx, uint32_t vector)
return -1;
}
- if (vector == LM_DEV_INTX_IRQ_IDX && !lm_ctx->pci_config_space->hdr.cmd.id) {
- lm_log(lm_ctx, LM_ERR, "failed to trigger INTx IRQ, INTx disabled\n");
- errno = EINVAL;
- return -1;
- } else if (vector == LM_DEV_MSIX_IRQ_IDX) {
- /*
- * FIXME must check that MSI-X capability exists during creation time
- * FIXME need to check that MSI-X is enabled and that it's not masked.
- * Currently that's not possible because libmuser doesn't care about
- * the internals of a capability.
- */
- }
-
return eventfd_write(lm_ctx->irqs.efds[vector], val);
}
diff --git a/lib/libmuser_pci.c b/lib/libmuser_pci.c
index c8bf826..98d7266 100644
--- a/lib/libmuser_pci.c
+++ b/lib/libmuser_pci.c
@@ -153,13 +153,13 @@ handle_command_write(lm_ctx_t *ctx, lm_pci_config_space_t *pci,
if ((v & PCI_COMMAND_INTX_DISABLE) == PCI_COMMAND_INTX_DISABLE) {
if (!pci->hdr.cmd.id) {
pci->hdr.cmd.id = 0x1;
- lm_log(ctx, LM_INF, "INTx emulation enabled\n");
+ lm_log(ctx, LM_INF, "INTx emulation disabled\n");
}
v &= ~PCI_COMMAND_INTX_DISABLE;
} else {
if (pci->hdr.cmd.id) {
pci->hdr.cmd.id = 0x0;
- lm_log(ctx, LM_INF, "INTx emulation disabled\n");
+ lm_log(ctx, LM_INF, "INTx emulation enabled\n");
}
}