git: 785b5da318bf - main - bhyve nvme: Add missing Admin opcodes

From: Chuck Tuffli <chuck_at_FreeBSD.org>
Date: Sat, 29 Jan 2022 23:15:40 UTC
The branch main has been updated by chuck:

URL: https://cgit.FreeBSD.org/src/commit/?id=785b5da318bf0e523fa00b3c9c6fde94b1156542

commit 785b5da318bf0e523fa00b3c9c6fde94b1156542
Author:     Chuck Tuffli <chuck@FreeBSD.org>
AuthorDate: 2022-01-30 07:07:04 +0000
Commit:     Chuck Tuffli <chuck@FreeBSD.org>
CommitDate: 2022-01-30 07:07:04 +0000

    bhyve nvme: Add missing Admin opcodes
    
    Don't treat unsupported Admin commands as Invalid Opcode. Instead return
    the proper Invalid Field in Command.
    
    Fixes UNH IOL test 1.17.2
    
    Reviewed by:    imp, allanjude
    Tested by:      jason@tubnor.net
    MFC after:      1 month
    Differential Revision:  https://reviews.freebsd.org/D33569
---
 usr.sbin/bhyve/pci_nvme.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c
index 43426f5f1f59..c9aaf86ed7be 100644
--- a/usr.sbin/bhyve/pci_nvme.c
+++ b/usr.sbin/bhyve/pci_nvme.c
@@ -1936,6 +1936,13 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, uint64_t value)
 			}
 			nvme_opc_format_nvm(sc, cmd, &compl);
 			break;
+		case NVME_OPC_SECURITY_SEND:
+		case NVME_OPC_SECURITY_RECEIVE:
+		case NVME_OPC_SANITIZE:
+		case NVME_OPC_GET_LBA_STATUS:
+			/* Valid but unsupported opcodes */
+			pci_nvme_status_genc(&compl.status, NVME_SC_INVALID_FIELD);
+			break;
 		default:
 			DPRINTF("0x%x command is not implemented",
 			    cmd->opc);