From nobody Wed Apr 17 03:33:56 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VK62Y1dNyz5HjT2; Wed, 17 Apr 2024 03:33:57 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VK62X6hVZz4QtY; Wed, 17 Apr 2024 03:33:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713324836; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/lldjRyCsMyuw4WzkE13N7UJAMWfoAabjioHUcIdN1Y=; b=YPRYBpSMP30bSAUHAZaQPcjMASs6WMhbxbkZWndE73iGXQVMrX9gL71tYAJcJoJnmpfavN 6bewgDE+0cFAa/1q5dMaTfF+wzig5ChwobZuWWfL57iRJBQUHVL4YozR17gy5YBvkc3z80 r0qFEPmLzpXND4qhm+wLvN7j9G8Oqf0P4tck6UhZKuEmuVJJ+WY7Bo9zabdhAeAbSNUsUu xvrCjjvC5RnswqC2BElzFbf42LkhiAtzzkFqB5WujflCRNj8q2ZCQ2lIWGo71tJ9ENglcn zCrmDDg3nLQZWb8kNimc3Q+EmhSy7JSTJC0BPMIKxDT3d99uilwSsPyfSpFjGw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713324836; a=rsa-sha256; cv=none; b=KYOdGEYFPdFWRo2PhTYcoEh93blv8Mv7TtC/jBPdeqVonCBi3Ufqncbq7LAIrVuLdlfJdS 96vXQFj1oZ7o1vOojOaGugz61oyuGvZvazw4BiOYpainJnmXewBYPIrs2skhhgwb5Idm2c Ls+Su5zqDOUOEn74mfDuL0tlpWED/OkC3/9EeSXtDrSdm5kjLGg3r9JcLnhy11PeFcT/xv VdOAEW5mx9PLPs8KRMW3OotiVX2gxXLfkuG/cl+Hre7pLZbzNmElc9pso/fjBa8sU5yzpi d1t1AlE22Kn+pfH2rgwc/k3SelcT47GqrCqJzcI7mHbgCxhVR4mC8FTHidvLqQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713324836; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/lldjRyCsMyuw4WzkE13N7UJAMWfoAabjioHUcIdN1Y=; b=vmpemTz7Fr6nUij9x3IEnDAzEu9dxtZtTH6dwYRLZDlrox2thJ72AxfbXSZZR5O51JB1Sc YYTHAHDoQ+WKWxjy0xncOv/RwDahY7HEBSMUWxK+UaPaupBtO+oRtCjOwTu9RBN3W9uYVS eE59z0F8l+wan8sZjAljKHUIHC8b3rNcswUT9V/BYjXRmFd/Gmw/9HLF7BbUVzEbqM1Zx9 H19eu6z9yCqZFJdUkUDkPve5nXkGTYnpK8mG7AWKjbB407vUZ3z8xuhZdqYZFFmy9JbYUI HxNP2QD3cs2U5LepZo8I4zK/4asI+XG2GXgxuogXBFuaD8Ao2oYAVqwszvRxkA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VK62X6KCtz19Yj; Wed, 17 Apr 2024 03:33:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43H3Xuxe087354; Wed, 17 Apr 2024 03:33:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43H3XuwO087351; Wed, 17 Apr 2024 03:33:56 GMT (envelope-from git) Date: Wed, 17 Apr 2024 03:33:56 GMT Message-Id: <202404170333.43H3XuwO087351@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 98ab7d0a30f8 - main - nvmecontrol: Add nvme 2.0 fields to read_logpage List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 98ab7d0a30f8d0fc9c51e1e97ac29f87750b526c Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=98ab7d0a30f8d0fc9c51e1e97ac29f87750b526c commit 98ab7d0a30f8d0fc9c51e1e97ac29f87750b526c Author: Warner Losh AuthorDate: 2024-04-16 22:37:20 +0000 Commit: Warner Losh CommitDate: 2024-04-17 03:30:19 +0000 nvmecontrol: Add nvme 2.0 fields to read_logpage Add the lpo, ot, csi and uuid_index fields to read_logpage. The logpage command has not been updated to allow these to be specified. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D44683 --- sbin/nvmecontrol/firmware.c | 3 ++- sbin/nvmecontrol/logpage.c | 15 ++++++++++----- sbin/nvmecontrol/nvmecontrol.h | 3 ++- sbin/nvmecontrol/sanitize.c | 3 ++- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/sbin/nvmecontrol/firmware.c b/sbin/nvmecontrol/firmware.c index 9ce2daf28d65..c1c26c310627 100644 --- a/sbin/nvmecontrol/firmware.c +++ b/sbin/nvmecontrol/firmware.c @@ -102,7 +102,8 @@ slot_has_valid_firmware(int fd, int slot) int has_fw = false; read_logpage(fd, NVME_LOG_FIRMWARE_SLOT, - NVME_GLOBAL_NAMESPACE_TAG, 0, 0, 0, &fw, sizeof(fw)); + NVME_GLOBAL_NAMESPACE_TAG, 0, 0, 0, 0, 0, 0, 0, + &fw, sizeof(fw)); if (fw.revision[slot-1][0] != '\0') has_fw = true; diff --git a/sbin/nvmecontrol/logpage.c b/sbin/nvmecontrol/logpage.c index dfc35f1eb788..023adf8f2d6a 100644 --- a/sbin/nvmecontrol/logpage.c +++ b/sbin/nvmecontrol/logpage.c @@ -190,7 +190,8 @@ get_log_buffer(uint32_t size) void read_logpage(int fd, uint8_t log_page, uint32_t nsid, uint8_t lsp, - uint16_t lsi, uint8_t rae, void *payload, uint32_t payload_size) + uint16_t lsi, uint8_t rae, uint64_t lpo, uint8_t csi, uint8_t ot, + uint16_t uuid_index, void *payload, uint32_t payload_size) { struct nvme_pt_command pt; u_int numd; @@ -207,9 +208,12 @@ read_logpage(int fd, uint8_t log_page, uint32_t nsid, uint8_t lsp, pt.cmd.cdw11 = htole32( ((uint32_t)lsi << 16) | /* LSI */ (numd >> 16)); /* NUMDU */ - pt.cmd.cdw12 = 0; /* LPOL */ - pt.cmd.cdw13 = 0; /* LPOU */ - pt.cmd.cdw14 = 0; /* UUID Index */ + pt.cmd.cdw12 = htole32(lpo & 0xffffffff); /* LPOL */ + pt.cmd.cdw13 = htole32(lpo >> 32); /* LPOU */ + pt.cmd.cdw14 = htole32( + (csi << 24) | /* CSI */ + (ot << 23) | /* OT */ + uuid_index); /* UUID Index */ pt.buf = payload; pt.len = payload_size; pt.is_read = 1; @@ -794,7 +798,8 @@ logpage(const struct cmd *f, int argc, char *argv[]) /* Read the log page */ buf = get_log_buffer(size); - read_logpage(fd, opt.page, nsid, opt.lsp, opt.lsi, opt.rae, buf, size); + read_logpage(fd, opt.page, nsid, opt.lsp, opt.lsi, opt.rae, + 0, 0, 0, 0, buf, size); print_fn(&cdata, buf, size); close(fd); diff --git a/sbin/nvmecontrol/nvmecontrol.h b/sbin/nvmecontrol/nvmecontrol.h index 4187c9bee432..2ce4ad4c5c2b 100644 --- a/sbin/nvmecontrol/nvmecontrol.h +++ b/sbin/nvmecontrol/nvmecontrol.h @@ -84,7 +84,8 @@ int read_namespace_data(int fd, uint32_t nsid, struct nvme_namespace_data *nsdat void print_hex(void *data, uint32_t length); void print_namespace(struct nvme_namespace_data *nsdata); void read_logpage(int fd, uint8_t log_page, uint32_t nsid, uint8_t lsp, - uint16_t lsi, uint8_t rae, void *payload, uint32_t payload_size); + uint16_t lsi, uint8_t rae, uint64_t lpo, uint8_t csi, uint8_t ot, + uint16_t uuid_index, void *payload, uint32_t payload_size); void print_temp_C(uint16_t t); void print_temp_K(uint16_t t); void print_intel_add_smart(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused); diff --git a/sbin/nvmecontrol/sanitize.c b/sbin/nvmecontrol/sanitize.c index ab75900d60da..ba89e138db83 100644 --- a/sbin/nvmecontrol/sanitize.c +++ b/sbin/nvmecontrol/sanitize.c @@ -182,7 +182,8 @@ sanitize(const struct cmd *f, int argc, char *argv[]) wait: read_logpage(fd, NVME_LOG_SANITIZE_STATUS, - NVME_GLOBAL_NAMESPACE_TAG, 0, 0, 0, &ss, sizeof(ss)); + NVME_GLOBAL_NAMESPACE_TAG, 0, 0, 0, + 0, 0, 0, 0, &ss, sizeof(ss)); switch (NVMEV(NVME_SS_PAGE_SSTAT_STATUS, ss.sstat)) { case NVME_SS_PAGE_SSTAT_STATUS_NEVER: printf("Never sanitized");