From patchwork Tue Jan 17 18:25:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janne Grunau X-Patchwork-Id: 44790 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1949564wrn; Tue, 17 Jan 2023 11:48:00 -0800 (PST) X-Google-Smtp-Source: AMrXdXuGOT7ErIXwo4tPj5XTarG4JdcPyZDNviiKU6vpfBd2J//ft6EWSevr+ma9OKefuUptSL4s X-Received: by 2002:a17:907:a68a:b0:7c1:4d35:a143 with SMTP id vv10-20020a170907a68a00b007c14d35a143mr20467798ejc.3.1673984880776; Tue, 17 Jan 2023 11:48:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673984880; cv=none; d=google.com; s=arc-20160816; b=B+JuQfQik1LSjhDct5yPMJzgX1XD6JHRtly7D2g1YhK+t95xVfzoly9EFjXcuRpVpb 1XQhQpTDhHHAHH85qT0gV0hrUetcT/4duVlNFl/7q5stxXUY4/urmz6aShoL6KcuXqVi eFs610/52neiNNklX4KC0tJhYPwUGuwHKFpY1RKNur5PUWNxvD5OL/IX3rvk3IWYHAFK I6qheFVl5dEab9b6m4nswvG2DRRD83C+RccqD75Y5hWDiKXgaYS3Ey/XSbx7IbDqmitI aLstumkdVY2FPk4FlIraVvGFsI27RNEjuh3TPSoT5A1h1wNQn1YEsIm9cHMykiAJF1Ws XWwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from; bh=ZDFbQ0TlqKd9EjCjh5pz4hHBoSsr0ACsHtv+L6aGr8s=; b=ybT3JMWaBFoYjx8M0lYToG32EcMKjBgj56Ippu37s5tLWj9EfEhVlzAWTJBwMZdey2 zwAk101Z2AlgzdYN3rXaPUE6DXZgh4npRHK0MEIfXumYprBKePuQlkdZ0XBNCCl4LXwG Au3rsRNjfjIO2WbEfqYzice2oaSy+E4DDL3uHkZvw9KzvGurXuNyailIBQ6YmwCz5aUe 6v3LjVMOQXtweZcsMKnhqu9EjPOGqilf5A4TaE9i/EiSLsKz4K/juCa283DEH1WiYGdW mK/7tOARqt/BHAYZAgZ6LHPcll57SAbM3+G5MPGD2353cgeTkvw/+NjCj/V0GJ9Ww+Ho FZlg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y17-20020a056402359100b0046b84bb563bsi6334026edc.464.2023.01.17.11.47.37; Tue, 17 Jan 2023 11:48:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234422AbjAQTeH (ORCPT + 99 others); Tue, 17 Jan 2023 14:34:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232686AbjAQT03 (ORCPT ); Tue, 17 Jan 2023 14:26:29 -0500 X-Greylist: delayed 555 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 17 Jan 2023 10:34:19 PST Received: from soltyk.jannau.net (soltyk.jannau.net [144.76.91.90]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E99F2113E2 for ; Tue, 17 Jan 2023 10:34:18 -0800 (PST) Received: from robin.home.jannau.net (p579ad32f.dip0.t-ipconnect.de [87.154.211.47]) by soltyk.jannau.net (Postfix) with ESMTPSA id F0B5B26F671; Tue, 17 Jan 2023 19:25:02 +0100 (CET) From: Janne Grunau Date: Tue, 17 Jan 2023 19:25:01 +0100 Subject: [PATCH v2 2/2] nvme-apple: Only reset the controller when RTKit is running MIME-Version: 1.0 Message-Id: <20230114-apple-nvme-suspend-fixes-v6.2-v2-2-9157bf633dba@jannau.net> References: <20230114-apple-nvme-suspend-fixes-v6.2-v2-0-9157bf633dba@jannau.net> In-Reply-To: <20230114-apple-nvme-suspend-fixes-v6.2-v2-0-9157bf633dba@jannau.net> To: Hector Martin , Sven Peter , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg Cc: Alyssa Rosenzweig , Eric Curtin , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Janne Grunau X-Mailer: b4 0.11.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1064; i=j@jannau.net; h=from:subject:message-id; bh=u2Uiv1bFso8EeQe26njgU/kTCYTgJ/N9RudVytjdmsU=; b=owGbwMvMwCG2UNrmdq9+ahrjabUkhuRjz//K7P3Rc/S+5fOiFZ0c4hcrs/1V1n16zHbtrIGKb0w1 r/zJjlIWBjEOBlkxRZYk7ZcdDKtrFGNqH4TBzGFlAhnCwMUpABMpcmBkeMTZ9OH5v9lqSRceHORvM4 4Q9zFbz9UsNGFlye/3Jg998hj++7Hea4k33LTUPu655PbvoTG930vEfwQnzVLgzrJcpPmXCQA= X-Developer-Key: i=j@jannau.net; a=openpgp; fpr=8B336A6BE4E5695E89B8532B81E806F586338419 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755300370626032180?= X-GMAIL-MSGID: =?utf-8?q?1755300370626032180?= NVMe controller register access hangs indefinitely when the co-processor is not running. A missed reset is preferable over a hanging thread since it could be recoverable. Signed-off-by: Janne Grunau --- drivers/nvme/host/apple.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/apple.c b/drivers/nvme/host/apple.c index 2a1f11b30615..3258fd7efaf9 100644 --- a/drivers/nvme/host/apple.c +++ b/drivers/nvme/host/apple.c @@ -991,11 +991,11 @@ static void apple_nvme_reset_work(struct work_struct *work) goto out; } - if (anv->ctrl.ctrl_config & NVME_CC_ENABLE) - apple_nvme_disable(anv, false); - /* RTKit must be shut down cleanly for the (soft)-reset to work */ if (apple_rtkit_is_running(anv->rtk)) { + /* reset the controller if it is enabled */ + if (anv->ctrl.ctrl_config & NVME_CC_ENABLE) + apple_nvme_disable(anv, false); dev_dbg(anv->dev, "Trying to shut down RTKit before reset."); ret = apple_rtkit_shutdown(anv->rtk); if (ret)