From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EDFB6C5479D for ; Wed, 11 Jan 2023 06:42:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FpNhtF8t6WfnsZO69qfhBTfSemzS9fB/cP0++1hCP3c=; b=ZKNk4JA5o1zujx 03KKYIlMfpkxKuU+jnsyYrkA/+UdzjG3E1USiPRCpMpYj5Uz0wT0F9r8uwVGbsOwqCks3MM5afa5t IgIF0FcpcVsmpXJiyrJytksF7wKLgJyTVkEfEYMfw7SOSQxJCVCEZRUZoW82EhmDUVhrlGybC1qB9 Nvy0Lxe1gRTCA01V611okupBeGDPHB7DZJRM4MLLJVWBHPrFWndj9onG1zL/UqpJPjo1CAtXPTtKj TE+WQl/x262z0ORKggq1xAe8jzIcE4CFjPo8UfkgdboOG8Ibq1Oi8fr5OwVNkDaAckdVdZoWkHwFp COeYYzSY4v6k3j6oTpJg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFUnk-009soY-Ev; Wed, 11 Jan 2023 06:41:32 +0000 Received: from verein.lst.de ([213.95.11.211]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFUng-009snj-Py; Wed, 11 Jan 2023 06:41:30 +0000 Received: by verein.lst.de (Postfix, from userid 2407) id CB7D868BEB; Wed, 11 Jan 2023 07:41:20 +0100 (CET) Date: Wed, 11 Jan 2023 07:41:20 +0100 From: Christoph Hellwig To: Hector Martin Cc: Christoph Hellwig , Keith Busch , Jens Axboe , Sagi Grimberg , Eric Curtin , Janne Grunau , Sven Peter , Alyssa Rosenzweig , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] nvme-apple: Do not try to shut down the controller twice Message-ID: <20230111064120.GA18581@lst.de> References: <20230111043614.27087-1-marcan@marcan.st> <20230111043614.27087-2-marcan@marcan.st> <20230111045402.GB15520@lst.de> <20230111051836.GA16576@lst.de> <0e7f9ef4-6660-5842-821b-7492f7ecbc61@marcan.st> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <0e7f9ef4-6660-5842-821b-7492f7ecbc61@marcan.st> User-Agent: Mutt/1.5.17 (2007-11-01) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230110_224129_025974_55D986B5 X-CRM114-Status: GOOD ( 29.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jan 11, 2023 at 02:44:42PM +0900, Hector Martin wrote: > The higher-level resume path can't do a disable since the firmware isn't > up at that point, and the subsequent reset (which is shared with other > conditions that cause a reset) is what brings the firmware back up. So > the disable has to either happen in the suspend path, or in the shared > reset path after we know the firmware is running. Ok, that's the weird part where nvme-apply really isn't nvme at all. Because for actual NVMe devices the register access must work all the time. > That's only if you issue a disable *in lieu* of a shutdown (and in fact > if you do that on Apple controllers under some conditions, they crash). > Issuing a disable *after* a shutdown is required by the NVMe spec if you > want to use the controller again (and should basically do nothing at > that point, since the controller is already cleanly shut down, but it is > required to set EN to 0 such that the subsequent 0->1 transition > actually kickstarts the controller again). If you don't do that, the > controller never leaves the shutdown state (how would it know?). Yes. Although I would not call this a disable after shutdown, but a disable (or rather reset) before using it again. > To be clear, the sequence I was attempting to describe (which is what we > were doing before the patch that regressed this) was: > > (on sleep) > - NVMe shutdown > - NVMe disable > - Firmware shutdown > > After the firmware shutdown, we can't do anything with NVMe again until > we start firmware back up, which requires going through the reset flow. > > Right now we're doing: > > (on sleep) > - NVMe shutdown > - Firmware shutdown > (wakeup) > - Oops, NVMe is enabled, let's disable it! (times out due to FW being > down but failure isn't propagated) > - Firmware startup > - NVMe enable (thinks it succeeds but actually the controller is still > in the shutdown state since it was never disabled and this persists > across the firmware cycle!) > - I/O (never completes) Yes, so I guess due to the weird firmware issues doing the disable after shutdown instead of before setting up might be the right thing for nvme-apple, unlike real NVMe. So I guess we need to do that in the driver, and add a big fat comment explaining why. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel