aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/bhyve/pci_nvme.c
diff options
context:
space:
mode:
authorChuck Tuffli <chuck@FreeBSD.org>2022-01-30 07:09:35 +0000
committerChuck Tuffli <chuck@FreeBSD.org>2022-01-30 07:09:35 +0000
commit073f2076fea4748b457b15dbd1d6e11b802b76f3 (patch)
tree756f1ae705b048af00e1016f7150712fd7ff3dd7 /usr.sbin/bhyve/pci_nvme.c
parent29241c96f75b38f09fb8752a18ac1ae1b864325e (diff)
downloadsrc-073f2076fea4748b457b15dbd1d6e11b802b76f3.tar.gz
src-073f2076fea4748b457b15dbd1d6e11b802b76f3.zip
Diffstat (limited to 'usr.sbin/bhyve/pci_nvme.c')
-rw-r--r--usr.sbin/bhyve/pci_nvme.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c
index 39d1827c2c96..ea3503bdbfc0 100644
--- a/usr.sbin/bhyve/pci_nvme.c
+++ b/usr.sbin/bhyve/pci_nvme.c
@@ -1798,12 +1798,16 @@ nvme_opc_set_features(struct pci_nvme_softc *sc, struct nvme_command *command,
return (0);
}
+#define NVME_FEATURES_SEL_SUPPORTED 0x3
+#define NVME_FEATURES_NS_SPECIFIC (1 << 1)
+
static int
nvme_opc_get_features(struct pci_nvme_softc* sc, struct nvme_command* command,
struct nvme_completion* compl)
{
struct nvme_feature_obj *feat;
uint8_t fid = command->cdw10 & 0xFF;
+ uint8_t sel = (command->cdw10 >> 8) & 0x7;
DPRINTF("%s: Feature ID 0x%x (%s)", __func__, fid, nvme_fid_to_name(fid));
@@ -1822,7 +1826,10 @@ nvme_opc_get_features(struct pci_nvme_softc* sc, struct nvme_command* command,
}
if (compl->status == NVME_SC_SUCCESS) {
- compl->cdw0 = feat->cdw11;
+ if ((sel == NVME_FEATURES_SEL_SUPPORTED) && feat->namespace_specific)
+ compl->cdw0 = NVME_FEATURES_NS_SPECIFIC;
+ else
+ compl->cdw0 = feat->cdw11;
}
return (0);