From nobody Mon Feb 21 21:58:04 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 064D219EB76D; Mon, 21 Feb 2022 21:58:06 +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 4K2blK1WB2z4gnY; Mon, 21 Feb 2022 21:58:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645480685; 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=v+/Uy/xtD9WEqeVmMU9plNO4mintnmK7ISfUBThnErk=; b=jdoPgPvEYFS/gnMrGe0x/3rTXyLVac5ZBN7QYyjtHb+zybjTE8p5ufjobkkxtIwUZGPx/e vbpIEU6BSyeAkt36MNDojoPgLLWAx0mqNGgLzloUFi9a+ZXd0elTu8YraadWWs1Rk+11Sz BDKaRm6yF0sps0colS/EKzqLf57o5r0mVw4YPXwkbYsD+qjV4ZJfp0Y2uaDQjP31PINPKa iUaRcofOZocrJMW2eJ/aNYAqYo067JdSHr/IbUJ6Zfvk95Gp6wuciAO7gdW4X9qQ8RKGnL iiggoP0aAlxVMZEbWoVlCdeOb70FThDDU0cvONhfsputrmj5JaWRRyEab94wfQ== 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 B9A401846A; Mon, 21 Feb 2022 21:58:04 +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 21LLw4oh052287; Mon, 21 Feb 2022 21:58:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21LLw4uP052285; Mon, 21 Feb 2022 21:58:04 GMT (envelope-from git) Date: Mon, 21 Feb 2022 21:58:04 GMT Message-Id: <202202212158.21LLw4uP052285@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: d9685b5787b3 - stable/13 - bhyve nvme: Fix Set Features, AEN 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: d9685b5787b310d2244274afa3d044831edcc6f8 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645480685; 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=v+/Uy/xtD9WEqeVmMU9plNO4mintnmK7ISfUBThnErk=; b=Lkj4HYNHgHTgwrDmR0AQ+mNWajxsucN9AFiz/b8JvpZyqYTmqfzwK36lxMWVRjB6PtsYlz Q2l/c3nsjNJiI2bE73LWjQBqCeSEhc1nNOdu9D1VRSopk699mBJH2ZTJaOeWnBmyYlHj0N RUJqsvYV/6qUSK7fgeuKUdkQIfQHqf4Vz3qtGkVZFVHPjkVE8reBPjd5AGLLuDEpYATHGI C83JepsbmpYYr/whp7j8unJa2b4LcKHwBvrfRXANZQ0/LUVn7I59NVCc8wVz3fZfzj2C24 c3sMpF7IGD2ledOD3h+YhIoCDfJd48tB6If8ECjowxdPfPPHIdEej3yiUHZM8g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645480685; a=rsa-sha256; cv=none; b=J1DLYInIjY+f2EEq8DiSt8+4lW52LojVUFtov0DrVJiA90hHHctXHSHneyWZlov0+SUVKh dAcLOv+8dAWuhz+rf8m/fP5MugPLsVhMlCAVqDxOrUOF+v08jzX8E1BeC+CBYeJnP74Gia 478FbGkjQ+qQA3Vm4BGjqx2k1W/Sep8L6qiSVTtiuGeEIWeO0aECfLNldVRmgqIE/UlLFK 47Lguhpc1UHbbu3gjcj9nCrD0JOIl+wPfkM3WOYe/mr23HHWVxkV0DxekOWzr/1qLGQdQC TD9jWFKNHt7znU/K4tBWnUBEooS26J0PEW6xJFerpsZQdf53Fu4sSWuTRL2kMw== 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=d9685b5787b310d2244274afa3d044831edcc6f8 commit d9685b5787b310d2244274afa3d044831edcc6f8 Author: Chuck Tuffli AuthorDate: 2022-01-30 07:10:59 +0000 Commit: Chuck Tuffli CommitDate: 2022-02-22 03:28:25 +0000 bhyve nvme: Fix Set Features, AEN NVMe Controllers which do not support Endurance Groups must return an error when the Endurance Group Event Aggregate Log Change Notices bit is set in Set Features, Asynchronous Event Configuration. Fixes UNH IOL Test 3.12, Case 8 (cherry picked from commit fa263c532beec68eb3b36f676aa0a072ffbe593f) --- usr.sbin/bhyve/pci_nvme.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c index cba5dfe293ca..ba05871f21a1 100644 --- a/usr.sbin/bhyve/pci_nvme.c +++ b/usr.sbin/bhyve/pci_nvme.c @@ -287,6 +287,13 @@ struct pci_nvme_aen { bool posted; }; +/* + * By default, enable all Asynchrnous Event Notifications: + * SMART / Health Critical Warnings + * Namespace Attribute Notices + */ +#define PCI_NVME_AEN_DEFAULT_MASK 0x11f + typedef enum { NVME_CNTRLTYPE_IO = 1, NVME_CNTRLTYPE_DISCOVERY = 2, @@ -413,6 +420,10 @@ static void nvme_feature_iv_config(struct pci_nvme_softc *, struct nvme_feature_obj *, struct nvme_command *, struct nvme_completion *); +static void nvme_feature_async_event(struct pci_nvme_softc *, + struct nvme_feature_obj *, + struct nvme_command *, + struct nvme_completion *); static void *aen_thr(void *arg); @@ -710,8 +721,9 @@ pci_nvme_init_features(struct pci_nvme_softc *sc) sc->feat[fid].set = nvme_feature_iv_config; break; case NVME_FEAT_ASYNC_EVENT_CONFIGURATION: + sc->feat[fid].set = nvme_feature_async_event; /* Enable all AENs by default */ - sc->feat[fid].cdw11 = 0x31f; + sc->feat[fid].cdw11 = PCI_NVME_AEN_DEFAULT_MASK; break; default: sc->feat[fid].set = nvme_feature_invalid_cb; @@ -1657,6 +1669,18 @@ nvme_feature_iv_config(struct pci_nvme_softc *sc, } } +#define NVME_ASYNC_EVENT_ENDURANCE_GROUP (0x4000) +static void +nvme_feature_async_event(struct pci_nvme_softc *sc, + struct nvme_feature_obj *feat, + struct nvme_command *command, + struct nvme_completion *compl) +{ + + if (command->cdw11 & NVME_ASYNC_EVENT_ENDURANCE_GROUP) + pci_nvme_status_genc(&compl->status, NVME_SC_INVALID_FIELD); +} + #define NVME_TEMP_THRESH_OVER 0 #define NVME_TEMP_THRESH_UNDER 1 static void