From nobody Wed Nov 13 07:06:13 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; dmarc=pass(p=none dis=none) header.from=samsung.com ARC-Seal: i=1; a=rsa-sha256; t=1716987278; cv=none; d=zohomail.com; s=zohoarc; b=FHmTjMx5bFhAsLq1EapwjpU0eKK0KIkcf2+qzrbquPE/pEn4skUFgsYqX1FHeMqodpT+ULVKqLBdODeQUL6kGHr47DbXLzeX6n+5qKLRQCJjZtkLy4NLzvYzAkBQWO3zuw9H4+/yorkYZMwQVmyGbowIMHaU8kAy0gKNeBnR6sg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716987278; h=Content-Type: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=rf73xYsjOK+oCcrNHdi2Wh/JkLrL9ZINsaGLF1SE6pI=; b=TT3fMuC10nr4FHOZy+RlnJTbXUducF1LbW79Rt/8W+CP9zdEWylRCG8kTI/vvoKaBfeLh8UHMDbFiLLXIFl9x71Adme89kIWkpHqzrkMnTvxyPEHZbAK4etH3/QtOB0V6RylqRiqtwNRk3OmiT0FKIaD381L+aLs42u6KMrwD6A= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1716987278551862.6759161228872; Wed, 29 May 2024 05:54:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCIor-000784-Qm; Wed, 29 May 2024 08:54:17 -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 1sCIop-00077J-VZ for qemu-devel@nongnu.org; Wed, 29 May 2024 08:54:15 -0400 Received: from mailout4.samsung.com ([203.254.224.34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCIoj-0008Ir-2I for qemu-devel@nongnu.org; Wed, 29 May 2024 08:54:13 -0400 Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20240529125358epoutp04c3931a4a4c1ac46f45020f9d6e9b3496~T9svllXSs2526525265epoutp04W for ; Wed, 29 May 2024 12:53:58 +0000 (GMT) Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20240529125358epcas2p3734d60e63720ea47818aea9520ed4c09~T9svOeTbJ1740717407epcas2p3_; Wed, 29 May 2024 12:53:58 +0000 (GMT) Received: from epsmgec2p1-new.samsung.com (unknown [182.195.36.99]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4Vq8TK4SRhz4x9Py; Wed, 29 May 2024 12:53:57 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmgec2p1-new.samsung.com (Symantec Messaging Gateway) with SMTP id 8B.D5.18956.56527566; Wed, 29 May 2024 21:53:57 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPA id 20240529125356epcas2p1f29357582a7cb7a922f950fb41f0df17~T9suEPKy40504005040epcas2p19; Wed, 29 May 2024 12:53:56 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20240529125356epsmtrp2ac3c724eb80c50f6099880f06e67088b~T9suC_6_n1667216672epsmtrp2B; Wed, 29 May 2024 12:53:56 +0000 (GMT) Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 02.AC.08336.46527566; Wed, 29 May 2024 21:53:56 +0900 (KST) Received: from localhost.dsn.sec.samsung.com (unknown [10.229.54.230]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20240529125356epsmtip261d983f030f65a2f7c48dc8cf167eee7~T9stztg_j1281412814epsmtip25; Wed, 29 May 2024 12:53:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20240529125358epoutp04c3931a4a4c1ac46f45020f9d6e9b3496~T9svllXSs2526525265epoutp04W DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1716987238; bh=rf73xYsjOK+oCcrNHdi2Wh/JkLrL9ZINsaGLF1SE6pI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZvTLKqdJZavDqnFA5BLBw4n/Tjmp+KHugwQY23StB8GS55wCdUXuGq+jxJuO75Ifg INH0QX2LN/k1+W4jhn7k/tk88580UDBKffAsux01nfPmdbsQws9WZ2IXiorsX9Z0YO e9ykPvNc9XnmTK6fUbjTAqJQ1AH/oyDbpuX8UBTE= X-AuditID: b6c32a4d-f95ff70000004a0c-57-665725651c51 From: Minwoo Im To: Keith Busch , Klaus Jensen , Jesper Devantier Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, minwoo.im@samsung.com, gost.dev@samsung.com, Klaus Jensen Subject: [PATCH v4 1/4] hw/nvme: add Identify Endurance Group List Date: Wed, 29 May 2024 21:42:31 +0900 Message-Id: <20240529124234.1430707-2-minwoo.im@samsung.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240529124234.1430707-1-minwoo.im@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprEJsWRmVeSWpSXmKPExsWy7bCmmW6qaniawZ9OZYsTU8Isbh7YyWSx /+A3VouTjXtYLSYdusZo8ez0AWaLWe/a2SyO9+5gceDwmDLtGrvHuR3n2T02repk83hybTOT R9+WVYwBrFHZNhmpiSmpRQqpecn5KZl56bZK3sHxzvGmZgaGuoaWFuZKCnmJuam2Si4+Abpu mTlAtygplCXmlAKFAhKLi5X07WyK8ktLUhUy8otLbJVSC1JyCswL9IoTc4tL89L18lJLrAwN DIxMgQoTsjMu/z3IXrBTpGLKwqgGxk6BLkZODgkBE4ndq/eydjFycQgJ7GGUuDnhAAuE84lR 4mLbZ0YI5xujxPa7P5hgWqZ1LYJq2csosf7ASqiW34wSX59dZgapYhNQl2iY+ooFxBYRyJHo X/mdCaSIWaCFUaL73C2wImEBJ4meV++ARnFwsAioSrzcowAS5hWwkfh77SnUNnmJ/QfPgpVz CthKdM15ww5RIyhxcuYTsPnMQDXNW2czg8yXEHjLLnGj9SMbRLOLxOeWyywQtrDEq+Nb2CFs KYnP7/ZC1ZRL/HwziRHCrpA4OOs2G8g9EgL2Eteep4CYzAKaEut36UNElSWO3ILayifRcfgv O0SYV6KjTQhihrLEx0OHmCFsSYnll15D7fGQ6Li8H+wpIYEJjBKvDtVOYFSYheSXWUh+mYWw dwEj8ypGqdSC4tz01GSjAkPdvNRyeBQn5+duYgQnTi3fHYyv1//VO8TIxMF4iFGCg1lJhPfM pNA0Id6UxMqq1KL8+KLSnNTiQ4ymwMCeyCwlmpwPTN15JfGGJpYGJmZmhuZGpgbmSuK891rn pggJpCeWpGanphakFsH0MXFwSjUwqab+C3ZzmMHRMH8h070f/CK9h07kzVkd9a2Q+6Hie4vS GIFD77eePBM0v8WsIewij1fEXlWX2rN1ppMips/fkpV3x/mM+M09j/KDgpyK5GqvPjdnUNpT wdO3Kqm3/mXb5ZTbsU6Ghq+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hveCRf98urvnOoU/+GvvHP0+otT7Wn7QK8PlqpdKT5wyy36f +oVt+YSU+U4rFZ1K5rodmjDvpL4h3zNH+TaRX+VV99tOz7c49EVaiaU4I9FQi7moOBEAP1z/ sN4CAAA= X-CMS-MailID: 20240529125356epcas2p1f29357582a7cb7a922f950fb41f0df17 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20240529125356epcas2p1f29357582a7cb7a922f950fb41f0df17 References: <20240529124234.1430707-1-minwoo.im@samsung.com> 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=203.254.224.34; envelope-from=minwoo.im@samsung.com; helo=mailout4.samsung.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.036, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @samsung.com) X-ZM-MESSAGEID: 1716987280723100001 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 --- 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 127c3d2383..18672f6619 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 bb231d0b9a..7c77d38174 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.34.1 From nobody Wed Nov 13 07:06:13 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; dmarc=pass(p=none dis=none) header.from=samsung.com ARC-Seal: i=1; a=rsa-sha256; t=1716987648; cv=none; d=zohomail.com; s=zohoarc; b=H3tvIc+Yn5grTW8H6FCNQMZSAStZ1ARnEg3hm8CqajJJUFybQpdTWGrze5CArArLt1dL3/Q4TTELcQb1tyhmGWTXFiL7M4BSAlOr1wBeJ1pHi0/xqITG1TPKqkg6m8RN/WRv11WpnZLqK++8PmfKTk6FhNDsG1j+uS5EktPskII= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716987648; h=Content-Type: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=URd0ET0qY4qruNePzvnDDejkpybUORKzBqsq3dIXZCM=; b=IGDZjSIhhJ2VzX8uzwZaSid7lIqI4HzogUFDPTNIbQzLu+/YnXPGMMVSrYCg+d9LGbfWMbuqBCMC1eA074RjeJVIT3xFElCIb9fpiTe0g+WHPQbM2RCcjE2p+O6qKaYO5m09srtxtflh8s4JguGg0hY499Egx7DcylFcLwXHQZM= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1716987648757702.4324000812936; Wed, 29 May 2024 06:00:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCIuz-0004M4-DV; Wed, 29 May 2024 09:00:37 -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 1sCIus-0004Df-TR for qemu-devel@nongnu.org; Wed, 29 May 2024 09:00:32 -0400 Received: from mailout1.samsung.com ([203.254.224.24]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCIuo-0001hh-Kc for qemu-devel@nongnu.org; Wed, 29 May 2024 09:00:30 -0400 Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20240529125358epoutp01b422dbd3722fe3a81e509b966b3eaec7~T9sv48NzW1385513855epoutp01T for ; Wed, 29 May 2024 12:53:58 +0000 (GMT) Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20240529125358epcas2p43936e4f19b8814465abf88ba9db1af59~T9svUIQKQ0605506055epcas2p4x; Wed, 29 May 2024 12:53:58 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.101]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4Vq8TK4g7Sz4x9Pq; Wed, 29 May 2024 12:53:57 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 50.D3.09485.56527566; Wed, 29 May 2024 21:53:57 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPA id 20240529125356epcas2p12f9e62a58081d18c6ff30753f6ba22cf~T9suGMrHq0515505155epcas2p12; Wed, 29 May 2024 12:53:56 +0000 (GMT) Received: from epsmgmcp1.samsung.com (unknown [182.195.42.82]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20240529125356epsmtrp23f41c0cd231c302199ab37005905b9dd~T9suD1Yy31667216672epsmtrp2C; Wed, 29 May 2024 12:53:56 +0000 (GMT) Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmcp1.samsung.com (Symantec Messaging Gateway) with SMTP id F8.3A.18846.46527566; Wed, 29 May 2024 21:53:56 +0900 (KST) Received: from localhost.dsn.sec.samsung.com (unknown [10.229.54.230]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20240529125356epsmtip267f1d58f930413614f77bcc258bb8c40~T9st2fbY11461914619epsmtip2O; Wed, 29 May 2024 12:53:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20240529125358epoutp01b422dbd3722fe3a81e509b966b3eaec7~T9sv48NzW1385513855epoutp01T DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1716987238; bh=URd0ET0qY4qruNePzvnDDejkpybUORKzBqsq3dIXZCM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R6Tn6UG+n3ZxfHLafoyjtajh04BsqkCCm9Pr2fGh/8/UHyNK82FiAygHYMezJ7SEm zZdIAJjzmDTR4Etuc7zB0ipfjfc9YFABIWEKBV9dQZn1TAUDk6E0ablXs+enFUYY3w 4ySamIUMkYoPU/1ehQKJFz3AfOtBiElWHzQmNLoo= X-AuditID: b6c32a46-19bfa7000000250d-16-66572565bb6d From: Minwoo Im To: Keith Busch , Klaus Jensen , Jesper Devantier Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, minwoo.im@samsung.com, gost.dev@samsung.com Subject: [PATCH v4 2/4] hw/nvme: separate identify data for sec. ctrl list Date: Wed, 29 May 2024 21:42:32 +0900 Message-Id: <20240529124234.1430707-3-minwoo.im@samsung.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240529124234.1430707-1-minwoo.im@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupkk+LIzCtJLcpLzFFi42LZdljTTDdVNTzN4NprJYsTU8Isbh7YyWSx /+A3VotJh64xWjw7fYDZYta7djaL4707WBzYPaZMu8bucW7HeXaPTas62TyeXNvM5NG3ZRVj AGtUtk1GamJKapFCal5yfkpmXrqtkndwvHO8qZmBoa6hpYW5kkJeYm6qrZKLT4CuW2YO0BlK CmWJOaVAoYDE4mIlfTubovzSklSFjPziElul1IKUnALzAr3ixNzi0rx0vbzUEitDAwMjU6DC hOyMC4vWsBb8Nq44cuUIawPjP7UuRg4OCQETiXMb7LsYuTiEBHYwSuyaM5MZwvnEKPFp6kwW OOdm/xz2LkZOsI7vH04yQiR2MkrMOrqZDcL5zShxd9kuFpAqNgF1iYapr8BsEYEcif6V35lA bGaBeInnK36ATRIW8JLYvGMDG4jNIqAq8XHZemYQm1fARmL/5mZGiG3yEvsPngWLcwrYSnTN ecMOUSMocXLmExaImfISzVtnM0PU32OX2LiuDsJ2kVjZ9hpqjrDEq+NboD6Qkvj8bi8bhF0u 8fPNJKiaComDs26zQcLFXuLa8xQQk1lAU2L9Ln2IqLLEkVtQS/kkOg7/ZYcI80p0tAlBzFCW +HjoENQtkhLLL72G2uMhsennA2jYTmCU2PLjIdMERoVZSH6ZheSXWQiLFzAyr2IUSy0ozk1P LTYqMIJHb3J+7iZGcJrUctvBOOXtB71DjEwcjIcYJTiYlUR4z0wKTRPiTUmsrEotyo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fhvXvVDzhoXl7wsP94d/2L9Cut/kycuj+9KaiwPmZ9Wem36tf8f bHnUQvZ5T6/VOFQrtWHTzp49KXduurl4hK+d3rtjfmkrj95K99SljvEzogKXtr843HW+Vq/v mvviBecP/BQ2fL57Bdfky3aLFjDdk3/kUWDL2Vo2VTxmStUMViFv7hMy3b9mqHg2S/57kJqr qr2SYc7Wp/++x0n7NxxRU1jUxSedpjm5VMUlyziDgZ/3o9DHjp/xjArGLiUlrVz7J5s6xO8z P//ZMPb11489ziXTW4K9kpP82Rc+66oOWK97if2LEktxRqKhFnNRcSIA7BQAAdYCAAA= X-CMS-MailID: 20240529125356epcas2p12f9e62a58081d18c6ff30753f6ba22cf X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20240529125356epcas2p12f9e62a58081d18c6ff30753f6ba22cf References: <20240529124234.1430707-1-minwoo.im@samsung.com> 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=203.254.224.24; envelope-from=minwoo.im@samsung.com; helo=mailout1.samsung.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.036, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 @samsung.com) X-ZM-MESSAGEID: 1716987663071100001 Secondary controller list for virtualization has been managed by Identify Secondary Controller List data structure with NvmeSecCtrlList where up to 127 secondary controller entries can be managed. The problem hasn't arisen so far because NVME_MAX_VFS has been 127. This patch separated identify data itself from the actual secondary controller list managed by controller to support more than 127 secondary controllers with the following patch. This patch reused NvmeSecCtrlEntry structure to manage all the possible secondary controllers, and copy entries to identify data structure when the command comes in. Signed-off-by: Minwoo Im Reviewed-by: Klaus Jensen --- hw/nvme/ctrl.c | 21 ++++++++++----------- hw/nvme/nvme.h | 14 ++++++++------ hw/nvme/subsys.c | 8 ++++---- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 18672f6619..7cf1e8e384 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -219,7 +219,6 @@ #define NVME_TEMPERATURE_CRITICAL 0x175 #define NVME_NUM_FW_SLOTS 1 #define NVME_DEFAULT_MAX_ZA_SIZE (128 * KiB) -#define NVME_MAX_VFS 127 #define NVME_VF_RES_GRANULARITY 1 #define NVME_VF_OFFSET 0x1 #define NVME_VF_STRIDE 1 @@ -5480,14 +5479,14 @@ static uint16_t nvme_identify_sec_ctrl_list(NvmeCtr= l *n, NvmeRequest *req) NvmeIdentify *c =3D (NvmeIdentify *)&req->cmd; uint16_t pri_ctrl_id =3D le16_to_cpu(n->pri_ctrl_cap.cntlid); uint16_t min_id =3D le16_to_cpu(c->ctrlid); - uint8_t num_sec_ctrl =3D n->sec_ctrl_list.numcntl; + uint8_t num_sec_ctrl =3D n->nr_sec_ctrls; NvmeSecCtrlList list =3D {0}; uint8_t i; =20 for (i =3D 0; i < num_sec_ctrl; i++) { - if (n->sec_ctrl_list.sec[i].scid >=3D min_id) { - list.numcntl =3D num_sec_ctrl - i; - memcpy(&list.sec, n->sec_ctrl_list.sec + i, + if (n->sec_ctrl_list[i].scid >=3D min_id) { + list.numcntl =3D MIN(num_sec_ctrl - i, 127); + memcpy(&list.sec, n->sec_ctrl_list + i, list.numcntl * sizeof(NvmeSecCtrlEntry)); break; } @@ -7144,8 +7143,8 @@ static void nvme_ctrl_reset(NvmeCtrl *n, NvmeResetTyp= e rst) =20 if (n->params.sriov_max_vfs) { if (!pci_is_vf(pci_dev)) { - for (i =3D 0; i < n->sec_ctrl_list.numcntl; i++) { - sctrl =3D &n->sec_ctrl_list.sec[i]; + for (i =3D 0; i < n->nr_sec_ctrls; i++) { + sctrl =3D &n->sec_ctrl_list[i]; nvme_virt_set_state(n, le16_to_cpu(sctrl->scid), false); } } @@ -7934,7 +7933,7 @@ static bool nvme_check_params(NvmeCtrl *n, Error **er= rp) static void nvme_init_state(NvmeCtrl *n) { NvmePriCtrlCap *cap =3D &n->pri_ctrl_cap; - NvmeSecCtrlList *list =3D &n->sec_ctrl_list; + NvmeSecCtrlEntry *list =3D n->sec_ctrl_list; NvmeSecCtrlEntry *sctrl; PCIDevice *pci =3D PCI_DEVICE(n); uint8_t max_vfs; @@ -7959,9 +7958,9 @@ static void nvme_init_state(NvmeCtrl *n) n->aer_reqs =3D g_new0(NvmeRequest *, n->params.aerl + 1); QTAILQ_INIT(&n->aer_queue); =20 - list->numcntl =3D max_vfs; + n->nr_sec_ctrls =3D max_vfs; for (i =3D 0; i < max_vfs; i++) { - sctrl =3D &list->sec[i]; + sctrl =3D &list[i]; sctrl->pcid =3D cpu_to_le16(n->cntlid); sctrl->vfn =3D cpu_to_le16(i + 1); } @@ -8534,7 +8533,7 @@ static void nvme_sriov_post_write_config(PCIDevice *d= ev, uint16_t old_num_vfs) int i; =20 for (i =3D pcie_sriov_num_vfs(dev); i < old_num_vfs; i++) { - sctrl =3D &n->sec_ctrl_list.sec[i]; + sctrl =3D &n->sec_ctrl_list[i]; nvme_virt_set_state(n, le16_to_cpu(sctrl->scid), false); } } diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h index bed8191bd5..485b42c104 100644 --- a/hw/nvme/nvme.h +++ b/hw/nvme/nvme.h @@ -26,6 +26,7 @@ =20 #define NVME_MAX_CONTROLLERS 256 #define NVME_MAX_NAMESPACES 256 +#define NVME_MAX_VFS 127 #define NVME_EUI64_DEFAULT ((uint64_t)0x5254000000000000) #define NVME_FDP_MAX_EVENTS 63 #define NVME_FDP_MAXPIDS 128 @@ -612,7 +613,8 @@ typedef struct NvmeCtrl { } features; =20 NvmePriCtrlCap pri_ctrl_cap; - NvmeSecCtrlList sec_ctrl_list; + uint32_t nr_sec_ctrls; + NvmeSecCtrlEntry sec_ctrl_list[NVME_MAX_VFS]; struct { uint16_t vqrfap; uint16_t virfap; @@ -662,7 +664,7 @@ static inline NvmeSecCtrlEntry *nvme_sctrl(NvmeCtrl *n) NvmeCtrl *pf =3D NVME(pcie_sriov_get_pf(pci_dev)); =20 if (pci_is_vf(pci_dev)) { - return &pf->sec_ctrl_list.sec[pcie_sriov_vf_number(pci_dev)]; + return &pf->sec_ctrl_list[pcie_sriov_vf_number(pci_dev)]; } =20 return NULL; @@ -671,12 +673,12 @@ static inline NvmeSecCtrlEntry *nvme_sctrl(NvmeCtrl *= n) static inline NvmeSecCtrlEntry *nvme_sctrl_for_cntlid(NvmeCtrl *n, uint16_t cntlid) { - NvmeSecCtrlList *list =3D &n->sec_ctrl_list; + NvmeSecCtrlEntry *list =3D n->sec_ctrl_list; uint8_t i; =20 - for (i =3D 0; i < list->numcntl; i++) { - if (le16_to_cpu(list->sec[i].scid) =3D=3D cntlid) { - return &list->sec[i]; + for (i =3D 0; i < n->nr_sec_ctrls; i++) { + if (le16_to_cpu(list[i].scid) =3D=3D cntlid) { + return &list[i]; } } =20 diff --git a/hw/nvme/subsys.c b/hw/nvme/subsys.c index d30bb8bfd5..561ed04a53 100644 --- a/hw/nvme/subsys.c +++ b/hw/nvme/subsys.c @@ -17,13 +17,13 @@ static int nvme_subsys_reserve_cntlids(NvmeCtrl *n, int start, int num) { NvmeSubsystem *subsys =3D n->subsys; - NvmeSecCtrlList *list =3D &n->sec_ctrl_list; + NvmeSecCtrlEntry *list =3D n->sec_ctrl_list; NvmeSecCtrlEntry *sctrl; int i, cnt =3D 0; =20 for (i =3D start; i < ARRAY_SIZE(subsys->ctrls) && cnt < num; i++) { if (!subsys->ctrls[i]) { - sctrl =3D &list->sec[cnt]; + sctrl =3D &list[cnt]; sctrl->scid =3D cpu_to_le16(i); subsys->ctrls[i] =3D SUBSYS_SLOT_RSVD; cnt++; @@ -36,12 +36,12 @@ static int nvme_subsys_reserve_cntlids(NvmeCtrl *n, int= start, int num) static void nvme_subsys_unreserve_cntlids(NvmeCtrl *n) { NvmeSubsystem *subsys =3D n->subsys; - NvmeSecCtrlList *list =3D &n->sec_ctrl_list; + NvmeSecCtrlEntry *list =3D n->sec_ctrl_list; NvmeSecCtrlEntry *sctrl; int i, cntlid; =20 for (i =3D 0; i < n->params.sriov_max_vfs; i++) { - sctrl =3D &list->sec[i]; + sctrl =3D &list[i]; cntlid =3D le16_to_cpu(sctrl->scid); =20 if (cntlid) { --=20 2.34.1 From nobody Wed Nov 13 07:06:13 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; dmarc=pass(p=none dis=none) header.from=samsung.com ARC-Seal: i=1; a=rsa-sha256; t=1716987619; cv=none; d=zohomail.com; s=zohoarc; b=cq9Sk5+rwCC6968EC/lwMo5lMP4VuCtjVa0xFVj79GMCl8mCglNigE1ahx0HCMe0xGziNyrL6gG/CvElrwasEIdCLCt12wOO0aFPWVaUL3OYAr6UB2avyvvDF6RRDWtGrxbhhRbccJGFlpQRE28D6Hur5oOhdBIrAZLkvdI08TA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716987619; h=Content-Type: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=XOSTDNnpBFlIvv8h6EZ6WZyo1wZw3QEABDyzLGvi40U=; b=dWwHmeHeTwXQs3HtpiCkx4jCvZh/AHwhakDhRtMAhrXpwkRyguAvInqSgbwidyV+vfFdaIWLWJl2spdCJNxw6kRJXc5qFKSo7XRZ4fUQtapqMJK3yk3zeQFys5MYxYQthiBvmIJdTFF+DXukO7afa+s9M7dpNsxTQh2gyGoTGBg= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1716987619328337.10973807621406; Wed, 29 May 2024 06:00:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCIu7-0002yz-G2; Wed, 29 May 2024 08:59:43 -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 1sCIu5-0002xf-1E for qemu-devel@nongnu.org; Wed, 29 May 2024 08:59:41 -0400 Received: from mailout2.samsung.com ([203.254.224.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCItz-0000tZ-Kn for qemu-devel@nongnu.org; Wed, 29 May 2024 08:59:39 -0400 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20240529125358epoutp0233074278e2218019ab036f15add2317a~T9svUs01v0033000330epoutp02X for ; Wed, 29 May 2024 12:53:58 +0000 (GMT) Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20240529125357epcas2p2c572eb49de1515c530477cef8136d560~T9su_pUr70039000390epcas2p2K; Wed, 29 May 2024 12:53:57 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.36.101]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4Vq8TK2Nthz4x9Pr; Wed, 29 May 2024 12:53:57 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 7C.E6.09479.56527566; Wed, 29 May 2024 21:53:57 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPA id 20240529125356epcas2p12d3250098243e6271bccd6519fb79cff~T9suH8vo-0504005040epcas2p1_; Wed, 29 May 2024 12:53:56 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20240529125356epsmtrp2f03cf2cf65e360b28fcc6ab2802b65fe~T9suEQYhm1667216672epsmtrp2D; Wed, 29 May 2024 12:53:56 +0000 (GMT) Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 33.6A.08622.46527566; Wed, 29 May 2024 21:53:56 +0900 (KST) Received: from localhost.dsn.sec.samsung.com (unknown [10.229.54.230]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20240529125356epsmtip262463068c0cf8c8aeb39f549be251957~T9st44-o60854208542epsmtip2B; Wed, 29 May 2024 12:53:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20240529125358epoutp0233074278e2218019ab036f15add2317a~T9svUs01v0033000330epoutp02X DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1716987238; bh=XOSTDNnpBFlIvv8h6EZ6WZyo1wZw3QEABDyzLGvi40U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UH0EahHsV0hMZxW7z0WwFpSnBAzqwd7cyLTczJ8FzOgDrh1mCw16YTi8pNWWOiWyj VN/hMSQGRzNwR7sidkbu7SBh9vtEqBkc7H0enGX7s7RaeDHMuxPZKpqE3pfHhNF80T pmMqWesz59IM7sVJB7BwQsRrVaUk+h1DpEyGbhVs= X-AuditID: b6c32a48-105fa70000002507-e5-66572565054e From: Minwoo Im To: Keith Busch , Klaus Jensen , Jesper Devantier Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, minwoo.im@samsung.com, gost.dev@samsung.com Subject: [PATCH v4 3/4] hw/nvme: Allocate sec-ctrl-list as a dynamic array Date: Wed, 29 May 2024 21:42:33 +0900 Message-Id: <20240529124234.1430707-4-minwoo.im@samsung.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240529124234.1430707-1-minwoo.im@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupik+LIzCtJLcpLzFFi42LZdljTQjdVNTzNoOMOv8WJKWEWNw/sZLLY f/Abq8WkQ9cYLZ6dPsBsMetdO5vF8d4dLA7sHlOmXWP3OLfjPLvHplWdbB5Prm1m8ujbsoox gDUq2yYjNTEltUghNS85PyUzL91WyTs43jne1MzAUNfQ0sJcSSEvMTfVVsnFJ0DXLTMH6Awl hbLEnFKgUEBicbGSvp1NUX5pSapCRn5xia1SakFKToF5gV5xYm5xaV66Xl5qiZWhgYGRKVBh QnbGp+Y2loL74hX/rws2MDYKdTFyckgImEg07bnM3sXIxSEksINRYub8I2wQzidGiQNrNjFB ON8YJW6d2s4G07Joa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qYuTkkBAwkVi0tJmpi5GLQ0hgN6PE 8sUT2SESkhL7Tt9khbCFJe63HGGFKPrJKLGl4xJYgk1AXaJh6isWEFtEIE/i2sslzCA2s0Cy xPFlM8DiwgJeEvP+fQCrZxFQlZj54yYjiM0rYCNxcNIzRogF8hL7D54F6+UUsJXomvMG7Agh oJpFj3+zQ9QLSpyc+YQFYr68RPPW2cwTGAVmIUnNQpJawMi0ilEytaA4Nz232LDAKC+1XK84 Mbe4NC9dLzk/dxMjOKi1tHYw7ln1Qe8QIxMH4yFGCQ5mJRHeM5NC04R4UxIrq1KL8uOLSnNS iw8xSnOwKInzfnvdmyIkkJ5YkpqdmlqQWgSTZeLglGpguvzgacrbFhkZlRm+S55azLAosDs4 5fvvTH25yi2X7lbKBGhrmxvbSeetWKPaLsZX/C951u3LefdX/jBsCfq6d8G1Fe36d3bsbuD9 1aR9u2btO6dex/aVR+Tq3hvda572aMm572LLZspd//Ctbnbn7fvrCi/va5tb8P8JU5HH7vSI m29+rFjxf8ORS3zuTxxu/jzvvqmNP/Nu4L9wsbCNX18pXk2XbBG7xZkg2urgsfSnE2/DIrun bw9dbFtSv/6b+KTGFmWzzw4PeRPnHpy5a97sG78iZHk5Dmz4sjAmcv7Z8nXhJkc3BIjGCu7c 9LfN/ejOuMhZjdEPlu52vtm5ov6y07IKBgWd12vfvSmWq29VYinOSDTUYi4qTgQAhN/x+NkC AAA= X-CMS-MailID: 20240529125356epcas2p12d3250098243e6271bccd6519fb79cff X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20240529125356epcas2p12d3250098243e6271bccd6519fb79cff References: <20240529124234.1430707-1-minwoo.im@samsung.com> 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=203.254.224.25; envelope-from=minwoo.im@samsung.com; helo=mailout2.samsung.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.036, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 @samsung.com) X-ZM-MESSAGEID: 1716987628386100001 To prevent further bumping up the number of maximum VF te support, this patch allocates a dynamic array (NvmeCtrl *)->sec_ctrl_list based on number of VF supported by sriov_max_vfs property. Signed-off-by: Minwoo Im Reviewed-by: Klaus Jensen --- hw/nvme/ctrl.c | 8 +------- hw/nvme/nvme.h | 5 ++--- hw/nvme/subsys.c | 2 ++ 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 7cf1e8e384..90a58e71bd 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -7863,12 +7863,6 @@ static bool nvme_check_params(NvmeCtrl *n, Error **e= rrp) return false; } =20 - if (params->sriov_max_vfs > NVME_MAX_VFS) { - error_setg(errp, "sriov_max_vfs must be between 0 and %d", - NVME_MAX_VFS); - return false; - } - if (params->cmb_size_mb) { error_setg(errp, "CMB is not supported with SR-IOV"); return false; @@ -8461,7 +8455,7 @@ static Property nvme_props[] =3D { DEFINE_PROP_UINT8("zoned.zasl", NvmeCtrl, params.zasl, 0), DEFINE_PROP_BOOL("zoned.auto_transition", NvmeCtrl, params.auto_transition_zones, true), - DEFINE_PROP_UINT8("sriov_max_vfs", NvmeCtrl, params.sriov_max_vfs, 0), + DEFINE_PROP_UINT16("sriov_max_vfs", NvmeCtrl, params.sriov_max_vfs, 0), DEFINE_PROP_UINT16("sriov_vq_flexible", NvmeCtrl, params.sriov_vq_flexible, 0), DEFINE_PROP_UINT16("sriov_vi_flexible", NvmeCtrl, diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h index 485b42c104..d8ec4bad6a 100644 --- a/hw/nvme/nvme.h +++ b/hw/nvme/nvme.h @@ -26,7 +26,6 @@ =20 #define NVME_MAX_CONTROLLERS 256 #define NVME_MAX_NAMESPACES 256 -#define NVME_MAX_VFS 127 #define NVME_EUI64_DEFAULT ((uint64_t)0x5254000000000000) #define NVME_FDP_MAX_EVENTS 63 #define NVME_FDP_MAXPIDS 128 @@ -532,7 +531,7 @@ typedef struct NvmeParams { bool auto_transition_zones; bool legacy_cmb; bool ioeventfd; - uint8_t sriov_max_vfs; + uint16_t sriov_max_vfs; uint16_t sriov_vq_flexible; uint16_t sriov_vi_flexible; uint8_t sriov_max_vq_per_vf; @@ -614,7 +613,7 @@ typedef struct NvmeCtrl { =20 NvmePriCtrlCap pri_ctrl_cap; uint32_t nr_sec_ctrls; - NvmeSecCtrlEntry sec_ctrl_list[NVME_MAX_VFS]; + NvmeSecCtrlEntry *sec_ctrl_list; struct { uint16_t vqrfap; uint16_t virfap; diff --git a/hw/nvme/subsys.c b/hw/nvme/subsys.c index 561ed04a53..77deaf2c2c 100644 --- a/hw/nvme/subsys.c +++ b/hw/nvme/subsys.c @@ -61,6 +61,8 @@ int nvme_subsys_register_ctrl(NvmeCtrl *n, Error **errp) if (pci_is_vf(&n->parent_obj)) { cntlid =3D le16_to_cpu(sctrl->scid); } else { + n->sec_ctrl_list =3D g_new0(NvmeSecCtrlEntry, num_vfs); + for (cntlid =3D 0; cntlid < ARRAY_SIZE(subsys->ctrls); cntlid++) { if (!subsys->ctrls[cntlid]) { break; --=20 2.34.1 From nobody Wed Nov 13 07:06:13 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; dmarc=pass(p=none dis=none) header.from=samsung.com ARC-Seal: i=1; a=rsa-sha256; t=1716987313; cv=none; d=zohomail.com; s=zohoarc; b=Cy9fzEilaryjxZvTWuW1dd1U9OP7MAD7GsflQDzz3a0n/3N5ycqfJja8Ly7hP84eKfsNpkbnkndTd7n0xS2ZTF0NXtJ7dbi3AddBCTTlwQbaVrKcVKcmurcVnoJr5QRhEo1JR1qSNXEcXQeddL9M9m6sebJbDzboC881+DC77uM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716987313; h=Content-Type: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=4UqckNa3SBolRT98q8YcZiBZPFFmi/MfRyXlY1dqzW0=; b=WkFKv29ZkDNKCrjLO/bsTHpS7mYuT1mOrnCr1ktQriOISCP0jyVqC8jcJeCSatECHYSpWTeYCZYAPZEeKdxAMkHHveXlJ2yThZXjUDXEjTPtifVHxG7R6PZGUNKTex8AK8SJy4Nszqdoylnr2utirmIMEW0oXgahHu4Ps7+RKhA= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1716987313872461.3495479721345; Wed, 29 May 2024 05:55:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCIow-0007Bj-QI; Wed, 29 May 2024 08:54:22 -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 1sCIor-000782-FB for qemu-devel@nongnu.org; Wed, 29 May 2024 08:54:17 -0400 Received: from mailout4.samsung.com ([203.254.224.34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCIoi-0008Il-N3 for qemu-devel@nongnu.org; Wed, 29 May 2024 08:54:16 -0400 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20240529125358epoutp0417ff4e9ee3fa5c8324b6aca84317ed83~T9svImTFd2500325003epoutp04b for ; Wed, 29 May 2024 12:53:58 +0000 (GMT) Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20240529125357epcas2p138f6648af3b1674729552ec99b040d88~T9suwLEmR0515505155epcas2p13; Wed, 29 May 2024 12:53:57 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.36.88]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4Vq8TK2RHKz4x9Pv; Wed, 29 May 2024 12:53:57 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 8C.E6.09479.56527566; Wed, 29 May 2024 21:53:57 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p2.samsung.com (KnoxPortal) with ESMTPA id 20240529125356epcas2p218eee16c01039ef5f0d5c8706825485d~T9suHfgRu0038900389epcas2p2Q; Wed, 29 May 2024 12:53:56 +0000 (GMT) Received: from epsmgmcp1.samsung.com (unknown [182.195.42.82]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20240529125356epsmtrp2d5418d6fd3b5933b0725e682d48dbe5a~T9suE5hbS1667216672epsmtrp2E; Wed, 29 May 2024 12:53:56 +0000 (GMT) Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmcp1.samsung.com (Symantec Messaging Gateway) with SMTP id 69.3A.18846.46527566; Wed, 29 May 2024 21:53:56 +0900 (KST) Received: from localhost.dsn.sec.samsung.com (unknown [10.229.54.230]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20240529125356epsmtip25bc1477f69fa5f1f32a9bb55fff374ff~T9st7Iwvf1461914619epsmtip2P; Wed, 29 May 2024 12:53:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20240529125358epoutp0417ff4e9ee3fa5c8324b6aca84317ed83~T9svImTFd2500325003epoutp04b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1716987238; bh=4UqckNa3SBolRT98q8YcZiBZPFFmi/MfRyXlY1dqzW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pIJMzwgzV1wdLlFFbbW8AWP3UNpHPbeQPl4ULlO4CZN7uihn1TmSxIBGKBerlZb6B luC5eX8tBE9Jqhu2tCgbwKsMzdOgctseNFP53Ur7H8N2CvqMkrF2CiaMeTwgNFKqEB eYzWmm0t1qX3rtw2mOqUM4+1mX+XbL9Ji9qufJDU= X-AuditID: b6c32a48-ea7ff70000002507-e6-6657256564c3 From: Minwoo Im To: Keith Busch , Klaus Jensen , Jesper Devantier Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, minwoo.im@samsung.com, gost.dev@samsung.com, Klaus Jensen Subject: [PATCH v4 4/4] hw/nvme: Expand VI/VQ resource to uint32 Date: Wed, 29 May 2024 21:42:34 +0900 Message-Id: <20240529124234.1430707-5-minwoo.im@samsung.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240529124234.1430707-1-minwoo.im@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnk+LIzCtJLcpLzFFi42LZdljTXDdVNTzNYPF1QYsTU8Isbh7YyWSx /+A3VouTjXtYLSYdusZo8ez0AWaLWe/a2SyO9+5gceDwmDLtGrvHuR3n2T02repk83hybTOT R9+WVYwBrFHZNhmpiSmpRQqpecn5KZl56bZK3sHxzvGmZgaGuoaWFuZKCnmJuam2Si4+Abpu mTlAtygplCXmlAKFAhKLi5X07WyK8ktLUhUy8otLbJVSC1JyCswL9IoTc4tL89L18lJLrAwN DIxMgQoTsjNO/ZvAXrCMv+LYS7MGxjvcXYycHBICJhLLp05l7GLk4hAS2MEo8XnvNyjnE6NE +9FjbHDOx5Zl7DAtszY+h6raySjRfGsPO4Tzm1Fix5zvTCBVbALqEg1TX7GA2CICORL9K0Hi XBzMAi2MEt3nbjGDJIQFHCSOz9jICGKzCKhK/Fi3HCzOK2AjsfDyZDaIdfIS+w+eBYtzCthK dM15ww5RIyhxcuYTsAXMQDXNW2czQ9S/ZJfoaquEsF0kuhf1M0LYwhKvjm+BekFK4vO7vVDz yyV+vpkEVVMhcXDWbaA4B5BtL3HteQqIySygKbF+lz5EVFniyC2opXwSHYf/skOEeSU62oQg ZihLfDx0COoWSYnll15D7fGQWNC+kgkSUhMYJWYsX84+gVFhFpJfZiH5ZRbC4gWMzKsYxVIL inPTU4uNCkzg8Zucn7uJEZwytTx2MM5++0HvECMTB+MhRgkOZiUR3jOTQtOEeFMSK6tSi/Lj i0pzUosPMZoCQ3ois5Rocj4waeeVxBuaWBqYmJkZmhuZGpgrifPea52bIiSQnliSmp2aWpBa BNPHxMEp1cA08bm3wanSxqL1iQWfGaM72zcapRhUqbxhdOyV+hf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COzVeIG88U7Xv/2HPjmnCofm83LEnpmlW/zxydxbXssZnLFnfq5KY5x5YQdr891qQvs/rR8 fryNafRf4yl9h4p+H2S1ijTd8qcx4O4yjhjfIx72qX777sUwbT7+9nn/pgS+uc8uJeXsuHLp 9x2/jExx85qCC3scu+69jJzKsqWvUSbhjeWDg+Hr5N7M5vjSp8RSnJFoqMVcVJwIANtkL9/a AgAA X-CMS-MailID: 20240529125356epcas2p218eee16c01039ef5f0d5c8706825485d X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20240529125356epcas2p218eee16c01039ef5f0d5c8706825485d References: <20240529124234.1430707-1-minwoo.im@samsung.com> 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=203.254.224.34; envelope-from=minwoo.im@samsung.com; helo=mailout4.samsung.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.036, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @samsung.com) X-ZM-MESSAGEID: 1716987314561100003 VI and VQ resources cover queue resources in each VFs in SR-IOV. Current maximum I/O queue pair size is 0xffff, we can expand them to cover the full number of I/O queue pairs. This patch also fixed Identify Secondary Controller List overflow due to expand of number of secondary controllers. Reviewed-by: Klaus Jensen Signed-off-by: Minwoo Im --- hw/nvme/ctrl.c | 8 ++++---- hw/nvme/nvme.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 90a58e71bd..b957debdc3 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -8460,10 +8460,10 @@ static Property nvme_props[] =3D { params.sriov_vq_flexible, 0), DEFINE_PROP_UINT16("sriov_vi_flexible", NvmeCtrl, params.sriov_vi_flexible, 0), - DEFINE_PROP_UINT8("sriov_max_vi_per_vf", NvmeCtrl, - params.sriov_max_vi_per_vf, 0), - DEFINE_PROP_UINT8("sriov_max_vq_per_vf", NvmeCtrl, - params.sriov_max_vq_per_vf, 0), + DEFINE_PROP_UINT32("sriov_max_vi_per_vf", NvmeCtrl, + params.sriov_max_vi_per_vf, 0), + DEFINE_PROP_UINT32("sriov_max_vq_per_vf", NvmeCtrl, + params.sriov_max_vq_per_vf, 0), DEFINE_PROP_BOOL("msix-exclusive-bar", NvmeCtrl, params.msix_exclusive= _bar, false), DEFINE_PROP_END_OF_LIST(), diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h index d8ec4bad6a..b0b2739802 100644 --- a/hw/nvme/nvme.h +++ b/hw/nvme/nvme.h @@ -534,8 +534,8 @@ typedef struct NvmeParams { uint16_t sriov_max_vfs; uint16_t sriov_vq_flexible; uint16_t sriov_vi_flexible; - uint8_t sriov_max_vq_per_vf; - uint8_t sriov_max_vi_per_vf; + uint32_t sriov_max_vq_per_vf; + uint32_t sriov_max_vi_per_vf; bool msix_exclusive_bar; } NvmeParams; =20 --=20 2.34.1