git: 795a9974144e - main - Hyper-V: storvsc: Call bus_dmamap_sync() for dma operations
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 15 Aug 2022 07:07:33 UTC
The branch main has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=795a9974144ec26f93a9081f72e09a2814ac3e4c commit 795a9974144ec26f93a9081f72e09a2814ac3e4c Author: Wei Hu <whu@FreeBSD.org> AuthorDate: 2022-08-15 06:56:01 +0000 Commit: Wei Hu <whu@FreeBSD.org> CommitDate: 2022-08-15 07:05:43 +0000 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 --- sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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;