From nobody Mon Feb 21 21:57:57 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 7416B19EB436; Mon, 21 Feb 2022 21:57:59 +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 4K2blB4wWDz4ghc; Mon, 21 Feb 2022 21:57:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645480679; 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=lWKuTs9OoHqr0pI5W5QS2E+P0KSqr8dz7He71aoAEh4=; b=EqfUkW9ybCiUtDwP4FG/hW9NoWWYga8vv+NwW0x4zLEG5lsjiwRFSH4pSgspjCuw0JxPPo c28CAtIBQR5QyXZbE2K0MOH1k0j98A1ByQ3a1FYebTwEHrr3LUWzPLLecBL2QVxx9l//Nn 1usS2M8TazTrkNPgfIk6md0sWb9Ghdk2RXUN9vyVOxmsPyWd7AhrtHunVE+JRnYkiCSFA6 D3InBDU9sETxke/JmhDqnV0EZbbH/U04BJ44BYAFGYI636vfPVOo6NZzMRADmaH8ff/J5r X35boTZwHt+I9mJ1tfXxi/2qDKBG2Eg0KFwMzR0bsC9l3v1dSpMiZ3X17OKOUA== 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 D4D2C17F3E; Mon, 21 Feb 2022 21:57:57 +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 21LLvvd7052136; Mon, 21 Feb 2022 21:57:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21LLvvb8052135; Mon, 21 Feb 2022 21:57:57 GMT (envelope-from git) Date: Mon, 21 Feb 2022 21:57:57 GMT Message-Id: <202202212157.21LLvvb8052135@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: 6e5e38c241e6 - stable/13 - bhyve nvme: Fix Set Features 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: 6e5e38c241e618007ae7edb0d26b704b68851dd6 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645480679; 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=lWKuTs9OoHqr0pI5W5QS2E+P0KSqr8dz7He71aoAEh4=; b=Wk5K9btAgd51QkvmqAkPcc8fcFMVJYsf7ovF2jFv0yp0T42KkA4j14v5+9WmZl7u1anzQa P86WnRyZxNy7jNx6trtQYf6/XHvGnVD5lLO+vsQc+TtKmFqglBdrGIVOHfLZWHiv5TW/sq pXSeX7dBIpRMqwSXKO8GdivtgGC1iD3yU7rxquUR4UVAPwamnBi0AomwaVgNkbJ+VkkwV+ 9NLnxcFMmxfHkggewrSYEljQf9Ikx5Vv8VMF9lOuB+YiB6w3RFVCZ8/1WNR5OIvVIhT+c9 TtYiWmPPu9xTMUymRUekaLF8VpPaw8qB5fxJdb+hTHI1vbdHToQBc+yNHGPbQQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645480679; a=rsa-sha256; cv=none; b=KWpEYWqdVL4d2+uizYng3ANszsXE7IDHx4guthl2Q+2f5r48zJhaXyk89q8ZNYdjPGIeSY 9grhxvec+fjnHiOkbgTKU2Nao2T11BQEoXU5hgDfRVOEAy6rXfLRQHt0LT35DRSIE2NeMt X3Xl3W0PU75iTgZiD2dLZQDxXXGUnmS6ULK3HYQfdTM7HjIZ06oBeefcpA86jCU3rRV2nO n0p+TSWfdNVGviPpgAi7RgCAmaGclBt0U2kywGuBAoThsNEhCGqUDzR6YfclDKBX1pZtYx aOlrCRZ5v03D3k0Nd2fWNDaZPblVr6BZtR4YC5qEGiTDQBYoPqakSWO9ZBOSQw== 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=6e5e38c241e618007ae7edb0d26b704b68851dd6 commit 6e5e38c241e618007ae7edb0d26b704b68851dd6 Author: Chuck Tuffli AuthorDate: 2022-01-30 07:07:44 +0000 Commit: Chuck Tuffli CommitDate: 2022-02-22 03:26:32 +0000 bhyve nvme: Fix Set Features Be more conservative and only support the Features mandatory for an I/O Controller. Avoids a "hang" in UNH test 1.2.10 associated with Predictable Latency Mode Configuration and Host Behavior Support features. (cherry picked from commit 1381a118297c5f304178707219983c4f70cfd2c5) --- usr.sbin/bhyve/pci_nvme.c | 52 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c index 682f7561329c..5719a5f6c8c2 100644 --- a/usr.sbin/bhyve/pci_nvme.c +++ b/usr.sbin/bhyve/pci_nvme.c @@ -666,21 +666,38 @@ pci_nvme_init_logpages(struct pci_nvme_softc *sc) static void pci_nvme_init_features(struct pci_nvme_softc *sc) { - - sc->feat[0].set = nvme_feature_invalid_cb; - sc->feat[0].get = nvme_feature_invalid_cb; - - sc->feat[NVME_FEAT_LBA_RANGE_TYPE].namespace_specific = true; - sc->feat[NVME_FEAT_ERROR_RECOVERY].namespace_specific = true; - sc->feat[NVME_FEAT_NUMBER_OF_QUEUES].set = nvme_feature_num_queues; - sc->feat[NVME_FEAT_INTERRUPT_VECTOR_CONFIGURATION].set = - nvme_feature_iv_config; - /* Enable all AENs by default */ - sc->feat[NVME_FEAT_ASYNC_EVENT_CONFIGURATION].cdw11 = 0x31f; - sc->feat[NVME_FEAT_PREDICTABLE_LATENCY_MODE_CONFIG].get = - nvme_feature_invalid_cb; - sc->feat[NVME_FEAT_PREDICTABLE_LATENCY_MODE_WINDOW].get = - nvme_feature_invalid_cb; + enum nvme_feature fid; + + for (fid = 0; fid < NVME_FID_MAX; fid++) { + switch (fid) { + case NVME_FEAT_ARBITRATION: + case NVME_FEAT_POWER_MANAGEMENT: + case NVME_FEAT_TEMPERATURE_THRESHOLD: + case NVME_FEAT_INTERRUPT_COALESCING: //XXX + case NVME_FEAT_WRITE_ATOMICITY: + /* Mandatory but no special handling required */ + //XXX hang - case NVME_FEAT_PREDICTABLE_LATENCY_MODE_CONFIG: + //XXX hang - case NVME_FEAT_HOST_BEHAVIOR_SUPPORT: + // this returns a data buffer + break; + case NVME_FEAT_ERROR_RECOVERY: + sc->feat[fid].namespace_specific = true; + break; + case NVME_FEAT_NUMBER_OF_QUEUES: + sc->feat[fid].set = nvme_feature_num_queues; + break; + case NVME_FEAT_INTERRUPT_VECTOR_CONFIGURATION: + sc->feat[fid].set = nvme_feature_iv_config; + break; + case NVME_FEAT_ASYNC_EVENT_CONFIGURATION: + /* Enable all AENs by default */ + sc->feat[fid].cdw11 = 0x31f; + break; + default: + sc->feat[fid].set = nvme_feature_invalid_cb; + sc->feat[fid].get = nvme_feature_invalid_cb; + } + } } static void @@ -1937,11 +1954,14 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, uint64_t value) case NVME_OPC_SECURITY_RECEIVE: case NVME_OPC_SANITIZE: case NVME_OPC_GET_LBA_STATUS: + DPRINTF("%s command OPC=%#x (unsupported)", __func__, + cmd->opc); /* Valid but unsupported opcodes */ pci_nvme_status_genc(&compl.status, NVME_SC_INVALID_FIELD); break; default: - DPRINTF("0x%x command is not implemented", + DPRINTF("%s command OPC=%#X (not implemented)", + __func__, cmd->opc); pci_nvme_status_genc(&compl.status, NVME_SC_INVALID_OPCODE); }