aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/nvme/nvme_qpair.c
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2020-12-04 21:34:48 +0000
committerWarner Losh <imp@FreeBSD.org>2020-12-04 21:34:48 +0000
commit082905cad121bf6721606b6b9ba20a09bc6e56d0 (patch)
treea7f070c875a04271677466024956aacc1fadc5e6 /sys/dev/nvme/nvme_qpair.c
parent730b1b4d1c7448a0bad3ad75f9ab5df2c64ffcf6 (diff)
downloadsrc-082905cad121bf6721606b6b9ba20a09bc6e56d0.tar.gz
src-082905cad121bf6721606b6b9ba20a09bc6e56d0.zip
nvme: Remove a wmb() that's not necessary.
bus_dmamap_sync() ensures that memory that's prepared for PREWRITE can be DMA'd immediately after it returns. The details differ, but this mirrors atomic thread release semantics, at least for the buffers synced. For non-x86 platforms, bus_dmamap_sync() has the right syncing and fences. So in the past, wmb() had been omitted for them. For x86 platforms, the memory ordering is already strong enough to ensure DMA to the device sees the current contents. As such, we don't need the wmb() here. It translates to an sfence which is only needed for writes to regions that have the write combining attribute set or when some exotic opcodes are used. The nvme driver does neither of these. Since bus_dmamap_sync() includes atomic_thread_fence_rel, we can be assured any optimizer won't reorder the bus_dmamap_sync and the bus_space_write operations. The wmb() was a vestiage of the pre-busdma version initially committed to the tree. Reviewed by: kib@, gallatin@, chuck@, mav@ Differential Revision: https://reviews.freebsd.org/D27448
Notes
Notes: svn path=/head/; revision=368352
Diffstat (limited to 'sys/dev/nvme/nvme_qpair.c')
-rw-r--r--sys/dev/nvme/nvme_qpair.c8
1 files changed, 0 insertions, 8 deletions
diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c
index 09b9336e5ac0..45b1568a4c5a 100644
--- a/sys/dev/nvme/nvme_qpair.c
+++ b/sys/dev/nvme/nvme_qpair.c
@@ -982,14 +982,6 @@ nvme_qpair_submit_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr)
bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
-#if !defined( __powerpc__) && !defined( __aarch64__) && !defined( __arm__)
- /*
- * powerpc's bus_dmamap_sync() already includes a heavyweight sync, but
- * no other archs do.
- */
- wmb();
-#endif
-
bus_space_write_4(qpair->ctrlr->bus_tag, qpair->ctrlr->bus_handle,
qpair->sq_tdbl_off, qpair->sq_tail);
qpair->num_cmds++;