Properly synchronize completion DMA buffers.
Within command completion processing the callback function may access DMAed data buffer. Synchronize it before use, not after. This allows to use NVMe disk on non-DMA coherent arm64 system. MFC after: 3 weeks
This commit is contained in:
parent
2e6bb6553b
commit
0a4b14e8cc
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=355774
@ -444,8 +444,15 @@ nvme_qpair_complete_tracker(struct nvme_tracker *tr,
|
||||
|
||||
KASSERT(cpl->cid == req->cmd.cid, ("cpl cid does not match cmd cid\n"));
|
||||
|
||||
if (req->cb_fn && !retry)
|
||||
req->cb_fn(req->cb_arg, cpl);
|
||||
if (!retry) {
|
||||
if (req->type != NVME_REQUEST_NULL) {
|
||||
bus_dmamap_sync(qpair->dma_tag_payload,
|
||||
tr->payload_dma_map,
|
||||
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
|
||||
}
|
||||
if (req->cb_fn)
|
||||
req->cb_fn(req->cb_arg, cpl);
|
||||
}
|
||||
|
||||
mtx_lock(&qpair->lock);
|
||||
callout_stop(&tr->timer);
|
||||
@ -455,9 +462,6 @@ nvme_qpair_complete_tracker(struct nvme_tracker *tr,
|
||||
nvme_qpair_submit_tracker(qpair, tr);
|
||||
} else {
|
||||
if (req->type != NVME_REQUEST_NULL) {
|
||||
bus_dmamap_sync(qpair->dma_tag_payload,
|
||||
tr->payload_dma_map,
|
||||
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
|
||||
bus_dmamap_unload(qpair->dma_tag_payload,
|
||||
tr->payload_dma_map);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user