aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/hyperv
diff options
context:
space:
mode:
authorWei Hu <whu@FreeBSD.org>2022-08-15 06:56:01 +0000
committerWei Hu <whu@FreeBSD.org>2022-08-15 07:05:43 +0000
commit795a9974144ec26f93a9081f72e09a2814ac3e4c (patch)
tree81eac7d9576bbf6a1a8b325e8e2223fd9a4debe2 /sys/dev/hyperv
parent036f1bc6139e8fc6d3aca61a5ab93ffc5715cf74 (diff)
downloadsrc-795a9974144ec26f93a9081f72e09a2814ac3e4c.tar.gz
src-795a9974144ec26f93a9081f72e09a2814ac3e4c.zip
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
Diffstat (limited to 'sys/dev/hyperv')
-rw-r--r--sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
index 2e2ecf3dd228..4c9869887db6 100644
--- a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
+++ b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
@@ -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;