Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp7125505yba; Thu, 2 May 2019 04:50:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqwscNC93jrl9Yc22gy3/f8x4DLFu5Z1Nkr7NZlOw9PNpetT1inI0RWOVFvkvPQ92lR5BL3B X-Received: by 2002:a63:ff26:: with SMTP id k38mr3517496pgi.123.1556797827521; Thu, 02 May 2019 04:50:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556797827; cv=none; d=google.com; s=arc-20160816; b=ho+VP3DamDBzluMKNlBRPwZWRBS8HqKNg3ZNKv2FxEDmQg+zEq3z0gxg6VuUlVxJ6K Ht6Bpw6qw600A0W9lg4x3zfghQ6AIryT25RfgLefl5UMS5siPpF4gPyJMenpkWV062zk arcBUzwNsF+rTmUhXScHaHK+2qvcwh+Hs9JN3odQohEqp8e9SyTfUNfRMG9qk/hTRgra 1D1jPBPx4B3HsFvGhHv55zNHj5aCEbN4ZhzylcR+WvsI/BjUx3CNeODk4Dk2p5SL/3jg eAoF49uSExoy0K0GHyvViPtIWWpSPJTrwI/zWvHTF26dnu20G/9oo7wJ/5ERU1R3LFSf qSQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=FVJakixJy6E7mDiYs8YO4ogcrxyLNC+7HxviYwNGM+M=; b=IYvcU/X6XfRUzvRw1CHXa8L1LJQVTAQfFCNGTiOOTTXqE3NQdrYE7FAi+Lr/EUL9Nj qGIrNotxEf6+yUJzP+s7VBYv0OE4yoleIZmsZvgCxg8+BJdbLhMDrsnzhE/Cso7xvgvc YM0SjVi+Gu4JAEGlYZtdB7nwQbqJB8dqk5zbBDhbGsR72YYHX5UKUEzWOmOd2bddgDWk zCQV7aL35cJpkJu/5IPezIbhHW0/8l0BnFAc+AvO+FgyC8y4RTksi0hwAS7ihYmtMXOC 4QwPUwhvI4J9s5CSZKOozTvKVMWIGZ8aysfDcJZboPHiAMNwbJclga/NjkWE6B/xkvRj kzqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 68si29247410pla.86.2019.05.02.04.50.12; Thu, 02 May 2019 04:50:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726570AbfEBLs6 (ORCPT + 99 others); Thu, 2 May 2019 07:48:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49208 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726473AbfEBLs5 (ORCPT ); Thu, 2 May 2019 07:48:57 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C60D73082E8E; Thu, 2 May 2019 11:48:56 +0000 (UTC) Received: from maximlenovopc.usersys.redhat.com (unknown [10.35.206.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 13D2417DDF; Thu, 2 May 2019 11:48:51 +0000 (UTC) From: Maxim Levitsky To: linux-nvme@lists.infradead.org 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 Ferlan Subject: [PATCH v2 05/10] nvme/pci: use the NVME_CTRL_SUSPENDED state Date: Thu, 2 May 2019 14:47:56 +0300 Message-Id: <20190502114801.23116-6-mlevitsk@redhat.com> In-Reply-To: <20190502114801.23116-1-mlevitsk@redhat.com> References: <20190502114801.23116-1-mlevitsk@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 02 May 2019 11:48:57 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When enteriing low power state, the nvme driver will now inform the core with the NVME_CTRL_SUSPENDED state which will allow mdev driver to act on this information Signed-off-by: Maxim Levitsky --- drivers/nvme/host/pci.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 1c844c66ecaa..282f28c851c1 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -2406,7 +2406,8 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown) u32 csts = readl(dev->bar + NVME_REG_CSTS); if (dev->ctrl.state == NVME_CTRL_LIVE || - dev->ctrl.state == NVME_CTRL_RESETTING) + dev->ctrl.state == NVME_CTRL_RESETTING || + dev->ctrl.state == NVME_CTRL_SUSPENDED) nvme_start_freeze(&dev->ctrl); dead = !!((csts & NVME_CSTS_CFS) || !(csts & NVME_CSTS_RDY) || pdev->error_state != pci_channel_io_normal); @@ -2852,6 +2853,9 @@ static int nvme_suspend(struct device *dev) struct pci_dev *pdev = to_pci_dev(dev); struct nvme_dev *ndev = pci_get_drvdata(pdev); + if (!nvme_change_ctrl_state(&ndev->ctrl, NVME_CTRL_SUSPENDED)) + WARN_ON(1); + nvme_dev_disable(ndev, true); return 0; } -- 2.17.2