summaryrefslogtreecommitdiffstats
path: root/drivers/nvme/host/pci.c
diff options
context:
space:
mode:
authorScott Bauer <scott.bauer@intel.com>2017-02-03 12:50:32 -0700
committerJens Axboe <axboe@fb.com>2017-02-06 09:44:21 -0700
commita98e58e54fbd0c80b6a46a7cac6e231eed3b3efa (patch)
treefa346839016a9667d47cf28d0744828d9db93006 /drivers/nvme/host/pci.c
parent455a7b238cd6bc68c4a550cbbd37c1e22b64f71c (diff)
downloadlinux-a98e58e54fbd0c80b6a46a7cac6e231eed3b3efa.tar.bz2
nvme: Add Support for Opal: Unlock from S3 & Opal Allocation/Ioctls
This patch implements the necessary logic to unlock an Opal enabled device coming back from an S3. The patch also implements the SED/Opal allocation necessary to support the opal ioctls. Signed-off-by: Scott Bauer <scott.bauer@intel.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/nvme/host/pci.c')
-rw-r--r--drivers/nvme/host/pci.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 06875bc1ba80..f08e86e73dda 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -43,6 +43,7 @@
#include <linux/types.h>
#include <linux/io-64-nonatomic-lo-hi.h>
#include <asm/unaligned.h>
+#include <linux/sed-opal.h>
#include "nvme.h"
@@ -1757,6 +1758,7 @@ static void nvme_remove_dead_ctrl(struct nvme_dev *dev, int status)
static void nvme_reset_work(struct work_struct *work)
{
struct nvme_dev *dev = container_of(work, struct nvme_dev, reset_work);
+ bool was_suspend = !!(dev->ctrl.ctrl_config & NVME_CC_SHN_NORMAL);
int result = -ENODEV;
if (WARN_ON(dev->ctrl.state == NVME_CTRL_RESETTING))
@@ -1789,6 +1791,11 @@ static void nvme_reset_work(struct work_struct *work)
if (result)
goto out;
+ init_opal_dev(&dev->ctrl.opal_dev, &nvme_sec_submit);
+
+ if (was_suspend)
+ opal_unlock_from_suspend(&dev->ctrl.opal_dev);
+
result = nvme_setup_io_queues(dev);
if (result)
goto out;