Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] basic RMEDIA support for nvme host
@ 2024-07-23 23:24 Wang Yugui
  2024-07-24 12:30 ` [PATCH RFC v2] nvme: basic RMEDIA support for host Wang Yugui
  2024-08-06  0:48 ` [PATCH RFC v3] " Wang Yugui
  0 siblings, 2 replies; 15+ messages in thread
From: Wang Yugui @ 2024-07-23 23:24 UTC (permalink / raw)
  To: linux-nvme; +Cc: Wang Yugui

Rotational media(RMEDIA) support is added the NVMe 2.0 specification.
We firstly add Rotational media(RMEDIA) support to nvme host, then we can add
the support to nvme target later if the backstore is a Rotational media(RMEDIA)
block device.

Signed-off-by: Wang Yugui <wangyugui@e16-tech.com>
---
 drivers/nvme/host/core.c | 5 +++++
 include/linux/nvme.h     | 1 +
 2 files changed, 6 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 19917253ba7b..f4c41bf70b19 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -40,6 +40,7 @@ struct nvme_ns_info {
 	bool is_readonly;
 	bool is_ready;
 	bool is_removed;
+	bool is_rmedia;
 };
 
 unsigned int admin_timeout = 60;
@@ -1622,6 +1623,7 @@ static int nvme_ns_info_from_id_cs_indep(struct nvme_ctrl *ctrl,
 		info->is_shared = id->nmic & NVME_NS_NMIC_SHARED;
 		info->is_readonly = id->nsattr & NVME_NS_ATTR_RO;
 		info->is_ready = id->nstat & NVME_NSTAT_NRDY;
+		info->is_rmedia = id->nsfeat & NVME_INDEP_NS_FEAT_RMEDIA;
 	}
 	kfree(id);
 	return ret;
@@ -2164,6 +2166,9 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
 	else
 		lim.features &= ~(BLK_FEAT_WRITE_CACHE | BLK_FEAT_FUA);
 
+	if(info->is_rmedia)
+		lim.lim.features |= BLK_FEAT_ROTATIONAL;
+
 	/*
 	 * Register a metadata profile for PI, or the plain non-integrity NVMe
 	 * metadata masquerading as Type 0 if supported, otherwise reject block
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index c12a329dd463..2c259d126f80 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -546,6 +546,7 @@ enum {
 	NVME_NS_FEAT_THIN	= 1 << 0,
 	NVME_NS_FEAT_ATOMICS	= 1 << 1,
 	NVME_NS_FEAT_IO_OPT	= 1 << 4,
+	NVME_INDEP_NS_FEAT_RMEDIA = 1 << 4,
 	NVME_NS_ATTR_RO		= 1 << 0,
 	NVME_NS_FLBAS_LBA_MASK	= 0xf,
 	NVME_NS_FLBAS_LBA_UMASK	= 0x60,
-- 
2.36.2



^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-08-12 14:28 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-23 23:24 [PATCH RFC] basic RMEDIA support for nvme host Wang Yugui
2024-07-24 12:30 ` [PATCH RFC v2] nvme: basic RMEDIA support for host Wang Yugui
2024-07-25  0:43   ` Damien Le Moal
2024-07-25  1:56     ` Wang Yugui
2024-07-25 14:10     ` Christoph Hellwig
2024-07-25 22:59       ` Damien Le Moal
2024-08-12 14:28         ` Hannes Reinecke
2024-07-25 14:09   ` Christoph Hellwig
2024-08-06  0:48 ` [PATCH RFC v3] " Wang Yugui
2024-08-06  0:49   ` [PATCH RFC] nvmet: basic RMEDIA support for target Wang Yugui
2024-08-06  8:11     ` Sagi Grimberg
2024-08-06  9:08       ` Wang Yugui
2024-08-06  9:42     ` [PATCH RFC v2] " Wang Yugui
2024-08-06 12:40     ` [PATCH RFC v3] " Wang Yugui
2024-08-07 12:14       ` Sagi Grimberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox