From 05a21658eb15463af9427fc1f7825b2aa244b9d5 Mon Sep 17 00:00:00 2001 From: Wanpeng Qian Date: Mon, 14 Nov 2022 14:06:34 +0100 Subject: [PATCH] bhyve: return FEATURE_NOT_CHANGEABLE for unimplemented feature of NVMe controller Set Feature is a feature specified function. Currently only some features have the set procedure. For features that are not handled by the controller, we should return a FEATURE_NOT_CHANGEABLE error message. Approved by: manu (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32802 --- usr.sbin/bhyve/pci_nvme.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c index 1cc9838c112..c9fde4ac787 100644 --- a/usr.sbin/bhyve/pci_nvme.c +++ b/usr.sbin/bhyve/pci_nvme.c @@ -1885,6 +1885,11 @@ nvme_opc_set_features(struct pci_nvme_softc *sc, struct nvme_command *command, if (feat->set) feat->set(sc, feat, command, compl); + else { + pci_nvme_status_tc(&compl->status, NVME_SCT_COMMAND_SPECIFIC, + NVME_SC_FEATURE_NOT_CHANGEABLE); + return (1); + } DPRINTF("%s: status=%#x cdw11=%#x", __func__, compl->status, command->cdw11); if (compl->status == NVME_SC_SUCCESS) {