From nobody Mon Feb 9 11:33: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 ARC-Seal: i=1; a=rsa-sha256; t=1610369212; cv=none; d=zohomail.com; s=zohoarc; b=JPGJZ7MegM2go8J9woKVUTUR7L9mOZDGzvzYv3vdIJFLPaaBp61j42Dgz6NX3KdY59qSfV3PpAr4mh07u5PEPkov22DetCLa3mf9lgCtwVDkd5u93gFyQXue3FayOHaDDs7HEo6i0RFZJzM9BtzwSuwAuB4ts3yzOC/q9dClwDs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610369212; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PLFFFUlCfhQEhBngs/osjgJd8mfOPQeRvanj/GSoYjE=; b=HObDnBTfzZs2IQN7ag8o/TMtjr6pJfNFCVU1N4BAdCzOmp45/Qa6UgmYt5+DwPyiY5ZJ3ihdFoK2y1pxwZq2HU5WpQm8MFfP3yAV5YLv1gg5auPl5yye676kjcwpde4mEOZtYO0LBtyVTmR1Cpx0bFhTrPn5VAwnZdgteQKILBA= ARC-Authentication-Results: i=1; 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 1610369212473702.6407901168815; Mon, 11 Jan 2021 04:46:52 -0800 (PST) Received: from localhost ([::1]:57078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kywax-0000Sy-2f for importer@patchew.org; Mon, 11 Jan 2021 07:46:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33168) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kywN7-0002Pw-OH; Mon, 11 Jan 2021 07:32:33 -0500 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:59191) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kywN4-0006r0-Md; Mon, 11 Jan 2021 07:32:33 -0500 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 5A40E29F4; Mon, 11 Jan 2021 07:32:28 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 11 Jan 2021 07:32:28 -0500 Received: from apples.local (80-167-98-190-cable.dk.customer.tdc.net [80.167.98.190]) by mail.messagingengine.com (Postfix) with ESMTPA id 5D256108005F; Mon, 11 Jan 2021 07:32:26 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=PLFFFUlCfhQEh Bngs/osjgJd8mfOPQeRvanj/GSoYjE=; b=pWii6i2DPyzV0qDzqwhmARlx0XabT xxV3MZ6bTl+Gh1qPs6PNMGpr5UJyRIAJ2yzMQpkRSkqlmvMwKJDt4c0O5jIO+DM0 9NK0c8rgMiwHmc6AeKzFAYb7sb8u4GZguZtKDf/OwCAhFvUnc5jZ9rWWHiYB2wmf 5nBrro7hD8Hr/nRM1iqT0Ua9f0BpBoTHATliNnjDnvn1vvYq+JVoTGST2dHM+5K+ c9Q/zF6lbquEkHZHsIuoBhcGACtLo0m8OHqNDZwe4RjX80qAD0vEWYpOGPkdq7hD 2gMU+tJEZ0UFsmiqL2/isVDDkXC6vYRhVpV95L2RR3cKSRspdUZ1c2RQw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=PLFFFUlCfhQEhBngs/osjgJd8mfOPQeRvanj/GSoYjE=; b=Xgv0lzXR FoeBYlLTITpjIHcOWQLb7yk2rabhP5GXEU7VpXaJHNdhHARY51C+5XunpRZ6AAeU VBV6Sc12jhSDUj/3I/QVTmBXCSzJ2kBTwz1kK/d2/r9KLMimNc9whf3FLKR0heth 80lES5Se2l2NCIn/wEbRoHz5RzQi94LEKEXJz4AFWWlF+69M8qk8nc12EwuQUoCj 384o06KRB7WCihRAZChM7dFFXGhIilFlnFpEiKxCWgttLrK8n53ABIXYlmAYAcuR UDSR9H59r+CXa1a1QfCUsze8MbnHtYsgcwLE6H+a28aPgt4YSvgSCPbs96V+IDbJ 6G2MqQyUOU6w6A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdehuddggedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefmlhgruhhs ucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnthdrughkqeenucggtffrrghtth gvrhhnpeeuleetgeeiuefhgfekfefgveejiefgteekiedtgfdtieefhfdthfefueffvefg keenucfkphepkedtrdduieejrdelkedrudeltdenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehithhssehirhhrvghlvghvrghnthdrughk X-ME-Proxy: From: Klaus Jensen To: qemu-devel@nongnu.org Subject: [PATCH 1/6] hw/block/nvme: fix shutdown/reset logic Date: Mon, 11 Jan 2021 13:32:18 +0100 Message-Id: <20210111123223.76248-2-its@irrelevant.dk> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111123223.76248-1-its@irrelevant.dk> References: <20210111123223.76248-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.21; envelope-from=its@irrelevant.dk; helo=wout5-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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 , qemu-block@nongnu.org, Dmitry Fomichev , Klaus Jensen , Max Reitz , Klaus Jensen , Keith Busch Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Klaus Jensen A shutdown is only about flushing stuff. It is the host that should delete any queues, so do not perform a reset here. Also, on shutdown, make sure that the PMR is flushed if in use. Fixes: 368f4e752cf9 ("hw/block/nvme: Process controller reset and shutdown = differently") Signed-off-by: Klaus Jensen Reviewed-by: Dmitry Fomichev Reviewed-by: Keith Busch Tested-by: Dmitry Fomichev --- hw/block/nvme.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 0854ee307227..cba509e90537 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -3413,7 +3413,7 @@ static void nvme_process_sq(void *opaque) } } =20 -static void nvme_clear_ctrl(NvmeCtrl *n) +static void nvme_ctrl_reset(NvmeCtrl *n) { NvmeNamespace *ns; int i; @@ -3447,11 +3447,7 @@ static void nvme_clear_ctrl(NvmeCtrl *n) n->aer_queued =3D 0; n->outstanding_aers =3D 0; n->qs_created =3D false; -} =20 -static void nvme_ctrl_reset(NvmeCtrl *n) -{ - nvme_clear_ctrl(n); n->bar.cc =3D 0; } =20 @@ -3460,7 +3456,9 @@ static void nvme_ctrl_shutdown(NvmeCtrl *n) NvmeNamespace *ns; int i; =20 - nvme_clear_ctrl(n); + if (n->pmrdev) { + memory_region_msync(&n->pmrdev->mr, 0, n->pmrdev->size); + } =20 for (i =3D 1; i <=3D n->num_namespaces; i++) { ns =3D nvme_ns(n, i); @@ -4303,7 +4301,7 @@ static void nvme_exit(PCIDevice *pci_dev) NvmeNamespace *ns; int i; =20 - nvme_ctrl_shutdown(n); + nvme_ctrl_reset(n); =20 for (i =3D 1; i <=3D n->num_namespaces; i++) { ns =3D nvme_ns(n, i); --=20 2.30.0 From nobody Mon Feb 9 11:33: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 ARC-Seal: i=1; a=rsa-sha256; t=1610368688; cv=none; d=zohomail.com; s=zohoarc; b=OJIsVf0RtrH1YWZgfSPiRfGbVb54GiVfqFbZE3D3syaR2hd2mjbHVLM/NIN26DOBN9U9uWo9t0Q6UBmi8wv4e9b6hRGwe49WmeYZUYWL7j1XBmRRgiefXVRUOGAoC1Ej3erBhfHrrvbLFuUU+OK46pvQLg75hop+WfqqGiPZQW8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610368688; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hMXrkCHmnF210sq0C9gh99fzq712fpTo7ozj3Lht6EE=; b=iV52k2Wrbrk57XxibOmTcQ0R2cdhabVDnPJ5I/bJpj0wbbLWCN9jFDkKKoftMzX/inXf9hxrlgIeVsNMY5XCRuIXlaNVUwbzmjA4HviGQS1jxKFNTRDMT+oLrDmsEQeBuf+JafhwMwygy45Z3Ev9Sfep0hfOEWLLSVehfQ3xHdI= ARC-Authentication-Results: i=1; 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 1610368687603287.3107404658414; Mon, 11 Jan 2021 04:38:07 -0800 (PST) Received: from localhost ([::1]:47496 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kywST-0004cI-Gs for importer@patchew.org; Mon, 11 Jan 2021 07:38:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33148) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kywN7-0002PF-3w; Mon, 11 Jan 2021 07:32:33 -0500 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:37939) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kywN5-0006rO-0O; Mon, 11 Jan 2021 07:32:32 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 1843B25D4; Mon, 11 Jan 2021 07:32:29 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 11 Jan 2021 07:32:29 -0500 Received: from apples.local (80-167-98-190-cable.dk.customer.tdc.net [80.167.98.190]) by mail.messagingengine.com (Postfix) with ESMTPA id 9AAD8108006B; Mon, 11 Jan 2021 07:32:27 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=hMXrkCHmnF210 sq0C9gh99fzq712fpTo7ozj3Lht6EE=; b=y28r4WEhrFv07B25gWyLjlkEha7vn KjkIyFtd9oyVdlojiNudSb2c/i3uhIeeI28LvjcXNskIVnIyZjxB0kMQsxRjtC2U jPhjPu9Wb1Nq9lsPddo3U3bKexN/znIyF8QFaBStPYBZP9BXn+dS62htHCI5MXUj Xf6b2Mt64kSvP0D+iS+ECEv2n09q3qXx2EEpAC1MGIGryyySVepfCMEbwo2yMTgx 7VUugoWwzBoPLE3cxmSd5S/5HC/P2iIk9GPK24YmIw3CO/YRs9WHAFg8H1UerofX S4EWGaewfnXSbXeq+wghcraEFijwq3GCX0IxVmmYVtNy0TItig2vVsoig== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=hMXrkCHmnF210sq0C9gh99fzq712fpTo7ozj3Lht6EE=; b=lWuFgtUm etr+4+3BwM+ac+8M++XL5AxjKDiK8t9G5fPb6gDsFRZAlBXXXwr46G1bwNHLdzQc qi2Jf60F0yPt3tXxd4Ry17BkefL3W6qSGREBVXzkdlpqqi8l8B1eXPyRkISqGuIC PJAaq2WouslTAvvYNH4iJxWr/XjeD7Y8FkEmjkSZBr9e+ox81SG0ZWJkCZ/EZ6BO SW986NgYei5pBdXoAS+SBBQSaRLMnhdWFDxAG9FA4huzoD2JVAe3REq3WQIVmHb1 EsgwEpr7qQXQdvj75yX+coJzreJ3fclZyAP+Y9rRV+o1bdZiVynyNQ76w6joKLCd 406TOOu3yiEj7w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdehuddggedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefmlhgruhhs ucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnthdrughkqeenucggtffrrghtth gvrhhnpeeuleetgeeiuefhgfekfefgveejiefgteekiedtgfdtieefhfdthfefueffvefg keenucfkphepkedtrdduieejrdelkedrudeltdenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehithhssehirhhrvghlvghvrghnthdrughk X-ME-Proxy: From: Klaus Jensen To: qemu-devel@nongnu.org Subject: [PATCH 2/6] hw/block/nvme: merge implicitly/explicitly opened processing masks Date: Mon, 11 Jan 2021 13:32:19 +0100 Message-Id: <20210111123223.76248-3-its@irrelevant.dk> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111123223.76248-1-its@irrelevant.dk> References: <20210111123223.76248-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.21; envelope-from=its@irrelevant.dk; helo=wout5-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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 , qemu-block@nongnu.org, Dmitry Fomichev , Klaus Jensen , Max Reitz , Klaus Jensen , Keith Busch Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Klaus Jensen Implicitly and explicitly opended zones are always bulk processed together, so merge the two processing masks. Signed-off-by: Klaus Jensen Reviewed-by: Dmitry Fomichev Tested-by: Dmitry Fomichev --- hw/block/nvme.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index cba509e90537..8b25c509c6b5 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1740,11 +1740,10 @@ typedef uint16_t (*op_handler_t)(NvmeNamespace *, N= vmeZone *, =20 enum NvmeZoneProcessingMask { NVME_PROC_CURRENT_ZONE =3D 0, - NVME_PROC_IMP_OPEN_ZONES =3D 1 << 0, - NVME_PROC_EXP_OPEN_ZONES =3D 1 << 1, - NVME_PROC_CLOSED_ZONES =3D 1 << 2, - NVME_PROC_READ_ONLY_ZONES =3D 1 << 3, - NVME_PROC_FULL_ZONES =3D 1 << 4, + NVME_PROC_OPENED_ZONES =3D 1 << 0, + NVME_PROC_CLOSED_ZONES =3D 1 << 1, + NVME_PROC_READ_ONLY_ZONES =3D 1 << 2, + NVME_PROC_FULL_ZONES =3D 1 << 3, }; =20 static uint16_t nvme_open_zone(NvmeNamespace *ns, NvmeZone *zone, @@ -1885,10 +1884,8 @@ static uint16_t nvme_bulk_proc_zone(NvmeNamespace *n= s, NvmeZone *zone, =20 switch (zs) { case NVME_ZONE_STATE_IMPLICITLY_OPEN: - proc_zone =3D proc_mask & NVME_PROC_IMP_OPEN_ZONES; - break; case NVME_ZONE_STATE_EXPLICITLY_OPEN: - proc_zone =3D proc_mask & NVME_PROC_EXP_OPEN_ZONES; + proc_zone =3D proc_mask & NVME_PROC_OPENED_ZONES; break; case NVME_ZONE_STATE_CLOSED: proc_zone =3D proc_mask & NVME_PROC_CLOSED_ZONES; @@ -1929,15 +1926,14 @@ static uint16_t nvme_do_zone_op(NvmeNamespace *ns, = NvmeZone *zone, } } } - if (proc_mask & NVME_PROC_IMP_OPEN_ZONES) { + if (proc_mask & NVME_PROC_OPENED_ZONES) { QTAILQ_FOREACH_SAFE(zone, &ns->imp_open_zones, entry, next) { status =3D nvme_bulk_proc_zone(ns, zone, proc_mask, op_hnd= lr); if (status !=3D NVME_SUCCESS) { goto out; } } - } - if (proc_mask & NVME_PROC_EXP_OPEN_ZONES) { + QTAILQ_FOREACH_SAFE(zone, &ns->exp_open_zones, entry, next) { status =3D nvme_bulk_proc_zone(ns, zone, proc_mask, op_hnd= lr); if (status !=3D NVME_SUCCESS) { @@ -2012,7 +2008,7 @@ static uint16_t nvme_zone_mgmt_send(NvmeCtrl *n, Nvme= Request *req) =20 case NVME_ZONE_ACTION_CLOSE: if (all) { - proc_mask =3D NVME_PROC_IMP_OPEN_ZONES | NVME_PROC_EXP_OPEN_ZO= NES; + proc_mask =3D NVME_PROC_OPENED_ZONES; } trace_pci_nvme_close_zone(slba, zone_idx, all); status =3D nvme_do_zone_op(ns, zone, proc_mask, nvme_close_zone); @@ -2020,8 +2016,7 @@ static uint16_t nvme_zone_mgmt_send(NvmeCtrl *n, Nvme= Request *req) =20 case NVME_ZONE_ACTION_FINISH: if (all) { - proc_mask =3D NVME_PROC_IMP_OPEN_ZONES | NVME_PROC_EXP_OPEN_ZO= NES | - NVME_PROC_CLOSED_ZONES; + proc_mask =3D NVME_PROC_OPENED_ZONES | NVME_PROC_CLOSED_ZONES; } trace_pci_nvme_finish_zone(slba, zone_idx, all); status =3D nvme_do_zone_op(ns, zone, proc_mask, nvme_finish_zone); @@ -2029,8 +2024,8 @@ static uint16_t nvme_zone_mgmt_send(NvmeCtrl *n, Nvme= Request *req) =20 case NVME_ZONE_ACTION_RESET: if (all) { - proc_mask =3D NVME_PROC_IMP_OPEN_ZONES | NVME_PROC_EXP_OPEN_ZO= NES | - NVME_PROC_CLOSED_ZONES | NVME_PROC_FULL_ZONES; + proc_mask =3D NVME_PROC_OPENED_ZONES | NVME_PROC_CLOSED_ZONES | + NVME_PROC_FULL_ZONES; } trace_pci_nvme_reset_zone(slba, zone_idx, all); status =3D nvme_do_zone_op(ns, zone, proc_mask, nvme_reset_zone); --=20 2.30.0 From nobody Mon Feb 9 11:33: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 ARC-Seal: i=1; a=rsa-sha256; t=1610368956; cv=none; d=zohomail.com; s=zohoarc; b=JbFgj3Nn8zk7GcHJRKVaApCByETbrQxWym+geWnMA1KywIiUV863bdBi7/bARqO8728HhspLSe+Z5gVrJr1PUj6FuoGi0Orw+fIaOs4Rej9he3k8dCa+2lAa2lR33KF6lvsCL0Yf2PLPxSt0IdlO9mRZYBxbBnq6WuaJkxbR7sk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610368956; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yaC//JjLJmIFTbBrZW4NBVptvALMn2zsj/kaY44uCII=; b=YaBKRzUw984I0AHJHB9K6MAtIfOzMU+twz1FmCr0bZnVsX+xzsipqJ/o9VCw6MmwcVVSP0JpiHIr3IeGBM8hld7ojwKQ6HqZRvnDqoEShnDewTIdcdLnirvb46XGYh8aAV49ek2kHuJmDseX/F/Jh929QQAWbGdAIwdK9wtcVxI= ARC-Authentication-Results: i=1; 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 1610368956476799.6556682404207; Mon, 11 Jan 2021 04:42:36 -0800 (PST) Received: from localhost ([::1]:52596 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kywWp-0006sq-8a for importer@patchew.org; Mon, 11 Jan 2021 07:42:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33182) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kywN8-0002QC-9D; Mon, 11 Jan 2021 07:32:34 -0500 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:52653) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kywN6-0006s0-8n; Mon, 11 Jan 2021 07:32:34 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 4F0992625; Mon, 11 Jan 2021 07:32:30 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 11 Jan 2021 07:32:30 -0500 Received: from apples.local (80-167-98-190-cable.dk.customer.tdc.net [80.167.98.190]) by mail.messagingengine.com (Postfix) with ESMTPA id D94611080057; Mon, 11 Jan 2021 07:32:28 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=yaC//JjLJmIFT bBrZW4NBVptvALMn2zsj/kaY44uCII=; b=jGfYZHL4Tz6lOSmM4XVYr84E3xrXM UZYwXwd0NmQRj3YHWNd3aGoTUVpdkEzMOgTh4e26ZAfv5v7ItaKvRmnCCpeHjcw0 RVf4pc5CjDtdkxgN1M+zTq4n7wc+pKol9/CoWazfzZani2YAnyfcPCD/IxpFzgpE DTR08C9/xjjhvc+ccewQGf2UTfbZoPM5ZoD5ktjt0sVpKljXrNIP9HPrE/QY+6VV tnwOXqqiqfs3mo7FqMPxyxIQW0M58U8RsU8Y65bP9goCl5jrpbiPkeSJR5cTO//W 9kNMV/lNAH1cREBxrFDqyMv1e+hqmgi21TZy2XoyocfWYuqPYBowkES5Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=yaC//JjLJmIFTbBrZW4NBVptvALMn2zsj/kaY44uCII=; b=IGyK6Ked I2xFqdeawX3i8eIx8kMvhd3L80eFrIowwF2AQhaPAB40cZtAMv6Sz4OkDjzX0aF/ 1qfVZ/3MdiiYIYUVoSrvSOlageVmEyZzdmuTNUuoGsNZ227JpMWYx5VngeQULuq8 urhOANFiDRYu81DJ6/7i8H18Nzqxbe6P3m5DVBjuzHhcosB79nJe9nkVBYhraVzf ht1+ym3Ii83MSKikyqnL+1ieXOvtSwMtJ0ESKHZX+yzKyqEzLQ5nWognyYzXdPXn ywtnTNOi25FaV1/OYDzoAVY+/sTvZ2/UVC/6T97JMRb5SSDV9/z173GU1Zrak37w k3Q+tGOL3IzMdA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdehuddggedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefmlhgruhhs ucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnthdrughkqeenucggtffrrghtth gvrhhnpeeuleetgeeiuefhgfekfefgveejiefgteekiedtgfdtieefhfdthfefueffvefg keenucfkphepkedtrdduieejrdelkedrudeltdenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehithhssehirhhrvghlvghvrghnthdrughk X-ME-Proxy: From: Klaus Jensen To: qemu-devel@nongnu.org Subject: [PATCH 3/6] hw/block/nvme: enum style fix Date: Mon, 11 Jan 2021 13:32:20 +0100 Message-Id: <20210111123223.76248-4-its@irrelevant.dk> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111123223.76248-1-its@irrelevant.dk> References: <20210111123223.76248-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.21; envelope-from=its@irrelevant.dk; helo=wout5-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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 , qemu-block@nongnu.org, Dmitry Fomichev , Klaus Jensen , Max Reitz , Klaus Jensen , Keith Busch Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Klaus Jensen Align with existing style and use a typedef for header-file enums. Signed-off-by: Klaus Jensen Reviewed-by: Dmitry Fomichev Tested-by: Dmitry Fomichev --- hw/block/nvme-ns.h | 4 ++-- include/block/nvme.h | 4 ++-- hw/block/nvme.c | 19 +++++++++---------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/hw/block/nvme-ns.h b/hw/block/nvme-ns.h index f8f3c28c360b..a0baa5f6d44c 100644 --- a/hw/block/nvme-ns.h +++ b/hw/block/nvme-ns.h @@ -102,12 +102,12 @@ static inline size_t nvme_l2b(NvmeNamespace *ns, uint= 64_t lba) =20 typedef struct NvmeCtrl NvmeCtrl; =20 -static inline enum NvmeZoneState nvme_get_zone_state(NvmeZone *zone) +static inline NvmeZoneState nvme_get_zone_state(NvmeZone *zone) { return zone->d.zs >> 4; } =20 -static inline void nvme_set_zone_state(NvmeZone *zone, enum NvmeZoneState = state) +static inline void nvme_set_zone_state(NvmeZone *zone, NvmeZoneState state) { zone->d.zs =3D state << 4; } diff --git a/include/block/nvme.h b/include/block/nvme.h index 9494246f1f59..45b2678db1f0 100644 --- a/include/block/nvme.h +++ b/include/block/nvme.h @@ -1212,7 +1212,7 @@ typedef struct QEMU_PACKED NvmeZoneDescr { uint8_t rsvd32[32]; } NvmeZoneDescr; =20 -enum NvmeZoneState { +typedef enum NvmeZoneState { NVME_ZONE_STATE_RESERVED =3D 0x00, NVME_ZONE_STATE_EMPTY =3D 0x01, NVME_ZONE_STATE_IMPLICITLY_OPEN =3D 0x02, @@ -1221,7 +1221,7 @@ enum NvmeZoneState { NVME_ZONE_STATE_READ_ONLY =3D 0x0D, NVME_ZONE_STATE_FULL =3D 0x0E, NVME_ZONE_STATE_OFFLINE =3D 0x0F, -}; +} NvmeZoneState; =20 static inline void _nvme_check_size(void) { diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 8b25c509c6b5..7c2ec17ad7d9 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -198,7 +198,7 @@ static uint16_t nvme_sqid(NvmeRequest *req) } =20 static void nvme_assign_zone_state(NvmeNamespace *ns, NvmeZone *zone, - enum NvmeZoneState state) + NvmeZoneState state) { if (QTAILQ_IN_USE(zone, entry)) { switch (nvme_get_zone_state(zone)) { @@ -1735,8 +1735,7 @@ static uint16_t nvme_get_mgmt_zone_slba_idx(NvmeNames= pace *ns, NvmeCmd *c, return NVME_SUCCESS; } =20 -typedef uint16_t (*op_handler_t)(NvmeNamespace *, NvmeZone *, - enum NvmeZoneState); +typedef uint16_t (*op_handler_t)(NvmeNamespace *, NvmeZone *, NvmeZoneStat= e); =20 enum NvmeZoneProcessingMask { NVME_PROC_CURRENT_ZONE =3D 0, @@ -1747,7 +1746,7 @@ enum NvmeZoneProcessingMask { }; =20 static uint16_t nvme_open_zone(NvmeNamespace *ns, NvmeZone *zone, - enum NvmeZoneState state) + NvmeZoneState state) { uint16_t status; =20 @@ -1780,7 +1779,7 @@ static uint16_t nvme_open_zone(NvmeNamespace *ns, Nvm= eZone *zone, } =20 static uint16_t nvme_close_zone(NvmeNamespace *ns, NvmeZone *zone, - enum NvmeZoneState state) + NvmeZoneState state) { switch (state) { case NVME_ZONE_STATE_EXPLICITLY_OPEN: @@ -1796,7 +1795,7 @@ static uint16_t nvme_close_zone(NvmeNamespace *ns, Nv= meZone *zone, } =20 static uint16_t nvme_finish_zone(NvmeNamespace *ns, NvmeZone *zone, - enum NvmeZoneState state) + NvmeZoneState state) { switch (state) { case NVME_ZONE_STATE_EXPLICITLY_OPEN: @@ -1819,7 +1818,7 @@ static uint16_t nvme_finish_zone(NvmeNamespace *ns, N= vmeZone *zone, } =20 static uint16_t nvme_reset_zone(NvmeNamespace *ns, NvmeZone *zone, - enum NvmeZoneState state) + NvmeZoneState state) { switch (state) { case NVME_ZONE_STATE_EXPLICITLY_OPEN: @@ -1842,7 +1841,7 @@ static uint16_t nvme_reset_zone(NvmeNamespace *ns, Nv= meZone *zone, } =20 static uint16_t nvme_offline_zone(NvmeNamespace *ns, NvmeZone *zone, - enum NvmeZoneState state) + NvmeZoneState state) { switch (state) { case NVME_ZONE_STATE_READ_ONLY: @@ -1879,7 +1878,7 @@ static uint16_t nvme_bulk_proc_zone(NvmeNamespace *ns= , NvmeZone *zone, op_handler_t op_hndlr) { uint16_t status =3D NVME_SUCCESS; - enum NvmeZoneState zs =3D nvme_get_zone_state(zone); + NvmeZoneState zs =3D nvme_get_zone_state(zone); bool proc_zone; =20 switch (zs) { @@ -2077,7 +2076,7 @@ static uint16_t nvme_zone_mgmt_send(NvmeCtrl *n, Nvme= Request *req) =20 static bool nvme_zone_matches_filter(uint32_t zafs, NvmeZone *zl) { - enum NvmeZoneState zs =3D nvme_get_zone_state(zl); + NvmeZoneState zs =3D nvme_get_zone_state(zl); =20 switch (zafs) { case NVME_ZONE_REPORT_ALL: --=20 2.30.0 From nobody Mon Feb 9 11:33: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 ARC-Seal: i=1; a=rsa-sha256; t=1610369674; cv=none; d=zohomail.com; s=zohoarc; b=LrSRtAQVIFxAq111cM0vwRxW6iDdCAzzH/Y+X/i7xy0CdikfdND7CKktyFKr3/8WzKG3uaAWhcJuRkfa93FkrsLB4JnT5nOPZybMfTQaEHNedn55iBwLnFsZ0ry0QzknLTi6bdXtsqqrol3mAaYlCO0SskgiuI4V29ttRRK2Ffk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610369674; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ePvMZoBzNKl6eZVdPmHVjKZAWcJtNto4CxVA71C71jY=; b=NksrSlF/AvgonmhRX81cw+2ACmUvLfik4pZM53embPo1hk3ZobJMqDFezN0tJgH/Fwby439paxF0YT8W2sx6YwWlVCg2biO1TnCirRSB1wzidW291g2T2MZ1lh8lSVBwoaC/xpy0yoJqVg29wGOeUgPv4yZwCzawJU0t6e6nvjA= ARC-Authentication-Results: i=1; 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 161036967440999.76313918841811; Mon, 11 Jan 2021 04:54:34 -0800 (PST) Received: from localhost ([::1]:38870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kywiO-0005Qn-KG for importer@patchew.org; Mon, 11 Jan 2021 07:54:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kywNA-0002RU-0H; Mon, 11 Jan 2021 07:32:36 -0500 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:37825) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kywN7-0006sU-Lm; Mon, 11 Jan 2021 07:32:35 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id A68D526C4; Mon, 11 Jan 2021 07:32:31 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 11 Jan 2021 07:32:32 -0500 Received: from apples.local (80-167-98-190-cable.dk.customer.tdc.net [80.167.98.190]) by mail.messagingengine.com (Postfix) with ESMTPA id 221E4108005C; Mon, 11 Jan 2021 07:32:30 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=ePvMZoBzNKl6e ZVdPmHVjKZAWcJtNto4CxVA71C71jY=; b=QjUDicMfN4WUahdwRCuF7vhLWa1QX lVXsfy/zJHyABqhgw1kcR4dSoyLfsq+xU1EVIJ4GnXwcG5Aq3FWGildmHEM/qQYl RTBXkK/Mfepe10fHpM8Juur99qgxM8QH3cupNhgi+uuAj0gFWcJKPP7paJyv8qto 4RbEjT87sBtaD7e51bECwHILflWZsebjvyOVYs8AefkSMHRI+to8p79Rl0fcHM5P eSC5Im00xqqFOruvZ+vwp3walrvhpLNLKtDbybUAGybjp69kf3fcnOrRJY3hltaG LXTU3qa6S0EiTTQ9xW8Zbfwtgk2VWuSPGHLeNX85k8xsznvnmJaqoQhZQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=ePvMZoBzNKl6eZVdPmHVjKZAWcJtNto4CxVA71C71jY=; b=gLcFVymw NmIu4l3EdKGOGiwI5NNxaQ6498RA6MS/6eCi+UPCupp9nPXhaB6++PygzYPjFraS FfeDy2f5lgm0pFhg/Vc3nBzxaE0AO4QyARL4GkJqvPQq4J6V6BzeUBDbLoh/tgfj v5sLJYji9X8MQH6k8veJF2mTwO2oN8zPjzFHaPKJ6YD2T0V5Vzj292/2QMJRZKK0 bPjc+PThj9MWLylgn30os0eRFpRLRCQGlw71ZuJq3w39x+Wc2hgL31NdiQi8bSMG /JSZqSQhmRwHZiwGOh6uAgBcITFXEj7y1ENsU53fXgz+HiSGRVvsRASdzzrbPa9S cb37lkzDxazRDg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdehuddggedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefmlhgruhhs ucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnthdrughkqeenucggtffrrghtth gvrhhnpeeuleetgeeiuefhgfekfefgveejiefgteekiedtgfdtieefhfdthfefueffvefg keenucfkphepkedtrdduieejrdelkedrudeltdenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehithhssehirhhrvghlvghvrghnthdrughk X-ME-Proxy: From: Klaus Jensen To: qemu-devel@nongnu.org Subject: [PATCH 4/6] hw/block/nvme: zero out zones on reset Date: Mon, 11 Jan 2021 13:32:21 +0100 Message-Id: <20210111123223.76248-5-its@irrelevant.dk> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111123223.76248-1-its@irrelevant.dk> References: <20210111123223.76248-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.21; envelope-from=its@irrelevant.dk; helo=wout5-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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 , qemu-block@nongnu.org, Dmitry Fomichev , Klaus Jensen , Max Reitz , Klaus Jensen , Keith Busch Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Klaus Jensen The zoned command set specification states that "All logical blocks in a zone *shall* be marked as deallocated when [the zone is reset]". Since the device guarantees 0x00 to be read from deallocated blocks we have to issue a pwrite_zeroes since we cannot be sure that a discard will do anything. But typically, this will be achieved with an efficient unmap/discard operation. Signed-off-by: Klaus Jensen Reviewed-by: Dmitry Fomichev Tested-by: Dmitry Fomichev --- hw/block/nvme.c | 150 +++++++++++++++++++++++++++++++----------- hw/block/trace-events | 1 + 2 files changed, 113 insertions(+), 38 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 7c2ec17ad7d9..b3658595fe1b 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1371,6 +1371,53 @@ static void nvme_aio_discard_cb(void *opaque, int re= t) nvme_enqueue_req_completion(nvme_cq(req), req); } =20 +struct nvme_zone_reset_ctx { + NvmeRequest *req; + NvmeZone *zone; +}; + +static void nvme_aio_zone_reset_cb(void *opaque, int ret) +{ + struct nvme_zone_reset_ctx *ctx =3D opaque; + NvmeRequest *req =3D ctx->req; + NvmeNamespace *ns =3D req->ns; + NvmeZone *zone =3D ctx->zone; + uintptr_t *resets =3D (uintptr_t *)&req->opaque; + + g_free(ctx); + + trace_pci_nvme_aio_zone_reset_cb(nvme_cid(req), zone->d.zslba); + + if (!ret) { + switch (nvme_get_zone_state(zone)) { + case NVME_ZONE_STATE_EXPLICITLY_OPEN: + case NVME_ZONE_STATE_IMPLICITLY_OPEN: + nvme_aor_dec_open(ns); + /* fall through */ + case NVME_ZONE_STATE_CLOSED: + nvme_aor_dec_active(ns); + /* fall through */ + case NVME_ZONE_STATE_FULL: + zone->w_ptr =3D zone->d.zslba; + zone->d.wp =3D zone->w_ptr; + nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_EMPTY); + /* fall through */ + default: + break; + } + } else { + nvme_aio_err(req, ret); + } + + (*resets)--; + + if (*resets) { + return; + } + + nvme_enqueue_req_completion(nvme_cq(req), req); +} + struct nvme_compare_ctx { QEMUIOVector iov; uint8_t *bounce; @@ -1735,7 +1782,8 @@ static uint16_t nvme_get_mgmt_zone_slba_idx(NvmeNames= pace *ns, NvmeCmd *c, return NVME_SUCCESS; } =20 -typedef uint16_t (*op_handler_t)(NvmeNamespace *, NvmeZone *, NvmeZoneStat= e); +typedef uint16_t (*op_handler_t)(NvmeNamespace *, NvmeZone *, NvmeZoneStat= e, + NvmeRequest *); =20 enum NvmeZoneProcessingMask { NVME_PROC_CURRENT_ZONE =3D 0, @@ -1746,7 +1794,7 @@ enum NvmeZoneProcessingMask { }; =20 static uint16_t nvme_open_zone(NvmeNamespace *ns, NvmeZone *zone, - NvmeZoneState state) + NvmeZoneState state, NvmeRequest *req) { uint16_t status; =20 @@ -1779,7 +1827,7 @@ static uint16_t nvme_open_zone(NvmeNamespace *ns, Nvm= eZone *zone, } =20 static uint16_t nvme_close_zone(NvmeNamespace *ns, NvmeZone *zone, - NvmeZoneState state) + NvmeZoneState state, NvmeRequest *req) { switch (state) { case NVME_ZONE_STATE_EXPLICITLY_OPEN: @@ -1795,7 +1843,7 @@ static uint16_t nvme_close_zone(NvmeNamespace *ns, Nv= meZone *zone, } =20 static uint16_t nvme_finish_zone(NvmeNamespace *ns, NvmeZone *zone, - NvmeZoneState state) + NvmeZoneState state, NvmeRequest *req) { switch (state) { case NVME_ZONE_STATE_EXPLICITLY_OPEN: @@ -1818,30 +1866,42 @@ static uint16_t nvme_finish_zone(NvmeNamespace *ns,= NvmeZone *zone, } =20 static uint16_t nvme_reset_zone(NvmeNamespace *ns, NvmeZone *zone, - NvmeZoneState state) + NvmeZoneState state, NvmeRequest *req) { + uintptr_t *resets =3D (uintptr_t *)&req->opaque; + struct nvme_zone_reset_ctx *ctx; + switch (state) { - case NVME_ZONE_STATE_EXPLICITLY_OPEN: - case NVME_ZONE_STATE_IMPLICITLY_OPEN: - nvme_aor_dec_open(ns); - /* fall through */ - case NVME_ZONE_STATE_CLOSED: - nvme_aor_dec_active(ns); - /* fall through */ - case NVME_ZONE_STATE_FULL: - zone->w_ptr =3D zone->d.zslba; - zone->d.wp =3D zone->w_ptr; - nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_EMPTY); - /* fall through */ case NVME_ZONE_STATE_EMPTY: return NVME_SUCCESS; + case NVME_ZONE_STATE_EXPLICITLY_OPEN: + case NVME_ZONE_STATE_IMPLICITLY_OPEN: + case NVME_ZONE_STATE_CLOSED: + case NVME_ZONE_STATE_FULL: + break; default: return NVME_ZONE_INVAL_TRANSITION; } + + /* + * The zone reset aio callback needs to know the zone that is being re= set + * in order to transition the zone on completion. + */ + ctx =3D g_new(struct nvme_zone_reset_ctx, 1); + ctx->req =3D req; + ctx->zone =3D zone; + + (*resets)++; + + blk_aio_pwrite_zeroes(ns->blkconf.blk, nvme_l2b(ns, zone->d.zslba), + nvme_l2b(ns, ns->zone_size), BDRV_REQ_MAY_UNMAP, + nvme_aio_zone_reset_cb, ctx); + + return NVME_NO_COMPLETE; } =20 static uint16_t nvme_offline_zone(NvmeNamespace *ns, NvmeZone *zone, - NvmeZoneState state) + NvmeZoneState state, NvmeRequest *req) { switch (state) { case NVME_ZONE_STATE_READ_ONLY: @@ -1875,7 +1935,7 @@ static uint16_t nvme_set_zd_ext(NvmeNamespace *ns, Nv= meZone *zone) =20 static uint16_t nvme_bulk_proc_zone(NvmeNamespace *ns, NvmeZone *zone, enum NvmeZoneProcessingMask proc_mask, - op_handler_t op_hndlr) + op_handler_t op_hndlr, NvmeRequest *re= q) { uint16_t status =3D NVME_SUCCESS; NvmeZoneState zs =3D nvme_get_zone_state(zone); @@ -1900,7 +1960,7 @@ static uint16_t nvme_bulk_proc_zone(NvmeNamespace *ns= , NvmeZone *zone, } =20 if (proc_zone) { - status =3D op_hndlr(ns, zone, zs); + status =3D op_hndlr(ns, zone, zs, req); } =20 return status; @@ -1908,42 +1968,46 @@ static uint16_t nvme_bulk_proc_zone(NvmeNamespace *= ns, NvmeZone *zone, =20 static uint16_t nvme_do_zone_op(NvmeNamespace *ns, NvmeZone *zone, enum NvmeZoneProcessingMask proc_mask, - op_handler_t op_hndlr) + op_handler_t op_hndlr, NvmeRequest *req) { NvmeZone *next; uint16_t status =3D NVME_SUCCESS; int i; =20 if (!proc_mask) { - status =3D op_hndlr(ns, zone, nvme_get_zone_state(zone)); + status =3D op_hndlr(ns, zone, nvme_get_zone_state(zone), req); } else { if (proc_mask & NVME_PROC_CLOSED_ZONES) { QTAILQ_FOREACH_SAFE(zone, &ns->closed_zones, entry, next) { - status =3D nvme_bulk_proc_zone(ns, zone, proc_mask, op_hnd= lr); - if (status !=3D NVME_SUCCESS) { + status =3D nvme_bulk_proc_zone(ns, zone, proc_mask, op_hnd= lr, + req); + if (status && status !=3D NVME_NO_COMPLETE) { goto out; } } } if (proc_mask & NVME_PROC_OPENED_ZONES) { QTAILQ_FOREACH_SAFE(zone, &ns->imp_open_zones, entry, next) { - status =3D nvme_bulk_proc_zone(ns, zone, proc_mask, op_hnd= lr); - if (status !=3D NVME_SUCCESS) { + status =3D nvme_bulk_proc_zone(ns, zone, proc_mask, op_hnd= lr, + req); + if (status && status !=3D NVME_NO_COMPLETE) { goto out; } } =20 QTAILQ_FOREACH_SAFE(zone, &ns->exp_open_zones, entry, next) { - status =3D nvme_bulk_proc_zone(ns, zone, proc_mask, op_hnd= lr); - if (status !=3D NVME_SUCCESS) { + status =3D nvme_bulk_proc_zone(ns, zone, proc_mask, op_hnd= lr, + req); + if (status && status !=3D NVME_NO_COMPLETE) { goto out; } } } if (proc_mask & NVME_PROC_FULL_ZONES) { QTAILQ_FOREACH_SAFE(zone, &ns->full_zones, entry, next) { - status =3D nvme_bulk_proc_zone(ns, zone, proc_mask, op_hnd= lr); - if (status !=3D NVME_SUCCESS) { + status =3D nvme_bulk_proc_zone(ns, zone, proc_mask, op_hnd= lr, + req); + if (status && status !=3D NVME_NO_COMPLETE) { goto out; } } @@ -1951,8 +2015,9 @@ static uint16_t nvme_do_zone_op(NvmeNamespace *ns, Nv= meZone *zone, =20 if (proc_mask & NVME_PROC_READ_ONLY_ZONES) { for (i =3D 0; i < ns->num_zones; i++, zone++) { - status =3D nvme_bulk_proc_zone(ns, zone, proc_mask, op_hnd= lr); - if (status !=3D NVME_SUCCESS) { + status =3D nvme_bulk_proc_zone(ns, zone, proc_mask, op_hnd= lr, + req); + if (status && status !=3D NVME_NO_COMPLETE) { goto out; } } @@ -1968,6 +2033,7 @@ static uint16_t nvme_zone_mgmt_send(NvmeCtrl *n, Nvme= Request *req) NvmeCmd *cmd =3D (NvmeCmd *)&req->cmd; NvmeNamespace *ns =3D req->ns; NvmeZone *zone; + uintptr_t *resets; uint8_t *zd_ext; uint32_t dw13 =3D le32_to_cpu(cmd->cdw13); uint64_t slba =3D 0; @@ -2002,7 +2068,7 @@ static uint16_t nvme_zone_mgmt_send(NvmeCtrl *n, Nvme= Request *req) proc_mask =3D NVME_PROC_CLOSED_ZONES; } trace_pci_nvme_open_zone(slba, zone_idx, all); - status =3D nvme_do_zone_op(ns, zone, proc_mask, nvme_open_zone); + status =3D nvme_do_zone_op(ns, zone, proc_mask, nvme_open_zone, re= q); break; =20 case NVME_ZONE_ACTION_CLOSE: @@ -2010,7 +2076,7 @@ static uint16_t nvme_zone_mgmt_send(NvmeCtrl *n, Nvme= Request *req) proc_mask =3D NVME_PROC_OPENED_ZONES; } trace_pci_nvme_close_zone(slba, zone_idx, all); - status =3D nvme_do_zone_op(ns, zone, proc_mask, nvme_close_zone); + status =3D nvme_do_zone_op(ns, zone, proc_mask, nvme_close_zone, r= eq); break; =20 case NVME_ZONE_ACTION_FINISH: @@ -2018,24 +2084,32 @@ static uint16_t nvme_zone_mgmt_send(NvmeCtrl *n, Nv= meRequest *req) proc_mask =3D NVME_PROC_OPENED_ZONES | NVME_PROC_CLOSED_ZONES; } trace_pci_nvme_finish_zone(slba, zone_idx, all); - status =3D nvme_do_zone_op(ns, zone, proc_mask, nvme_finish_zone); + status =3D nvme_do_zone_op(ns, zone, proc_mask, nvme_finish_zone, = req); break; =20 case NVME_ZONE_ACTION_RESET: + resets =3D (uintptr_t *)&req->opaque; + if (all) { proc_mask =3D NVME_PROC_OPENED_ZONES | NVME_PROC_CLOSED_ZONES | NVME_PROC_FULL_ZONES; } trace_pci_nvme_reset_zone(slba, zone_idx, all); - status =3D nvme_do_zone_op(ns, zone, proc_mask, nvme_reset_zone); - break; + + *resets =3D 1; + + status =3D nvme_do_zone_op(ns, zone, proc_mask, nvme_reset_zone, r= eq); + + (*resets)--; + + return *resets ? NVME_NO_COMPLETE : req->status; =20 case NVME_ZONE_ACTION_OFFLINE: if (all) { proc_mask =3D NVME_PROC_READ_ONLY_ZONES; } trace_pci_nvme_offline_zone(slba, zone_idx, all); - status =3D nvme_do_zone_op(ns, zone, proc_mask, nvme_offline_zone); + status =3D nvme_do_zone_op(ns, zone, proc_mask, nvme_offline_zone,= req); break; =20 case NVME_ZONE_ACTION_SET_ZD_EXT: diff --git a/hw/block/trace-events b/hw/block/trace-events index deaacdae5097..78d76b0a71c1 100644 --- a/hw/block/trace-events +++ b/hw/block/trace-events @@ -49,6 +49,7 @@ pci_nvme_dsm_deallocate(uint16_t cid, uint32_t nsid, uint= 64_t slba, uint32_t nlb pci_nvme_compare(uint16_t cid, uint32_t nsid, uint64_t slba, uint32_t nlb)= "cid %"PRIu16" nsid %"PRIu32" slba 0x%"PRIx64" nlb %"PRIu32"" pci_nvme_compare_cb(uint16_t cid) "cid %"PRIu16"" pci_nvme_aio_discard_cb(uint16_t cid) "cid %"PRIu16"" +pci_nvme_aio_zone_reset_cb(uint16_t cid, uint64_t zslba) "cid %"PRIu16" zs= lba 0x%"PRIx64"" pci_nvme_create_sq(uint64_t addr, uint16_t sqid, uint16_t cqid, uint16_t q= size, uint16_t qflags) "create submission queue, addr=3D0x%"PRIx64", sqid= =3D%"PRIu16", cqid=3D%"PRIu16", qsize=3D%"PRIu16", qflags=3D%"PRIu16"" pci_nvme_create_cq(uint64_t addr, uint16_t cqid, uint16_t vector, uint16_t= size, uint16_t qflags, int ien) "create completion queue, addr=3D0x%"PRIx6= 4", cqid=3D%"PRIu16", vector=3D%"PRIu16", qsize=3D%"PRIu16", qflags=3D%"PRI= u16", ien=3D%d" pci_nvme_del_sq(uint16_t qid) "deleting submission queue sqid=3D%"PRIu16"" --=20 2.30.0 From nobody Mon Feb 9 11:33: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 ARC-Seal: i=1; a=rsa-sha256; t=1610369521; cv=none; d=zohomail.com; s=zohoarc; b=dG7GlBuiE/q6WfswwM4V2bjnO3EnpZ+su+i4K9dJwxjIiDvh7XzkzVgVri2KEFZv44BS4yFVNIZBzZrJtrJMdvMdH86AFAUb/LGclk+N+KEbu/8NEXtqqBk4jPwDP23QCspiXvAwyISU/k2h7WkZAOUaQLgTL3V2hu9v75ksa9Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610369521; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ndtceV/Hor0GsqXeBPqIl4CkzXMOk2D3Hvp1dStxsPQ=; b=QCqqifycooTFlSiEIyoiqUUo663BjLQJoLSQo18m7wJo1TRD/+2VBu6bnUHzPBpXoW6sTgmOyLNGC92XKqcuoWVLyBZ1FWAmxPX9Gp3GD6BcFARCobHAqj5a7DDMScVLaa8RTE1kszgvA9DJ+lAZwY0FY6WNc7+LhWWXvhKL/Uo= ARC-Authentication-Results: i=1; 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 1610369520972331.8885365795471; Mon, 11 Jan 2021 04:52:00 -0800 (PST) Received: from localhost ([::1]:36958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kywfv-0004Mt-Dn for importer@patchew.org; Mon, 11 Jan 2021 07:51:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33222) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kywNA-0002SI-Fq; Mon, 11 Jan 2021 07:32:36 -0500 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:36153) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kywN8-0006tO-RU; Mon, 11 Jan 2021 07:32:36 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id E1A8D28EF; Mon, 11 Jan 2021 07:32:32 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 11 Jan 2021 07:32:33 -0500 Received: from apples.local (80-167-98-190-cable.dk.customer.tdc.net [80.167.98.190]) by mail.messagingengine.com (Postfix) with ESMTPA id 608281080057; Mon, 11 Jan 2021 07:32:31 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=ndtceV/Hor0Gs qXeBPqIl4CkzXMOk2D3Hvp1dStxsPQ=; b=oAySnfKGEbWGEm1COV/bZQGxX2U2N s5FY1lV7OjN7YGQtyw6x83DcsoWnDlKvUYGz9RxUeCSBOkh45BZOpnd4Ee6JgoM6 frCVJ6ozdC1AkmoEh2jX1IW5iYy9Ss8OAPKycjUov/GYfG9v2C/p4dBzLL5e3AvW iP14oJKKu7/bjllbiK+Gp142WzBUz/DD29T8HhFWfvhtuee6udN9/4EXxPGzUH5b 1kYvEbdXbGd0DRcdj/KlfppcuuRXGUenFB7zjTITSaZhklkVmH8mJoxysbKGYsky Z1k813X3JUNYBQ+R0X3D4mJIL+17p2BMDRSV4sXGyVTR1Hp1fIMB3QEHw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=ndtceV/Hor0GsqXeBPqIl4CkzXMOk2D3Hvp1dStxsPQ=; b=H94DVCjm rbMJYexfsOUXxIpZc9MmP3MtnX2/nBq1ryfSBfWtBvKTASfig81LiYVW5T6JK+qU slYZsl/bznRMQ6pwwj2SNfsFTog+QJXJqGfhsjbeY5DLUAnKV+gUETa/z99Ecl8r 0hIFNztfXcIvyXrlykpSA7ItgsaGop0bUmFZGf3Lz0zlUOr3+VCsz9jASxtlyI/3 vLdGDtG8YaAfafVaipAhSq3Dg6qS2KxgNctA0+q1fKN6DjM7lg7lKmh9mMa6QY03 7j0nh8jyuIK2o1HdDbviRzD1jPBgQ81S1rFDZEwK7C3FcFlBw060gU789zAGYNSo 9xBoAcF6kOgj3w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdehuddggedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefmlhgruhhs ucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnthdrughkqeenucggtffrrghtth gvrhhnpeeuleetgeeiuefhgfekfefgveejiefgteekiedtgfdtieefhfdthfefueffvefg keenucfkphepkedtrdduieejrdelkedrudeltdenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehithhssehirhhrvghlvghvrghnthdrughk X-ME-Proxy: From: Klaus Jensen To: qemu-devel@nongnu.org Subject: [PATCH 5/6] hw/block/nvme: add missing string representations for commands Date: Mon, 11 Jan 2021 13:32:22 +0100 Message-Id: <20210111123223.76248-6-its@irrelevant.dk> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111123223.76248-1-its@irrelevant.dk> References: <20210111123223.76248-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.21; envelope-from=its@irrelevant.dk; helo=wout5-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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 , qemu-block@nongnu.org, Dmitry Fomichev , Klaus Jensen , Max Reitz , Klaus Jensen , Keith Busch Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Klaus Jensen Add missing string representations for a couple of new commands. Signed-off-by: Klaus Jensen Reviewed-by: Dmitry Fomichev Tested-by: Dmitry Fomichev --- hw/block/nvme.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/block/nvme.h b/hw/block/nvme.h index b7fbcca39d9f..65540b650e1d 100644 --- a/hw/block/nvme.h +++ b/hw/block/nvme.h @@ -64,8 +64,12 @@ static inline const char *nvme_io_opc_str(uint8_t opc) case NVME_CMD_FLUSH: return "NVME_NVM_CMD_FLUSH"; case NVME_CMD_WRITE: return "NVME_NVM_CMD_WRITE"; case NVME_CMD_READ: return "NVME_NVM_CMD_READ"; + case NVME_CMD_COMPARE: return "NVME_NVM_CMD_COMPARE"; case NVME_CMD_WRITE_ZEROES: return "NVME_NVM_CMD_WRITE_ZEROES"; case NVME_CMD_DSM: return "NVME_NVM_CMD_DSM"; + case NVME_CMD_ZONE_MGMT_SEND: return "NVME_ZONED_CMD_MGMT_SEND"; + case NVME_CMD_ZONE_MGMT_RECV: return "NVME_ZONED_CMD_MGMT_RECV"; + case NVME_CMD_ZONE_APPEND: return "NVME_ZONED_CMD_ZONE_APPEND"; default: return "NVME_NVM_CMD_UNKNOWN"; } } --=20 2.30.0 From nobody Mon Feb 9 11:33: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 ARC-Seal: i=1; a=rsa-sha256; t=1610368860; cv=none; d=zohomail.com; s=zohoarc; b=B+FXaINvIkR7HVWV03HGZ0VzImugZvhhUWMdR1PVok84HFCIgm3jtllZrIxXYQ6tjwywOyB0727E26YN6iBuunqoErU7Sw029xSYZ9MRm5rtPwicVtqSp0wWRhp4MON+0d/631SAQpspht7GvPct/nuG1bHJyIUv1bAAt3Tf3nY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610368860; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=adtGXhYc66V9YuG6CN04y44WiSyTghbjeZIAb9k/xaM=; b=CXWPH4eWGgUCiVPwuWM2FLdYCBVnRQ9LY896KqyfTp7k9jr0khCFDMvqCz/4pZSDSxhsXFNaVRZypB57d1Z3Wg284VXQBWkcQ/9hs4hCzgKdrDlyxB8RGu67ccagmu/TRz0NWX6iQathRwXMiCSN7GRZgBMbiMiOAFSRx/KV4uM= ARC-Authentication-Results: i=1; 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 1610368860323716.5393957590686; Mon, 11 Jan 2021 04:41:00 -0800 (PST) Received: from localhost ([::1]:50506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kywVF-0005tS-Mp for importer@patchew.org; Mon, 11 Jan 2021 07:40:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33236) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kywNB-0002Th-Vg; Mon, 11 Jan 2021 07:32:38 -0500 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:48321) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kywNA-0006tf-62; Mon, 11 Jan 2021 07:32:37 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 2FBCC25D4; Mon, 11 Jan 2021 07:32:34 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 11 Jan 2021 07:32:34 -0500 Received: from apples.local (80-167-98-190-cable.dk.customer.tdc.net [80.167.98.190]) by mail.messagingengine.com (Postfix) with ESMTPA id 9BBA3108005C; Mon, 11 Jan 2021 07:32:32 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=adtGXhYc66V9Y uG6CN04y44WiSyTghbjeZIAb9k/xaM=; b=IGXtQfN2nbvJImRwguniR3m9it+Xl yeo0DKwCLLZGM9Lq3legn0VzXetR2pSV5ovfWg9lRfJD4w6fAhNgMIxdRWiUAYi3 10lW+5+u3vfsk336ATWeK8+I5iM40HqYmlZghkIY7J8bqk6W5AjPQc2vnz0bySRc 72yd3R/XkKwH2UjGaUxRzDwZkB8HWUqzOuNIYGbrSF2wSYMmXbi+jvOmZ5lgVhBV DbkiJ9qePO3cKGU2xYNpF9SJWS56GkQlPA0Yjalb65DXOMwJpX1n0PlpduzzCUbg FZZb3GgqqccNEaWHUkUTiFX1rnDwW6yMPhQ0tQzi40G5dfIXk+ESOzskQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=adtGXhYc66V9YuG6CN04y44WiSyTghbjeZIAb9k/xaM=; b=EbtdhqGx eK4x29o/Tg0ui+Zfzdm5Yfv+TFMGa/TIBdMXe9qfKXBLZeVbZSiqDPuh1LhM324B NsClr6ry4DcqthFirh5oUXpwa5/j/3kRxwLHNwMfwOdw8ZCOwgYgDB4ePQveAY5J q0IMm+cXOJyo/OtEazjiv7mAW8Kr660uS8+HAm7uaYKU/Dk8q4PqV74eOD4xvqNB 1+zk6isb63RSWPjTxaah70XQ+DCLnaJiVwigscHKEytmENuqKShYUiwpVk54cXV0 yJGBzOhoPmNEzhxwg8WbRTGbhlQnUN2ewaeub4RDl1sg1VlPEHyMgIL8QCakQ7g5 pLbMU6/MIoEP1g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdehuddggedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefmlhgruhhs ucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnthdrughkqeenucggtffrrghtth gvrhhnpeeuleetgeeiuefhgfekfefgveejiefgteekiedtgfdtieefhfdthfefueffvefg keenucfkphepkedtrdduieejrdelkedrudeltdenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehithhssehirhhrvghlvghvrghnthdrughk X-ME-Proxy: From: Klaus Jensen To: qemu-devel@nongnu.org Subject: [PATCH 6/6] hw/block/nvme: remove unnecessary check for append Date: Mon, 11 Jan 2021 13:32:23 +0100 Message-Id: <20210111123223.76248-7-its@irrelevant.dk> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111123223.76248-1-its@irrelevant.dk> References: <20210111123223.76248-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.21; envelope-from=its@irrelevant.dk; helo=wout5-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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 , qemu-block@nongnu.org, Dmitry Fomichev , Klaus Jensen , Max Reitz , Klaus Jensen , Keith Busch Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Klaus Jensen nvme_io_cmd already checks if the namespace supports the Zone Append command, so the removed check is dead code. Signed-off-by: Klaus Jensen Reviewed-by: Dmitry Fomichev Tested-by: Dmitry Fomichev --- hw/block/nvme.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index b3658595fe1b..1f175c7f8256 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1707,10 +1707,6 @@ static uint16_t nvme_do_write(NvmeCtrl *n, NvmeReque= st *req, bool append, } =20 res->slba =3D nvme_advance_zone_wp(ns, zone, nlb); - } else if (append) { - trace_pci_nvme_err_invalid_opc(rw->opcode); - status =3D NVME_INVALID_OPCODE; - goto invalid; } =20 data_offset =3D nvme_l2b(ns, slba); --=20 2.30.0