git: 6637279c9534 - stable/13 - bhyve: return FEATURE_NOT_CHANGEABLE for unimplemented feature of NVMe controller

From: Corvin Köhne <corvink_at_FreeBSD.org>
Date: Wed, 23 Nov 2022 09:44:02 UTC
The branch stable/13 has been updated by corvink:

URL: https://cgit.FreeBSD.org/src/commit/?id=6637279c9534a22720cd02d7d1d507e2d3f03724

commit 6637279c9534a22720cd02d7d1d507e2d3f03724
Author:     Wanpeng Qian <wanpengqian@gmail.com>
AuthorDate: 2022-11-14 13:06:34 +0000
Commit:     Corvin Köhne <corvink@FreeBSD.org>
CommitDate: 2022-11-22 06:51:27 +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
    
    (cherry picked from commit 05a21658eb15463af9427fc1f7825b2aa244b9d5)
---
 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 46839078e89d..91cf919f49fd 100644
--- a/usr.sbin/bhyve/pci_nvme.c
+++ b/usr.sbin/bhyve/pci_nvme.c
@@ -1848,6 +1848,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) {