Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jun 2020 00:32:12 +0000 (UTC)
From:      Chuck Tuffli <chuck@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r362762 - head/usr.sbin/bhyve
Message-ID:  <202006290032.05T0WCNE050007@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: chuck
Date: Mon Jun 29 00:32:11 2020
New Revision: 362762
URL: https://svnweb.freebsd.org/changeset/base/362762

Log:
  bhyve: add basic NVMe Firmware Commit support
  
  This commit updates the Identify Controller data to advertise the
  Controller supports a single firmware slot and that firmware slot 1 is
  read-only. Additionally, it returns an "Invalid Firmware Slot" error
  when the host issues any Firmware Commit command (a.k.a. Firmware
  Activate).
  
  Fixes UNH Test 5.5.3
  
  Tested by:	Jason Tubnor
  MFC after:	2 weeks
  Differential Revision: https://reviews.freebsd.org/D24897

Modified:
  head/usr.sbin/bhyve/pci_nvme.c

Modified: head/usr.sbin/bhyve/pci_nvme.c
==============================================================================
--- head/usr.sbin/bhyve/pci_nvme.c	Mon Jun 29 00:32:08 2020	(r362761)
+++ head/usr.sbin/bhyve/pci_nvme.c	Mon Jun 29 00:32:11 2020	(r362762)
@@ -468,6 +468,9 @@ pci_nvme_init_ctrldata(struct pci_nvme_softc *sc)
 	cd->acl = 2;
 	cd->aerl = 4;
 
+	/* Advertise 1, Read-only firmware slot */
+	cd->frmw = NVME_CTRLR_DATA_FRMW_SLOT1_RO_MASK |
+	    (1 << NVME_CTRLR_DATA_FRMW_NUM_SLOTS_SHIFT);
 	cd->lpa = 0;	/* TODO: support some simple things like SMART */
 	cd->elpe = 0;	/* max error log page entries */
 	cd->npss = 1;	/* number of power states support */
@@ -1556,6 +1559,12 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u
 		case NVME_OPC_GET_FEATURES:
 			DPRINTF("%s command GET_FEATURES", __func__);
 			nvme_opc_get_features(sc, cmd, &compl);
+			break;
+		case NVME_OPC_FIRMWARE_ACTIVATE:
+			DPRINTF("%s command FIRMWARE_ACTIVATE", __func__);
+			pci_nvme_status_tc(&compl.status,
+			    NVME_SCT_COMMAND_SPECIFIC,
+			    NVME_SC_INVALID_FIRMWARE_SLOT);
 			break;
 		case NVME_OPC_ASYNC_EVENT_REQUEST:
 			DPRINTF("%s command ASYNC_EVENT_REQ", __func__);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006290032.05T0WCNE050007>