From nobody Sat Jan 29 23:15:37 2022 X-Original-To: dev-commits-src-all@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 39437197ACB9; Sat, 29 Jan 2022 23:15:38 +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 4JmVYP6XDGz3sF9; Sat, 29 Jan 2022 23:15:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643498138; 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=xjkwjvjtfn6Kx45opfAF/Che3qz2hnq5blHrzF8bkmI=; b=v6Dsitpy+YCm7KX7PIfUokd09+3mCsBSP/s+8b0U37ZrXbxR8ZT8Q5gpNQnX8kUhEXB3Ed gxYq8HsdAvfJAlRora+mFNJ80v5CN2O5AXSRt0iH5r2IdXFpHct4QbkIpUSEjD2Y6SmIFe H9G/Xs+2JEjvRn0FRBhMTyzJ+k3Z2DbHlE7AK/NnzrnPQJLEv/nTumfKomMsZWvZdW3YtM RnIr7nOmMo/a4sODBHb5k5bwA2OzxJZRSsEJ7uL+GRqPsGOr3FWej0sZaoiFRrjc70tatY ZE6u6+RrZnlNWYNlOA9NnCY+mZA4Q9NFPUHP04VhNTKnjY6fs8zYbG2e53Co4A== 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 8661D1E515; Sat, 29 Jan 2022 23:15:37 +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 20TNFbqS008128; Sat, 29 Jan 2022 23:15:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20TNFbst008127; Sat, 29 Jan 2022 23:15:37 GMT (envelope-from git) Date: Sat, 29 Jan 2022 23:15:37 GMT Message-Id: <202201292315.20TNFbst008127@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Chuck Tuffli Subject: git: cf76cdd4bf05 - main - bhyve nvme: Fix NVM Format completion status List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: cf76cdd4bf05908eb278b825fc6d33bb6557e0c8 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643498138; 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=xjkwjvjtfn6Kx45opfAF/Che3qz2hnq5blHrzF8bkmI=; b=UsNamJrwIapE+h2FwMmPyHOocPVr0GNdKAqeK2GOP3WpzDu9Fp23r00i5xGgGVxO5T1RL1 rtwmsiZqQSiP+tglS+6lHkPWHmmc4fBkcCQvSLL3chXm86iUIYfHHvEc7OYUWJqChECsUv yxNZNinQmuGBghPOhHOTGkYqziui+1ETZOXgVjSjKdo0ci7S5/KY6Rv7bKlO4VUz82qB/u s+tYZHclyVPzNhiC34p+POewt78uqEfsiQEjuoFWDCsxlRO0i+QBawH0ZEWt4bBLEKPW/e VC5KE8WmoOT7Onqima5WpigGl691O9Hn7Ejf/jmjsOLAUfUGF5hZDEjJaRLF8Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643498138; a=rsa-sha256; cv=none; b=BypeqTnDry8IpNaapUZxFsZ94iTbOjrw38F1RQ/v9rr8MZuXOyg5ObCPW6Kco3Eb1afFE8 g3RsR99KRU8Dw3ldw0/5CDA8nCQlpwb+SNcPksfd+co77rTH2BonYU6U1xHCCvu2mfKw1M WMdNUPL7tZVjTowC/fei1AG34Plo1AUf6raQcuEABcb3LMfY1XTC1mbE2JPD4UzG/OjA0t Kkwy6c7oqE+yDio1lpzAH2LrKfQpXgc/7ALOKdlIR8RK2yLoKEW8Wuns0e8ElPzY9DKL5F QkruSLeaduGNgPEJd1ngdRNql240tgRqYDq7qLltC8JZNFFFMD55PdaA55x15Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by chuck: URL: https://cgit.FreeBSD.org/src/commit/?id=cf76cdd4bf05908eb278b825fc6d33bb6557e0c8 commit cf76cdd4bf05908eb278b825fc6d33bb6557e0c8 Author: Chuck Tuffli AuthorDate: 2022-01-30 07:05:58 +0000 Commit: Chuck Tuffli CommitDate: 2022-01-30 07:05:58 +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. Reviewed by: imp, allanjude Tested by: jason@tubnor.net MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D33565 --- 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 af24f41116a0..09425b1cace3 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: