[PATCH v3 17/21] nvme: Add support for CQT to nvme host
From: Mohamed Khalfella
Date: Fri Feb 13 2026 - 23:29:35 EST
TP4129 KATO Corrections and Clarifications defined CQT (Command Quiesce
Time) which is used along with KATO (Keep Alive Timeout) to set an upper
limit for attempting Cross-Controller Recovery. Add ctrl->cqt and
read its value from controller identify response. Update fence timeout
to consider ctrl->cqt.
Signed-off-by: Mohamed Khalfella <mkhalfella@xxxxxxxxxxxxxxx>
---
drivers/nvme/host/core.c | 1 +
drivers/nvme/host/nvme.h | 5 +++--
drivers/nvme/host/sysfs.c | 2 ++
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index a9fcde1b411b..0680d05900c1 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3739,6 +3739,7 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl)
ctrl->ciu = id->ciu;
ctrl->cirn = le64_to_cpu(id->cirn);
atomic_set(&ctrl->ccr_limit, id->ccrl);
+ ctrl->cqt = le16_to_cpu(id->cqt);
ctrl->oacs = le16_to_cpu(id->oacs);
ctrl->oncs = le16_to_cpu(id->oncs);
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index af6a4e83053e..a7f382e35821 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -336,6 +336,7 @@ struct nvme_ctrl {
u32 max_zone_append;
#endif
u16 crdt[3];
+ u16 cqt;
u16 oncs;
u8 dmrl;
u8 ciu;
@@ -1245,8 +1246,8 @@ static inline bool nvme_multi_css(struct nvme_ctrl *ctrl)
static inline unsigned long nvme_fence_timeout_ms(struct nvme_ctrl *ctrl)
{
if (ctrl->ctratt & NVME_CTRL_ATTR_TBKAS)
- return 3 * ctrl->kato * 1000;
- return 2 * ctrl->kato * 1000;
+ return 3 * ctrl->kato * 1000 + ctrl->cqt;
+ return 2 * ctrl->kato * 1000 + ctrl->cqt;
}
#endif /* _NVME_H */
diff --git a/drivers/nvme/host/sysfs.c b/drivers/nvme/host/sysfs.c
index 1e4261144933..0234e11730bb 100644
--- a/drivers/nvme/host/sysfs.c
+++ b/drivers/nvme/host/sysfs.c
@@ -387,6 +387,7 @@ nvme_show_int_function(numa_node);
nvme_show_int_function(queue_count);
nvme_show_int_function(sqsize);
nvme_show_int_function(kato);
+nvme_show_int_function(cqt);
static ssize_t nvme_sysfs_ciu_show(struct device *dev,
struct device_attribute *attr,
@@ -759,6 +760,7 @@ static struct attribute *nvme_dev_attrs[] = {
&dev_attr_sqsize.attr,
&dev_attr_ciu.attr,
&dev_attr_cirn.attr,
+ &dev_attr_cqt.attr,
&dev_attr_hostnqn.attr,
&dev_attr_hostid.attr,
&dev_attr_ctrl_loss_tmo.attr,
--
2.52.0