From patchwork Tue Feb 4 09:52:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Jensen X-Patchwork-Id: 11364345 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ABCDF13A4 for ; Tue, 4 Feb 2020 10:05:20 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 82A752192A for ; Tue, 4 Feb 2020 10:05:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="CTCRBqrI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 82A752192A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:55508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iyv55-0003fC-L7 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 04 Feb 2020 05:05:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55971) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iyusp-0004XU-TE for qemu-devel@nongnu.org; Tue, 04 Feb 2020 04:52:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iyuso-0007if-KX for qemu-devel@nongnu.org; Tue, 04 Feb 2020 04:52:39 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:39364) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iyuso-0007HQ-Du for qemu-devel@nongnu.org; Tue, 04 Feb 2020 04:52:38 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200204095227euoutp020e88a43c95263cc632a600792f1de3eb~wKkWYTLc02939629396euoutp02V for ; Tue, 4 Feb 2020 09:52:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200204095227euoutp020e88a43c95263cc632a600792f1de3eb~wKkWYTLc02939629396euoutp02V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1580809947; bh=ngZmAEle7Rl4AlNKbikHFaebBO01MamT0DYTVMAtk3k=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=CTCRBqrIoLcR1XHlWLsroCrhQwY/PR+vE+WV0ZDj5yYonp1xUrLkXgKAKjhhIoRgD tZt1YbF+lxqou4rqVxfwlAOhV7MEsbZMMLyk/S8rHF9MyV3D4kws4UrMwRwSocqkCL MpMbeKTVWRw+CDs1agc0bEZ12SNCRZ/qX+yUIXOA= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200204095227eucas1p2838d8c122e00aa6c843e8fc43ec9991a~wKkWNmb4R2200522005eucas1p2H; Tue, 4 Feb 2020 09:52:27 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 05.EF.60698.BDE393E5; Tue, 4 Feb 2020 09:52:27 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200204095227eucas1p2f23061d391e67f4d3bde8bab74d1e44b~wKkV7dOmt2198521985eucas1p2E; Tue, 4 Feb 2020 09:52:27 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200204095227eusmtrp2bafbc92f87c8bbd0f649df7b2dc4f20f~wKkV64rBa0487104871eusmtrp2p; Tue, 4 Feb 2020 09:52:27 +0000 (GMT) X-AuditID: cbfec7f5-a0fff7000001ed1a-02-5e393edbc585 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 3E.6A.07950.BDE393E5; Tue, 4 Feb 2020 09:52:27 +0000 (GMT) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200204095226eusmtip24de5e465024b0db952e79b7a1a808112~wKkVzSwb62798927989eusmtip2i; Tue, 4 Feb 2020 09:52:26 +0000 (GMT) Received: from CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) by CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Tue, 4 Feb 2020 09:52:26 +0000 Received: from apples.local (106.110.32.41) by CAMSVWEXC01.scsc.local (106.1.227.71) with Microsoft SMTP Server id 15.0.1320.4 via Frontend Transport; Tue, 4 Feb 2020 09:52:26 +0000 From: Klaus Jensen To: Subject: [PATCH v5 18/26] nvme: use preallocated qsg/iov in nvme_dma_prp Date: Tue, 4 Feb 2020 10:52:00 +0100 Message-ID: <20200204095208.269131-19-k.jensen@samsung.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200204095208.269131-1-k.jensen@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrEKsWRmVeSWpSXmKPExsWy7djPc7q37SzjDHqnCVls7m9ntNh/8Bur xaRD1xgtllxMtZh3S9li1rt2NovjvTtYHNg9zu04z+6xaVUnm8eda3vYPJ5c28zk8X7fVbYA 1igum5TUnMyy1CJ9uwSujL/3zrEUTBGsOPbvLFsD4xaeLkZODgkBE4n+c/PYuhi5OIQEVjBK zDncw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//YLaIgLRE+9VJYBuYBX4z SvzpCwSxhQU8JK61HgHbwCKgItG+cicTiM0rYC2xcPJmRojN8hKzG0+DLeMEiu9fdQKohgNo mZVE61FuiHJBiZMzn7BAjJeXaN46mxnClpA4+OIF8wRG4VlIymYhKZuFpGwBI/MqRpHU0uLc 9NxiI73ixNzi0rx0veT83E2MwIjbduznlh2MXe+CDzEKcDAq8fBqOFrECbEmlhVX5h5ilOBg VhLhPa9vGSfEm5JYWZValB9fVJqTWnyI0RTot4nMUqLJ+cBkkFcSb2hqaG5haWhubG5sZqEk ztshcDBGSCA9sSQ1OzW1ILUIpo+Jg1OqgbHcYZmInd5Rp3lfY7987rh75LhVnEH4K9l5D8/u j4sy+nSsOHJqbu2cYkXja5M0NyzKj21wmaXlLyBqXbjX8erjroA3aw2MNCwrAxyXvhJw+Hbm xMPkDfPWibWeehcStvqEeemqaeJTmP8wzN7z+3HDXKEfZm9PlfzsWXtIPTFY9GGJZqhKY7kS S3FGoqEWc1FxIgDyRJuCzgIAAA== X-CMS-MailID: 20200204095227eucas1p2f23061d391e67f4d3bde8bab74d1e44b X-Msg-Generator: CA X-RootMTR: 20200204095227eucas1p2f23061d391e67f4d3bde8bab74d1e44b X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200204095227eucas1p2f23061d391e67f4d3bde8bab74d1e44b References: <20200204095208.269131-1-k.jensen@samsung.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 210.118.77.12 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Beata Michalska , qemu-devel@nongnu.org, Max Reitz , Klaus Jensen , Keith Busch , Javier Gonzalez Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Since clean up of the request qsg/iov has been moved to the common nvme_enqueue_req_completion function, there is no need to use a stack allocated qsg/iov in nvme_dma_prp. Signed-off-by: Klaus Jensen Reviewed-by: Maxim Levitsky --- hw/block/nvme.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index e97da35c4ca1..f8c81b9e2202 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -298,23 +298,21 @@ unmap: static uint16_t nvme_dma_prp(NvmeCtrl *n, uint8_t *ptr, uint32_t len, uint64_t prp1, uint64_t prp2, DMADirection dir, NvmeRequest *req) { - QEMUSGList qsg; - QEMUIOVector iov; uint16_t status = NVME_SUCCESS; size_t bytes; - status = nvme_map_prp(n, &qsg, &iov, prp1, prp2, len, req); + status = nvme_map_prp(n, &req->qsg, &req->iov, prp1, prp2, len, req); if (status) { return status; } - if (qsg.nsg > 0) { + if (req->qsg.nsg > 0) { uint64_t residual; if (dir == DMA_DIRECTION_TO_DEVICE) { - residual = dma_buf_write(ptr, len, &qsg); + residual = dma_buf_write(ptr, len, &req->qsg); } else { - residual = dma_buf_read(ptr, len, &qsg); + residual = dma_buf_read(ptr, len, &req->qsg); } if (unlikely(residual)) { @@ -322,15 +320,13 @@ static uint16_t nvme_dma_prp(NvmeCtrl *n, uint8_t *ptr, uint32_t len, status = NVME_INVALID_FIELD | NVME_DNR; } - qemu_sglist_destroy(&qsg); - return status; } if (dir == DMA_DIRECTION_TO_DEVICE) { - bytes = qemu_iovec_to_buf(&iov, 0, ptr, len); + bytes = qemu_iovec_to_buf(&req->iov, 0, ptr, len); } else { - bytes = qemu_iovec_from_buf(&iov, 0, ptr, len); + bytes = qemu_iovec_from_buf(&req->iov, 0, ptr, len); } if (unlikely(bytes != len)) { @@ -338,8 +334,6 @@ static uint16_t nvme_dma_prp(NvmeCtrl *n, uint8_t *ptr, uint32_t len, status = NVME_INVALID_FIELD | NVME_DNR; } - qemu_iovec_destroy(&iov); - return status; }