aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuck Tuffli <chuck@FreeBSD.org>2022-01-30 07:10:59 +0000
committerChuck Tuffli <chuck@FreeBSD.org>2022-01-30 07:10:59 +0000
commitfa263c532beec68eb3b36f676aa0a072ffbe593f (patch)
tree86ee31685b46e0a44377ba6ec60b30b15b33ecea
parentff5ed0fac420d3441aac436d884d926d91c79b3c (diff)
downloadsrc-fa263c532beec68eb3b36f676aa0a072ffbe593f.tar.gz
src-fa263c532beec68eb3b36f676aa0a072ffbe593f.zip
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 Tested by: jason@tubnor.net MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D33577
-rw-r--r--usr.sbin/bhyve/pci_nvme.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c
index e2837e6c7069..1034fe532892 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