From nobody Mon Feb 9 06:34:25 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16448281779011.858043379277433; Mon, 14 Feb 2022 00:42:57 -0800 (PST) Received: from localhost ([::1]:43290 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nJWwi-0007gt-4z for importer@patchew.org; Mon, 14 Feb 2022 03:42:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39984) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJWPW-0003B8-9T; Mon, 14 Feb 2022 03:08:38 -0500 Received: from wnew4-smtp.messagingengine.com ([64.147.123.18]:46039) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJWPG-0007Xl-Si; Mon, 14 Feb 2022 03:08:25 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id 1AE382B001D9; Mon, 14 Feb 2022 03:08:20 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 14 Feb 2022 03:08:21 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 14 Feb 2022 03:08:17 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=cc:cc:content-transfer-encoding:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; bh=szWnx2TgghT4kr anW41Qedy8ps34nmWCXbpWfNleVnw=; b=LL13hrNktttnqjLY7UYnLKloK3XxmS hTsubAF7U6/DRIKP+rHcDnBc96wsZeYph+cDk/Hq8zLrtXnXncWW2aGfZ96CQIxh UEFGb762kMoX34hxj2yaCzHPiWAzvCb+Ey91hwvxsErSq8FkgwBbsdfBd4icJH2k QOb4DEqysM9xjo5ZJOoj5bobjo7x+Z35mlkAHEoGI3+l2WfMlvn4QEGVW0AcSTkN w1yzpg0EUlydKfUqaaYztOdF/APE9EQIKnxK2PDLGsgUEV5FY9xqd6m46YOngQUs jwH6eq51nlWRbA1+U1dzJyxM8jg0wblxt4SI2sx4K8kT7adwyOYi/Mhw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=szWnx2 TgghT4kranW41Qedy8ps34nmWCXbpWfNleVnw=; b=St4yHfPRrAB/xPQPmKw2wg CN5U0pPQK/FEmo5/zclHWGBnrzKRJatfR1sxpTXZ9UXei6JJEMn5TY+w6fymwr5Y b+tzs/GVBMmA1Hk4c8nwcn1oK1UCkG/yU3+R1QSckfr7Ajoh2QBZXCNZmqrAzrfu rxqkl+fDPZiU1Sd5TMpd/oovCgzVAi7pEOSvlAV0hRc9yHjP50dSHmrX+ws33EyU qk5Z9JcEQyjf8Qhy4/NZK9y9OWjqINnQK7Ok1YS+IyCu6R0I9/wYgBusuNAtE4Q4 +qMgSkrt1bESoq+iD9mzX+2WAZ27WberUp5WQ3RkA8BH1HG/J4H0opy8e+Hpc0tg == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrjedugdduudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefmlhgruhhs ucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnthdrughkqeenucggtffrrghtth gvrhhnpeeuleetgeeiuefhgfekfefgveejiefgteekiedtgfdtieefhfdthfefueffvefg keenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehith hssehirhhrvghlvghvrghnthdrughk X-ME-Proxy: From: Klaus Jensen To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 4/6] hw/nvme: add struct for zone management send Date: Mon, 14 Feb 2022 09:07:59 +0100 Message-Id: <20220214080801.13627-5-its@irrelevant.dk> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214080801.13627-1-its@irrelevant.dk> References: <20220214080801.13627-1-its@irrelevant.dk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=64.147.123.18; envelope-from=its@irrelevant.dk; helo=wnew4-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Klaus Jensen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Klaus Jensen , Hanna Reitz , Stefan Hajnoczi , Keith Busch Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1644828180059100001 Content-Type: text/plain; charset="utf-8" From: Klaus Jensen Add struct for Zone Management Send in preparation for more zone send flags. Reviewed-by: Keith Busch Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 10 ++++------ include/block/nvme.h | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 4344405e5939..7cb4974c5e83 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -3616,26 +3616,24 @@ done: =20 static uint16_t nvme_zone_mgmt_send(NvmeCtrl *n, NvmeRequest *req) { - NvmeCmd *cmd =3D (NvmeCmd *)&req->cmd; + NvmeZoneSendCmd *cmd =3D (NvmeZoneSendCmd *)&req->cmd; NvmeNamespace *ns =3D req->ns; NvmeZone *zone; NvmeZoneResetAIOCB *iocb; uint8_t *zd_ext; - uint32_t dw13 =3D le32_to_cpu(cmd->cdw13); uint64_t slba =3D 0; uint32_t zone_idx =3D 0; uint16_t status; - uint8_t action; + uint8_t action =3D cmd->zsa; bool all; enum NvmeZoneProcessingMask proc_mask =3D NVME_PROC_CURRENT_ZONE; =20 - action =3D dw13 & 0xff; - all =3D !!(dw13 & 0x100); + all =3D cmd->zsflags & NVME_ZSFLAG_SELECT_ALL; =20 req->status =3D NVME_SUCCESS; =20 if (!all) { - status =3D nvme_get_mgmt_zone_slba_idx(ns, cmd, &slba, &zone_idx); + status =3D nvme_get_mgmt_zone_slba_idx(ns, &req->cmd, &slba, &zone= _idx); if (status) { return status; } diff --git a/include/block/nvme.h b/include/block/nvme.h index e3bd47bf76ab..709d491c70d8 100644 --- a/include/block/nvme.h +++ b/include/block/nvme.h @@ -1433,6 +1433,21 @@ enum NvmeZoneType { NVME_ZONE_TYPE_SEQ_WRITE =3D 0x02, }; =20 +typedef struct QEMU_PACKED NvmeZoneSendCmd { + uint8_t opcode; + uint8_t flags; + uint16_t cid; + uint32_t nsid; + uint32_t rsvd8[4]; + NvmeCmdDptr dptr; + uint64_t slba; + uint32_t rsvd48; + uint8_t zsa; + uint8_t zsflags; + uint8_t rsvd54[2]; + uint32_t rsvd56[2]; +} NvmeZoneSendCmd; + enum NvmeZoneSendAction { NVME_ZONE_ACTION_RSD =3D 0x00, NVME_ZONE_ACTION_CLOSE =3D 0x01, @@ -1443,6 +1458,10 @@ enum NvmeZoneSendAction { NVME_ZONE_ACTION_SET_ZD_EXT =3D 0x10, }; =20 +enum { + NVME_ZSFLAG_SELECT_ALL =3D 1 << 0, +}; + typedef struct QEMU_PACKED NvmeZoneDescr { uint8_t zt; uint8_t zs; --=20 2.35.1