git: f676c13d4226 - main - nvme: Allow command opcodes with lower bit clear as reads
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 30 Apr 2025 23:06:19 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=f676c13d422661088f4e9449a7383e589ca54f54
commit f676c13d422661088f4e9449a7383e589ca54f54
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-04-30 23:05:07 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-04-30 23:05:44 +0000
nvme: Allow command opcodes with lower bit clear as reads
Linux does this, and nvme-cli has some vendor specific opcodes that need
this.
Sponsored by: Netflix
Reviewed by: chuck
Differential Revision: https://reviews.freebsd.org/D50064
---
sys/dev/nvme/nvme_ctrlr.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c
index c47e7ece5a04..e82e468775dc 100644
--- a/sys/dev/nvme/nvme_ctrlr.c
+++ b/sys/dev/nvme/nvme_ctrlr.c
@@ -1358,8 +1358,13 @@ nvme_ctrlr_linux_passthru_cmd(struct nvme_controller *ctrlr,
npc->data_len, ctrlr->max_xfer_size);
return (EIO);
}
- /* We only support data out or data in commands, but not both at once. */
- if ((npc->opcode & 0x3) == 0 || (npc->opcode & 0x3) == 3)
+ /*
+ * We only support data out or data in commands, but not both at
+ * once. However, there's some comands with lower bit cleared
+ * that are really read commands, so we should filter & 3 == 0,
+ * but don't.
+ */
+ if ((npc->opcode & 0x3) == 3)
return (EINVAL);
if (is_user) {
buf = uma_zalloc(pbuf_zone, M_WAITOK);