From nobody Sun Nov 24 01:27:17 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=1727792115; cv=none; d=zohomail.com; s=zohoarc; b=b8zSPT+vpt3vbVpA/xFEDnbMaBVkiYz1d91hiDpgjvTbfoob8sQzhyzwmoeaRwnmDW12qG8KPiztyJRJCAAMMeNjHXxowGGWz5bqGQYN2H13QHaxmJSgEgXb3YwkE44kOgwmQe5JMAqnvY9hqhXb8MKXmPjZzJgpDBMyjeFvSyc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727792115; 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=fg5ajWBIkDI9g+3hZuI8UIo2TtY7qRypApN90qn3Dxc=; b=Urnf7uzmHa2r6AvWAHncZKnpJSOFmzflTDp/Z26PXB1FXmL2bqY9IKU7wKdMtce9Wf4ToUCAhgqLwtICbyZ8mX4LSDC6Ui/7evDkGeFnbHc7mxehVDty7wrrESyKuZBnpWjcMWR+Xug4X7hn7UbIeuMW2x1AUI8AN3pVpBITbec= 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 1727792115553303.0352870788183; Tue, 1 Oct 2024 07:15:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svdbj-0007XW-Dg; Tue, 01 Oct 2024 10:12:07 -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 1svdbf-0007TS-IC; Tue, 01 Oct 2024 10:12:03 -0400 Received: from fhigh-a2-smtp.messagingengine.com ([103.168.172.153]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1svdbc-00033t-OG; Tue, 01 Oct 2024 10:12:03 -0400 Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfhigh.phl.internal (Postfix) with ESMTP id D91EF1141A91; Tue, 1 Oct 2024 03:04:37 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-10.internal (MEProxy); Tue, 01 Oct 2024 03:04:37 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 1 Oct 2024 03:04:35 -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=1727766277; x= 1727852677; bh=fg5ajWBIkDI9g+3hZuI8UIo2TtY7qRypApN90qn3Dxc=; b=B 6CJyEGNCtqzQt73GjA1rDV83tge9oedh+LZJRIK7stEcR3hJDEpoubD2JVYxs/Zd eLGajRT7kCg9C2OrE5a4dqFq9lsADpmt8yDRZdAlTDkR80h0pZ3eFX0ua4W/wBNG nnMNkyfabzv8e8Ps40v7TIa559mm+Wukcan5cmumpci2r+XflS9sE4tsq2dZn/tk zBUYikTypLYVVHv3OGBH4NnZkaeIWIVdfDR2wPNe7SNT0NfwC4kXwduDgeXu8Asa 947HqeP+3mOMyMyxC8ZgRN0EFvPKbRYvMImzuBXvttganlwa9apgBSSb4G0wvYuk Jvg1Nbkue7qryd5gEuIqQ== 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=1727766277; x= 1727852677; bh=fg5ajWBIkDI9g+3hZuI8UIo2TtY7qRypApN90qn3Dxc=; b=h zFLPD2MLds6aaA4rGjK/iNL5s2bLKVDiXomhEb6Gt31P78dPLwBEVuiPuspBwIdt IZNxTPdC1MZes/zraCT62n0+lpFmQQAk4V0YU0EobaItZshHSqaEceECbEjT3QxL tuI77Xxh2gs65wElPULxtBOfmrc/K/0BoPydg3M9y36EkJQih99V1aDwluaO8Bdf AI1icRX/kn6P40p94bdcNPXDnOLcJvly50UHzSb1Otr29V3XEmKRzVcNBgLyT+eQ aDPV6/0FjcZgcO2tswAHCn0PuRCazsx9RLADI7H4VxB3qWlpFV4TdlP1o/5MBG4Q NR3OIc7xvPj3xc/Pa1Qsw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdduiedgudduiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddt necuhfhrohhmpefmlhgruhhsucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnth drughkqeenucggtffrrghtthgvrhhnpeejgfeilefgieevheekueevheehkeefveegiefg heefgfejjeehffefgedujedugeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehithhssehirhhrvghlvghvrghnthdrughkpdhnsggprhgtphht thhopeejpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehqvghmuhdquggvvhgvlh esnhhonhhgnhhurdhorhhgpdhrtghpthhtohepphgvthgvrhdrmhgrhiguvghllheslhhi nhgrrhhordhorhhgpdhrtghpthhtohepkhgsuhhstghhsehkvghrnhgvlhdrohhrghdprh gtphhtthhopehkrdhjvghnshgvnhesshgrmhhsuhhnghdrtghomhdprhgtphhtthhopehi thhssehirhhrvghlvghvrghnthdrughkpdhrtghpthhtohepfhhoshhsseguvghfmhgrtg hrohdrihhtpdhrtghpthhtohepqhgvmhhuqdgslhhotghksehnohhnghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: idc91472f:Fastmail From: Klaus Jensen To: qemu-devel@nongnu.org Cc: Peter Maydell , Keith Busch , Klaus Jensen , Klaus Jensen , Jesper Devantier , qemu-block@nongnu.org Subject: [PULL 1/5] hw/nvme: report id controller metadata sgl support Date: Tue, 1 Oct 2024 09:04:13 +0200 Message-ID: <20241001070418.28737-2-its@irrelevant.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001070418.28737-1-its@irrelevant.dk> References: <20241001070418.28737-1-its@irrelevant.dk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=103.168.172.153; envelope-from=its@irrelevant.dk; helo=fhigh-a2-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_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=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: 1727792116031116600 Content-Type: text/plain; charset="utf-8" From: Keith Busch The controller already supports this decoding, so just set the ID_CTRL.SGLS field accordingly. Signed-off-by: Keith Busch Reviewed-by: Klaus Jensen Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 2589e1968ea6..d5ea9ad653f2 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -8536,7 +8536,8 @@ static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice *pc= i_dev) =20 id->ocfs =3D cpu_to_le16(NVME_OCFS_COPY_FORMAT_0 | NVME_OCFS_COPY_FORM= AT_1 | NVME_OCFS_COPY_FORMAT_2 | NVME_OCFS_COPY_FORMA= T_3); - id->sgls =3D cpu_to_le32(NVME_CTRL_SGLS_SUPPORT_NO_ALIGN); + id->sgls =3D cpu_to_le32(NVME_CTRL_SGLS_SUPPORT_NO_ALIGN | + NVME_CTRL_SGLS_MPTR_SGL); =20 nvme_init_subnqn(n); =20 --=20 2.45.2 From nobody Sun Nov 24 01:27:17 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=1727792194; cv=none; d=zohomail.com; s=zohoarc; b=B2MTQrlSpBVteOV6m8ljP+q1HddMMbN47QxVs4NW8+otPyZktEMqxd0nAHwD5HLRvtzE9OIcsiGgrCQ89ekekOxJc9dafuZCZubYnnSADlnUGj/jd5mP/0VLqwAj0LdQHnIjaA8CPESXMkr0P1IY3SVvbLVZak8B7nDF7KXyYJo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727792194; 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=5XqoLTAFqCtY2x87btFp3v8D5GoR0hqn0xoHj6uIjac=; b=GnkbKYJTDMJPpT14bl2+I5fFsrjtxpdY9J+YgDDvPdeyUbwCHNHfuT5Bv+5PNeO/BAaWwYg+ReuAf1PF4dQ/mwteFIzIu6bkgmqEiaLB1R/2cMEAeL6QEEYKBOz2Z8hG1f4q7V/eMmZLN3ZL3yCzK8UtodG8JE5/C5Xp303MXFY= 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 1727792194516697.132502993481; Tue, 1 Oct 2024 07:16:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svdcE-0008Lx-Fz; Tue, 01 Oct 2024 10:12:38 -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 1svdbo-0007fG-97; Tue, 01 Oct 2024 10:12:14 -0400 Received: from fout-a4-smtp.messagingengine.com ([103.168.172.147]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1svdbc-000340-OB; Tue, 01 Oct 2024 10:12:11 -0400 Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id 86B191381F44; Tue, 1 Oct 2024 03:04:39 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Tue, 01 Oct 2024 03:04:39 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 1 Oct 2024 03:04:38 -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=1727766279; x= 1727852679; bh=5XqoLTAFqCtY2x87btFp3v8D5GoR0hqn0xoHj6uIjac=; b=i 2PtjMJwsyizlr60ds1MHGn/u5tQPDIqPJ4iT97iBdQyK1FDKwxTZNPwlERQED775 4xrb/XdKkkTfvTW5ucNomhpz+Ktwoz8O3Y8Zrll6aVtUoB2et5Tt9NABR1AMbuxk PYCR9ZQhW6Esjj1/iOxLYc5RaPQAPTXJyWEbMe1oJAnEVFC03pAwluGY05qBbGhz 1+SZhJT1/uToZ/Z1Y0Ug/gWnZJgLJyW8hQMfJdQ/6NbMhBxvqj+xUT1r6ipGrpq3 O+C/dcjh6JOenQAoB3za9sIgMo8RptAVmknEYtw6ZtoYyDPGihHpxlFiZ4n9FiCn jRE6a214FCpCYUMpwacyw== 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=1727766279; x= 1727852679; bh=5XqoLTAFqCtY2x87btFp3v8D5GoR0hqn0xoHj6uIjac=; b=R QmSEW90OBx9LCgVcL/X1VOcbyZurRcOrpC7ucTydNqnDruxNZSY0NLrrSc6BjinZ JMQDcvQuGSPUVZiMLrdvT76fOINC4uWfaySj4oTupiBuYVBDFbmFgMvlH2Z0nKtY ult2u5ztmTFfgzHYgkx95CJ+zH2f1YMni+vePGUhdm3lwW2+XClV6YsQjgvER6gB VqznFM2+57it5pow4E3BXhENjr99+a7OoPwTP0i7DDocsHgAXKUqHQ4GRaNeLXqA FNADr8YK+L15x17GreIHJH5K/XXLKK0MA8zyMC5QZp/HKfpeJi3ZZe86sP3GVyf8 9yPAyj9XihyYZ3qMqGq1g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdduiedgudduiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddt necuhfhrohhmpefmlhgruhhsucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnth drughkqeenucggtffrrghtthgvrhhnpeejgfeilefgieevheekueevheehkeefveegiefg heefgfejjeehffefgedujedugeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehithhssehirhhrvghlvghvrghnthdrughkpdhnsggprhgtphht thhopeekpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehqvghmuhdquggvvhgvlh esnhhonhhgnhhurdhorhhgpdhrtghpthhtohepphgvthgvrhdrmhgrhiguvghllheslhhi nhgrrhhordhorhhgpdhrtghpthhtoheprghruhhnrdhkkhgrsehsrghmshhunhhgrdgtoh hmpdhrtghpthhtohepkhdrjhgvnhhsvghnsehsrghmshhunhhgrdgtohhmpdhrtghpthht ohepkhgsuhhstghhsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehithhssehirhhrvg hlvghvrghnthdrughkpdhrtghpthhtohepfhhoshhsseguvghfmhgrtghrohdrihhtpdhr tghpthhtohepqhgvmhhuqdgslhhotghksehnohhnghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: idc91472f:Fastmail From: Klaus Jensen To: qemu-devel@nongnu.org Cc: Peter Maydell , Arun Kumar , Klaus Jensen , Keith Busch , Klaus Jensen , Jesper Devantier , qemu-block@nongnu.org Subject: [PULL 2/5] hw/nvme: clear masked events from the aer queue Date: Tue, 1 Oct 2024 09:04:14 +0200 Message-ID: <20241001070418.28737-3-its@irrelevant.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001070418.28737-1-its@irrelevant.dk> References: <20241001070418.28737-1-its@irrelevant.dk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=103.168.172.147; envelope-from=its@irrelevant.dk; helo=fout-a4-smtp.messagingengine.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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: 1727792196580116600 Content-Type: text/plain; charset="utf-8" From: Arun Kumar Clear masked events from the aer queue when get log page is issued with RAE 0 without checking for the presence of outstanding aer requests. Signed-off-by: Arun Kumar [k.jensen: remove unnecessary QTAILQ_EMPTY check] Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index d5ea9ad653f2..a720dbc354a2 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -1649,9 +1649,16 @@ static void nvme_smart_event(NvmeCtrl *n, uint8_t ev= ent) =20 static void nvme_clear_events(NvmeCtrl *n, uint8_t event_type) { + NvmeAsyncEvent *event, *next; + n->aer_mask &=3D ~(1 << event_type); - if (!QTAILQ_EMPTY(&n->aer_queue)) { - nvme_process_aers(n); + + QTAILQ_FOREACH_SAFE(event, &n->aer_queue, entry, next) { + if (event->result.event_type =3D=3D event_type) { + QTAILQ_REMOVE(&n->aer_queue, event, entry); + n->aer_queued--; + g_free(event); + } } } =20 --=20 2.45.2 From nobody Sun Nov 24 01:27:17 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=1727791998; cv=none; d=zohomail.com; s=zohoarc; b=XzyNda0FwcCp+nBuE4YHxMGBwL02uF+RrIa8GaZFI3RaG0KASZPTvjAmWuM35oJSPGrMjow3Pq70bQDj7ph0Ypux/4pOqe3NfNYLBT4BQ8cZNOnuUydwhvH89Kt3zUcW0BGwrXsIXqcsaiRj+d2uzZ0eUWL9V7WiVpqOHyeWJ10= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727791998; 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=ytqbBQEEKPItfETLehQ2Mmw3aOWzfVEc2PMLnqbV+QE=; b=FObpBjHHg0S/2QUjiHseexhk/Ph5EJIPI3d9d2zM8wC9RIgdD96PyyEvzfsaNaUz71o4T6u8vZmQESw4T89bz5S8q3+WlPsVkq24zCNRKcZ7cI2VV6100EJWYy/SsHiABxNmFwlyavC1qzcl+rpbHangMX6F2a176zkqriqE7/8= 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 1727791995832577.6207563914683; Tue, 1 Oct 2024 07:13:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svdcB-0008CW-Jl; Tue, 01 Oct 2024 10:12:35 -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 1svdbf-0007TT-IM; Tue, 01 Oct 2024 10:12:03 -0400 Received: from fhigh-a2-smtp.messagingengine.com ([103.168.172.153]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1svdbc-00034H-Gk; Tue, 01 Oct 2024 10:12:03 -0400 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfhigh.phl.internal (Postfix) with ESMTP id 1D2B81141AA5; Tue, 1 Oct 2024 03:04:42 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-12.internal (MEProxy); Tue, 01 Oct 2024 03:04:42 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 1 Oct 2024 03:04:39 -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=1727766282; x= 1727852682; bh=ytqbBQEEKPItfETLehQ2Mmw3aOWzfVEc2PMLnqbV+QE=; b=F zX0nfjVYpNpaSf7G5p9uwHn2/MF4S5ncghIpLh5tDHFX1D8ZlZIYGJdgg2efZrxE WQ4IrGrUURR2gyW/xNR56xTZ6It8wdokn+lwc86K8T3Tymj7JnUTn1bnim85yMQa 1r/frhZ+jO61nCNwbAo8DttQpH8CEGORp7RmouiAcl3bz09cLUWYWTIAJBetRLSs FhBQC0ZjmlXVkPnMkWLSluTULGsudtla/fAIiy5MOytio7FTb6v/ncdPLFmqslUj btZZe+cciO7IjR9KPvud7jZlZWkIkiDP5wF//pqrJF98AlVda9Q0Tj0fDFlbGQxE NaZUvACQU68MIaQObpC1A== 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=1727766282; x= 1727852682; bh=ytqbBQEEKPItfETLehQ2Mmw3aOWzfVEc2PMLnqbV+QE=; b=k X3bRDI9eVdhSw/NNsH9gg1mTxl8GoO0sD6p0VZ8Kx2Ch/N9rpbK9p4kYKJQROC9e WT7f6NBMaBgYNhG/SO6pOfJFk9HA1gehhv3PZxA5LvhHp5SZ/ADvZbXfsE7MRfw+ rXHevUbg1UoI6nLGfnbgUAzewwNFAt5fPg8GSvH2DE+9XmKRCrqilOAWkS3IOOLQ ORBsZrAmi6moOqBktJdGlCmebV3pSy2RDl8qhxMC8R7JAaZVJzfoPU+Jmx5uGbDY sRRmh2mJJlUIbUK85/xxzU1pDsyD+przcYEF+zzC8cpxr2hYfZcUnsvJLrXh0Uxf gRTvvD9yLSZdgY5lU3bJQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdduiedgudduiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddt necuhfhrohhmpefmlhgruhhsucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnth drughkqeenucggtffrrghtthgvrhhnpeejgfeilefgieevheekueevheehkeefveegiefg heefgfejjeehffefgedujedugeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehithhssehirhhrvghlvghvrghnthdrughkpdhnsggprhgtphht thhopedufedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepqhgvmhhuqdguvghvvg hlsehnohhnghhnuhdrohhrghdprhgtphhtthhopehpvghtvghrrdhmrgihuggvlhhlsehl ihhnrghrohdrohhrghdprhgtphhtthhopegrrhhunhdrkhhkrgesshgrmhhsuhhnghdrtg homhdprhgtphhtthhopehkrdhjvghnshgvnhesshgrmhhsuhhnghdrtghomhdprhgtphht thhopehksghushgthheskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepihhtshesihhrrh gvlhgvvhgrnhhtrdgukhdprhgtphhtthhopehfohhsshesuggvfhhmrggtrhhordhithdp rhgtphhtthhopehsthgvfhgrnhhhrgesrhgvughhrghtrdgtohhmpdhrtghpthhtohepfh grmhesvghuphhhohhnrdhnvght X-ME-Proxy: Feedback-ID: idc91472f:Fastmail From: Klaus Jensen To: qemu-devel@nongnu.org Cc: Peter Maydell , Arun Kumar , Klaus Jensen , Keith Busch , Klaus Jensen , Jesper Devantier , Stefan Hajnoczi , Fam Zheng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org Subject: [PULL 3/5] hw/nvme: support CTRATT.MEM Date: Tue, 1 Oct 2024 09:04:15 +0200 Message-ID: <20241001070418.28737-4-its@irrelevant.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001070418.28737-1-its@irrelevant.dk> References: <20241001070418.28737-1-its@irrelevant.dk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=103.168.172.153; envelope-from=its@irrelevant.dk; helo=fhigh-a2-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_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=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: 1727791999441116600 Content-Type: text/plain; charset="utf-8" From: Arun Kumar Indicate that 'MDTS and Size Limits Exclude Metadata (MEM)' in the Controller Attributes (CTRATT) I/O Command Set Independent Identify Controller Data Structure. Signed-off-by: Arun Kumar Reviewed-by: Klaus Jensen [k.jensen: updated commit message] Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 19 ++++++++++++++----- include/block/nvme.h | 3 +++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index a720dbc354a2..050cb63e3390 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -2653,6 +2653,7 @@ static uint16_t nvme_verify(NvmeCtrl *n, NvmeRequest = *req) uint64_t slba =3D le64_to_cpu(rw->slba); uint32_t nlb =3D le16_to_cpu(rw->nlb) + 1; size_t len =3D nvme_l2b(ns, nlb); + size_t data_len =3D len; int64_t offset =3D nvme_l2b(ns, slba); uint8_t prinfo =3D NVME_RW_PRINFO(le16_to_cpu(rw->control)); uint32_t reftag =3D le32_to_cpu(rw->reftag); @@ -2672,7 +2673,11 @@ static uint16_t nvme_verify(NvmeCtrl *n, NvmeRequest= *req) } } =20 - if (len > n->page_size << n->params.vsl) { + if (nvme_ns_ext(ns) && !(NVME_ID_CTRL_CTRATT_MEM(n->id_ctrl.ctratt))) { + data_len +=3D nvme_m2b(ns, nlb); + } + + if (data_len > (n->page_size << n->params.vsl)) { return NVME_INVALID_FIELD | NVME_DNR; } =20 @@ -3413,7 +3418,11 @@ static uint16_t nvme_compare(NvmeCtrl *n, NvmeReques= t *req) len +=3D nvme_m2b(ns, nlb); } =20 - status =3D nvme_check_mdts(n, len); + if (NVME_ID_CTRL_CTRATT_MEM(n->id_ctrl.ctratt)) { + status =3D nvme_check_mdts(n, data_len); + } else { + status =3D nvme_check_mdts(n, len); + } if (status) { return status; } @@ -3590,7 +3599,7 @@ static uint16_t nvme_read(NvmeCtrl *n, NvmeRequest *r= eq) BlockBackend *blk =3D ns->blkconf.blk; uint16_t status; =20 - if (nvme_ns_ext(ns)) { + if (nvme_ns_ext(ns) && !(NVME_ID_CTRL_CTRATT_MEM(n->id_ctrl.ctratt))) { mapped_size +=3D nvme_m2b(ns, nlb); =20 if (NVME_ID_NS_DPS_TYPE(ns->id_ns.dps)) { @@ -3702,7 +3711,7 @@ static uint16_t nvme_do_write(NvmeCtrl *n, NvmeReques= t *req, bool append, BlockBackend *blk =3D ns->blkconf.blk; uint16_t status; =20 - if (nvme_ns_ext(ns)) { + if (nvme_ns_ext(ns) && !(NVME_ID_CTRL_CTRATT_MEM(n->id_ctrl.ctratt))) { mapped_size +=3D nvme_m2b(ns, nlb); =20 if (NVME_ID_NS_DPS_TYPE(ns->id_ns.dps)) { @@ -8483,7 +8492,7 @@ static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice *pc= i_dev) id->cntlid =3D cpu_to_le16(n->cntlid); =20 id->oaes =3D cpu_to_le32(NVME_OAES_NS_ATTR); - ctratt =3D NVME_CTRATT_ELBAS; + ctratt =3D NVME_CTRATT_ELBAS | NVME_CTRATT_MEM; =20 id->rab =3D 6; =20 diff --git a/include/block/nvme.h b/include/block/nvme.h index 5298bc4a2867..a37be0d0da8e 100644 --- a/include/block/nvme.h +++ b/include/block/nvme.h @@ -1182,6 +1182,7 @@ enum NvmeIdCtrlOaes { enum NvmeIdCtrlCtratt { NVME_CTRATT_ENDGRPS =3D 1 << 4, NVME_CTRATT_ELBAS =3D 1 << 15, + NVME_CTRATT_MEM =3D 1 << 16, NVME_CTRATT_FDPS =3D 1 << 19, }; =20 @@ -1285,6 +1286,8 @@ enum NvmeNsAttachmentOperation { #define NVME_ERR_REC_TLER(err_rec) (err_rec & 0xffff) #define NVME_ERR_REC_DULBE(err_rec) (err_rec & 0x10000) =20 +#define NVME_ID_CTRL_CTRATT_MEM(ctratt) (ctratt & NVME_CTRATT_MEM) + enum NvmeFeatureIds { NVME_ARBITRATION =3D 0x1, NVME_POWER_MANAGEMENT =3D 0x2, --=20 2.45.2 From nobody Sun Nov 24 01:27:17 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=1727792216; cv=none; d=zohomail.com; s=zohoarc; b=kZD6L78FI5ZAI+T6J2Q7zoOz52ckK3idiXUb16zJ9s2gaQ2yRJd+Rr5tcDaFUYI+c0oJXovhRCBP3YUQG6rCBSFnn4oHXDOCEJkd4VR477zGJs4Bxa5S1DOXVYxtXzd176zlSBLU3+xRZtFHMrKTrXiqpQP5adVCoJCHLOW7UHc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727792216; 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=zfxKcGYBWejJhPfihOF8Kc26jktRb/WUlCj6Qb2QhwI=; b=gBcFaMyVfoqwBC2raUcx+othG87oi8R7hNeXXh/ekJNtkvgQqKLQ/9jn2tzhY5NSvrdNfbGg4mkuAXG8PnYXn0bgqheMaL16rDSk/+KQ4xHfg9uWF1mdqPgwFIP1czl66qll9c8tLPLNenlphuG+47kGeBaaAkR8SeZVTsuPGGU= 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 1727792216004913.9013125190307; Tue, 1 Oct 2024 07:16:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svdc7-0007tv-EG; Tue, 01 Oct 2024 10:12:31 -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 1svdbg-0007Ud-St; Tue, 01 Oct 2024 10:12:04 -0400 Received: from fout-a4-smtp.messagingengine.com ([103.168.172.147]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1svdbc-00033v-Go; Tue, 01 Oct 2024 10:12:04 -0400 Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id C2EE41381F42; Tue, 1 Oct 2024 03:04:43 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Tue, 01 Oct 2024 03:04:43 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 1 Oct 2024 03:04:42 -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=1727766283; x= 1727852683; bh=zfxKcGYBWejJhPfihOF8Kc26jktRb/WUlCj6Qb2QhwI=; b=u B5DYOVQrypGstT7EfGt7u3xdj1Jahmm4ggX/QO4KHCZmR1eqWNLtRRkj+xhyvDdh ux0n65PB74xH9vOHjp3EnipDYdJ9JAhu35tCDT+SRu3A/T+1N0ekOWWlYRvC6S2L Za5f5nndtJp6JmvyIdpgmTy2l1WAyAaLKsaRYetjhdJLCRrf4otdlURhRquicAPe xIg7N6hCHgCj9f0VaJAOJKuFHWPyYy8UrCO8lxsuHqCXDQ7U3WSxpTBtgDXQuv7D n1bcPwxzCOd4nQIc+bxBoBOMLtgYwykxeWUcqOIiNzsJ+endlR0SKo7kccD2w24U vH5UL1mOWkLFrorNkDgPQ== 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=1727766283; x= 1727852683; bh=zfxKcGYBWejJhPfihOF8Kc26jktRb/WUlCj6Qb2QhwI=; b=R VUde4rjiMRnvdvgecTbAPjTOzNBgH9SgKRRdLhDvuyEjFCnxXgl8disuU8AiYebM 3Tx+0eLGSbT0dNwWZIqoa16Jfn4w9giExGPylloj8DX0eTA/k+ndZ089Q+NEY1Jk ICYCldQwaBinKo+8wLdLgUw4pmw30UCwuowdNLM8FXg8K6lAt8IXmSXQtRRbt0wl eyXVnq9NEw7Zf5s+a9jHH4lZ5Qga887ZqPC+qe2aNj45qEX2c7ayIRKf2SEcGcoG ybQwocZ4CuYgVg8LRhi3eI/ZsRiQEGlzF51h9Q7/qcL4dFZ1pw3JThYPL6qChgvq jOJX10BP4evg4s1WEeAaQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdduiedguddujecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddt necuhfhrohhmpefmlhgruhhsucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnth drughkqeenucggtffrrghtthgvrhhnpeejgfeilefgieevheekueevheehkeefveegiefg heefgfejjeehffefgedujedugeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehithhssehirhhrvghlvghvrghnthdrughkpdhnsggprhgtphht thhopeelpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehqvghmuhdquggvvhgvlh esnhhonhhgnhhurdhorhhgpdhrtghpthhtohepphgvthgvrhdrmhgrhiguvghllheslhhi nhgrrhhordhorhhgpdhrtghpthhtohepkhdrjhgvnhhsvghnsehsrghmshhunhhgrdgtoh hmpdhrtghpthhtohepmhhinhifohhordhimhesshgrmhhsuhhnghdrtghomhdprhgtphht thhopegrrhhunhdrkhhkrgesshgrmhhsuhhnghdrtghomhdprhgtphhtthhopehksghush gthheskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepihhtshesihhrrhgvlhgvvhgrnhht rdgukhdprhgtphhtthhopehfohhsshesuggvfhhmrggtrhhordhithdprhgtphhtthhope hqvghmuhdqsghlohgtkhesnhhonhhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: idc91472f:Fastmail From: Klaus Jensen To: qemu-devel@nongnu.org Cc: Peter Maydell , Klaus Jensen , Minwoo Im , Arun Kumar , Keith Busch , Klaus Jensen , Jesper Devantier , qemu-block@nongnu.org Subject: [PULL 4/5] hw/nvme: add knob for CTRATT.MEM Date: Tue, 1 Oct 2024 09:04:16 +0200 Message-ID: <20241001070418.28737-5-its@irrelevant.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001070418.28737-1-its@irrelevant.dk> References: <20241001070418.28737-1-its@irrelevant.dk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=103.168.172.147; envelope-from=its@irrelevant.dk; helo=fout-a4-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_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=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: 1727792216669116600 Content-Type: text/plain; charset="utf-8" From: Klaus Jensen Add a boolean prop (ctratt.mem) for setting CTRATT.MEM and default it to unset (false) to keep existing behavior of the device intact. Reviewed-by: Minwoo Im Reviewed-by: Arun Kumar Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 7 ++++++- hw/nvme/nvme.h | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 050cb63e3390..119adec31274 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -8492,7 +8492,11 @@ static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice *p= ci_dev) id->cntlid =3D cpu_to_le16(n->cntlid); =20 id->oaes =3D cpu_to_le32(NVME_OAES_NS_ATTR); - ctratt =3D NVME_CTRATT_ELBAS | NVME_CTRATT_MEM; + + ctratt =3D NVME_CTRATT_ELBAS; + if (n->params.ctratt.mem) { + ctratt |=3D NVME_CTRATT_MEM; + } =20 id->rab =3D 6; =20 @@ -8751,6 +8755,7 @@ static Property nvme_props[] =3D { false), DEFINE_PROP_UINT16("mqes", NvmeCtrl, params.mqes, 0x7ff), DEFINE_PROP_UINT16("spdm_port", PCIDevice, spdm_port, 0), + DEFINE_PROP_BOOL("ctratt.mem", NvmeCtrl, params.ctratt.mem, false), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h index 781985754d0d..bd3c6ba33a67 100644 --- a/hw/nvme/nvme.h +++ b/hw/nvme/nvme.h @@ -538,6 +538,10 @@ typedef struct NvmeParams { uint32_t sriov_max_vq_per_vf; uint32_t sriov_max_vi_per_vf; bool msix_exclusive_bar; + + struct { + bool mem; + } ctratt; } NvmeParams; =20 typedef struct NvmeCtrl { --=20 2.45.2 From nobody Sun Nov 24 01:27:17 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=1727791988; cv=none; d=zohomail.com; s=zohoarc; b=LmnmIlMSUQukuZSIyDjegMO/LI7aXUYCO8MuVD6SKa0iAgSUE6dUspGy0/3nEqPhievrWO48tqH3ho+ExH0MrwUTy+mmD+qXJqR0UY0XdArkumoQ860O3QNGfrnhP+Ct14uIkdL6dhU7zXCosPfa27mKpC6V+7DyzTfRa13R/1M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727791988; 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=4x4njllrpEgg+I2ho9IlMJ6gfQVOYi2Scy0o+rUGnN0=; b=CcHb2gWMvd95d3WbhnxcDHWN+B+XyMz0IsE3XePvFTDBWXTOa/m02TjEji0g3UmY/fYbKygaLkBQ9mQQqjWVFPfa4Z7zfry27HZx7giWppJ9qx+cdFlXPkJRc7ctAS6h6YkimwgwAPl6aumgPGgFhnErGfiFZe6tIP+L8Jqnits= 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 17277919886131019.0918741266796; Tue, 1 Oct 2024 07:13:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svdcH-0000A0-6m; Tue, 01 Oct 2024 10:12:41 -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 1svdbg-0007UN-5n; Tue, 01 Oct 2024 10:12:04 -0400 Received: from fhigh-a2-smtp.messagingengine.com ([103.168.172.153]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1svdbc-00034M-UU; Tue, 01 Oct 2024 10:12:03 -0400 Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id 74BB111412E9; Tue, 1 Oct 2024 03:04:45 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Tue, 01 Oct 2024 03:04:45 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 1 Oct 2024 03:04:43 -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=1727766285; x= 1727852685; bh=4x4njllrpEgg+I2ho9IlMJ6gfQVOYi2Scy0o+rUGnN0=; b=V zQk0g6ugK0Ih/p28IuksV9ErVKlV7+tjSOsCJUvzK12nWDpxLR3badiN2mMqDjkH EyGMr60psosQ5HZqZMWik2+w34O59TfmVLlkgTIGb3YLsyBh6JQNiaqxPO4ITGSs /U3EkXVgFlNQxJHVlQ6/oRY69NDgPCFtoX/ac8OuX2CkxKAcDxbb55z8QcA6B/rv YbnxJhyvwrCzjSQaFRpC8yZ2HbLsyhBb0o5wPYYeNyUqTYDdhnF+QuZDvvuXAway v61uckmZlFUVkvSP04j+IlZELbXGBVWSdwLFPDy2f6JOeL2uh3UiGPqcUsYcVXg+ f56Ug8iLLW0Z7+09hFzbg== 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=1727766285; x= 1727852685; bh=4x4njllrpEgg+I2ho9IlMJ6gfQVOYi2Scy0o+rUGnN0=; b=b BQgzypilKB7BEDWR3EgQps9A7QidUWNKNcvhAW3rgc+5s/htJjIPJ/BlcmyX0nyw TbMmGmim2cVwzyrkadogc1hFdja8LdhN4N7cSLdb73nrzyGEMPGRofkHGqMq70CV 6oYZ5kBFKl3pk+tJo93Pk5dtFVXfc+AHvBd9BXLlphvRLhGU/vVXWU9UH7gLpA/w DjWNhmeUIaaneJ32AsAE+ZdSYy3rfT1xS2iVOTD6BU9k3sDDokhqm3KprU2GghQG IXOkvTtCDMj1QJPeE5w5qyWdLiAdU5myLS886UF4eIUNkEAr8PBXQvbbY4tGr22B LHgHKMvT7uBp9+dIugglQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdduiedgudduiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddt necuhfhrohhmpefmlhgruhhsucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnth drughkqeenucggtffrrghtthgvrhhnpeejgfeilefgieevheekueevheehkeefveegiefg heefgfejjeehffefgedujedugeenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmh epmhgrihhlfhhrohhmpehithhssehirhhrvghlvghvrghnthdrughkpdhnsggprhgtphht thhopeekpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehqvghmuhdquggvvhgvlh esnhhonhhgnhhurdhorhhgpdhrtghpthhtohepphgvthgvrhdrmhgrhiguvghllheslhhi nhgrrhhordhorhhgpdhrtghpthhtoheprghlrghnrdgruggrmhhsohhnsehorhgrtghlvg drtghomhdprhgtphhtthhopehkrdhjvghnshgvnhesshgrmhhsuhhnghdrtghomhdprhgt phhtthhopehksghushgthheskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepihhtshesih hrrhgvlhgvvhgrnhhtrdgukhdprhgtphhtthhopehfohhsshesuggvfhhmrggtrhhordhi thdprhgtphhtthhopehqvghmuhdqsghlohgtkhesnhhonhhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: idc91472f:Fastmail From: Klaus Jensen To: qemu-devel@nongnu.org Cc: Peter Maydell , Alan Adamson , Klaus Jensen , Keith Busch , Klaus Jensen , Jesper Devantier , qemu-block@nongnu.org Subject: [PULL 5/5] hw/nvme: add atomic write support Date: Tue, 1 Oct 2024 09:04:17 +0200 Message-ID: <20241001070418.28737-6-its@irrelevant.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001070418.28737-1-its@irrelevant.dk> References: <20241001070418.28737-1-its@irrelevant.dk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=103.168.172.153; envelope-from=its@irrelevant.dk; helo=fhigh-a2-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_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=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: 1727791990497116600 Content-Type: text/plain; charset="utf-8" From: Alan Adamson Adds support for the controller atomic parameters: AWUN and AWUPF. Atomic Compare and Write Unit (ACWU) is not currently supported. Writes that adhere to the ACWU and AWUPF parameters are guaranteed to be at= omic. New NVMe QEMU Parameters (See NVMe Specification for details): atomic.dn (default off) - Set the value of Disable Normal. atomic.awun=3DUINT16 (default: 0) atomic.awupf=3DUINT16 (default: 0) By default (Disable Normal set to zero), the maximum atomic write size is set to the AWUN value. If Disable Normal is set, the maximum atomic write size is set to AWUPF. Signed-off-by: Alan Adamson Reviewed-by: Klaus Jensen Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 158 ++++++++++++++++++++++++++++++++++++++++++++++++- hw/nvme/nvme.h | 12 ++++ 2 files changed, 169 insertions(+), 1 deletion(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 119adec31274..f4e89203c1a6 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -40,6 +40,9 @@ * sriov_vi_flexible=3D \ * sriov_max_vi_per_vf=3D \ * sriov_max_vq_per_vf=3D \ + * atomic.dn=3D, \ + * atomic.awun, \ + * atomic.awupf, \ * subsys=3D * -device nvme-ns,drive=3D,bus=3D,nsid=3D,\ * zoned=3D, \ @@ -254,6 +257,7 @@ static const uint32_t nvme_feature_cap[NVME_FID_MAX] = =3D { [NVME_ERROR_RECOVERY] =3D NVME_FEAT_CAP_CHANGE | NVME_FEAT_C= AP_NS, [NVME_VOLATILE_WRITE_CACHE] =3D NVME_FEAT_CAP_CHANGE, [NVME_NUMBER_OF_QUEUES] =3D NVME_FEAT_CAP_CHANGE, + [NVME_WRITE_ATOMICITY] =3D NVME_FEAT_CAP_CHANGE, [NVME_ASYNCHRONOUS_EVENT_CONF] =3D NVME_FEAT_CAP_CHANGE, [NVME_TIMESTAMP] =3D NVME_FEAT_CAP_CHANGE, [NVME_HOST_BEHAVIOR_SUPPORT] =3D NVME_FEAT_CAP_CHANGE, @@ -6309,8 +6313,10 @@ defaults: if (ret) { return ret; } - goto out; + break; =20 + case NVME_WRITE_ATOMICITY: + result =3D n->dn; break; default: result =3D nvme_feature_default[fid]; @@ -6394,6 +6400,8 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeReq= uest *req) uint8_t save =3D NVME_SETFEAT_SAVE(dw10); uint16_t status; int i; + NvmeIdCtrl *id =3D &n->id_ctrl; + NvmeAtomic *atomic =3D &n->atomic; =20 trace_pci_nvme_setfeat(nvme_cid(req), nsid, fid, save, dw11); =20 @@ -6546,6 +6554,22 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeRe= quest *req) return NVME_CMD_SEQ_ERROR | NVME_DNR; case NVME_FDP_EVENTS: return nvme_set_feature_fdp_events(n, ns, req); + case NVME_WRITE_ATOMICITY: + + n->dn =3D 0x1 & dw11; + + if (n->dn) { + atomic->atomic_max_write_size =3D le16_to_cpu(id->awupf) + 1; + } else { + atomic->atomic_max_write_size =3D le16_to_cpu(id->awun) + 1; + } + + if (atomic->atomic_max_write_size =3D=3D 1) { + atomic->atomic_writes =3D 0; + } else { + atomic->atomic_writes =3D 1; + } + break; default: return NVME_FEAT_NOT_CHANGEABLE | NVME_DNR; } @@ -7243,6 +7267,81 @@ static void nvme_update_sq_tail(NvmeSQueue *sq) trace_pci_nvme_update_sq_tail(sq->sqid, sq->tail); } =20 +#define NVME_ATOMIC_NO_START 0 +#define NVME_ATOMIC_START_ATOMIC 1 +#define NVME_ATOMIC_START_NONATOMIC 2 + +static int nvme_atomic_write_check(NvmeCtrl *n, NvmeCmd *cmd, + NvmeAtomic *atomic) +{ + NvmeRwCmd *rw =3D (NvmeRwCmd *)cmd; + uint64_t slba =3D le64_to_cpu(rw->slba); + uint32_t nlb =3D (uint32_t)le16_to_cpu(rw->nlb); + uint64_t elba =3D slba + nlb; + bool cmd_atomic_wr =3D true; + int i; + + if ((cmd->opcode =3D=3D NVME_CMD_READ) || ((cmd->opcode =3D=3D NVME_CM= D_WRITE) && + ((rw->nlb + 1) > atomic->atomic_max_write_size))) { + cmd_atomic_wr =3D false; + } + + /* + * Walk the queues to see if there are any atomic conflicts. + */ + for (i =3D 1; i < n->params.max_ioqpairs + 1; i++) { + NvmeSQueue *sq; + NvmeRequest *req; + NvmeRwCmd *req_rw; + uint64_t req_slba; + uint32_t req_nlb; + uint64_t req_elba; + + sq =3D n->sq[i]; + if (!sq) { + continue; + } + + /* + * Walk all the requests on a given queue. + */ + QTAILQ_FOREACH(req, &sq->out_req_list, entry) { + req_rw =3D (NvmeRwCmd *)&req->cmd; + + if (((req_rw->opcode =3D=3D NVME_CMD_WRITE) || + (req_rw->opcode =3D=3D NVME_CMD_READ)) && + (cmd->nsid =3D=3D req->ns->params.nsid)) { + req_slba =3D le64_to_cpu(req_rw->slba); + req_nlb =3D (uint32_t)le16_to_cpu(req_rw->nlb); + req_elba =3D req_slba + req_nlb; + + if (cmd_atomic_wr) { + if ((elba >=3D req_slba) && (slba <=3D req_elba)) { + return NVME_ATOMIC_NO_START; + } + } else { + if (req->atomic_write && ((elba >=3D req_slba) && + (slba <=3D req_elba))) { + return NVME_ATOMIC_NO_START; + } + } + } + } + } + if (cmd_atomic_wr) { + return NVME_ATOMIC_START_ATOMIC; + } + return NVME_ATOMIC_START_NONATOMIC; +} + +static NvmeAtomic *nvme_get_atomic(NvmeCtrl *n, NvmeCmd *cmd) +{ + if (n->atomic.atomic_writes) { + return &n->atomic; + } + return NULL; +} + static void nvme_process_sq(void *opaque) { NvmeSQueue *sq =3D opaque; @@ -7259,6 +7358,9 @@ static void nvme_process_sq(void *opaque) } =20 while (!(nvme_sq_empty(sq) || QTAILQ_EMPTY(&sq->req_list))) { + NvmeAtomic *atomic; + bool cmd_is_atomic; + addr =3D sq->dma_addr + (sq->head << NVME_SQES); if (nvme_addr_read(n, addr, (void *)&cmd, sizeof(cmd))) { trace_pci_nvme_err_addr_read(addr); @@ -7266,6 +7368,26 @@ static void nvme_process_sq(void *opaque) stl_le_p(&n->bar.csts, NVME_CSTS_FAILED); break; } + + atomic =3D nvme_get_atomic(n, &cmd); + + cmd_is_atomic =3D false; + if (sq->sqid && atomic) { + int ret; + + ret =3D nvme_atomic_write_check(n, &cmd, atomic); + switch (ret) { + case NVME_ATOMIC_NO_START: + qemu_bh_schedule(sq->bh); + return; + case NVME_ATOMIC_START_ATOMIC: + cmd_is_atomic =3D true; + break; + case NVME_ATOMIC_START_NONATOMIC: + default: + break; + } + } nvme_inc_sq_head(sq); =20 req =3D QTAILQ_FIRST(&sq->req_list); @@ -7275,6 +7397,10 @@ static void nvme_process_sq(void *opaque) req->cqe.cid =3D cmd.cid; memcpy(&req->cmd, &cmd, sizeof(NvmeCmd)); =20 + if (sq->sqid && atomic) { + req->atomic_write =3D cmd_is_atomic; + } + status =3D sq->sqid ? nvme_io_cmd(n, req) : nvme_admin_cmd(n, req); if (status !=3D NVME_NO_COMPLETE) { @@ -7378,6 +7504,8 @@ static void nvme_ctrl_reset(NvmeCtrl *n, NvmeResetTyp= e rst) n->outstanding_aers =3D 0; n->qs_created =3D false; =20 + n->dn =3D n->params.atomic_dn; /* Set Disable Normal */ + nvme_update_msixcap_ts(pci_dev, n->conf_msix_qsize); =20 if (pci_is_vf(pci_dev)) { @@ -8154,6 +8282,8 @@ static void nvme_init_state(NvmeCtrl *n) NvmeSecCtrlEntry *list =3D n->sec_ctrl_list; NvmeSecCtrlEntry *sctrl; PCIDevice *pci =3D PCI_DEVICE(n); + NvmeAtomic *atomic =3D &n->atomic; + NvmeIdCtrl *id =3D &n->id_ctrl; uint8_t max_vfs; int i; =20 @@ -8211,6 +8341,29 @@ static void nvme_init_state(NvmeCtrl *n) cpu_to_le16(n->params.sriov_max_vi_per_vf) : cap->vifrt / MAX(max_vfs, 1); } + + /* Atomic Write */ + id->awun =3D cpu_to_le16(n->params.atomic_awun); + id->awupf =3D cpu_to_le16(n->params.atomic_awupf); + n->dn =3D n->params.atomic_dn; + + if (id->awun || id->awupf) { + if (id->awupf > id->awun) { + id->awupf =3D 0; + } + + if (n->dn) { + atomic->atomic_max_write_size =3D id->awupf + 1; + } else { + atomic->atomic_max_write_size =3D id->awun + 1; + } + + if (atomic->atomic_max_write_size =3D=3D 1) { + atomic->atomic_writes =3D 0; + } else { + atomic->atomic_writes =3D 1; + } + } } =20 static void nvme_init_cmb(NvmeCtrl *n, PCIDevice *pci_dev) @@ -8756,6 +8909,9 @@ static Property nvme_props[] =3D { DEFINE_PROP_UINT16("mqes", NvmeCtrl, params.mqes, 0x7ff), DEFINE_PROP_UINT16("spdm_port", PCIDevice, spdm_port, 0), DEFINE_PROP_BOOL("ctratt.mem", NvmeCtrl, params.ctratt.mem, false), + DEFINE_PROP_BOOL("atomic.dn", NvmeCtrl, params.atomic_dn, 0), + DEFINE_PROP_UINT16("atomic.awun", NvmeCtrl, params.atomic_awun, 0), + DEFINE_PROP_UINT16("atomic.awupf", NvmeCtrl, params.atomic_awupf, 0), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h index bd3c6ba33a67..7566b316d12d 100644 --- a/hw/nvme/nvme.h +++ b/hw/nvme/nvme.h @@ -220,6 +220,11 @@ typedef struct NvmeNamespaceParams { } fdp; } NvmeNamespaceParams; =20 +typedef struct NvmeAtomic { + uint32_t atomic_max_write_size; + bool atomic_writes; +} NvmeAtomic; + typedef struct NvmeNamespace { DeviceState parent_obj; BlockConf blkconf; @@ -421,6 +426,7 @@ typedef struct NvmeRequest { NvmeCmd cmd; BlockAcctCookie acct; NvmeSg sg; + bool atomic_write; QTAILQ_ENTRY(NvmeRequest)entry; } NvmeRequest; =20 @@ -542,6 +548,10 @@ typedef struct NvmeParams { struct { bool mem; } ctratt; + + uint16_t atomic_awun; + uint16_t atomic_awupf; + bool atomic_dn; } NvmeParams; =20 typedef struct NvmeCtrl { @@ -623,6 +633,8 @@ typedef struct NvmeCtrl { uint16_t vqrfap; uint16_t virfap; } next_pri_ctrl_cap; /* These override pri_ctrl_cap after reset */ + uint32_t dn; /* Disable Normal */ + NvmeAtomic atomic; } NvmeCtrl; =20 typedef enum NvmeResetType { --=20 2.45.2