Hyper-V: storvsc: Call bus_dmamap_sync() for dma operations

Call bus_dmamap_sync() for related dma operations. This is required
on ARM64 architecture.

Tested by:	Souradeep Chakrabarti <schakrabarti@microsoft.com>
MFC after:	2 weeks
Sponsored by:	Microsoft
This commit is contained in:
Wei Hu 2022-08-15 06:56:01 +00:00
parent 036f1bc613
commit 795a997414

View File

@ -1853,6 +1853,18 @@ storvsc_xferbuf_prepare(void *arg, bus_dma_segment_t *segs, int nsegs, int error
prplist->gpa_page[i] = atop(segs[i].ds_addr);
}
reqp->prp_cnt = nsegs;
if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) {
bus_dmasync_op_t op;
if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN)
op = BUS_DMASYNC_PREREAD;
else
op = BUS_DMASYNC_PREWRITE;
bus_dmamap_sync(reqp->softc->storvsc_req_dtag,
reqp->data_dmap, op);
}
}
/**
@ -2113,6 +2125,19 @@ storvsc_io_done(struct hv_storvsc_request *reqp)
int ori_sg_count = 0;
const struct scsi_generic *cmd;
if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) {
bus_dmasync_op_t op;
if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN)
op = BUS_DMASYNC_POSTREAD;
else
op = BUS_DMASYNC_POSTWRITE;
bus_dmamap_sync(reqp->softc->storvsc_req_dtag,
reqp->data_dmap, op);
bus_dmamap_unload(sc->storvsc_req_dtag, reqp->data_dmap);
}
/* destroy bounce buffer if it is used */
if (reqp->bounce_sgl_count) {
ori_sglist = (bus_dma_segment_t *)ccb->csio.data_ptr;