Message ID | 1497799324-19598-30-git-send-email-sagi@grimberg.me (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Sun, Jun 18, 2017 at 06:22:03PM +0300, Sagi Grimberg wrote:
> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
The subject sounds odd and it could use a changelog. But I'd love to
pick this change up ASAP as it's the right thing to do..
> The subject sounds odd and it could use a changelog. But I'd love to > pick this change up ASAP as it's the right thing to do.. How? where would you place it? there is no nvme_configure_admin_queue in nvme-core. I suppose we could get it in nvme_init_ctrl?
On Mon, Jun 19, 2017 at 11:03:36AM +0300, Sagi Grimberg wrote: > >> The subject sounds odd and it could use a changelog. But I'd love to >> pick this change up ASAP as it's the right thing to do.. > > How? where would you place it? there is no nvme_configure_admin_queue in > nvme-core. Doh. Yeah, let's keep it where it is.
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 476c49c0601f..f4800b8e47a0 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2493,6 +2493,7 @@ static void nvme_free_ctrl(struct kref *kref) put_device(ctrl->device); nvme_release_instance(ctrl); ida_destroy(&ctrl->ns_ida); + free_opal_dev(ctrl->opal_dev); ctrl->ops->free_ctrl(ctrl); } @@ -2814,6 +2815,7 @@ EXPORT_SYMBOL_GPL(nvme_destroy_admin_queue); int nvme_configure_admin_queue(struct nvme_ctrl *ctrl, bool new) { + bool was_suspend = !!(ctrl->ctrl_config & NVME_CC_SHN_NORMAL); int error; error = ctrl->ops->alloc_hw_queue(ctrl, 0, NVME_AQ_DEPTH); @@ -2868,6 +2870,16 @@ int nvme_configure_admin_queue(struct nvme_ctrl *ctrl, bool new) if (error) goto out_cleanup_connect_queue; + if (ctrl->oacs & NVME_CTRL_OACS_SEC_SUPP) { + if (!ctrl->opal_dev) + ctrl->opal_dev = init_opal_dev(ctrl, &nvme_sec_submit); + else if (was_suspend) + opal_unlock_from_suspend(ctrl->opal_dev); + } else { + free_opal_dev(ctrl->opal_dev); + ctrl->opal_dev = NULL; + } + nvme_start_keep_alive(ctrl); return 0;
Signed-off-by: Sagi Grimberg <sagi@grimberg.me> --- drivers/nvme/host/core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)