From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxim Levitsky Subject: [PATCH 3/9] nvme/core: add NVME_CTRL_SUSPENDED controller state Date: Tue, 19 Mar 2019 16:41:10 +0200 Message-ID: <20190319144116.400-4-mlevitsk@redhat.com> References: <20190319144116.400-1-mlevitsk@redhat.com> Cc: Maxim Levitsky , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Jens Axboe , Alex Williamson , Keith Busch , Christoph Hellwig , Sagi Grimberg , Kirti Wankhede , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Wolfram Sang , Nicolas Ferre , "Paul E . McKenney " , Paolo Bonzini , Liang Cunming , Liu Changpeng , Fam Zheng , Amnon Ilan , John Ferla To: linux-nvme@lists.infradead.org Return-path: In-Reply-To: <20190319144116.400-1-mlevitsk@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org This state will be used by a controller that is going to suspended state, and will later be used by mdev framework to detect this and flush its queues Signed-off-by: Maxim Levitsky --- drivers/nvme/host/core.c | 15 +++++++++++++++ drivers/nvme/host/nvme.h | 1 + 2 files changed, 16 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 6a9dd68c0f4f..cf9de026cb93 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -320,6 +320,19 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, switch (old_state) { case NVME_CTRL_NEW: case NVME_CTRL_RESETTING: + case NVME_CTRL_CONNECTING: + case NVME_CTRL_SUSPENDED: + changed = true; + /* FALLTHRU */ + default: + break; + } + break; + case NVME_CTRL_SUSPENDED: + switch (old_state) { + case NVME_CTRL_NEW: + case NVME_CTRL_LIVE: + case NVME_CTRL_RESETTING: case NVME_CTRL_CONNECTING: changed = true; /* FALLTHRU */ @@ -332,6 +345,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, case NVME_CTRL_NEW: case NVME_CTRL_LIVE: case NVME_CTRL_ADMIN_ONLY: + case NVME_CTRL_SUSPENDED: changed = true; /* FALLTHRU */ default: @@ -354,6 +368,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, case NVME_CTRL_ADMIN_ONLY: case NVME_CTRL_RESETTING: case NVME_CTRL_CONNECTING: + case NVME_CTRL_SUSPENDED: changed = true; /* FALLTHRU */ default: diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index c4a1bb41abf0..9320b0a87d79 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -142,6 +142,7 @@ static inline u16 nvme_req_qid(struct request *req) enum nvme_ctrl_state { NVME_CTRL_NEW, NVME_CTRL_LIVE, + NVME_CTRL_SUSPENDED, NVME_CTRL_ADMIN_ONLY, /* Only admin queue live */ NVME_CTRL_RESETTING, NVME_CTRL_CONNECTING, -- 2.17.2