From nobody Sun Nov 24 20:07:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=1720721156; cv=none; d=zohomail.com; s=zohoarc; b=iYCpqXpwsAhLpl0kgcGIvbjfEG3RRZoEgOPFX5KJLGP81IqBF4V/K+z0DXdYqW5kkUX9/s9jV2NXlZtm7yiiHN2CiInuHnwoC9bK5YV9X3qsJM/WP1t83/pNC9nD4VLvwMbg70WLfn5bPjIepBjp89B9LTCsrsaMCG12SF94ieU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1720721156; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fU0R5yFm01ORA9K//V//NlC8z2SUntdN8U1tV783OlM=; b=IUaMLnWLKncxfT/oRJlfe+tVE/Y+1Jtdcr7us/V5DHfDMYAK8DfCy4G22hXsmdBPOMGv1kZPhfPePdAbZwKm0CSljCID4q54Jys0hFRDSN6NKOoCrr5hk4QqPBRoiIce3uwKJPHAAc2ro9GMCEFEWOAV06oq8SPYizRIWpKQ6tM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1720721156716355.6344897274254; Thu, 11 Jul 2024 11:05:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sRyAF-0007Mt-6n; Thu, 11 Jul 2024 14:05:08 -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 1sRyA6-00075l-GC; Thu, 11 Jul 2024 14:05:00 -0400 Received: from fhigh5-smtp.messagingengine.com ([103.168.172.156]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sRyA4-0003x1-P8; Thu, 11 Jul 2024 14:04:58 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 8091D1140395; Thu, 11 Jul 2024 14:04:55 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 11 Jul 2024 14:04:55 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 11 Jul 2024 14:04:52 -0400 (EDT) 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:subject:subject:to:to; s=fm1; t=1720721095; x= 1720807495; bh=fU0R5yFm01ORA9K//V//NlC8z2SUntdN8U1tV783OlM=; b=I 3hcItcKwDfVkO8U2XZYnzKK2s/kesvma/BsXzX5IJ2ulfukxaeffvvaneKY8t9KC KIUW6aO0zGklWvmgQT2HtNMMxJLycVct7oiVplFH6sVghRFkeH4s0yoIkFhbw6Lc b1F22tfzHLvng61koP8Z7Wru1PBLV6zmNPNxkbh7RteopbCAvWWbb7iO7Ff3Ut1d hFLSn1qy3NE8nanlZ7BZO0tVDJwFxI95KpehYNA1+2DxTy1whQmaS3hAvoYJ+rK9 ZnEbdeAnaE9K+LXFKylfzHC5/7VWjMmE3E0FUcv3LDI0hJXSo/OuNZ1gOXpOjV/y toC1yAFCrbYkoGwOR74YA== 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:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1720721095; x= 1720807495; bh=fU0R5yFm01ORA9K//V//NlC8z2SUntdN8U1tV783OlM=; b=t ddzMYDh9i/oR0o74aSJDdeld9cg4Yztw0VHESVvoGpuU/4bq5lS5blpk2WP+WsPz p7eACwl1jLj2+4JLJtPnTieKZvgSzVOfExIktg950j64t2R6J8XE/hs2YVijLikh vHpOwwYto2MVBgL/il6CCJnpz9lD1TzB+QTIJS445mk2pof+IWNvuM7mKUDBeLjI nNSh3rKofjJkxjjaY4nVxYzB8yoPesDLhi2SKdWaCBc39uJDTkaoiaUz8Lk0rOvW f+5btSzthMvIHjlKADyrv3Sv7lXwACjcQq5NhP3VdFSYSaRYhl9sJVp6oVsH6Bzr r7VPtlU7WzYfDjak6xUJQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrfeeggdduvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepmfhlrghu shculfgvnhhsvghnuceoihhtshesihhrrhgvlhgvvhgrnhhtrdgukheqnecuggftrfgrth htvghrnhepjefgieelgfeiveehkeeuveehheekfeevgeeigfehfefgjeejhefffeegudej udegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepih htshesihhrrhgvlhgvvhgrnhhtrdgukh X-ME-Proxy: Feedback-ID: idc91472f:Fastmail From: Klaus Jensen To: qemu-devel@nongnu.org, Peter Maydell Cc: qemu-block@nongnu.org, Kevin Wolf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Keith Busch , Klaus Jensen , Jesper Devantier , Stefan Hajnoczi , Hanna Reitz , Fam Zheng , Minwoo Im , Klaus Jensen Subject: [PULL 4/7] hw/nvme: add Identify Endurance Group List Date: Thu, 11 Jul 2024 20:04:41 +0200 Message-ID: <20240711180436.8532-13-its@irrelevant.dk> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240711180436.8532-9-its@irrelevant.dk> References: <20240711180436.8532-9-its@irrelevant.dk> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2675; i=k.jensen@samsung.com; h=from:subject; bh=bLLqYH+xpFPc6bj1dQ4f6vAV7JLMQj/+ItiUpoYuPOA=; b=owJ4nAFtAZL+kA0DAAoBTeGvMW1PDekByyZiAGaQHrU8bZRr6zIgFxItj9xrzxUI9CElqs2CU CUAnZF7nVMpwYkBMwQAAQoAHRYhBFIoM6p14tzmokdmwE3hrzFtTw3pBQJmkB61AAoJEE3hrzFt Tw3pXEwH/0wPzyvsHQ1QZHI7kShq8cgvnoXGtheuhaxQk370jOv5Ulvna4iaJpYk9W8MovYp3S+ lF/XGz1goxNsqkO2s0nwdtzk0kBvP8G1+8ZT24Bc8fo4ELx+DEFRWfVhh0OTtNEiFFu+UJRdYVF Us0xwhZCN8kWbMLoDDBiWXi2Lqm+sE8FSWapz7nEsD6w/BK/4Nca6z0iLEN1cIUKjkXcqt4jQ9W uiIODdwdoB8EQ+vkWK24aiZPYjLcDoLeOiDRwMFBmycW9RsEizvew1FKL0OefPMqMZ08BE83G5M QblLBznpIeCjkjfG6KT3Q4jcnyr0qjqZebzZo7BDW3QOIkeafjUMdaLR X-Developer-Key: i=k.jensen@samsung.com; a=openpgp; fpr=DDCA4D9C9EF931CC3468427263D56FC5E55DA838 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=103.168.172.156; envelope-from=its@irrelevant.dk; helo=fhigh5-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_H4=0.001, RCVD_IN_MSPIKE_WL=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @irrelevant.dk) X-ZM-MESSAGEID: 1720721157520116600 Content-Type: text/plain; charset="utf-8" From: Minwoo Im Commit 73064edfb864 ("hw/nvme: flexible data placement emulation") intorudced NVMe FDP feature to nvme-subsys and nvme-ctrl with a single endurance group #1 supported. This means that controller should return proper identify data to host with Identify Endurance Group List (CNS 19h). But, yes, only just for the endurance group #1. This patch allows host applications to ask for which endurance group is available and utilize FDP through that endurance group. Reviewed-by: Klaus Jensen Signed-off-by: Minwoo Im Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 22 ++++++++++++++++++++++ include/block/nvme.h | 1 + 2 files changed, 23 insertions(+) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index f3ae54896f6d..50f8cc90b038 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -5629,6 +5629,26 @@ static uint16_t nvme_identify_nslist_csi(NvmeCtrl *n= , NvmeRequest *req, return nvme_c2h(n, list, data_len, req); } =20 +static uint16_t nvme_endurance_group_list(NvmeCtrl *n, NvmeRequest *req) +{ + uint16_t list[NVME_CONTROLLER_LIST_SIZE] =3D {}; + uint16_t *nr_ids =3D &list[0]; + uint16_t *ids =3D &list[1]; + uint16_t endgid =3D le32_to_cpu(req->cmd.cdw11) & 0xffff; + + /* + * The current nvme-subsys only supports Endurance Group #1. + */ + if (!endgid) { + *nr_ids =3D 1; + ids[0] =3D 1; + } else { + *nr_ids =3D 0; + } + + return nvme_c2h(n, list, sizeof(list), req); +} + static uint16_t nvme_identify_ns_descr_list(NvmeCtrl *n, NvmeRequest *req) { NvmeNamespace *ns; @@ -5744,6 +5764,8 @@ static uint16_t nvme_identify(NvmeCtrl *n, NvmeReques= t *req) return nvme_identify_nslist(n, req, false); case NVME_ID_CNS_CS_NS_ACTIVE_LIST: return nvme_identify_nslist_csi(n, req, true); + case NVME_ID_CNS_ENDURANCE_GROUP_LIST: + return nvme_endurance_group_list(n, req); case NVME_ID_CNS_CS_NS_PRESENT_LIST: return nvme_identify_nslist_csi(n, req, false); case NVME_ID_CNS_NS_DESCR_LIST: diff --git a/include/block/nvme.h b/include/block/nvme.h index bb231d0b9ad0..7c77d38174a7 100644 --- a/include/block/nvme.h +++ b/include/block/nvme.h @@ -1074,6 +1074,7 @@ enum NvmeIdCns { NVME_ID_CNS_CTRL_LIST =3D 0x13, NVME_ID_CNS_PRIMARY_CTRL_CAP =3D 0x14, NVME_ID_CNS_SECONDARY_CTRL_LIST =3D 0x15, + NVME_ID_CNS_ENDURANCE_GROUP_LIST =3D 0x19, NVME_ID_CNS_CS_NS_PRESENT_LIST =3D 0x1a, NVME_ID_CNS_CS_NS_PRESENT =3D 0x1b, NVME_ID_CNS_IO_COMMAND_SET =3D 0x1c, --=20 2.44.0