From nobody Mon Aug 15 07:07:33 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4M5lj153H0z4YZGn; Mon, 15 Aug 2022 07:07:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M5lj14Xdwz3k7T; Mon, 15 Aug 2022 07:07:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660547253; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IFRbd2wUBp7FL/DrdqzpyKt0r3Y+DyjOseFP3wvOcYY=; b=Wdm4V5Ypljo323/faemRKr4x89RYST7FAkYVf4gkMN8P6zkebsWjANG+9vgWRdRaiW/ZhM 1IiM21n3vUW2x2bT8jfsqqFWZeAVIPhMKUuaeqshgArQy+fCiIZT9UdwY3SerWJcqVBlsu A+EifIdocrauJw1uzK6GeNGTa1wju4Eyhsmy1MHU3/atBtUqY2oOzmBuFvqJ4u82aDozi5 yZA0GfLZa7uA4yPP3YEiZKm8AxqpeXEUMYlGpKMlAmOkInm7ofrqPz5h28wNaW0KBU472V jkX9NFTwkwyggYLkRAfZ9zY2SvXYkPythyOWDRmVEPXAdNYueZUNnW4CASVBVQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4M5lj13bHqzLlS; Mon, 15 Aug 2022 07:07:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27F77XRq029206; Mon, 15 Aug 2022 07:07:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27F77XuI029205; Mon, 15 Aug 2022 07:07:33 GMT (envelope-from git) Date: Mon, 15 Aug 2022 07:07:33 GMT Message-Id: <202208150707.27F77XuI029205@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wei Hu Subject: git: 795a9974144e - main - Hyper-V: storvsc: Call bus_dmamap_sync() for dma operations List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 795a9974144ec26f93a9081f72e09a2814ac3e4c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660547253; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IFRbd2wUBp7FL/DrdqzpyKt0r3Y+DyjOseFP3wvOcYY=; b=F0c0w9sOiRR6u4XlFXB1Y7dJlRLYqKRN2Sug5dodmWijrUX6PWQc2XHUV0fyKQiif+gDW8 DrGaxg23p9ZyhsqKoJzUFQt15D8wRhkmCVmTtqmDlIPAOXJBB53tbZDovZCjE+znQ/qq/Q R/jPuenvjg4mD6R5EWupkuQapXEJ7CT/yhrb6bAu0coX8ZdchuMQ6g/obPvR4FpHzcKBSW SVNuP9R4t7cw8BiiF4jjeU5xsiChJFSwLBBE7QIwsQE7sDu45mkZjnpm4SGnu2cLn4kYk5 eqVyBjcKVhbUMYbcPi/ulkCrvUQCCHDNeo68qbTMMJIKf9L1aARpNocw4Obtxg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660547253; a=rsa-sha256; cv=none; b=ZbnhCo2cwkoeAOG50WDQuphP+UA5pgj+DU0PgyZeYWs3Xq+8iGAmfXJ8rZswB8UwQIcffB iXl3prQL/UC7GAETm8pp2bKUtGrjiHxYqmPq29xGe2yPYTXyDhpfV590p4zIolwtI8hO2O sRVtFD6aAD5Fw3ZqdVpBBpvHDuzIzgU03AfZvN7rAz5LmfISkUbWdnRTDNfCXJXKDfiR33 q70fiifQIwzZh6O+n7Nd14ba2hQ3dD+xAaox+2H9PgU7rM5sAEiuXw9pcmFdvfR34oMJ2A KF1RW/3RaF2Xkh2/T2wmC7QLhKEXKMjWRnY3fvXSX92Pld3iSnkoqUsm9ql1Sw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=795a9974144ec26f93a9081f72e09a2814ac3e4c commit 795a9974144ec26f93a9081f72e09a2814ac3e4c Author: Wei Hu AuthorDate: 2022-08-15 06:56:01 +0000 Commit: Wei Hu 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 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;