]> www.infradead.org Git - users/sagi/nvme-cli.git/log
users/sagi/nvme-cli.git
12 months agoutil: remove unnecessary parentheses in argconfig_parse_type()
Caleb Sander Mateos [Tue, 16 Jul 2024 16:17:46 +0000 (10:17 -0600)]
util: remove unnecessary parentheses in argconfig_parse_type()

Match the style in argconfig_set_opt_val().

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agoutil: remove redundant cast in argconfig_parse_type()
Caleb Sander Mateos [Tue, 16 Jul 2024 16:13:01 +0000 (10:13 -0600)]
util: remove redundant cast in argconfig_parse_type()

s->default_value is already a void *,
so there is no need to cast it to a char * and back.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agoutil: inline argconfig_parse_byte()
Caleb Sander Mateos [Tue, 16 Jul 2024 16:10:48 +0000 (10:10 -0600)]
util: inline argconfig_parse_byte()

argconfig_parse_byte() is only used in argconfig_parse_type().
For consistency with the other cases, inline it into the function.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agoutil: remove redundant NULL check in argconfig_print_help()
Caleb Sander Mateos [Tue, 16 Jul 2024 16:05:41 +0000 (10:05 -0600)]
util: remove redundant NULL check in argconfig_print_help()

s has been checked to be non-NULL earlier,
so there is no need to check it in the loop.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agoutil: use cleanup to avoid goto in argconfig_parse()
Caleb Sander Mateos [Tue, 16 Jul 2024 15:57:38 +0000 (09:57 -0600)]
util: use cleanup to avoid goto in argconfig_parse()

Use _cleanup_free_ in place of explicit calls to free()
in argconfig_parse(). This simplifies the code
and allows using an early return in place of a goto.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agoutil: make argconfig_set_opt_val() a void function
Caleb Sander Mateos [Tue, 16 Jul 2024 15:49:46 +0000 (09:49 -0600)]
util: make argconfig_set_opt_val() a void function

argconfig_set_opt_val() always returns 0,
so there is no need for its return value.
Return 0 in the one caller, argconfig_set_opt_val(), instead.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agoutil: remove argconfig_parse_val() declaration
Caleb Sander Mateos [Tue, 16 Jul 2024 15:42:36 +0000 (09:42 -0600)]
util: remove argconfig_parse_val() declaration

argconfig_parse_val() is defined before it is used,
so there is no need to pre-declare it.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agoutil: remove argconfig CFG_SIZE type
Caleb Sander Mateos [Tue, 16 Jul 2024 18:42:44 +0000 (12:42 -0600)]
util: remove argconfig CFG_SIZE type

CFG_SIZE is unused and not handled by argconfig_set_opt_val().

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agotest: add test cases for argconfig comma-separated array parsing
Caleb Sander Mateos [Tue, 16 Jul 2024 22:46:04 +0000 (16:46 -0600)]
test: add test cases for argconfig comma-separated array parsing

There are no unit tests currently covering
argconfig's comma-separated integer array parsing.
Add test cases to test-argconfig-parse.c
that use argconfig_parse_comma_sep_array_u32(),
verifying its functionality and edge cases.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agotest: add test cases for argconfig option values
Caleb Sander Mateos [Tue, 16 Jul 2024 18:38:11 +0000 (12:38 -0600)]
test: add test cases for argconfig option values

test-argconfig-parse.c tests argconfig option parsing,
but is missing test cases for options with opt_val lists.

Add test cases to verify this functionality and its edge cases.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agowdc: Update and refactor the C0h log page parsing
jeff-lien-wdc [Mon, 8 Jan 2024 15:38:55 +0000 (09:38 -0600)]
wdc: Update and refactor the C0h log page parsing

Add OCP 2.5 fields
Create common functions to get and parse the
different variations of the C0 log page.

Signed-off-by: jeff-lien-wdc <jeff.lien@wdc.com>
12 months agobuild(deps): bump mosteo-actions/docker-run from 1 to 2
dependabot[bot] [Mon, 15 Jul 2024 18:23:37 +0000 (18:23 +0000)]
build(deps): bump mosteo-actions/docker-run from 1 to 2

Bumps [mosteo-actions/docker-run](https://github.com/mosteo-actions/docker-run) from 1 to 2.
- [Release notes](https://github.com/mosteo-actions/docker-run/releases)
- [Commits](https://github.com/mosteo-actions/docker-run/compare/v1...v2)

---
updated-dependencies:
- dependency-name: mosteo-actions/docker-run
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
12 months agobuild: use official download action
Daniel Wagner [Fri, 12 Jul 2024 18:38:38 +0000 (20:38 +0200)]
build: use official download action

There is no point in using 3rd party actions for downloading the
artifacts. Let's use the official one.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agobuild: fetch complete git history
Daniel Wagner [Fri, 12 Jul 2024 12:51:14 +0000 (14:51 +0200)]
build: fetch complete git history

In order to build a image with which contains the correct git version
SHA we need to fetch the complete git tree. Otherwise 'git describe'
fails and we use the project version string as fallback.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agobuild: show git version used during configuration
Daniel Wagner [Fri, 12 Jul 2024 12:18:12 +0000 (14:18 +0200)]
build: show git version used during configuration

Show which git version is used when configuration phase.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agobuild: add static build target
Daniel Wagner [Fri, 12 Jul 2024 11:52:54 +0000 (13:52 +0200)]
build: add static build target

Add a static build target.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agoccan: Add freed pointer checking to delete strset member
Tokunori Ikegami [Fri, 23 Feb 2024 12:07:48 +0000 (21:07 +0900)]
ccan: Add freed pointer checking to delete strset member

Add to set freed entry pointer to NULL then check it if NULL.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agofabrics: connect all hosts in config.json
Daniel Wagner [Tue, 9 Jul 2024 09:02:48 +0000 (11:02 +0200)]
fabrics: connect all hosts in config.json

Iterate over all hosts defined in the config.json configuration file,
instead just the default controller.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agofabrics: refactore discover from json config
Daniel Wagner [Fri, 5 Jul 2024 12:35:30 +0000 (14:35 +0200)]
fabrics: refactore discover from json config

Move the connect logic out of the subsystem, ctrl loop. Too much
indention.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agofabrics: first read config before topology scanning
Daniel Wagner [Thu, 11 Jul 2024 08:49:23 +0000 (10:49 +0200)]
fabrics: first read config before topology scanning

The topology scanning will create nodes in the internal libnvme tree. As
we rely on the order of the nodes in the tree, we need to read the
config before we scan. This makes sure the first node is the one we have
defined in the config.json. This is important because the first node
provides default hosnqn configuration in absents of /etc/nvme/hostnqn.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agofabrics: use helper to lookup default hostnqn/hostid
Daniel Wagner [Wed, 3 Jul 2024 08:22:18 +0000 (10:22 +0200)]
fabrics: use helper to lookup default hostnqn/hostid

libnvme provides a handy new helper to lookup the hostnqn and hostid.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agofabrics: extend already connected message
Daniel Wagner [Thu, 11 Jul 2024 11:40:42 +0000 (13:40 +0200)]
fabrics: extend already connected message

The 'already connected' message only contains the traddr as info. Add
the missing information so that it's possible to figure out what
combination is already in use.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agofabrics: use cleanup helper to free nvme root object
Daniel Wagner [Wed, 3 Jul 2024 09:42:42 +0000 (11:42 +0200)]
fabrics: use cleanup helper to free nvme root object

Simplify the error handling path by using the cleanup helpers.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agobuild: bump libnvme wrap
Daniel Wagner [Fri, 12 Jul 2024 08:20:25 +0000 (10:20 +0200)]
build: bump libnvme wrap

Fetch hostnqn changes.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme: check MD size with PI size when PRACT set to 1
Francis Pravin [Fri, 12 Jul 2024 06:18:51 +0000 (11:48 +0530)]
nvme: check MD size with PI size when PRACT set to 1

As per NVM Command Set Specification, Rev 1.0d, Sec-5.2.2 PRACT Bit:
"If PRACT bit is set to 1 and Metadata size equals to the Protection
Information size, the protection information is stripped or inserted
by the controller."
Currently NVMe supports 8 and 16 byte size of Protection Information.
So, use pi_size instead of 8 byte.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
12 months agonvme-print: add new field added in TP4090
Nitin Sao [Wed, 26 Jun 2024 03:17:42 +0000 (08:47 +0530)]
nvme-print: add new field added in TP4090

As per TP4090, a new field support is added as NPDGL (Namespace
Preferred Deallocate Granularity Large) and so the bit-field of
NSFEAT, OPTPERF get extended by 1 bit.

Signed-off-by: Nitin Sao <nitin.sao@samsung.com>
Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Reviewed-by: Mohit Kapoor <mohit.kap@samsung.com>
12 months agobuild: bump libnvme wrap
Nitin Sao [Wed, 26 Jun 2024 03:17:42 +0000 (08:47 +0530)]
build: bump libnvme wrap

Fetch npdgl field from nvme_nvm_id_ns

Signed-off-by: Nitin Sao <nitin.sao@samsung.com>
12 months agonvme-print-binary: add effects-log command output missed
Tokunori Ikegami [Tue, 9 Jul 2024 15:55:49 +0000 (00:55 +0900)]
nvme-print-binary: add effects-log command output missed

The csi data added before effects log page output.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agobuild: add documentation CI build
Daniel Wagner [Wed, 10 Jul 2024 06:58:16 +0000 (08:58 +0200)]
build: add documentation CI build

Build the documentation in the CI build to catch formatting issues in
the submissions.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agocompletions: add ocp get-error-injection command
Tokunori Ikegami [Sun, 7 Jul 2024 07:52:44 +0000 (16:52 +0900)]
completions: add ocp get-error-injection command

The set-error-injection command will be added separately.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agodoc: add ocp get-error-injection command
Tokunori Ikegami [Sun, 7 Jul 2024 07:36:07 +0000 (16:36 +0900)]
doc: add ocp get-error-injection command

The set-error-injection command will be added separately.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agoocp: add get-error-injection command
Tokunori Ikegami [Sun, 7 Jul 2024 06:08:20 +0000 (15:08 +0900)]
ocp: add get-error-injection command

The set-error-injection command will be added separately.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agoocp: fix eol-plp-failure-mode command sel option value
Tokunori Ikegami [Sun, 7 Jul 2024 09:11:05 +0000 (18:11 +0900)]
ocp: fix eol-plp-failure-mode command sel option value

Since the select value 8 as changed not supported by the command.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agodoc: fix ocp eol-plp-failure-mode select short option
Tokunori Ikegami [Sun, 7 Jul 2024 08:20:55 +0000 (17:20 +0900)]
doc: fix ocp eol-plp-failure-mode select short option

Fix -s to -S since the -s is used for the save short option.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agoocp: set UUID index for eol-plp-failure-mode command to get
Tokunori Ikegami [Sun, 7 Jul 2024 06:28:54 +0000 (15:28 +0900)]
ocp: set UUID index for eol-plp-failure-mode command to get

The value required from OCP version 2.0 for get feature command also.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agonvme: fix verbose logging
Martin George [Mon, 8 Jul 2024 16:03:58 +0000 (21:33 +0530)]
nvme: fix verbose logging

The -v verbose option for certain nvme commands like id-ctrl,
id-ns, smart-log, sanitize-log, etc. is practically a no-op since
it only prints latency info in addition to the regular output.
But at the same time, these commands already implement a -H human
readable option which prints additional useful info. So fix the
-v option to make it synonymous with the -H option here. And while
we are at it, move the latency info from current INFO level (i.e.
-v logging) to DEBUG level (i.e. -vv logging) since it is better
suited there.

Signed-off-by: Martin George <marting@netapp.com>
12 months agodoc: fix micron ocp telemetry log parse title
Daniel Wagner [Tue, 9 Jul 2024 15:38:41 +0000 (17:38 +0200)]
doc: fix micron ocp telemetry log parse title

The title needs a man page section info.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme-rpmb: send RPMB_REQ_READ_RESULT for authentication key programming
Tokunori Ikegami [Fri, 28 Jun 2024 11:57:40 +0000 (20:57 +0900)]
nvme-rpmb: send RPMB_REQ_READ_RESULT for authentication key programming

This follows the NVMe revision 2.0a authentication key data flow.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agoplugins/micron: Add support for OCP telemetry log parsing
Chaithanya shoba [Fri, 24 May 2024 07:26:08 +0000 (12:56 +0530)]
plugins/micron: Add support for OCP telemetry log parsing

Datacenter NVMe SSD Specification v2.5r9, section 4.9.

Signed-off-by: Chaithanya Shoba <ashoba@micron.com>
12 months agoocp: Update Plugin Version
jeff-lien-wdc [Fri, 5 Jul 2024 14:35:08 +0000 (09:35 -0500)]
ocp: Update Plugin Version

Update ocp plugin version to 2.9.0

Signed-off-by: jeff-lien-wdc <jeff.lien@wdc.com>
12 months agonvme: fix lbaf inuse to use 6:5 bits
Steven Seungcheol Lee [Mon, 8 Jul 2024 06:55:54 +0000 (15:55 +0900)]
nvme: fix lbaf inuse to use 6:5 bits

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
12 months agoocp: use NVME_ARGS macro definition by eol-plp-failure-mode command
Tokunori Ikegami [Sun, 7 Jul 2024 13:55:14 +0000 (22:55 +0900)]
ocp: use NVME_ARGS macro definition by eol-plp-failure-mode command

The verbose, output-format and timeout options enabled by the macro.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agonvme: extern NVME_ARGS macro definition
Tokunori Ikegami [Sun, 7 Jul 2024 13:52:41 +0000 (22:52 +0900)]
nvme: extern NVME_ARGS macro definition

To use the macro by the plugins/ocp commands etc.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agonvme: use _cleanup_free_ type buffer for get-feature command
Tokunori Ikegami [Sat, 6 Jul 2024 11:35:25 +0000 (20:35 +0900)]
nvme: use _cleanup_free_ type buffer for get-feature command

Reduce the buffer free calls.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agoplugins/ocp: Update telemetry string log page (C9h)
Vigneshwaran Saravanan/Vigneshwaran Saravanan [Thu, 4 Jul 2024 08:36:02 +0000 (14:06 +0530)]
plugins/ocp: Update telemetry string log page (C9h)

Take care the below failures for "telemetry-string-log".

Resolved the json printing issue.

Changed the Statistic Identifier, Event String, Vendor Unique, ASCII
table offset and size calculation.

Reviewed-by: Karthik Balan <karthik.b82@samsung.com>
Reviewed-by: Arunpandian J <arun.j@samsung.com>
Reviewed-by: Jayakanthan Rajendran <jaya.ganthan@samsung.com>
Signed-off-by: Vigneshwaran Saravanan <s.vignesh@samsung.com>
12 months agonvme-print-json: add get-feature command fahrenheit temperature output
Tokunori Ikegami [Sun, 30 Jun 2024 06:56:27 +0000 (15:56 +0900)]
nvme-print-json: add get-feature command fahrenheit temperature output

Add temperature threshold and host controlled thermal management outputs.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agonvme: add get-feature and id-ctrl commands fahrenheit outputs
Tokunori Ikegami [Fri, 5 Jul 2024 16:01:15 +0000 (01:01 +0900)]
nvme: add get-feature and id-ctrl commands fahrenheit outputs

Show temperatures in degrees fahrenheit by the option.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agonvme: delete smart-log command fahrenheit option
Tokunori Ikegami [Fri, 5 Jul 2024 15:52:48 +0000 (00:52 +0900)]
nvme: delete smart-log command fahrenheit option

Used locale for the fahrenheit temperature instead.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agonvme-print: check locale to use temperatures in degrees fahrenheit
Tokunori Ikegami [Thu, 4 Jul 2024 16:55:45 +0000 (01:55 +0900)]
nvme-print: check locale to use temperatures in degrees fahrenheit

Delete the fahrenheit option separately.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agocompletion: add support for tls-key
Daniel Wagner [Thu, 4 Jul 2024 17:17:46 +0000 (19:17 +0200)]
completion: add support for tls-key

The tls-key command is missing support for the zsh and bash completion.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agodoc: add tls-key --revoke documentation
Daniel Wagner [Mon, 1 Jul 2024 09:24:12 +0000 (11:24 +0200)]
doc: add tls-key --revoke documentation

Add the --revoke option to the tls-key documentation.

While at it, add examples how to use it.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agodoc: fix tls-key --keyfile shorthand
Daniel Wagner [Thu, 4 Jul 2024 17:20:27 +0000 (19:20 +0200)]
doc: fix tls-key --keyfile shorthand

The shorthand for --keyfile is -f and not -k.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agobuild: sort documentation files entries
Daniel Wagner [Mon, 1 Jul 2024 12:38:27 +0000 (14:38 +0200)]
build: sort documentation files entries

Sort the file names alphabetically.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme: add support to revoke TLS key
Daniel Wagner [Mon, 1 Jul 2024 09:13:11 +0000 (11:13 +0200)]
nvme: add support to revoke TLS key

Add support to nvme-cli to revoke TLS keys from a keyring.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme: return error code/message for TLS commands
Daniel Wagner [Tue, 9 Jul 2024 09:19:06 +0000 (11:19 +0200)]
nvme: return error code/message for TLS commands

Propagate error codes for TLS commands. Also print an error message when
scanning TLS keys.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme: factor out import key function
Daniel Wagner [Fri, 28 Jun 2024 18:12:55 +0000 (20:12 +0200)]
nvme: factor out import key function

Split the command line option handling code from the operation.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme: use cleanup helper to close file descriptor
Daniel Wagner [Thu, 4 Jul 2024 16:43:54 +0000 (18:43 +0200)]
nvme: use cleanup helper to close file descriptor

io_mgmt_send uses a file descriptor. Let's use the cleanup helper to
close it.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme-rpmb: use cleanup helper for STREAM objects
Daniel Wagner [Thu, 4 Jul 2024 16:42:46 +0000 (18:42 +0200)]
nvme-rpmb: use cleanup helper for STREAM objects

write_file uses a STREAM. Let's use the cleanup helper to close it.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agofabrics: use cleanup helper for STREAM objects
Daniel Wagner [Thu, 4 Jul 2024 16:41:35 +0000 (18:41 +0200)]
fabrics: use cleanup helper for STREAM objects

discover_from_conf_file uses a STREAM. Let's use the cleanup helper to
close it.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme: use cleanup helper for STREAM objects
Daniel Wagner [Thu, 4 Jul 2024 16:38:56 +0000 (18:38 +0200)]
nvme: use cleanup helper for STREAM objects

The tls_key function is using a STREAM object and closes it when leaving
the context. Update it to use the helper.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme: strip newline when parsing TLS key files
Daniel Wagner [Mon, 1 Jul 2024 12:46:04 +0000 (14:46 +0200)]
nvme: strip newline when parsing TLS key files

When exporting a TLS keys from the kernel keyring a line might have a
newline. Strip the newline away as the nvme_import_tls_key is not
expecting it and thus fails to load an exported keyfile.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme: use stdout for exporting TLS keys
Daniel Wagner [Mon, 1 Jul 2024 09:41:11 +0000 (11:41 +0200)]
nvme: use stdout for exporting TLS keys

The export command should use stdout as default output as documentation
claims. Furthermore, it should open the keyfile to write in write mode.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agobuild: bump libnvme wrap
Daniel Wagner [Thu, 4 Jul 2024 17:28:07 +0000 (19:28 +0200)]
build: bump libnvme wrap

Fetch nvme_revoke_tls_key.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme: change _cleanup_file_ to _cleanup_fd_
Tokunori Ikegami [Thu, 4 Jul 2024 15:59:56 +0000 (00:59 +0900)]
nvme: change _cleanup_file_ to _cleanup_fd_

Add _cleanup_file_ to clean up file stream instead.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agocommon.h: Avoid using unsupported load/store instructions in arm64 VMs
Oliver Upton [Thu, 4 Jul 2024 09:09:40 +0000 (09:09 +0000)]
common.h: Avoid using unsupported load/store instructions in arm64 VMs

Using nvme show-regs within a VM on arm64 can sometimes lead to VM
termination.

To answer why this happens: one of the deficiencies of the Arm
architecture is that there exists a range of load/store instructions
that have insufficient decode information for traps taken to the
hypervisor. KVM, for example, may raise an external abort or outright
terminate the VM depending on the configuration.

This is a known problem on the kernel side, and is fixed by using
assembly MMIO accessors w/ 'safe' load/store instructions. So do
exactly that, providing arm64-specific accessors and falling back to
plain old volatile pointer accesses for other architectures.

Reported-by: William Butler <wab@google.com>
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
12 months agoocp: OCP 2.5 Telemetry DA 1 and 2 Parsing Updates
jeff-lien-wdc [Wed, 10 Apr 2024 17:51:46 +0000 (12:51 -0500)]
ocp: OCP 2.5 Telemetry DA 1 and 2 Parsing Updates

This commit will provide the first phase of changes
needed for parsing of OCP 2.5 Telemetry Data Areas
1 and 2.  It will decode the prefined classes,
statistics, and events.

Signed-off-by: jeff-lien-wdc <jeff.lien@wdc.com>
12 months agonvme-print-stdout: refactor subsys config
Daniel Wagner [Tue, 2 Jul 2024 12:21:51 +0000 (14:21 +0200)]
nvme-print-stdout: refactor subsys config

DRY the subsys config output. Refactor into a helper.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agowdc: Fix compiler warning.
jeff-lien-wdc [Tue, 2 Jul 2024 14:45:23 +0000 (09:45 -0500)]
wdc: Fix compiler warning.

Make the file_path array size big enough to contain the
full directory and file name.

Signed-off-by: jeff-lien-wdc <jeff.lien@wdc.com>
12 months agonvme: add flags type nvme_print_flags_t
Tokunori Ikegami [Mon, 1 Jul 2024 16:06:31 +0000 (01:06 +0900)]
nvme: add flags type nvme_print_flags_t

Change the flags type to the type from enum nvme_print_flags.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agonvme-print: Use 'unsigned int' instead of 'unsigned'
Tokunori Ikegami [Sat, 29 Jun 2024 07:41:56 +0000 (16:41 +0900)]
nvme-print: Use 'unsigned int' instead of 'unsigned'

Fix for the checkpatch review error below.
  Error: WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agonvme: update parse_args() return value handling
Martin George [Sun, 30 Jun 2024 07:39:07 +0000 (13:09 +0530)]
nvme: update parse_args() return value handling

Treat non-zero return values from parse_args() as errors, and not
just negative return values. Also makes this consistent with other
functions in nvme.c where parse_args() is invoked.

Signed-off-by: Martin George <marting@netapp.com>
13 months agonvme-print: Fix nvme_show_smart_log indentation error
Tokunori Ikegami [Fri, 28 Jun 2024 15:39:31 +0000 (00:39 +0900)]
nvme-print: Fix nvme_show_smart_log indentation error

Follow the linux kernel coding style indentation.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agonvme-print-stdout: Fix stdout_smart_log indentation error
Tokunori Ikegami [Fri, 28 Jun 2024 15:35:26 +0000 (00:35 +0900)]
nvme-print-stdout: Fix stdout_smart_log indentation error

Follow the linux kernel coding style indentation.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agonvme-print-binary: Fix binary_smart_log indentation error
Tokunori Ikegami [Fri, 28 Jun 2024 15:33:28 +0000 (00:33 +0900)]
nvme-print-binary: Fix binary_smart_log indentation error

Follow the linux kernel coding style indentation.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agocompletions: add smart-log command fahrenheit option
Tokunori Ikegami [Fri, 28 Jun 2024 09:11:11 +0000 (18:11 +0900)]
completions: add smart-log command fahrenheit option

Added the verbose option missed also.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agodoc: Add smart-log command fahrenheit option
Tokunori Ikegami [Fri, 28 Jun 2024 08:58:08 +0000 (17:58 +0900)]
doc: Add smart-log command fahrenheit option

Show temperatures in degrees fahrenheit by the option.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agonvme: Add smart-log command fahrenheit option
Tokunori Ikegami [Fri, 28 Jun 2024 15:39:03 +0000 (00:39 +0900)]
nvme: Add smart-log command fahrenheit option

Show temperatures in degrees fahrenheit by the option.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agonvme-print: add PEL vendor specific and TCG defined events strings
Tokunori Ikegami [Fri, 28 Jun 2024 08:31:52 +0000 (17:31 +0900)]
nvme-print: add PEL vendor specific and TCG defined events strings

Added the PEL event types definitions in libnvme.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agobuild: bump libnvme wrap
Tokunori Ikegami [Fri, 28 Jun 2024 08:31:32 +0000 (17:31 +0900)]
build: bump libnvme wrap

Include libnvme nvme_persistent_event_types definition changes.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agonvme-print: Print PEL reserved event string
Tokunori Ikegami [Fri, 28 Jun 2024 01:12:54 +0000 (10:12 +0900)]
nvme-print: Print PEL reserved event string

Previously PEL reserved event output as NULL string.
This resolves to print as reserved event with the event type value.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agocompletions: Add timeout option bash completions
Tokunori Ikegami [Sun, 14 Apr 2024 04:19:03 +0000 (13:19 +0900)]
completions: Add timeout option bash completions

Added the option as a nvme default option.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agocompletions: Add timeout option zsh completions
Tokunori Ikegami [Sat, 13 Apr 2024 17:09:45 +0000 (02:09 +0900)]
completions: Add timeout option zsh completions

Added the option as a nvme default option.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agocompletions: Add io-mgmt-recv/send commands zsh completions
Tokunori Ikegami [Sat, 13 Apr 2024 17:07:10 +0000 (02:07 +0900)]
completions: Add io-mgmt-recv/send commands zsh completions

Missed to add the commands completions.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agocompletions: Add /dev/nvme argument missed
Tokunori Ikegami [Sat, 13 Apr 2024 17:02:29 +0000 (02:02 +0900)]
completions: Add /dev/nvme argument missed

The nvme-mi-recv/send and get/set-reg commands missed it.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agocompletions: Change fw-activate command name to fw-commit
Tokunori Ikegami [Sat, 13 Apr 2024 16:39:26 +0000 (01:39 +0900)]
completions: Change fw-activate command name to fw-commit

The fw-activate command is old version prior to 1.2.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agocompletions: Fix _nvme indentation errors
Tokunori Ikegami [Wed, 26 Jun 2024 15:31:50 +0000 (00:31 +0900)]
completions: Fix _nvme indentation errors

Fix white spaces indentation to use tabs.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agocompletions: Fix bash-nvme-completion.sh indentation errors
Tokunori Ikegami [Sat, 13 Apr 2024 16:29:15 +0000 (01:29 +0900)]
completions: Fix bash-nvme-completion.sh indentation errors

Fix white spaces indentation to use tabs.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agodoc: Add nvme commands timeout option
Tokunori Ikegami [Thu, 11 Apr 2024 16:01:01 +0000 (01:01 +0900)]
doc: Add nvme commands timeout option

The option added as NVME_ARGS default option.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agonvme: Add support for delete-ns command timeout option
Tokunori Ikegami [Wed, 10 Apr 2024 16:13:14 +0000 (01:13 +0900)]
nvme: Add support for delete-ns command timeout option

Change to pass the timeout value to libnvme API.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agonvme: Change NVME_DEFAULT_IOCTL_TIMEOUT to use nvme_cfg timeout
Tokunori Ikegami [Wed, 10 Apr 2024 15:17:51 +0000 (00:17 +0900)]
nvme: Change NVME_DEFAULT_IOCTL_TIMEOUT to use nvme_cfg timeout

The timeout variable zero initialized as same with the default definition.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agonvme: Add nvme_cfg timeout default option
Tokunori Ikegami [Wed, 10 Apr 2024 14:53:05 +0000 (23:53 +0900)]
nvme: Add nvme_cfg timeout default option

Replace the existing timeout options to use this instead.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agonvme: Add nvme_cfg global variable for NVME_ARGS default options
Tokunori Ikegami [Wed, 26 Jun 2024 15:29:38 +0000 (00:29 +0900)]
nvme: Add nvme_cfg global variable for NVME_ARGS default options

To preapare to add NVME_ARGS default option further.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agonvme: add helper function to get pif and sts value
Francis Pravin [Wed, 26 Jun 2024 13:37:50 +0000 (19:07 +0530)]
nvme: add helper function to get pif and sts value

Add a helper function to get pif and sts value from elbaf filed.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
13 months agonvme: choose PIF from QPIF if QPIFS supports and PIF is QTYPE
Francis Pravin [Wed, 26 Jun 2024 06:35:39 +0000 (12:05 +0530)]
nvme: choose PIF from QPIF if QPIFS supports and PIF is QTYPE

As per TP4141a:
"If the Qualified Protection Information Format Support(QPIFS) bit is
set to 1 and the Protection Information Format(PIF) field is set to 11b
(i.e., Qualified Type), then the pif is as defined in the Qualified
Protection Information Format (QPIF) field."
So, choose PIF from QPIF if QPIFS supports and PIF is QTYPE.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
13 months agonvme: use libnvme's atomic ANA log page fetch
Caleb Sander Mateos [Tue, 30 Apr 2024 22:35:01 +0000 (16:35 -0600)]
nvme: use libnvme's atomic ANA log page fetch

nvme ana-log currently uses libnvme's nvme{,_mi_admin}_get_log_ana()
function to fetch the ANA log page.
As described in the commit adding nvme_get_ana_log_atomic() to libnvme,
this has the potential to overread the ANA log page
and may result in a torn result if the log page changes concurrently.
Use nvme{,_mi_admin}_get_ana_log_atomic() to only fetch up to the end
of the ANA log page and protect against concurrent log page changes.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
13 months agonvme: fix maximum ANA log page length calculation
Caleb Sander Mateos [Mon, 24 Jun 2024 21:31:39 +0000 (15:31 -0600)]
nvme: fix maximum ANA log page length calculation

nvme ana-log only includes space for MNAN namespace IDs
in the allocated ANA log page buffer if bit 6 of ANACAP
in the Identify Controller structure isn't set.

But the specification says:
Bit 6 if set to '1', then the ANAGRPID field in the Identify Namespace
data structure (refer to the NVM Command Set Specification)
does not change while the namespace is attached to any controller

There is no suggestion that NSIDs won't be returned in the ANA log page.

However, we can exclude space for NSIDs from the allocated buffer
if the Get Log Page command is going to be sent with the RGO bit set,
i.e. the --groups argument is passed.

Therefore, use the libnvme helper nvme_get_ana_log_len_from_id_ctrl()
to calculate the maximum ANA log page length.
It ignores ANACAP and takes the RGO setting into account.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Fixes: bb269bdb5392 ("nvme-cli: add minimal ana-log page support")
13 months agobuild: update libnvme wrap
Caleb Sander Mateos [Tue, 25 Jun 2024 15:03:37 +0000 (09:03 -0600)]
build: update libnvme wrap

Pick up support for nvme_get_ana_log_atomic()
and nvme_get_ana_log_len_from_id_ctrl().

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
13 months agonvme-print-json: add missing va_end()
Maurizio Lombardi [Mon, 24 Jun 2024 15:35:56 +0000 (17:35 +0200)]
nvme-print-json: add missing va_end()

Every va_start() should be matched by a corresponding va_end()
to keep the static analyzers happy.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
13 months agofabrics: skip namespace scan for fabric commands
Daniel Wagner [Fri, 7 Jun 2024 12:43:55 +0000 (14:43 +0200)]
fabrics: skip namespace scan for fabric commands

The fabric commands such as connect or disconnect don't need a full
topology scan. The scan is not scalling well on larger setups, thus skip
it.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
13 months agonvme-print: print the new fields added in TP4141a
Francis Pravin [Fri, 21 Jun 2024 07:36:22 +0000 (13:06 +0530)]
nvme-print: print the new fields added in TP4141a

Print the newly added fields in TP4141a. Also, fixed the stcrs
bit mask value.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>