diff options
author | jimharris <jimharris@FreeBSD.org> | 2016-01-07 16:11:31 +0000 |
---|---|---|
committer | jimharris <jimharris@FreeBSD.org> | 2016-01-07 16:11:31 +0000 |
commit | 35417c6f6727d389b26333c64cb0639275c3400b (patch) | |
tree | 20819a37e717531751445d6b6e73e5ccd2daddb5 /sys/dev/nvme | |
parent | 6f7e8e539309cc085154008676bff1a0d411d928 (diff) | |
download | FreeBSD-src-35417c6f6727d389b26333c64cb0639275c3400b.zip FreeBSD-src-35417c6f6727d389b26333c64cb0639275c3400b.tar.gz |
nvme: do not pre-allocate MSI-X IRQ resources
The issue referenced here was resolved by other changes
in recent commits, so this code is no longer needed.
MFC after: 3 days
Sponsored by: Intel
Diffstat (limited to 'sys/dev/nvme')
-rw-r--r-- | sys/dev/nvme/nvme_ctrlr.c | 37 | ||||
-rw-r--r-- | sys/dev/nvme/nvme_private.h | 2 | ||||
-rw-r--r-- | sys/dev/nvme/nvme_qpair.c | 3 |
3 files changed, 3 insertions, 39 deletions
diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index d5c7373..35ee07b 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -929,7 +929,7 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev) { union cap_lo_register cap_lo; union cap_hi_register cap_hi; - int i, per_cpu_io_queues, rid; + int per_cpu_io_queues; int num_vectors_requested, num_vectors_allocated; int status, timeout_period; @@ -1030,41 +1030,6 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev) panic("could not reallocate 2 vectors\n"); } - /* - * On earlier FreeBSD releases, there are reports that - * pci_alloc_msix() can return successfully with all vectors - * requested, but a subsequent bus_alloc_resource_any() - * for one of those vectors fails. This issue occurs more - * readily with multiple devices using per-CPU vectors. - * To workaround this issue, try to allocate the resources now, - * and fall back to INTx if we cannot allocate all of them. - * This issue cannot be reproduced on more recent versions of - * FreeBSD which have increased the maximum number of MSI-X - * vectors, but adding the workaround makes it easier for - * vendors wishing to import this driver into kernels based on - * older versions of FreeBSD. - */ - for (i = 0; i < num_vectors_allocated; i++) { - rid = i + 1; - ctrlr->msi_res[i] = bus_alloc_resource_any(ctrlr->dev, - SYS_RES_IRQ, &rid, RF_ACTIVE); - - if (ctrlr->msi_res[i] == NULL) { - ctrlr->msix_enabled = 0; - while (i > 0) { - i--; - bus_release_resource(ctrlr->dev, - SYS_RES_IRQ, - rman_get_rid(ctrlr->msi_res[i]), - ctrlr->msi_res[i]); - } - pci_release_msi(dev); - nvme_printf(ctrlr, "could not obtain all MSI-X " - "resources, reverting to intx\n"); - break; - } - } - intx: if (!ctrlr->msix_enabled) diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index a6d3eff..7e049ee 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -275,8 +275,6 @@ struct nvme_controller { struct task fail_req_task; struct taskqueue *taskqueue; - struct resource *msi_res[MAXCPU + 1]; - /* For shared legacy interrupt. */ int rid; struct resource *res; diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index d0cb8c6..92fe672 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -479,8 +479,9 @@ nvme_qpair_construct(struct nvme_qpair *qpair, uint32_t id, * the queue's vector to get the corresponding rid to use. */ qpair->rid = vector + 1; - qpair->res = ctrlr->msi_res[vector]; + qpair->res = bus_alloc_resource_any(ctrlr->dev, SYS_RES_IRQ, + &qpair->rid, RF_ACTIVE); bus_setup_intr(ctrlr->dev, qpair->res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, nvme_qpair_msix_handler, qpair, &qpair->tag); |