aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbdelkader Boudih <seuros@FreeBSD.org>2026-09-23 18:01:57 +0000
committerAbdelkader Boudih <seuros@FreeBSD.org>2026-09-23 18:01:57 +0000
commitad57f212665e1642423afb83aef19e755833643f (patch)
tree02b6c5a76a11d85cba63fcf1057f60ae5017aa94
parentba974faaf30b74472acc4f0dc5853a22d43951f2 (diff)
nvme: do not touch INTMS/INTMC when configured for MSI-X
The single-vector MSI-X fallback installs the shared interrupt handler, which masks interrupts through INTMS/INTMC around the completion poll. INTx and MSI are unaffected. Only MSI-X track the interrupt mode and skip un/masking Reviewed by: ngie, imp, adrian Differential Revision: https://reviews.freebsd.org/D59637
-rw-r--r--sys/dev/nvme/nvme_ctrlr.c7
-rw-r--r--sys/dev/nvme/nvme_pci.c1
-rw-r--r--sys/dev/nvme/nvme_private.h1
3 files changed, 7 insertions, 2 deletions
diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c
index a8d8d1b99647..6dba83708df4 100644
--- a/sys/dev/nvme/nvme_ctrlr.c
+++ b/sys/dev/nvme/nvme_ctrlr.c
@@ -1405,9 +1405,12 @@ nvme_ctrlr_shared_handler(void *arg)
{
struct nvme_controller *ctrlr = arg;
- nvme_mmio_write_4(ctrlr, intms, 1);
+ /* INTMS/INTMC are undefined when configured for MSI-X. */
+ if (!ctrlr->is_msix)
+ nvme_mmio_write_4(ctrlr, intms, 1);
nvme_ctrlr_poll(ctrlr);
- nvme_mmio_write_4(ctrlr, intmc, 1);
+ if (!ctrlr->is_msix)
+ nvme_mmio_write_4(ctrlr, intmc, 1);
}
#define NVME_MAX_PAGES (int)(1024 / sizeof(vm_page_t))
diff --git a/sys/dev/nvme/nvme_pci.c b/sys/dev/nvme/nvme_pci.c
index 8ea31850d09b..5d4fab3b2ab1 100644
--- a/sys/dev/nvme/nvme_pci.c
+++ b/sys/dev/nvme/nvme_pci.c
@@ -385,6 +385,7 @@ again:
ctrlr->msi_count = 0;
goto msi;
}
+ ctrlr->is_msix = true;
if (ctrlr->msi_count == 1)
return (nvme_ctrlr_setup_shared(ctrlr, 1));
if (ctrlr->msi_count != num_vectors_requested) {
diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h
index f96729608ed5..9bee1b23bd4e 100644
--- a/sys/dev/nvme/nvme_private.h
+++ b/sys/dev/nvme/nvme_private.h
@@ -257,6 +257,7 @@ struct nvme_controller {
struct resource *msix_pba_resource;
int msi_count;
+ bool is_msix;
uint32_t enable_aborts;
uint32_t num_io_queues;