From nobody Wed Feb 23 17:22:38 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 65E2E19E3DF3; Wed, 23 Feb 2022 17:22: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 4K3jXZ2PPmz4v5k; Wed, 23 Feb 2022 17:22:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645636958; 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=t4Myg6iL110dWCfdCHxf8CdMFWzWT3uBykpGBIyi2aw=; b=NyTqvdornt4WeV79qeDZp48rgCY2FDS8oumo/hpkuPoxCpk2LcHLmcXIUhOVZBz0JXJNZ8 pkAKiGgJdGQzIQyxmb4zcL/1Epj0daaYWzyfrqlFB8Iu34KUYuQzGi4X0I//age+hen/bB 0zdmlFktXKZenOliOGV+3kSHj+zqbJJk9Z5ndk/XLVEBTaToCYNKEJHKc3ABsg1JDmin9F y5ve8nZeDC0ZN2T3Osado2boCl1N39uPF9Rn/CkVeLeWWz0DaeGG3dg9w3WNSsa5G1xVIn Aq16ybQ5VoaC5gfO+yzzXtL31p5iWrtz8dlTVLq5o7+TpRG55edkYLGGlekw5g== 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 323A21C34F; Wed, 23 Feb 2022 17:22:38 +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 21NHMcXB061849; Wed, 23 Feb 2022 17:22:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21NHMc20061848; Wed, 23 Feb 2022 17:22:38 GMT (envelope-from git) Date: Wed, 23 Feb 2022 17:22:38 GMT Message-Id: <202202231722.21NHMc20061848@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: e0ac9dc2b069 - main - bhyve nvme: Advertise Namespace changed AEN 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: e0ac9dc2b069c309c0dc18d3170d9883c421bfd9 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645636958; 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=t4Myg6iL110dWCfdCHxf8CdMFWzWT3uBykpGBIyi2aw=; b=iVcVI1gC6h5TEPjSpR0ElDOO/wqwuKrwb6j728A4loPJ6MPg906QrvbjWGOgXuBYUadIMn wInUgtciu45pnOh9uCrluOMlfrq/hMRruLiIgrV5zVEizufVaa2xpO4K9bwe/do1m9rS3j CXoRVRdftTp5mfU2h+EGMsjQapK+DOablPQcSFe8z74duHjMI15j/cb/oR0ecJQFpeNdPX UEsUCQQjsELYgla/7td52gAN0a1abEXqIMO+CFKL6Ucv6yh8x2CWm6WU3yaHxPKaO2/YHI XPbLpj0u/KO+MbZQDKdYTovxpQ54FcTmvVXZV3KtEziFCUplMidJ4ZDsCDAbjQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645636958; a=rsa-sha256; cv=none; b=qsSXu3unjO+JqAMyaiaQ1DYmfnxDuMLbNU4sxUo0s7PhMDBI56GGxRSHdS+I5TzyrAWPyL wcqFnaawzB9rp6mAksbekw1KNlFr7yCKMcwNteAoj1DwVQn1oj0/Ths2A7pStVnVCA3vz/ g9ChGBXPv66FfMKURcrTxG8gG2Acu9xBz4jGXonalPyui9xd6f6ijCVvDDob1uv3WN16fJ 67V2rQud8Sic4qfvH8jcmLCBAkzS0NRqc2jw9eYK3Myi6sSzn1oUO7jwBeM+zftLPY/NyT MspinkqTZRjPaXc1tQzNxaNBsz8YbyJdqfkps49E/Fnc8iehFKa17a58WVGLXQ== 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=e0ac9dc2b069c309c0dc18d3170d9883c421bfd9 commit e0ac9dc2b069c309c0dc18d3170d9883c421bfd9 Author: Chuck Tuffli AuthorDate: 2022-02-23 15:18:54 +0000 Commit: Chuck Tuffli CommitDate: 2022-02-23 17:15:45 +0000 bhyve nvme: Advertise Namespace changed AEN Advertise Namespace Attribute Notices events in the Optional Asynchronous Events Supported (OAES) field of the Identify Controller data structure. Additionally, rename the enums and macros to clarify these are AEN's related to Notices and not generic information. Reported by: andy@omniosce.org Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D34331 --- usr.sbin/bhyve/pci_nvme.c | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c index 12c0c93b4bc6..b780b5529da2 100644 --- a/usr.sbin/bhyve/pci_nvme.c +++ b/usr.sbin/bhyve/pci_nvme.c @@ -269,16 +269,20 @@ struct pci_nvme_aer { uint16_t cid; /* Command ID of the submitted AER */ }; +/** Asynchronous Event Information - Notice */ typedef enum { - PCI_NVME_AE_INFO_NS_ATTR_CHANGED = 0, - PCI_NVME_AE_INFO_FW_ACTIVATION, - PCI_NVME_AE_INFO_TELEMETRY_CHANGE, - PCI_NVME_AE_INFO_ANA_CHANGE, - PCI_NVME_AE_INFO_PREDICT_LATENCY_CHANGE, - PCI_NVME_AE_INFO_LBA_STATUS_ALERT, - PCI_NVME_AE_INFO_ENDURANCE_GROUP_CHANGE, - PCI_NVME_AE_INFO_MAX, -} pci_nvme_async_info; + PCI_NVME_AEI_NOTICE_NS_ATTR_CHANGED = 0, + PCI_NVME_AEI_NOTICE_FW_ACTIVATION, + PCI_NVME_AEI_NOTICE_TELEMETRY_CHANGE, + PCI_NVME_AEI_NOTICE_ANA_CHANGE, + PCI_NVME_AEI_NOTICE_PREDICT_LATENCY_CHANGE, + PCI_NVME_AEI_NOTICE_LBA_STATUS_ALERT, + PCI_NVME_AEI_NOTICE_ENDURANCE_GROUP_CHANGE, + PCI_NVME_AEI_NOTICE_MAX, +} pci_nvme_async_event_info_notice; + +#define PCI_NVME_AEI_NOTICE_SHIFT 8 +#define PCI_NVME_AEI_NOTICE_MASK(event) (1 << (event + PCI_NVME_AEI_NOTICE_SHIFT)) /* Asynchronous Event Notifications */ struct pci_nvme_aen { @@ -536,6 +540,7 @@ pci_nvme_init_ctrldata(struct pci_nvme_softc *sc) cd->cntrltype = NVME_CNTRLTYPE_IO; cd->oacs = 1 << NVME_CTRLR_DATA_OACS_FORMAT_SHIFT; + cd->oaes = NVMEB(NVME_CTRLR_DATA_OAES_NS_ATTR); cd->acl = 2; cd->aerl = 4; @@ -944,35 +949,34 @@ pci_nvme_aen_process(struct pci_nvme_softc *sc) lid = NVME_LOG_HEALTH_INFORMATION; break; case PCI_NVME_AE_TYPE_NOTICE: - if (aen->event_data >= PCI_NVME_AE_INFO_MAX) { + if (aen->event_data >= PCI_NVME_AEI_NOTICE_MAX) { EPRINTLN("%s unknown AEN notice type %u", __func__, aen->event_data); status = NVME_SC_INTERNAL_DEVICE_ERROR; break; } - mask >>= 8; - if (((1 << aen->event_data) & mask) == 0) + if ((PCI_NVME_AEI_NOTICE_MASK(aen->event_data) & mask) == 0) continue; switch (aen->event_data) { - case PCI_NVME_AE_INFO_NS_ATTR_CHANGED: + case PCI_NVME_AEI_NOTICE_NS_ATTR_CHANGED: lid = NVME_LOG_CHANGED_NAMESPACE; break; - case PCI_NVME_AE_INFO_FW_ACTIVATION: + case PCI_NVME_AEI_NOTICE_FW_ACTIVATION: lid = NVME_LOG_FIRMWARE_SLOT; break; - case PCI_NVME_AE_INFO_TELEMETRY_CHANGE: + case PCI_NVME_AEI_NOTICE_TELEMETRY_CHANGE: lid = NVME_LOG_TELEMETRY_CONTROLLER_INITIATED; break; - case PCI_NVME_AE_INFO_ANA_CHANGE: + case PCI_NVME_AEI_NOTICE_ANA_CHANGE: lid = NVME_LOG_ASYMMETRIC_NAMESPACE_ACCESS; break; - case PCI_NVME_AE_INFO_PREDICT_LATENCY_CHANGE: + case PCI_NVME_AEI_NOTICE_PREDICT_LATENCY_CHANGE: lid = NVME_LOG_PREDICTABLE_LATENCY_EVENT_AGGREGATE; break; - case PCI_NVME_AE_INFO_LBA_STATUS_ALERT: + case PCI_NVME_AEI_NOTICE_LBA_STATUS_ALERT: lid = NVME_LOG_LBA_STATUS_INFORMATION; break; - case PCI_NVME_AE_INFO_ENDURANCE_GROUP_CHANGE: + case PCI_NVME_AEI_NOTICE_ENDURANCE_GROUP_CHANGE: lid = NVME_LOG_ENDURANCE_GROUP_EVENT_AGGREGATE; break; default: @@ -3171,7 +3175,7 @@ pci_nvme_resized(struct blockif_ctxt *bctxt, void *arg, size_t new_size) sc->ns_log.ns[1] = 0; pci_nvme_aen_post(sc, PCI_NVME_AE_TYPE_NOTICE, - PCI_NVME_AE_INFO_NS_ATTR_CHANGED); + PCI_NVME_AEI_NOTICE_NS_ATTR_CHANGED); } static int