git: ae60b4cfe14b - stable/13 - bhyve nvme: Add missing Admin opcodes

From: Chuck Tuffli <chuck_at_FreeBSD.org>
Date: Mon, 21 Feb 2022 21:57:55 UTC
The branch stable/13 has been updated by chuck:

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

commit ae60b4cfe14b134570875603c226ee2b86555714
Author:     Chuck Tuffli <chuck@FreeBSD.org>
AuthorDate: 2022-01-30 07:07:04 +0000
Commit:     Chuck Tuffli <chuck@FreeBSD.org>
CommitDate: 2022-02-22 03:26:06 +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
    
    (cherry picked from commit 785b5da318bf0e523fa00b3c9c6fde94b1156542)
---
 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 78af3077f623..71abfa17deae 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);