Commit c0561f82 authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Christoph Hellwig

nvme: submit AEN event configuration on startup

We should register for AEN events; some law-abiding targets might
not be sending us AENs otherwise.
Signed-off-by: default avatarHannes Reinecke <hare@suse.com>
[hch: slight cleanups]
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
parent 55fdd6b6
...@@ -1030,6 +1030,21 @@ int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count) ...@@ -1030,6 +1030,21 @@ int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count)
} }
EXPORT_SYMBOL_GPL(nvme_set_queue_count); EXPORT_SYMBOL_GPL(nvme_set_queue_count);
#define NVME_AEN_SUPPORTED \
(NVME_AEN_CFG_NS_ATTR | NVME_AEN_CFG_FW_ACT)
static void nvme_enable_aen(struct nvme_ctrl *ctrl)
{
u32 result;
int status;
status = nvme_set_features(ctrl, NVME_FEAT_ASYNC_EVENT,
ctrl->oaes & NVME_AEN_SUPPORTED, NULL, 0, &result);
if (status)
dev_warn(ctrl->device, "Failed to configure AEN (cfg %x)\n",
ctrl->oaes & NVME_AEN_SUPPORTED);
}
static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio)
{ {
struct nvme_user_io io; struct nvme_user_io io;
...@@ -2347,6 +2362,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl) ...@@ -2347,6 +2362,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
ctrl->oacs = le16_to_cpu(id->oacs); ctrl->oacs = le16_to_cpu(id->oacs);
ctrl->oncs = le16_to_cpup(&id->oncs); ctrl->oncs = le16_to_cpup(&id->oncs);
ctrl->oaes = le32_to_cpu(id->oaes);
atomic_set(&ctrl->abort_limit, id->acl + 1); atomic_set(&ctrl->abort_limit, id->acl + 1);
ctrl->vwc = id->vwc; ctrl->vwc = id->vwc;
ctrl->cntlid = le16_to_cpup(&id->cntlid); ctrl->cntlid = le16_to_cpup(&id->cntlid);
...@@ -3379,6 +3395,7 @@ void nvme_start_ctrl(struct nvme_ctrl *ctrl) ...@@ -3379,6 +3395,7 @@ void nvme_start_ctrl(struct nvme_ctrl *ctrl)
if (ctrl->queue_count > 1) { if (ctrl->queue_count > 1) {
nvme_queue_scan(ctrl); nvme_queue_scan(ctrl);
nvme_enable_aen(ctrl);
queue_work(nvme_wq, &ctrl->async_event_work); queue_work(nvme_wq, &ctrl->async_event_work);
nvme_start_queues(ctrl); nvme_start_queues(ctrl);
} }
......
...@@ -176,6 +176,7 @@ struct nvme_ctrl { ...@@ -176,6 +176,7 @@ struct nvme_ctrl {
u16 kas; u16 kas;
u8 npss; u8 npss;
u8 apsta; u8 apsta;
u32 oaes;
u32 aen_result; u32 aen_result;
unsigned int shutdown_timeout; unsigned int shutdown_timeout;
unsigned int kato; unsigned int kato;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment