From: james_p_freyensee@linux.intel.com (J Freyensee)
Subject: [RESEND PATCH 2/2] NVMe: Add nvme subsystem reset IOCTL
Date: Tue, 11 Aug 2015 09:11:03 -0700 [thread overview]
Message-ID: <1439309463.2790.3.camel@linux.intel.com> (raw)
In-Reply-To: <1439241641-3444-2-git-send-email-keith.busch@intel.com>
On Mon, 2015-08-10@15:20 -0600, Keith Busch wrote:
> From: Jon Derrick <jonathan.derrick at intel.com>
>
> Controllers can perform optional subsystem resets as introduced in
> NVMe
> 1.1. This patch adds an IOCTL to trigger the subsystem reset by
> writing
> "NVMe" to the NSSR register.
I just took a Linux Foundation training class and one of the points the
Foundation made was the Linux community wanting to move off of IOCTLs
to other userspace-to-kernelspace mechanisms (like sysfs for example).
I was wondering if it's a good thing to be continuing to add IOCTLs if
it is true that the Linux community would like to move off the reliance
of IOCTLs?
>
> Signed-off-by: Jon Derrick <jonathan.derrick at intel.com>
> Acked-by: Keith Busch <keith.busch at intel.com>
> ---
> drivers/block/nvme-core.c | 11 +++++++++++
> include/linux/nvme.h | 2 +-
> include/uapi/linux/nvme.h | 1 +
> 3 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
> index 4e19c8a..613c1bc 100644
> --- a/drivers/block/nvme-core.c
> +++ b/drivers/block/nvme-core.c
> @@ -1862,6 +1862,15 @@ static int nvme_user_cmd(struct nvme_dev *dev,
> struct nvme_ns *ns,
> return status;
> }
>
> +static int nvme_subsys_reset(struct nvme_dev *dev)
> +{
> + if (!dev->subsystem)
> + return -ENOTTY;
> +
> + writel(0x4E564D65, &dev->bar->nssr); /* "NVMe" */
> + return 0;
> +}
> +
> static int nvme_ioctl(struct block_device *bdev, fmode_t mode,
> unsigned int cmd,
> unsigned
> long arg)
> {
> @@ -2829,6 +2838,8 @@ static long nvme_dev_ioctl(struct file *f,
> unsigned int cmd, unsigned long arg)
> case NVME_IOCTL_RESET:
> dev_warn(dev->dev, "resetting controller\n");
> return nvme_reset(dev);
> + case NVME_IOCTL_SUBSYS_RESET:
> + return nvme_subsys_reset(dev);
> default:
> return -ENOTTY;
> }
> diff --git a/include/linux/nvme.h b/include/linux/nvme.h
> index a566b41..4d08354 100644
> --- a/include/linux/nvme.h
> +++ b/include/linux/nvme.h
> @@ -28,7 +28,7 @@ struct nvme_bar {
> __u32 cc; /* Controller Configuration
> */
> __u32 rsvd1; /* Reserved */
> __u32 csts; /* Controller Status */
> - __u32 rsvd2; /* Reserved */
> + __u32 nssr; /* Subsystem Reset */
> __u32 aqa; /* Admin Queue Attributes */
> __u64 asq; /* Admin SQ Base Address */
> __u64 acq; /* Admin CQ Base Address */
> diff --git a/include/uapi/linux/nvme.h b/include/uapi/linux/nvme.h
> index 732b32e..8864194 100644
> --- a/include/uapi/linux/nvme.h
> +++ b/include/uapi/linux/nvme.h
> @@ -584,5 +584,6 @@ struct nvme_passthru_cmd {
> #define NVME_IOCTL_SUBMIT_IO _IOW('N', 0x42, struct nvme_user_io)
> #define NVME_IOCTL_IO_CMD _IOWR('N', 0x43, struct
> nvme_passthru_cmd)
> #define NVME_IOCTL_RESET _IO('N', 0x44)
> +#define NVME_IOCTL_SUBSYS_RESET _IO('N', 0x45)
>
> #endif /* _UAPI_LINUX_NVME_H */
next prev parent reply other threads:[~2015-08-11 16:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-10 21:20 [RESEND PATCH 1/2] NVMe: Add nvme subsystem reset support Keith Busch
2015-08-10 21:20 ` [RESEND PATCH 2/2] NVMe: Add nvme subsystem reset IOCTL Keith Busch
2015-08-11 16:11 ` J Freyensee [this message]
2015-08-11 17:21 ` Keith Busch
2015-08-11 18:13 ` Christoph Hellwig
2015-08-11 21:23 ` J Freyensee
2015-08-18 17:56 ` [RESEND PATCH 1/2] NVMe: Add nvme subsystem reset support Jens Axboe
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=1439309463.2790.3.camel@linux.intel.com \
--to=james_p_freyensee@linux.intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.