From nobody Mon Feb 9 19:53:16 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=1621245633; cv=none; d=zohomail.com; s=zohoarc; b=fToKaqgPnmWEOLVNAa4pDhMDomrubFhmOTyEMkdatyHPTdh0B2Sbu2T5eu7xv/bRNl3b8pZ1P+DbVY2C7UI8bcNF+t5Rjo03a3sjqHo8thafNq7eGNfo2ry8lnEYNTknPk0sgt33Vh7uf3+77Ex7lE3+xtz2EXDmoSMjaixVKbM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621245633; 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=OjjOCTGGyGxcai3HzvKQum9is7s3hqHrEO3Us4Ph/bc=; b=ILysXdkvMV4zXEd6OWRx7bzMGhOeAokxedg6wp18bG+8oJP4boiVs9OgjlkqECJbLWLhH4FmTpNXGWHqLnm33w11tU99warCEwCFi713/Gwb8C2mEEC4qWybnG5dKIi9tDgfmGAA/WVBkUSz2QeFRkxdAN0t4bntnoL1rjSsc08= 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 1621245632134340.42253467966725; Mon, 17 May 2021 03:00:32 -0700 (PDT) Received: from localhost ([::1]:42758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lia32-0000zJ-0x for importer@patchew.org; Mon, 17 May 2021 06:00:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33652) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1liZOg-0003zd-Qo; Mon, 17 May 2021 05:18:46 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:58483) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1liZOf-00067R-3J; Mon, 17 May 2021 05:18:46 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 363725C0046; Mon, 17 May 2021 05:18:42 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 17 May 2021 05:18:42 -0400 Received: from apples.local (80-167-98-190-cable.dk.customer.tdc.net [80.167.98.190]) by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 17 May 2021 05:18:39 -0400 (EDT) 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=fm3; bh=OjjOCTGGyGxca i3HzvKQum9is7s3hqHrEO3Us4Ph/bc=; b=ZsFgvcJJsf0spVLVC72JzbtlVklxm vDMXvbHw5rl2PCJdqvUdq4ytg9WWp+ceb+7lBBhkLp20dSjevZMUTHQSi+h004oi dFrOfEQ+AHwrWvWDhS0qQj7rrLiiFUtppCuedo/OuaGEeLlczoWE48ADyssvE12K qvn6HqVravLPzurYqb8V1D8iI4lxYVNA8DyP13y7s0MpVOQ4Gnj77H+l4RXuJ6X0 pI2HAPia12Yb0jJt0MBizfL9fH09PJn8eFUc6CmBbEB8wKx0F0G31fwpIrB5eojr 9iynBahivBHHkB44fxCBtiBxq9+EL+068g6vAlc/QzV+Vy5TmteatKSbQ== 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= fm2; bh=OjjOCTGGyGxcai3HzvKQum9is7s3hqHrEO3Us4Ph/bc=; b=W2KdLe1o DI6vk17KN62Egr7QBUQjMptE51/vil8sd75tmDb1n4PzZow5Kl+V1BkF4nq82RPs hYQQ+/LXPqR0q717YxYFxDEPdXairV992C+fFci51N1WWJFRd7LPy9L/QVnJ+pg6 /kPznoP7vFQlqbJEd4PdgFnTR37jkC+gBwUQLVC7WdGmIvYgl4Nd31vrhF0ZKHqC RcQ48VPHubucDO6ScVl1r0gxeVfUAf+6BH/BVffNSmNt+kc3Y8Uan3Xt6TlzmcuE eF7nYcRuU+WQhOvK/SgoJmdz/1dhpC3iMQImMnOqsVpoSf1Zrz76bSb+i1spawPf BG5qpt909oq03g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdeihedgudegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefmlhgruhhs ucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnthdrughkqeenucggtffrrghtth gvrhhnpeeuleetgeeiuefhgfekfefgveejiefgteekiedtgfdtieefhfdthfefueffvefg keenucfkphepkedtrdduieejrdelkedrudeltdenucevlhhushhtvghrufhiiigvpedune curfgrrhgrmhepmhgrihhlfhhrohhmpehithhssehirhhrvghlvghvrghnthdrughk X-ME-Proxy: From: Klaus Jensen To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 19/20] hw/block/nvme: move zoned constraints checks Date: Mon, 17 May 2021 11:17:36 +0200 Message-Id: <20210517091737.841787-20-its@irrelevant.dk> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517091737.841787-1-its@irrelevant.dk> References: <20210517091737.841787-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=66.111.4.28; envelope-from=its@irrelevant.dk; helo=out4-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_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Klaus Jensen , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Klaus Jensen Validation of the max_active and max_open zoned parameters are independent of any other state, so move them to the early nvme_ns_check_constraints parameter checks. Signed-off-by: Klaus Jensen Reviewed-by: Keith Busch --- hw/block/nvme-ns.c | 52 +++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/hw/block/nvme-ns.c b/hw/block/nvme-ns.c index 008deb5e87d1..992e5a13f538 100644 --- a/hw/block/nvme-ns.c +++ b/hw/block/nvme-ns.c @@ -210,30 +210,6 @@ static int nvme_ns_zoned_check_calc_geometry(NvmeNames= pace *ns, Error **errp) return -1; } =20 - if (ns->params.max_active_zones) { - if (ns->params.max_open_zones > ns->params.max_active_zones) { - error_setg(errp, "max_open_zones (%u) exceeds max_active_zones= (%u)", - ns->params.max_open_zones, ns->params.max_active_zo= nes); - return -1; - } - - if (!ns->params.max_open_zones) { - ns->params.max_open_zones =3D ns->params.max_active_zones; - } - } - - if (ns->params.zd_extension_size) { - if (ns->params.zd_extension_size & 0x3f) { - error_setg(errp, - "zone descriptor extension size must be a multiple of 64B"= ); - return -1; - } - if ((ns->params.zd_extension_size >> 6) > 0xff) { - error_setg(errp, "zone descriptor extension size is too large"= ); - return -1; - } - } - return 0; } =20 @@ -403,6 +379,34 @@ static int nvme_ns_check_constraints(NvmeCtrl *n, Nvme= Namespace *ns, } } =20 + if (ns->params.zoned) { + if (ns->params.max_active_zones) { + if (ns->params.max_open_zones > ns->params.max_active_zones) { + error_setg(errp, "max_open_zones (%u) exceeds " + "max_active_zones (%u)", ns->params.max_open_zo= nes, + ns->params.max_active_zones); + return -1; + } + + if (!ns->params.max_open_zones) { + ns->params.max_open_zones =3D ns->params.max_active_zones; + } + } + + if (ns->params.zd_extension_size) { + if (ns->params.zd_extension_size & 0x3f) { + error_setg(errp, "zone descriptor extension size must be a= " + "multiple of 64B"); + return -1; + } + if ((ns->params.zd_extension_size >> 6) > 0xff) { + error_setg(errp, + "zone descriptor extension size is too large"); + return -1; + } + } + } + return 0; } =20 --=20 2.31.1