From owner-svn-src-all@freebsd.org Wed Jul 17 03:19:31 2019 Return-Path: Delivered-To: svn-src-all@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 2A0A3A1B11; Wed, 17 Jul 2019 03:19:31 +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) server-signature RSA-PSS (4096 bits) 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 D1FF88A1CA; Wed, 17 Jul 2019 03:19:30 +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 AC1CC18409; Wed, 17 Jul 2019 03:19:30 +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 x6H3JUhh024685; Wed, 17 Jul 2019 03:19:30 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6H3JUQC024684; Wed, 17 Jul 2019 03:19:30 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <201907170319.x6H3JUQC024684@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Wed, 17 Jul 2019 03:19:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350077 - 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: 350077 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D1FF88A1CA X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jul 2019 03:19:31 -0000 Author: chuck Date: Wed Jul 17 03:19:30 2019 New Revision: 350077 URL: https://svnweb.freebsd.org/changeset/base/350077 Log: bhyve: update the NVMe CQ based on the status Instead of skipping the NVMe Completion Queue update based on the opcode, define a synthetic status value which indicates the completion queue entry is invalid. This will also allow deferred completion queue updates for other commands. Also returns the correct status for unrecognized opcodes ("invalid opcode"). Reviewed by: imp, jhb, araujo Approved by: imp (mentor), jhb (maintainer) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20945 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Wed Jul 17 02:24:16 2019 (r350076) +++ head/usr.sbin/bhyve/pci_nvme.c Wed Jul 17 03:19:30 2019 (r350077) @@ -99,6 +99,10 @@ static int nvme_debug = 0; #define NVME_PRP2_ITEMS (PAGE_SIZE/sizeof(uint64_t)) #define NVME_MAX_BLOCKIOVS 512 +/* This is a synthetic status code to indicate there is no status */ +#define NVME_NO_STATUS 0xffff +#define NVME_COMPLETION_VALID(c) ((c).status != NVME_NO_STATUS) + /* helpers */ /* Convert a zero-based value into a one-based value */ @@ -1093,14 +1097,16 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u /* XXX dont care, unhandled for now do_intr |= nvme_opc_async_event_req(sc, cmd, &compl); */ + compl.status = NVME_NO_STATUS; break; default: WPRINTF(("0x%x command is not implemented\r\n", cmd->opc)); + pci_nvme_status_genc(&compl.status, NVME_SC_INVALID_OPCODE); + do_intr |= 1; } - /* for now skip async event generation */ - if (cmd->opc != NVME_OPC_ASYNC_EVENT_REQUEST) { + if (NVME_COMPLETION_VALID(compl)) { struct nvme_completion *cp; int phase;