git: 05a21658eb15 - main - bhyve: return FEATURE_NOT_CHANGEABLE for unimplemented feature of NVMe controller

From: Corvin Köhne <corvink_at_FreeBSD.org>
Date: Tue, 15 Nov 2022 07:26:07 UTC
The branch main has been updated by corvink:

URL: https://cgit.FreeBSD.org/src/commit/?id=05a21658eb15463af9427fc1f7825b2aa244b9d5

commit 05a21658eb15463af9427fc1f7825b2aa244b9d5
Author:     Wanpeng Qian <wanpengqian@gmail.com>
AuthorDate: 2022-11-14 13:06:34 +0000
Commit:     Corvin Köhne <corvink@FreeBSD.org>
CommitDate: 2022-11-15 06:48:25 +0000

    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 1cc9838c112f..c9fde4ac7876 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) {