From patchwork Wed Jun 28 09:24:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Jensen X-Patchwork-Id: 13295407 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 781C9EB64DA for ; Wed, 28 Jun 2023 09:26:17 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qERQF-0006s9-6a; Wed, 28 Jun 2023 05:25:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qERQC-0006qs-Ib; Wed, 28 Jun 2023 05:25:08 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qERQ8-00018T-Eo; Wed, 28 Jun 2023 05:25:08 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 549015C0208; Wed, 28 Jun 2023 05:25:02 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 28 Jun 2023 05:25:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1687944302; x= 1688030702; bh=pKSgGPugpMae8P+g9ZSMuUMtsFuKLPdDV3W3UFsC10o=; b=V SPJT51i1zATjq7SBgHSO1Tv3/IZSzYgBptIU36t6ZjmUF9+LCBkjN7lTNhpDrzj6 BFRLap9MITtKqYKgPVjGyDycTc1iUhiPOJGXeVWXTUEXSfqq7xHTV+L0JM3LwZos f8HUSBOKoYESfGZwOiUyH+IQPjL7NYBAM5rdmfe68Wpc3aMCjYyPWjqccMPgMPwt DxvP+J2CabzJqorxVVr3xMNozknMivH+NdMw3aCASlc7hGByY0kMFTFFi+ZWBIc+ aXbmkxPNNhtWnyGsZxB+d1/IiWnt/WRrpkvKjal2vIwwep3Hc0GpCwDNJbLvZg4D PTTiGiBS/krZt29WzfnTA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id: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; t=1687944302; x= 1688030702; bh=pKSgGPugpMae8P+g9ZSMuUMtsFuKLPdDV3W3UFsC10o=; b=R y6V3/n3tdUtckIQetO0z2p0T8szrrjVvztV1M/E08/+JjTIldGUQX6MuM47s51MW fk/X722xiOKRolnSKJMp7kjFX6gjyYDzIAD9gOMy1Gxaw0jmLmG2J/yp7Puh5nGQ 013bphJFGTUY9916glETZ8lxB5KvEnJ96CTEnbQcoQ9sFc9dW9W7iRS5O6SAtf/9 EnE33cryJixn1/LhvkJat5yWAwaVxVmYfNheb51a3DQiClkNAT/JW3aSTZGTV+E7 nfOEdtN3DRWDUJMGGWFiU2pFGEfz5Vu9a4B09J/fU//2++PoWD20XgcBAJIBuJr7 5tzcAkfJLjCaTdxgwH4vg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrtddvgddufecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefmlhgruhhs ucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnthdrughkqeenucggtffrrghtth gvrhhnpeejgfeilefgieevheekueevheehkeefveegiefgheefgfejjeehffefgedujedu geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehith hssehirhhrvghlvghvrghnthdrughk X-ME-Proxy: Feedback-ID: idc91472f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 28 Jun 2023 05:25:00 -0400 (EDT) From: Klaus Jensen To: qemu-devel@nongnu.org, Peter Maydell Cc: Fam Zheng , Stefan Hajnoczi , Kevin Wolf , Keith Busch , =?utf-8?q?P?= =?utf-8?q?hilippe_Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Hanna Reitz , Klaus Jensen , Minwoo Im , Klaus Jensen Subject: [PULL 1/7] hw/nvme: add comment for nvme-ns properties Date: Wed, 28 Jun 2023 11:24:55 +0200 Message-ID: <20230628092453.39602-10-its@irrelevant.dk> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628092453.39602-9-its@irrelevant.dk> References: <20230628092453.39602-9-its@irrelevant.dk> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1300; i=k.jensen@samsung.com; h=from:subject; bh=d6hLJrNAEXhZ3XBWCPuox7FQ1uK+b1JaB9MdsfsOYLY=; b=owJ4nAFtAZL+kA0DAAoBTeGvMW1PDekByyZiAGSb/GVVib31dxosdNPemWevyS1/kC/GzCerU FREuOzK4sWgF4kBMwQAAQoAHRYhBFIoM6p14tzmokdmwE3hrzFtTw3pBQJkm/xlAAoJEE3hrzFt Tw3poq8IALRpj7bSFi0rkfFbJiI/L/ZoiD4jOQT4bDKpxqLtPohxyBNMZAXgrLvA37YRrmQYjU4 7appKTooGypbQiOPD/NS5mxP6583pZbcfSKzeJPyS2tfRo72bw60eI7LMVqkZSFuxCUxpEc1Pvj RVsX2SL0YMHAP7cgOlWjtbcc8/c8WfNaDlVj3/fVynf0Z+YIwkdYtkuniuX5C5/ARy0PkG/2TPi /jcmNMip6hq+QtpahuarPQF8WKkzwIUdmmX5sG3TYWhMyZ1oCZgw/xsY+XB81AQtY/pgMe4JIzv 1EEjK2XaiEcwrdKLzUEMV7I0wzhgxoDzxfQSIk+rY8Io6bIVWnXzHK62 X-Developer-Key: i=k.jensen@samsung.com; a=openpgp; fpr=DDCA4D9C9EF931CC3468427263D56FC5E55DA838 Received-SPF: pass client-ip=66.111.4.29; envelope-from=its@irrelevant.dk; helo=out5-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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Minwoo Im Add more comments of existing properties for nvme-ns device. Signed-off-by: Minwoo Im Reviewed-by: Klaus Jensen Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index fd917fcda1f5..020f37a780e0 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -43,7 +43,14 @@ * subsys= * -device nvme-ns,drive=,bus=,nsid=,\ * zoned=, \ - * subsys=,detached= + * subsys=,shared=, \ + * detached=, \ + * zoned.zone_size=, \ + * zoned.zone_capacity=, \ + * zoned.descr_ext_size=, \ + * zoned.max_active=, \ + * zoned.max_open=, \ + * zoned.cross_read= * * Note cmb_size_mb denotes size of CMB in MB. CMB is assumed to be at * offset 0 in BAR2 and supports only WDS, RDS and SQS for now. By default, the From patchwork Wed Jun 28 09:24:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Jensen X-Patchwork-Id: 13295409 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 3CCE3EB64DA for ; Wed, 28 Jun 2023 09:26:48 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qERQE-0006rl-7U; Wed, 28 Jun 2023 05:25:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qERQB-0006qS-II; Wed, 28 Jun 2023 05:25:07 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qERQ9-0001JL-9u; Wed, 28 Jun 2023 05:25:07 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 8A1AE5C01EA; Wed, 28 Jun 2023 05:25:04 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 28 Jun 2023 05:25:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1687944304; x= 1688030704; bh=nc9Hvjg/exthUfwyl9oW072OtPhq6B/BaXkQeS2Ls+I=; b=B nex0vNq/qenAE2RYI5skwK6vNMKX2Bk+puXj5rqY8iZYJPOEx+ZoTxPv/ny9eWnX BuMBGffLnlmDS7LT493gurfd0i0QPnhc4CWHoxV4AKHe7lil/vK+uFGMdDW0PwL6 AKgQlPwJ2JrTd50Xjs3MfzrmkKzI+4XtAFH+E+ynNum6sVTe38QdIDaYrtwgK1jx FOTWNsF6kmh6ynjfenT7HXXtZCavlX5bzcbALZSCQylYZ29VewWQwQJp0k8PuWbW f25QvUq02uSXdd25/D5JRlPb98IuVKgdnQZC1bc1/Ii0+ybuD/wSZWpcznmy0pfP tzaoeQ+6Gaim9f8AvAgKw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id: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; t=1687944304; x= 1688030704; bh=nc9Hvjg/exthUfwyl9oW072OtPhq6B/BaXkQeS2Ls+I=; b=m WyMBgukHjzVdcd+oJWvAU+5L+0rW7k8Up4GmtHZXFcFw5u7SonvzI+Wil4fgkwA2 PhGZ6G6MwJ9VrEmAd1y+HZJJNHpuVH5UCoHBzeekymbVppfqC36y/ZqNta1A3QKk cLXQyak7BQAxQ4GGq13Z2AvRdVBUi4FB+aBAQhr5O/QVNKmuh0YJMLfunhQJR2pN 8ZUJZGpT2dyyA9R9rP8OtYB2vsTNuZejyKPpxWlNGoBs4XQg9kAaGluK3G4KPSdn S/9CnP2ltbc0u1Xi+LGP7MUfkw2YqmCJUob1hHDqpGaRaG6UZwrHaU47ZM0s4Old +0eMqRbgAmoRIQ3ZYN5PQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrtddvgddufecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefmlhgruhhs ucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnthdrughkqeenucggtffrrghtth gvrhhnpeejgfeilefgieevheekueevheehkeefveegiefgheefgfejjeehffefgedujedu geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehith hssehirhhrvghlvghvrghnthdrughk X-ME-Proxy: Feedback-ID: idc91472f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 28 Jun 2023 05:25:02 -0400 (EDT) From: Klaus Jensen To: qemu-devel@nongnu.org, Peter Maydell Cc: Fam Zheng , Stefan Hajnoczi , Kevin Wolf , Keith Busch , =?utf-8?q?P?= =?utf-8?q?hilippe_Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Hanna Reitz , Klaus Jensen , Minwoo Im , Klaus Jensen Subject: [PULL 2/7] hw/nvme: consider COPY command in nvme_aio_err Date: Wed, 28 Jun 2023 11:24:56 +0200 Message-ID: <20230628092453.39602-11-its@irrelevant.dk> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628092453.39602-9-its@irrelevant.dk> References: <20230628092453.39602-9-its@irrelevant.dk> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1035; i=k.jensen@samsung.com; h=from:subject; bh=SzPvUmf1mwaRcbQQTu9QRtcGmSDNxD8XoXG5+zbb4zI=; b=owJ4nAFtAZL+kA0DAAoBTeGvMW1PDekByyZiAGSb/GYe8JeNk/d+RclM8ACvIRty+82BulKac 0KHZbf85ecoxokBMwQAAQoAHRYhBFIoM6p14tzmokdmwE3hrzFtTw3pBQJkm/xmAAoJEE3hrzFt Tw3pZ04H/1UwsbdnxRqYd56fl6TMIBMtozx0ASK/RXz44JKznq969ysT/AAqd/RWtl9MW/YZK3Q 0xOvkIuN1Hm/AlcnmKbZ7BnXuVCjIAsR/8WbvSmV3WhJquJff3xjJlv9vLieXFekFTPonjZFYlW bCB7Gb/n5sCizTu5Y0bd9k5MiJ/+bhvbUm32eIcdM6SUD/YPupX3oX+9/YLuZlO2TJ4jO63KXQa aMQCA6wv8B5pnkFzbaJihBp2+nkuu5JNk6oa/exSvUY0IvZMCm8bt5s+zmgSKKSVhM4ijyBG9dR W5c54+9LrEajTwH9wOY9E9Vj6KVJPETnOOLRM+POWASb3OvIT55Z1LOl X-Developer-Key: i=k.jensen@samsung.com; a=openpgp; fpr=DDCA4D9C9EF931CC3468427263D56FC5E55DA838 Received-SPF: pass client-ip=66.111.4.29; envelope-from=its@irrelevant.dk; helo=out5-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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Minwoo Im If we don't have NVME_CMD_COPY consideration in the switch statement in nvme_aio_err(), it will go to have NVME_INTERNAL_DEV_ERROR and `req->status` will be ovewritten to it. During the aio context, it might set the NVMe status field like NVME_CMD_SIZE_LIMIT, but it's overwritten in the nvme_aio_err(). Add consideration for the NVME_CMD_COPY not to overwrite the status at the end of the function. Signed-off-by: Minwoo Im Reviewed-by: Klaus Jensen Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 020f37a780e0..e031c2250a84 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -1755,6 +1755,7 @@ static void nvme_aio_err(NvmeRequest *req, int ret) case NVME_CMD_WRITE: case NVME_CMD_WRITE_ZEROES: case NVME_CMD_ZONE_APPEND: + case NVME_CMD_COPY: status = NVME_WRITE_FAULT; break; default: From patchwork Wed Jun 28 09:24:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Jensen X-Patchwork-Id: 13295412 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 3BB52EB64DC for ; Wed, 28 Jun 2023 09:27:06 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qERQI-0006tz-Ew; Wed, 28 Jun 2023 05:25:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qERQE-0006rn-Hb; Wed, 28 Jun 2023 05:25:10 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qERQD-0001Jj-1f; Wed, 28 Jun 2023 05:25:10 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 0D5555C0256; Wed, 28 Jun 2023 05:25:07 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Wed, 28 Jun 2023 05:25:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1687944307; x= 1688030707; bh=0SAFqxK4V1/WoZqNqzV4M1fFbLLbqOGk3I++tVFYBTA=; b=c pXCUS87GhOiBzcL7vJuqh4Qc/Lk2CXKW6GnSmoZzMou2CVU69OVe45fqikgY/J1W MJQwfpfN9gaVeF4fMMlvjHR5AFrGZOxsTVDKFjDiYGyL/sqrhUZRPeJLGExhfeua d8LphmdJXqq/foNvCAApY9RDUWRE4BpoT3oasRO7y78y92G8KTNciEvl6nYoQunz mNZ1oFOtRPePCFDlTxW0SwuITvg9SR4PN7Th1nDw2ZQCBc1FT+b+oOg73395B53J dBYfBDlw1ryPAtY2O2G35cezr7mEaL47uMq22gHWHQAu1zoGqwAzLrRGHYEeo/Mb VKMPRD4lqlpaA1Ciy63mg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id: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; t=1687944307; x= 1688030707; bh=0SAFqxK4V1/WoZqNqzV4M1fFbLLbqOGk3I++tVFYBTA=; b=p ekQkUvhU190GwF32KkqItKNOtBuHsE5DOStpgeGowHSsDNSo7P0fGd4HPqf7nZuo kzKETiTtQTzr/KHl6SG7Xh1OLoxWdUU9DdFKXxiKjoJIc1zu1T9MYx0aiAN+TnAu KRsLSyd+PvoW2bXiv9vwYaj5CjFoVoWyDEvSZgzDoNmgZyWNTR0h0IhqB936bE2S NCstEFUHxaURNQ2ymX4SLxdF2H91WD39TP9VaifGV/3uapQbSUf0yGEpgdbYpp1f nWXkZN/e0zI0TZmgIYXzy/dvPvwASevlVMZna7VTSAYSx3DW875/UG5cuw+SzHJ8 dInrG+MWrVa9DRHgXuZsw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrtddvgddugecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefmlhgruhhs ucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnthdrughkqeenucggtffrrghtth gvrhhnpeejgfeilefgieevheekueevheehkeefveegiefgheefgfejjeehffefgedujedu geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehith hssehirhhrvghlvghvrghnthdrughk X-ME-Proxy: Feedback-ID: idc91472f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 28 Jun 2023 05:25:04 -0400 (EDT) From: Klaus Jensen To: qemu-devel@nongnu.org, Peter Maydell Cc: Fam Zheng , Stefan Hajnoczi , Kevin Wolf , Keith Busch , =?utf-8?q?P?= =?utf-8?q?hilippe_Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Hanna Reitz , Klaus Jensen , Minwoo Im , Klaus Jensen Subject: [PULL 3/7] hw/nvme: check maximum copy length (MCL) for COPY Date: Wed, 28 Jun 2023 11:24:57 +0200 Message-ID: <20230628092453.39602-12-its@irrelevant.dk> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628092453.39602-9-its@irrelevant.dk> References: <20230628092453.39602-9-its@irrelevant.dk> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1670; i=k.jensen@samsung.com; h=from:subject; bh=eKUVEUgODcXz3wtxTeNtY/83NRFFRhmOiWfERAFAsk0=; b=owJ4nAFtAZL+kA0DAAoBTeGvMW1PDekByyZiAGSb/GYzacgX39Slxe3kS6GMf1Yo1H8sMKI4a tDbINuyDls5iYkBMwQAAQoAHRYhBFIoM6p14tzmokdmwE3hrzFtTw3pBQJkm/xmAAoJEE3hrzFt Tw3pKWkH/ReLj8LT5xIYZZPu6eJw/cWAulu/ojIAMeJvHimSjUiTwSPdRoFOJbHyOsGhuoYiY3a fonU00RBfRVh1eramn2uHUPccP4WFkFRlZ0hTNDWrnTt15te7wHpw3wbO1/J6w2AJ1gd1BBfimA bAXbRFtWANCprA7yvNuhA0o8iosl1ieYhk4dD0n4Qee9E0hLKkcV1QFEgc8Fk+jCLwqYMtoOUe+ KL26YQHp1n5qn3dSVc1rElaw+YylAfDNOjE7xI/nrs19GG1NpI+7cssEsdJzKP+Q7MUODZPAc/Y ix5E3xzgh7VWMccSme3KKF3ERHKMrYMzLh+Rp9l7Y8/yttjwyEK05q2F X-Developer-Key: i=k.jensen@samsung.com; a=openpgp; fpr=DDCA4D9C9EF931CC3468427263D56FC5E55DA838 Received-SPF: pass client-ip=66.111.4.29; envelope-from=its@irrelevant.dk; helo=out5-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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Minwoo Im MCL(Maximum Copy Length) in the Identify Namespace data structure limits the number of LBAs to be copied inside of the controller. We've not checked it at all, so added the check with returning the proper error status. Signed-off-by: Minwoo Im Reviewed-by: Klaus Jensen Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index e031c2250a84..355668bdf87e 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -2855,6 +2855,25 @@ static void nvme_copy_source_range_parse(void *ranges, int idx, uint8_t format, } } +static inline uint16_t nvme_check_copy_mcl(NvmeNamespace *ns, + NvmeCopyAIOCB *iocb, uint16_t nr) +{ + uint32_t copy_len = 0; + + for (int idx = 0; idx < nr; idx++) { + uint32_t nlb; + nvme_copy_source_range_parse(iocb->ranges, idx, iocb->format, NULL, + &nlb, NULL, NULL, NULL); + copy_len += nlb + 1; + } + + if (copy_len > ns->id_ns.mcl) { + return NVME_CMD_SIZE_LIMIT | NVME_DNR; + } + + return NVME_SUCCESS; +} + static void nvme_copy_out_completed_cb(void *opaque, int ret) { NvmeCopyAIOCB *iocb = opaque; @@ -3167,6 +3186,11 @@ static uint16_t nvme_copy(NvmeCtrl *n, NvmeRequest *req) } } + status = nvme_check_copy_mcl(ns, iocb, nr); + if (status) { + goto invalid; + } + iocb->req = req; iocb->ret = 0; iocb->nr = nr; From patchwork Wed Jun 28 09:24:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Jensen X-Patchwork-Id: 13295411 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 95E9AEB64D7 for ; Wed, 28 Jun 2023 09:26:57 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qERQI-0006tx-Cx; Wed, 28 Jun 2023 05:25:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qERQG-0006ss-Bb; Wed, 28 Jun 2023 05:25:12 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qERQE-0001Kx-Nu; Wed, 28 Jun 2023 05:25:12 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id DC0CF5C0254; Wed, 28 Jun 2023 05:25:09 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 28 Jun 2023 05:25:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1687944309; x= 1688030709; bh=fizn5INwmm2k1ZWTRHs1ql1YE1488B/2o6dkGpp88EI=; b=W rBHNLpcwg8ofdi+HWuNy1tzaW7XcvzwM7oJ2mopCQo5g6TD+HLiGwxVNndyw9add SCNkng0sUhwb5Ve0LkwXZhSfPaCdmHRdKKXuVW0b8+T/ZXz7Fhu3sQGIyYLFVinm NmeKDou4NPdSFYEgVNiIWp/ZewDuM534o0CUoVKg4Gd6IzcXu/8EmEiOf+IjPZ6v 9KtchyGvHVvOIMxAfMXR6HKNd3XjTRre8cN/HrcsF9Z3ADFRZb8b8SJhWGntFv8C IzckopHFGvpqBocY+71AouXzeMFJXA5uYfDTbrxLMfJh4PR7raykBpqBe6kgcIK1 NkA11AHc9PbpHq5jYVLgA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id: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; t=1687944309; x= 1688030709; bh=fizn5INwmm2k1ZWTRHs1ql1YE1488B/2o6dkGpp88EI=; b=i dgc7OQGqcvAuL47s7y0F19dWStecPnAu1gLAo3DfYVTuyApSQr5qS2DLC4YCnDpT tTnho3ZaFhHQMFmFmPPO4w8Ux+klzuBBF4mujz85R1CP0Ptq5toegDt920METE23 n9euwKt6b+cNKfXPyxzkpD7KOzVYHNFc/b9h8nKR39Q5IT6Z7kdqE/hvOTV1Zr1E dAlFqo8cdHMoJL/ebUiFRCDOBQyQNHrgROcSgohLUzvKQDM3qktXgEhDijHV9V2u UfrpL3g/JCY9nkOZ/y7MFcmeDudAogIYzajd01YoWu8nzWF3WLPcUyDDlmur153l Ielqmdwab45tWdACJf8pg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrtddvgddufecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefmlhgruhhs ucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnthdrughkqeenucggtffrrghtth gvrhhnpeduheeuueeukeetuddttddvvddvfeehfeekleevteekfeefueeifeevudduhfeh teenucffohhmrghinheprhhuhhhsrdhtohenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpehithhssehirhhrvghlvghvrghnthdrughk X-ME-Proxy: Feedback-ID: idc91472f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 28 Jun 2023 05:25:07 -0400 (EDT) From: Klaus Jensen To: qemu-devel@nongnu.org, Peter Maydell Cc: Fam Zheng , Stefan Hajnoczi , Kevin Wolf , Keith Busch , =?utf-8?q?P?= =?utf-8?q?hilippe_Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Hanna Reitz , Klaus Jensen , Klaus Jensen , Jesper Wendel Devantier Subject: [PULL 4/7] hw/nvme: fix verification of number of ruhis Date: Wed, 28 Jun 2023 11:24:58 +0200 Message-ID: <20230628092453.39602-13-its@irrelevant.dk> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628092453.39602-9-its@irrelevant.dk> References: <20230628092453.39602-9-its@irrelevant.dk> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1748; i=k.jensen@samsung.com; h=from:subject; bh=Qvn3h713z/xOqhjAUBNUyTzo7mDZgiguvvfFAjleIl4=; b=owJ4nAFtAZL+kA0DAAoBTeGvMW1PDekByyZiAGSb/GaMvkceeJvBw/fdKZ8dz/zjbmy3RoaR2 yoWrbhEB8YcWIkBMwQAAQoAHRYhBFIoM6p14tzmokdmwE3hrzFtTw3pBQJkm/xmAAoJEE3hrzFt Tw3p7zkIAKGimmqGF0vySYqo8AW3Z6wfzOrIpfhZKElKsBewf0OUYOECCEThXj7UXhQr+6YYcxl 7WPBf/7TQjh3oPhdpdZPGvJYoAwCfYfFumQ1NzBamjuzqTFTOuuMM2R1Bs1wEKZwpgDiLSShP01 e77yjTFfL1ooqacJQT8/mZ5jzw98Lg1hNTgnVp7iG4PfhyfqFedhj2Ua1ILMLsF8JXQ/izVyc2M TQNFfSe0tGp6r/EBrWTEamSsVvYX/B27VnYaueIjYU3WQNOy09TObJXinRIT2bXQJNYL9K2EsWA j1XRKigB5QFrxZ7wvjl7qqRg72Rf21Is0vV5IiGUcIgJPoY7RDd1zKqf X-Developer-Key: i=k.jensen@samsung.com; a=openpgp; fpr=DDCA4D9C9EF931CC3468427263D56FC5E55DA838 Received-SPF: pass client-ip=66.111.4.29; envelope-from=its@irrelevant.dk; helo=out5-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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Klaus Jensen Fix a off-by-one error when verifying the number of reclaim unit handle identifiers specified in fdp.ruhs. To make the fix nicer, move the verification of the fdp.nruh parameter to an earlier point. Fixes: 73064edfb864 ("hw/nvme: flexible data placement emulation") Reviewed-by: Jesper Wendel Devantier Signed-off-by: Klaus Jensen --- hw/nvme/ns.c | 4 +--- hw/nvme/subsys.c | 6 ++++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c index 547c0b154312..050fdaf50fcd 100644 --- a/hw/nvme/ns.c +++ b/hw/nvme/ns.c @@ -438,9 +438,7 @@ static bool nvme_ns_init_fdp(NvmeNamespace *ns, Error **errp) /* parse the placement handle identifiers */ while ((token = qemu_strsep(&p, ";")) != NULL) { - ns->fdp.nphs += 1; - if (ns->fdp.nphs > NVME_FDP_MAXPIDS || - ns->fdp.nphs == endgrp->fdp.nruh) { + if (ns->fdp.nphs++ == endgrp->fdp.nruh) { error_setg(errp, "too many placement handles"); free(r); return false; diff --git a/hw/nvme/subsys.c b/hw/nvme/subsys.c index 24ddec860e45..d30bb8bfd5b4 100644 --- a/hw/nvme/subsys.c +++ b/hw/nvme/subsys.c @@ -158,8 +158,10 @@ static bool nvme_subsys_setup_fdp(NvmeSubsystem *subsys, Error **errp) endgrp->fdp.nrg = subsys->params.fdp.nrg; - if (!subsys->params.fdp.nruh) { - error_setg(errp, "fdp.nruh must be non-zero"); + if (!subsys->params.fdp.nruh || + subsys->params.fdp.nruh > NVME_FDP_MAXPIDS) { + error_setg(errp, "fdp.nruh must be non-zero and less than %u", + NVME_FDP_MAXPIDS); return false; } From patchwork Wed Jun 28 09:24:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Jensen X-Patchwork-Id: 13295408 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 13F65EB64DA for ; Wed, 28 Jun 2023 09:26:39 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qERQJ-0006vV-MW; Wed, 28 Jun 2023 05:25:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qERQI-0006u0-Fj; Wed, 28 Jun 2023 05:25:14 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qERQH-0001Ll-0R; Wed, 28 Jun 2023 05:25:14 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 262ED5C0241; Wed, 28 Jun 2023 05:25:12 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 28 Jun 2023 05:25:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1687944312; x= 1688030712; bh=jIrNQjCeIfQAQMFuWqOGIuTcnSKlPmEGEl2PPVtk0HM=; b=L ql5oL57sG9NscJAZKs1IExCMhiay3wLT7zPqDV/WNuMMtLQODjXscU9HraEEW0VD JCgcUbqwYbqoeC/c73ysn4kw+hbArVQeArmZScg7nR4/JKK1MRrQQENfjfHJOPjt DzcWWPJnBg7aaR2wP46HGnCzGGQtQsR2p6PEHk76OQZ9cA3XWE+scIwDyxRoOq0W MDKXf2UwsDv7pEGJuluoXPGo7/kKjswP44lro1q63Jm8QAvPEL2ylMkdl4DR1niG PfxQXMzliJir+ysDAp/TMlrhoMZdFT9X2/fjWpZ3CsRtx9lnAKe7y2pKl4Ka41+g dfDXoTDgZ4Rtc6CJiavtw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id: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; t=1687944312; x= 1688030712; bh=jIrNQjCeIfQAQMFuWqOGIuTcnSKlPmEGEl2PPVtk0HM=; b=R 0N35L4xgzDv/gt+HWr+ce3udSeDXw20JHCJyllx/nJZYe7bOysJdXTDzZ+oXWLuQ GHBRcqiij07+a3rnTZzeDoSuGByjxp79NirsYte1IwQKX934mbCNAjwOiUe4GFrh AgfBGhU3DvNT3/FuRvIJuRYF5ICNwWZ3BP+3lrW3usyyxqMUlK6wQFOMiFpjzAo8 54yrAk+wk44BvAeKpmn6MqBqpp0+eAVsSqatJPJB6j9baBybzLixxQxIFtslk/KG 3YErCLw0t4Ov1ourKhnkT1iOvWJQddEMrrDP5v3PlVvnkxpekn/3CHiqCyn7lBPB 8E3PtB6oF5pUOyELGMA/Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrtddvgddugecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefmlhgruhhs ucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnthdrughkqeenucggtffrrghtth gvrhhnpeejgfeilefgieevheekueevheehkeefveegiefgheefgfejjeehffefgedujedu geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehith hssehirhhrvghlvghvrghnthdrughk X-ME-Proxy: Feedback-ID: idc91472f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 28 Jun 2023 05:25:10 -0400 (EDT) From: Klaus Jensen To: qemu-devel@nongnu.org, Peter Maydell Cc: Fam Zheng , Stefan Hajnoczi , Kevin Wolf , Keith Busch , =?utf-8?q?P?= =?utf-8?q?hilippe_Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Hanna Reitz , Klaus Jensen , Klaus Jensen , Jesper Wendel Devantier Subject: [PULL 5/7] hw/nvme: verify uniqueness of reclaim unit handle identifiers Date: Wed, 28 Jun 2023 11:24:59 +0200 Message-ID: <20230628092453.39602-14-its@irrelevant.dk> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628092453.39602-9-its@irrelevant.dk> References: <20230628092453.39602-9-its@irrelevant.dk> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1070; i=k.jensen@samsung.com; h=from:subject; bh=3vltZ98tCm0E+zi8rOmVK306W6qCc37UtTzfMKwuHWw=; b=owJ4nAFtAZL+kA0DAAoBTeGvMW1PDekByyZiAGSb/GZlVPZdBnHJlXT7sY1N/72wNPJRO93uF NTfauZ56FzUPIkBMwQAAQoAHRYhBFIoM6p14tzmokdmwE3hrzFtTw3pBQJkm/xmAAoJEE3hrzFt Tw3p5o0H/1+2+uIvWmJHLqfu7A4HnLzL82rhLgrtEIcPZOYYBPtQGL6UmluubWwp143aPkmDXlj KuPty9xL+oRdRcDJJkdScJqS+BSwzXExVH2H2EYLYzc04dAbrAoWtCh2l2+w07O+0JFjOLdpxzr kvimQY/47tL8pQpoL/kMpzcKBc0BvXvxgopdfp0BSXfsv/T/9FnUckyxByMCttbkuyrT0YIwpxZ 4Npi9RmOENRJyPKpnBNJ17Yo8vXIfYzbL7QMDDnjCT++GwBj8rr+dJfFIilcBzMUORBIS8CjW7l b1nImCN7L9FdunKru1wqJrzVz15DZOwUCHWzJTskkYAEcDWbPxCdNarj X-Developer-Key: i=k.jensen@samsung.com; a=openpgp; fpr=DDCA4D9C9EF931CC3468427263D56FC5E55DA838 Received-SPF: pass client-ip=66.111.4.29; envelope-from=its@irrelevant.dk; helo=out5-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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Klaus Jensen Verify that a reclaim unit handle identifier is only specified once in fdp.ruhs. Fixes: 73064edfb864 ("hw/nvme: flexible data placement emulation") Reviewed-by: Jesper Wendel Devantier Signed-off-by: Klaus Jensen --- hw/nvme/ns.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c index 050fdaf50fcd..c4ea2033bb1c 100644 --- a/hw/nvme/ns.c +++ b/hw/nvme/ns.c @@ -453,6 +453,17 @@ static bool nvme_ns_init_fdp(NvmeNamespace *ns, Error **errp) free(r); + /* verify that the ruhids are unique */ + for (unsigned int i = 0; i < ns->fdp.nphs; i++) { + for (unsigned int j = i + 1; j < ns->fdp.nphs; j++) { + if (ruhids[i] == ruhids[j]) { + error_setg(errp, "duplicate reclaim unit handle identifier: %u", + ruhids[i]); + return false; + } + } + } + ph = ns->fdp.phs = g_new(uint16_t, ns->fdp.nphs); ruhid = ruhids; From patchwork Wed Jun 28 09:25:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Jensen X-Patchwork-Id: 13295404 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C0227EB64D7 for ; Wed, 28 Jun 2023 09:25:40 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qERQM-0006xs-Ek; Wed, 28 Jun 2023 05:25:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qERQK-0006x3-QP; Wed, 28 Jun 2023 05:25:16 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qERQJ-0001MN-3O; Wed, 28 Jun 2023 05:25:16 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 4F90C5C0259; Wed, 28 Jun 2023 05:25:14 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 28 Jun 2023 05:25:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1687944314; x= 1688030714; bh=lwkKKVXuR68xGTsUo5sThyDvbS0I2vTE0f77BW9RSM0=; b=d +XHhSB2gEaVjnm2W17t5/V9uun+A7Oocxg9wIpc854eDqBqaGXJZG5LtUFbjdLui zPWrjF3myfPjQ2vNgvlcDh8xxZvn7u+LQzcqU/JFv7npkcOh+oxk+nGiYedMqtwh BnmU7oHypViExvxw2mxXbJaPMvhkLL+8CULCvY7YMdweGrqywmp9clIOFQzuuXmr k2ixe4TjedieBAHZvsjk0G2Bm2rqWzZqMt5FVS/I26zT0v6p1/T3r8KVKODb1BBv r1bcPUdF9AOFoC1+98gmWjebj9ce7TzFTcVLnRLhWFwJPiq3JYTeHiyIM4pvPKNL pNzo7Tpn/3tLvpMCfUw7w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id: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; t=1687944314; x= 1688030714; bh=lwkKKVXuR68xGTsUo5sThyDvbS0I2vTE0f77BW9RSM0=; b=R i/a3k9LVN9BCg1jj2mqD4Egm8nUyVWfKrvV4ukJBPsbIomiumgOATsLSocSpkzh3 fX06Z5hxhVeKZ1iQO4F3vwmpD5FehsThZS/6vR7T/kQRvphzaT3a9q++y29cZcHw iZz26g/eFABIDBcTBDSPhGwzKdaO8/DeeKFv5DL2+km95MNoKYb4ADgYGkwhuYUD EjRgG0x+1nKxYw+UdARPYzcwUeZ1M8SbTHnzhhk5iMZH7ibX3176DNPbspvwvxue tQkn8NWeIeT/T/dx4nBzsFOQ27NB2K2PlGecwY4r2VcCi3yk0UWAMfg95YZWSlPB zpubP/A+OYpqlSXhYHQEA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrtddvgddufecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefmlhgruhhs ucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnthdrughkqeenucggtffrrghtth gvrhhnpeejgfeilefgieevheekueevheehkeefveegiefgheefgfejjeehffefgedujedu geenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehith hssehirhhrvghlvghvrghnthdrughk X-ME-Proxy: Feedback-ID: idc91472f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 28 Jun 2023 05:25:12 -0400 (EDT) From: Klaus Jensen To: qemu-devel@nongnu.org, Peter Maydell Cc: Fam Zheng , Stefan Hajnoczi , Kevin Wolf , Keith Busch , =?utf-8?q?P?= =?utf-8?q?hilippe_Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Hanna Reitz , Klaus Jensen , Klaus Jensen , Jesper Wendel Devantier Subject: [PULL 6/7] hw/nvme: add placement handle list ranges Date: Wed, 28 Jun 2023 11:25:00 +0200 Message-ID: <20230628092453.39602-15-its@irrelevant.dk> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628092453.39602-9-its@irrelevant.dk> References: <20230628092453.39602-9-its@irrelevant.dk> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2398; i=k.jensen@samsung.com; h=from:subject; bh=AqujWSP59cGf2AINrUNyW8IaIl4bQuWfEv4pffOVtpY=; b=owJ4nAFtAZL+kA0DAAoBTeGvMW1PDekByyZiAGSb/GaJM5TrJ+3KmUIWb6bCr48DMUnd3Bt3R 8L/WtDS9S4g+4kBMwQAAQoAHRYhBFIoM6p14tzmokdmwE3hrzFtTw3pBQJkm/xmAAoJEE3hrzFt Tw3pTREH/0dUnxVPhZPXrb8qMlOmJIWtFRvXpryMXRtzaPtuc+el41sfNBrUQOjoBiZXsEPYgkk 7JUbDmpLaUpTvWbQjn+nW2D3AL90HkYVSOswI44bSNVg8VDXhUnvJiSI6TPWFgBkkNWEanjLAFn Xs7d/hBK9uqP7xufH5h95fWY+Jx1cMeU7XtJSUb4oS0CP09gg/Lmz7LFtNKgeEZsNe3m+/hp6Hq bgkbkSi+55vYh8x5InuQsHHurFU7bvlKA/XqwC36j9pyH6fiwHQ+/OoB4dU2GafLrhNh1gIdmm8 aCcyuAj7TY6RMr1lETsVpHPTjI2YzRtsXK9tz77Rh137j18IG9GlIqyL X-Developer-Key: i=k.jensen@samsung.com; a=openpgp; fpr=DDCA4D9C9EF931CC3468427263D56FC5E55DA838 Received-SPF: pass client-ip=66.111.4.29; envelope-from=its@irrelevant.dk; helo=out5-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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Klaus Jensen Allow the placement handles to be specified as ranges, i.e. `fdp.ruhs=1:3-5` will attempt to assign ruh 1, 3, 4 and 5 to the namespace. Reviewed-by: Jesper Wendel Devantier Signed-off-by: Klaus Jensen --- hw/nvme/ns.c | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c index c4ea2033bb1c..44aba8f4d9cf 100644 --- a/hw/nvme/ns.c +++ b/hw/nvme/ns.c @@ -400,8 +400,9 @@ static bool nvme_ns_init_fdp(NvmeNamespace *ns, Error **errp) NvmeRuHandle *ruh; uint8_t lbafi = NVME_ID_NS_FLBAS_INDEX(ns->id_ns.flbas); g_autofree unsigned int *ruhids = NULL; - unsigned int *ruhid; - char *r, *p, *token; + unsigned int n, m, *ruhid; + const char *endptr, *token; + char *r, *p; uint16_t *ph; if (!ns->params.fdp.ruhs) { @@ -438,17 +439,40 @@ static bool nvme_ns_init_fdp(NvmeNamespace *ns, Error **errp) /* parse the placement handle identifiers */ while ((token = qemu_strsep(&p, ";")) != NULL) { - if (ns->fdp.nphs++ == endgrp->fdp.nruh) { - error_setg(errp, "too many placement handles"); - free(r); - return false; - } - - if (qemu_strtoui(token, NULL, 0, ruhid++) < 0) { + if (qemu_strtoui(token, &endptr, 0, &n) < 0) { error_setg(errp, "cannot parse reclaim unit handle identifier"); free(r); return false; } + + m = n; + + /* parse range */ + if (*endptr == '-') { + token = endptr + 1; + + if (qemu_strtoui(token, NULL, 0, &m) < 0) { + error_setg(errp, "cannot parse reclaim unit handle identifier"); + free(r); + return false; + } + + if (m < n) { + error_setg(errp, "invalid reclaim unit handle identifier range"); + free(r); + return false; + } + } + + for (; n <= m; n++) { + if (ns->fdp.nphs++ == endgrp->fdp.nruh) { + error_setg(errp, "too many placement handles"); + free(r); + return false; + } + + *ruhid++ = n; + } } free(r); From patchwork Wed Jun 28 09:25:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Jensen X-Patchwork-Id: 13295410 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id E59D7EB64D7 for ; Wed, 28 Jun 2023 09:26:49 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qERQP-0006zI-Et; Wed, 28 Jun 2023 05:25:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qERQN-0006xy-0m; Wed, 28 Jun 2023 05:25:19 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qERQL-0001Mr-Aq; Wed, 28 Jun 2023 05:25:18 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 720635C0264; Wed, 28 Jun 2023 05:25:16 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 28 Jun 2023 05:25:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1687944316; x= 1688030716; bh=KVT+ujvnzF3IlcRhQ+7c4hl6lloqDpHwzBWNFnFECaA=; b=u /Fhh4Rk+FAp03Zlwv6znXl7WsqLrPDvQJ7nUaE2wJQD6WN0KFpJUzcKRQTo0H/hd KHFj37gW+yJSMn/GqGUlVG7vSquT+G2tinjmi9xKZ5GPYBSovTkPp6uORmzo9VRH 24wxxyY+owanmuYn/apBJ2QE4A8PHw+q5D1N8DkEZ/YlMNMATXKPOuXjooLL9Uvo Js+qPDZE4NtkZmoHUVsY43+q1NgJAvhRKuuHTBjq0KBHG4kpJiKDK8KxgRrXcpsh 8TLiXXBgN+3NMjX+6cjKW/DGjiSwBP0Lu7gS2bhyNB/vDiM2vOy2AZ7szc4luiRT npXJG+jo92JI4gAlvZ3ag== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id: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; t=1687944316; x= 1688030716; bh=KVT+ujvnzF3IlcRhQ+7c4hl6lloqDpHwzBWNFnFECaA=; b=X d50PRzyx3GLVDBbkNiTxHTfS1aqanX34pEEam0X+aA2Mi8zOdt+yqlbSy21CWt2V CCXGr+t9Sgwkdz/A3K4KLFVHemuPaGKdt48ROWDQzkKos5OvMLL455BkAvMf1qWP MWWgvddSscCKkCF+BPteKmpQLuKz1h4/I3HnRnqox8Bu3tKaRFAMFuPLMWBvRCWo WstpqbSk33ye9gOTn4xLQ39svVl9Qv5hm5ZD1Bfgrrj0p2Bh6EXkWjtOA5FVJJD+ Ley+vBM5bmzzT7Swio9FL/08UZu8dfVlq1F2NFJdAPbao4qARHFK5zzDvmlZv5wo Ya+578nJ9l1ILat2IlWIQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrtddvgddufecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefmlhgruhhs ucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnthdrughkqeenucggtffrrghtth gvrhhnpeejgfeilefgieevheekueevheehkeefveegiefgheefgfejjeehffefgedujedu geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehith hssehirhhrvghlvghvrghnthdrughk X-ME-Proxy: Feedback-ID: idc91472f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 28 Jun 2023 05:25:14 -0400 (EDT) From: Klaus Jensen To: qemu-devel@nongnu.org, Peter Maydell Cc: Fam Zheng , Stefan Hajnoczi , Kevin Wolf , Keith Busch , =?utf-8?q?P?= =?utf-8?q?hilippe_Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Hanna Reitz , Klaus Jensen , Klaus Jensen , Jesper Wendel Devantier Subject: [PULL 7/7] docs: update hw/nvme documentation for TP4146 Date: Wed, 28 Jun 2023 11:25:01 +0200 Message-ID: <20230628092453.39602-16-its@irrelevant.dk> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628092453.39602-9-its@irrelevant.dk> References: <20230628092453.39602-9-its@irrelevant.dk> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2327; i=k.jensen@samsung.com; h=from:subject; bh=kKPYV0y0niAhnY7vHefj6DX0B5zNNJSY0+WCys+kjrw=; b=owJ4nAFtAZL+kA0DAAoBTeGvMW1PDekByyZiAGSb/Gb1Av7hkR21Mu5L/CobXQndKJaRwqFHN lz9Orc770Vs24kBMwQAAQoAHRYhBFIoM6p14tzmokdmwE3hrzFtTw3pBQJkm/xmAAoJEE3hrzFt Tw3p9QUIAJBaTc87kBMkI5RCTP/oSt479WLNaEqUxRkK8+DsDHFET28cD2YHz1U4btzAAPti4gH nR1ls2PmcCBEoBQWaGmOsduVCrraGvvL/DC8HRSp9pP93cdOOQ73UMW2dMifcUivy/SYjV6SGNC pykEHH0W12qiilibLXoIC+PbK7Hkq0CPIu43ZNR0IKV1JWZExhhDsZY2XNIh/IdBsKoQi1SFyrV qp6cuNarZnn7FUrsf3IsgtSq9lQcC9vCqt0OVIxCHLLscsGrz6Un6fXgMZMNBvsBxujM8DgsGV4 ef7cvUYnH77KIJ2R9bG+KLdY9ymrPPQxPAxb9UVP9jh59/pAS9JwQqT6 X-Developer-Key: i=k.jensen@samsung.com; a=openpgp; fpr=DDCA4D9C9EF931CC3468427263D56FC5E55DA838 Received-SPF: pass client-ip=66.111.4.29; envelope-from=its@irrelevant.dk; helo=out5-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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Klaus Jensen Update documentation for TP4146 ("Flexible Data Placement") emulation. Reviewed-by: Jesper Wendel Devantier Signed-off-by: Klaus Jensen --- docs/system/devices/nvme.rst | 37 +++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/docs/system/devices/nvme.rst b/docs/system/devices/nvme.rst index 30f841ef6222..a8bb8d729cd2 100644 --- a/docs/system/devices/nvme.rst +++ b/docs/system/devices/nvme.rst @@ -212,6 +212,41 @@ The namespace may be configured with additional parameters the minimum memory page size (CAP.MPSMIN). The default value (``0``) has this property inherit the ``mdts`` value. +Flexible Data Placement +----------------------- + +The device may be configured to support TP4146 ("Flexible Data Placement") by +configuring it (``fdp=on``) on the subsystem:: + + -device nvme-subsys,id=nvme-subsys-0,nqn=subsys0,fdp=on,fdp.nruh=16 + +The subsystem emulates a single Endurance Group, on which Flexible Data +Placement will be supported. Also note that the device emulation deviates +slightly from the specification, by always enabling the "FDP Mode" feature on +the controller if the subsystems is configured for Flexible Data Placement. + +Enabling Flexible Data Placement on the subsyste enables the following +parameters: + +``fdp.nrg`` (default: ``1``) + Set the number of Reclaim Groups. + +``fdp.nruh`` (default: ``0``) + Set the number of Reclaim Unit Handles. This is a mandatory paramater and + must be non-zero. + +``fdp.runs`` (default: ``96M``) + Set the Reclaim Unit Nominal Size. Defaults to 96 MiB. + +Namespaces within this subsystem may requests Reclaim Unit Handles:: + + -device nvme-ns,drive=nvm-1,fdp.ruhs=RUHLIST + +The ``RUHLIST`` is a semicolon separated list (i.e. ``0;1;2;3``) and may +include ranges (i.e. ``0;8-15``). If no reclaim unit handle list is specified, +the controller will assign the controller-specified reclaim unit handle to +placement handle identifier 0. + Metadata -------- @@ -320,4 +355,4 @@ controller are: .. code-block:: console - echo 0000:01:00.1 > /sys/bus/pci/drivers/nvme/bind \ No newline at end of file + echo 0000:01:00.1 > /sys/bus/pci/drivers/nvme/bind