From nobody Mon Feb 21 21:57:52 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2CAF119EAEAA; Mon, 21 Feb 2022 21:57:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4K2bl45qPWz4gNr; Mon, 21 Feb 2022 21:57:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645480672; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8KqqYOH9ay3cae32ao5ZC67irw40WGNgw1P07r2qdJY=; b=Dhz4Gx5cr2h0zOZMcrYbxJ6tByEiLvoUk90n3wxQjP4ee70QyCPoqhTU8xZD9Z9RiFEoaT NGd3HlGtuKHgZus33TGfDG7pyuePHLDy6w6uG+oIsx2fqQow7AiFlVS8Bv+rgowoI0y2Y/ RwVQFXwBdlKV+1j4ZSm+Ao8Z5Xfx0Z6LPcwVtET/FaBYTbjcEhHDfefzucOsbPdn4HFKpl GjmCKZUkZhpN5RtlvXgUFf8wy68DaHErpIFGSNxvlgfijsxTWUIeLaMW9/mDntb+f2Zao7 eFOi1htr/PTfIRoNQJsS3H1y3Na04YVljLMkQ7SM+hXSX1NCAQezGWTkSU8FPg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 329ED1849A; Mon, 21 Feb 2022 21:57:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 21LLvq1R052010; Mon, 21 Feb 2022 21:57:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21LLvqUn052009; Mon, 21 Feb 2022 21:57:52 GMT (envelope-from git) Date: Mon, 21 Feb 2022 21:57:52 GMT Message-Id: <202202212157.21LLvqUn052009@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Chuck Tuffli Subject: git: 3d681a9a8009 - stable/13 - bhyve nvme: Fix NVM Format completion status List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: chuck X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3d681a9a8009dded2f89fad99d186e0de895b3e9 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645480672; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8KqqYOH9ay3cae32ao5ZC67irw40WGNgw1P07r2qdJY=; b=KS8HO6ffQJkfscPuFhs3hGyNhH0mymIRiWhaCiQYBnpJUx4nzWOOdJGd+qi9NYD0E6zQZ2 NFw31FRVR0HfVpaHXJYRNuTt+P0g+E07nCo575RRMDaJQ8sf0AlOSjslO23DI1qKDgkYi/ 1iiQ2t8bVfV2dlV9ks0ph6DD91kOgS37ZkZUsUveXHs1/D4wSnpaF6z7PrT4EZkdG624MV a9DyO2M7Pu00fjWEBBfnVOCIs+5X1078PGs9cc9K1YiL2KBkSqGspcnC8fE5lRJvCIFZUd iB1THTR3PVpHzgZY4vXOSUKTn0QTSVzFAl3YjXbeJNS1D39sX3JoY0+My8W9RQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645480672; a=rsa-sha256; cv=none; b=Tujat1106NQfp7NEK7vZLFweKN43EJvypN7TQcjwFl8kjSFVKM3YYUiaudsf+7z0wx44/2 ixkce1tCf8JTLg4YR2wVnEJWXy3ObX4RjwF7BqfzSgJAI1izzDaUvj3xjclEFrnFqCt+ia 05bYg97Nx82jItBUFFAs0VYWyTp64AcQiq9UJv1GqxDFCNatf8flSd5QJzHhgPE3zKJb5D TQDCCGfmib5Q/n1Uq+p9V5mRYjNtwpeLLRePQ/LM07BDkbY9PsLFty01VEAHmgON+49U6S YWJ/uTUf0OKaBbh4yEImgd9Sg1aGuXABRfKyJtPk/6M1w7MzE45AfJALq1oUdw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by chuck: URL: https://cgit.FreeBSD.org/src/commit/?id=3d681a9a8009dded2f89fad99d186e0de895b3e9 commit 3d681a9a8009dded2f89fad99d186e0de895b3e9 Author: Chuck Tuffli AuthorDate: 2022-01-30 07:05:58 +0000 Commit: Chuck Tuffli CommitDate: 2022-02-22 03:25:18 +0000 bhyve nvme: Fix NVM Format completion status The NVM Format command is unique among the Admin commands in that it needs to finish asynchronously. For this reason, the emulation code invented a synthetic completion status (NVME_NO_STATUS) to indicate that the command was still in progress and the command processing loop should not generate a completion message. The implementation used the value 0xffff for the synthetic value as this set both the Status Code and Status Code Type fields to reserved values. Format initialized the completion status to this value and expected error cases to override it with a status code/type appropriate to the situation. The macros used to set the NVMe status are careful not to modify bit 0 (i.e. the phase bit), which with the synthetic completion status, causes the phase bit to get out of sync. When running tests in a guest with illegal NVM Format commands, Admin commands would eventually hang because it appeared there were no completions due to the incorrect phase bit value. Fix is to only set NVME_NO_STATUS if the blockif delete command succeeds. While in the neighborhood, add a missing break statement when NVM Format is not supported. (cherry picked from commit cf76cdd4bf05908eb278b825fc6d33bb6557e0c8) --- usr.sbin/bhyve/pci_nvme.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c index 8352e00cf12b..0ce26f0adfee 100644 --- a/usr.sbin/bhyve/pci_nvme.c +++ b/usr.sbin/bhyve/pci_nvme.c @@ -1773,7 +1773,8 @@ nvme_opc_format_nvm(struct pci_nvme_softc* sc, struct nvme_command* command, pci_nvme_status_genc(&compl->status, NVME_SC_INTERNAL_DEVICE_ERROR); pci_nvme_release_ioreq(sc, req); - } + } else + compl->status = NVME_NO_STATUS; } return (1); @@ -1900,8 +1901,8 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, uint64_t value) if ((sc->ctrldata.oacs & (1 << NVME_CTRLR_DATA_OACS_FORMAT_SHIFT)) == 0) { pci_nvme_status_genc(&compl.status, NVME_SC_INVALID_OPCODE); + break; } - compl.status = NVME_NO_STATUS; nvme_opc_format_nvm(sc, cmd, &compl); break; default: