Skip to content

mi: Add ISH bit (admin command cflags)#3086

Merged
igaw merged 1 commit intolinux-nvme:masterfrom
sc108-lee:mi_ish
Feb 11, 2026
Merged

mi: Add ISH bit (admin command cflags)#3086
igaw merged 1 commit intolinux-nvme:masterfrom
sc108-lee:mi_ish

Conversation

@sc108-lee
Copy link
Contributor

Add ish bit for mi admin commands that access media

Spec NVM-Express-Management-Interface-Specification
-Revision-2.1-2025.08.01-Ratified
Figure 136: NVMe Admin Command Request Description Command Flags (CFLGS): Bit 2 : Ignore Shutdown (ISH) This bit shall have no effect on the value of the CSTS.SHST field.

(193 page from spec)
If an NVMe Admin Command does not require access to media, then the ISH bit shall have no effect on the processing of that NVMe Admin Command.

spec NVM-Express-Base-Specification-Revision-2.3-2025.08.01-Ratified Figure 84: Admin Commands Permitted to Return a Status Code of Admin
Command Media Not Ready

From Figure 84, we can assume that below Admin commands access media Capacity Management, Device Self-test, Firmware Commit, Firmware Image Download, Get LBA Status, Get Log Page, Namespace Attachment, Namespace Management, Format NVM, Sanitize, Sanitize Namespace, Security Receive, Security Send, Vendor Specific

Reported-by: Hojin Ahn hojin82.ahn@samsung.com

@igaw
Copy link
Collaborator

igaw commented Feb 10, 2026

I am not really happy to pass this flag through all helpers. This makes the number of arguments per function even bigger. Also the true/false as argument is not self explaining. What about introducing a dedicated helper just to set the flag?

Something like:

static inline void
nvme_init_cmd_flags(struct nvme_passthru_cmd *cmd, bool ish)
{
	cmd->flags = NVME_FIELD_ENCODE(ish,
			NVME_MI_ADMIN_CFLAGS_ISH_SHIFT,
			NVME_MI_ADMIN_CFLAGS_ISH_MASK);
}

And then

nvme_init_format_nvm(&cmd, nsid, lbaf, mset, pi, pil, ses);
if (ish) {
   if (nvme_transport_is_mi_handle(hdl))
     nvme_init_cmd_flags(&cmd, ish);
   else
     printf("no ISH not supported\n");
}

just as rough idea. naming could be improved.

Add ish bit for mi admin commands that access media

Spec NVM-Express-Management-Interface-Specification
     -Revision-2.1-2025.08.01-Ratified
Figure 136: NVMe Admin Command Request Description
Command Flags (CFLGS): Bit 2 : Ignore Shutdown (ISH)
This bit shall have no effect on the value of the CSTS.SHST field.

(193 page from spec)
If an NVMe Admin Command does not require access to media, then the ISH
bit shall have no effect on the processing of that NVMe Admin Command.

spec NVM-Express-Base-Specification-Revision-2.3-2025.08.01-Ratified
Figure 84: Admin Commands Permitted to Return a Status Code of Admin
           Command Media Not Ready

From Figure 84, we can assume that below Admin commands access media
Capacity Management, Device Self-test, Firmware Commit,
Firmware Image Download, Get LBA Status, Get Log Page,
Namespace Attachment, Namespace Management, Format NVM, Sanitize,
Sanitize Namespace, Security Receive, Security Send, Vendor Specific

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Reported-by: Hojin Ahn <hojin82.ahn@samsung.com>
@sc108-lee
Copy link
Contributor Author

@igaw Thanks for good opinion, Updated based on that :)

int nvme_fw_download_seq(struct nvme_transport_handle *hdl, __u32 size, __u32 xfer, __u32 offset,
void *buf);
int nvme_fw_download_seq(struct nvme_transport_handle *hdl, bool ish,
__u32 size, __u32 xfer, __u32 offset, void *buf);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see we still have to modify the linux.h API for this, because this is API is wrapping the command initialization and the command submission into one function. There are more of these function left in the code base. Ideally we could convert them somehow into the other style (splitting command initialization and submission). Though this is a different task. So for this here it's fine. I am glad we don't have to update all the ioctl.h APIs with this approach :)

@igaw igaw merged commit 5be98d6 into linux-nvme:master Feb 11, 2026
20 checks passed
@igaw
Copy link
Collaborator

igaw commented Feb 11, 2026

Nice, way better!

BTW, could you update the documentation for the commands as well? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants