From owner-svn-src-head@freebsd.org Mon Jun 29 00:33:00 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EAFBD359664; Mon, 29 Jun 2020 00:33:00 +0000 (UTC) (envelope-from chuck@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49w7kL1sTRz43y6; Mon, 29 Jun 2020 00:32:57 +0000 (UTC) (envelope-from chuck@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 34DE21EE84; Mon, 29 Jun 2020 00:32:12 +0000 (UTC) (envelope-from chuck@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05T0WCiE050008; Mon, 29 Jun 2020 00:32:12 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0WCNE050007; Mon, 29 Jun 2020 00:32:12 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290032.05T0WCNE050007@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:32:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362762 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362762 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2020 00:33:01 -0000 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__);