From 45d7e233a56e29e952f42c5d87a79f9787c33db1 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Wed, 27 Feb 2019 22:16:59 +0000 Subject: [PATCH] Unconditionally support unmapped BIOs. This was another shim for supporting older kernels. However, all supported versions of FreeBSD have unmapped I/Os (as do several that have gone EOL), remove it. It's unlikely the driver would work on the older kernels anyway at this point. --- sys/dev/nvme/nvme_ctrlr.c | 4 ---- sys/dev/nvme/nvme_ns.c | 11 +---------- sys/dev/nvme/nvme_private.h | 18 ------------------ sys/dev/nvme/nvme_qpair.c | 2 -- 4 files changed, 1 insertion(+), 34 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 1bbafa8ea44..8d8f794629f 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1056,11 +1056,7 @@ nvme_ctrlr_passthrough_cmd(struct nvme_controller *ctrlr, buf->b_data = pt->buf; buf->b_bufsize = pt->len; buf->b_iocmd = pt->is_read ? BIO_READ : BIO_WRITE; -#ifdef NVME_UNMAPPED_BIO_SUPPORT if (vmapbuf(buf, 1) < 0) { -#else - if (vmapbuf(buf) < 0) { -#endif ret = EFAULT; goto err; } diff --git a/sys/dev/nvme/nvme_ns.c b/sys/dev/nvme/nvme_ns.c index 37789b3f28f..55e8931cfd1 100644 --- a/sys/dev/nvme/nvme_ns.c +++ b/sys/dev/nvme/nvme_ns.c @@ -357,10 +357,8 @@ nvme_construct_child_bios(struct bio *bp, uint32_t alignment, int *num_bios) caddr_t data; uint32_t rem_bcount; int i; -#ifdef NVME_UNMAPPED_BIO_SUPPORT struct vm_page **ma; uint32_t ma_offset; -#endif *num_bios = nvme_get_num_segments(bp->bio_offset, bp->bio_bcount, alignment); @@ -373,10 +371,8 @@ nvme_construct_child_bios(struct bio *bp, uint32_t alignment, int *num_bios) cur_offset = bp->bio_offset; rem_bcount = bp->bio_bcount; data = bp->bio_data; -#ifdef NVME_UNMAPPED_BIO_SUPPORT ma_offset = bp->bio_ma_offset; ma = bp->bio_ma; -#endif for (i = 0; i < *num_bios; i++) { child = child_bios[i]; @@ -386,7 +382,6 @@ nvme_construct_child_bios(struct bio *bp, uint32_t alignment, int *num_bios) child->bio_bcount = min(rem_bcount, alignment - (cur_offset & (alignment - 1))); child->bio_flags = bp->bio_flags; -#ifdef NVME_UNMAPPED_BIO_SUPPORT if (bp->bio_flags & BIO_UNMAPPED) { child->bio_ma_offset = ma_offset; child->bio_ma = ma; @@ -398,9 +393,7 @@ nvme_construct_child_bios(struct bio *bp, uint32_t alignment, int *num_bios) ma += child->bio_ma_n; if (ma_offset != 0) ma -= 1; - } else -#endif - { + } else { child->bio_data = data; data += child->bio_bcount; } @@ -599,9 +592,7 @@ nvme_ns_construct(struct nvme_namespace *ns, uint32_t id, if (res != 0) return (ENXIO); -#ifdef NVME_UNMAPPED_BIO_SUPPORT ns->cdev->si_flags |= SI_UNMAPPED; -#endif return (0); } diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index 3c12befc711..3d0a97f9081 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -112,16 +112,6 @@ MALLOC_DECLARE(M_NVME); #define CACHE_LINE_SIZE (64) #endif -/* - * Use presence of the BIO_UNMAPPED flag to determine whether unmapped I/O - * support and the bus_dmamap_load_bio API are available on the target - * kernel. This will ease porting back to earlier stable branches at a - * later point. - */ -#ifdef BIO_UNMAPPED -#define NVME_UNMAPPED_BIO_SUPPORT -#endif - extern uma_zone_t nvme_request_zone; extern int32_t nvme_retry_count; @@ -134,9 +124,7 @@ struct nvme_completion_poll_status { #define NVME_REQUEST_VADDR 1 #define NVME_REQUEST_NULL 2 /* For requests with no payload. */ #define NVME_REQUEST_UIO 3 -#ifdef NVME_UNMAPPED_BIO_SUPPORT #define NVME_REQUEST_BIO 4 -#endif #define NVME_REQUEST_CCB 5 struct nvme_request { @@ -506,14 +494,8 @@ nvme_allocate_request_bio(struct bio *bio, nvme_cb_fn_t cb_fn, void *cb_arg) req = _nvme_allocate_request(cb_fn, cb_arg); if (req != NULL) { -#ifdef NVME_UNMAPPED_BIO_SUPPORT req->type = NVME_REQUEST_BIO; req->u.bio = bio; -#else - req->type = NVME_REQUEST_VADDR; - req->u.payload = bio->bio_data; - req->payload_size = bio->bio_bcount; -#endif } return (req); } diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index f0d75c05823..c0eeb6da6be 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -954,7 +954,6 @@ _nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req) case NVME_REQUEST_NULL: nvme_qpair_submit_tracker(tr->qpair, tr); break; -#ifdef NVME_UNMAPPED_BIO_SUPPORT case NVME_REQUEST_BIO: KASSERT(req->u.bio->bio_bcount <= qpair->ctrlr->max_xfer_size, ("bio->bio_bcount (%jd) exceeds max_xfer_size (%d)\n", @@ -966,7 +965,6 @@ _nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req) nvme_printf(qpair->ctrlr, "bus_dmamap_load_bio returned 0x%x!\n", err); break; -#endif case NVME_REQUEST_CCB: err = bus_dmamap_load_ccb(tr->qpair->dma_tag_payload, tr->payload_dma_map, req->u.payload,