From: Wang Yugui <wangyugui@e16-tech.com>
To: linux-nvme@lists.infradead.org
Cc: Wang Yugui <wangyugui@e16-tech.com>
Subject: [PATCH RFC] basic RMEDIA support for nvme host
Date: Wed, 24 Jul 2024 07:24:19 +0800 [thread overview]
Message-ID: <20240723232419.19753-1-wangyugui@e16-tech.com> (raw)
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
next reply other threads:[~2024-07-23 23:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-23 23:24 Wang Yugui [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240723232419.19753-1-wangyugui@e16-tech.com \
--to=wangyugui@e16-tech.com \
--cc=linux-nvme@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox