Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED0EDC433F5 for ; Thu, 9 Sep 2021 10:55:50 +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 6191D60FE3 for ; Thu, 9 Sep 2021 10:55:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6191D60FE3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=irrelevant.dk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:40084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mOHif-00070G-AP for qemu-devel@archiver.kernel.org; Thu, 09 Sep 2021 06:55:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34840) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOHfj-0005s3-7B; Thu, 09 Sep 2021 06:52:47 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:46277) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOHfh-0001sP-NH; Thu, 09 Sep 2021 06:52:46 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id CF34C5C00AB; Thu, 9 Sep 2021 06:52:44 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 09 Sep 2021 06:52:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=6UNo/WDJerRFiEhIbit2GCeSvc4 FL7Tx0N/WI/w4EL4=; b=a4ff1UIMG7jTBKM6PfbCoi4hELm56m+TDUgnhnLyCfu cnm5l8O23aRyq5LEXZki+5Hmo/ZdnJCHZ4PGttos71Gvur2BgRmICouEBQTHHcYZ Fs1FADrG6u4GOU40LQPbNkpBEkpqNlZVWqAhbOp44hzRcBZ1ozUZXURSi8+MTbmv /6llZH9MsFQDQHDHbcwnGqP+3Q9nI0frPco95W/YUYD6lE/jWF6y/6poTfhAzdQa Fl5gHbhAb0UKnPQiY5sGBwgJjiPyjvOYH7EathxFaL7Lypi+jkQr741UAUT+hp4h fDdhSPUsDv56ff4Elpl4UoMXOadiX9cafZ8kpRtXxVg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type: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=fm3; bh=6UNo/W DJerRFiEhIbit2GCeSvc4FL7Tx0N/WI/w4EL4=; b=eqD07IuGCQ91JgH26nNlBs gtuVBTds8F4sxrHE573hTr9nDcv9kOrRFkeHsFWZL4JQkiaCpS1Du4YxSH44HKA0 hE0XkD8cnh5vzpYwOmoox47eSDwN2OG2a0B+L28E0mTbfsjw8q1sIz6+OLNRu5UK nF3NhEvG7pgnF2rY08jZgk6IFLo0axOj5SeCOKvY7VB/7WJQkA1zBvmgW/OkzC2Q BD1yNc/0L5SG2MzRWIvoEEfJitsBwNROJM6ukPNl67QPHYdhic/YZarTkB4VKSEW ARSBFaAoea08QykSwPtcXziqnd102DGsirax2BKg0qsWnz0cAnEJ/iWqwrGn9SyQ == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudefledgfeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehgtderredttdejnecuhfhrohhmpefmlhgruhhs ucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnthdrughkqeenucggtffrrghtth gvrhhnpeejgeduffeuieetkeeileekvdeuleetveejudeileduffefjeegfffhuddvudff keenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehith hssehirhhrvghlvghvrghnthdrughk X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 9 Sep 2021 06:52:42 -0400 (EDT) Date: Thu, 9 Sep 2021 12:52:39 +0200 From: Klaus Jensen To: Hannes Reinecke Subject: Re: [PATCH] hw/nvme: select first free NSID for legacy drive configuration Message-ID: References: <20210909095159.122174-1-hare@suse.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="UFU8u3d2QqidBmgN" Content-Disposition: inline In-Reply-To: <20210909095159.122174-1-hare@suse.de> Received-SPF: pass client-ip=66.111.4.27; envelope-from=its@irrelevant.dk; helo=out3-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: Klaus Jensen , qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --UFU8u3d2QqidBmgN Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sep 9 11:51, Hannes Reinecke wrote: > If a legacy 'drive' argument is passed to the controller we cannot > assume that '1' will be a free NSID, as the subsys might already > have attached a namespace to this NSID. So select the first free > one. >=20 > Signed-off-by: Hannes Reinecke > --- > hw/nvme/ctrl.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) >=20 > diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c > index 757cdff038..2c69031ca9 100644 > --- a/hw/nvme/ctrl.c > +++ b/hw/nvme/ctrl.c > @@ -6546,8 +6546,15 @@ static void nvme_realize(PCIDevice *pci_dev, Error= **errp) > =20 > /* setup a namespace if the controller drive property was given */ > if (n->namespace.blkconf.blk) { > + int i; > ns =3D &n->namespace; > - ns->params.nsid =3D 1; > + for (i =3D 1; i <=3D NVME_MAX_NAMESPACES; i++) { > + if (nvme_ns(n, i) || nvme_subsys_ns(n->subsys, i)) { > + continue; > + } > + ns->params.nsid =3D i; > + break; > + } > =20 > if (nvme_ns_setup(ns, errp)) { > return; > --=20 > 2.26.2 >=20 Did you actually hit this? Because then then property checking logic is bad... The device is not supposed to allow nvme,drive=3D combined with a subsystem property. In nvme_check_constraints(): if (n->namespace.blkconf.blk && n->subsys) { /* error out */ return; } --UFU8u3d2QqidBmgN Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEUigzqnXi3OaiR2bATeGvMW1PDekFAmE553YACgkQTeGvMW1P DemozQf+OGFyViwNy7Sn0xR8OTxRdCx4UsKNpazWzyPjTHNYE5X2WtoTJn0d/RNQ mF8WluJNZ150Dn1Xw6Bq8px9hv9Oo9sCyWvp3aR5NccNPw7XANvJfLT87kKsmQIq hacGhzZBeMv6WP+4PGvVL7/mApaYyeChhu4cguOAg7rE4mbFeZEbJlpA5eKe6HNu GJOI/WNnUi/fZXVtny1LEswZy1FxikU8qviFXIlYNaaRv29uHlk8rqd4bHAEeh6D 7zU00NmxDgYia52+nKwfg/barL3bo/fVi+POlqH+zofnzF14iDsoqurq5CF4bsTx UDDX1ggOGqI5EEb2+3DkggaF0V254w== =Ye85 -----END PGP SIGNATURE----- --UFU8u3d2QqidBmgN--