From patchwork Wed Jan 11 04:36:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hector Martin X-Patchwork-Id: 3843 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3124951wrt; Tue, 10 Jan 2023 20:39:41 -0800 (PST) X-Google-Smtp-Source: AMrXdXtFE7MV304vjhu/k/PT84ni4ZMVBYOQRBrhzIBb4V7H5If2CsQLBAtD9BynCtrGjFRlOsLu X-Received: by 2002:a17:907:c242:b0:7c1:9e6:d38e with SMTP id tj2-20020a170907c24200b007c109e6d38emr73149258ejc.67.1673411981349; Tue, 10 Jan 2023 20:39:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673411981; cv=none; d=google.com; s=arc-20160816; b=MERBfl9ylj4csWGANG/+/ZUpVDv8EPdjXYRWSFlIn8/cYFWJQ49OKlLIcRIPasXHVn XJBk5RLS0fOkVNP6nxnFOQuNJjLvqNavA6Ny9SkyjdocojRY8nUIpZVygGLxS3I7ZGeU QqgY4LM8XwB5/WYYkT7ezfTnozkFAZvKUfWNe9xqM8u0jXeD3FYeJUNzXuFPeyG6sZvl tKv7MpbWgP2qlRy28WFPoue+tMEUwFcJoPUAp3Iy0vu8NRfGDhxhKzVD5N0FeOpI6s4V Jm8yB6R91M9M9bMv2uIPWHXkntPCbwlSJJEI1ZZCvPIVM5XB8gWsSPYoWJsXMy6bzgf+ rY2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=oneim6tpPOoxGS+0ehCutTcCQMBae12oFHQIUvi8u1U=; b=qFr59hFmHqulUzp/V94K49SiSW32vpQ7MSk51V6K47G96DRAlG9mhqIFKH5/rHwQPO XqFakqELryfr90Ax3qP94iMUMkKEcMd8LtS5QLKNn9+LaPuafnfDIUIssi6nQ/0yDqI5 d8MQAJH2f4tUVPUU5If3Zse8yW1d+fimGvsOwXQvQoXbw/ibIvUahIEroyQiBh1xbrtr oJb/6e/dX53MrO5idW8n9uMi8Kzk3OQdHT90lmYWDaYVFAPjhJY4zeOLZi9xitXKw2Vd TU/1yWCdcEsuhT9RY6PDHKetwBmD7A+zqz6VP65KoRtrUmAptrmreWZptxx8GrQz/GFx PEmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marcan.st header.s=default header.b=P8chu566; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=marcan.st Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb2-20020a170907960200b0077f3a9c58e2si14585466ejc.6.2023.01.10.20.39.18; Tue, 10 Jan 2023 20:39:41 -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; dkim=pass header.i=@marcan.st header.s=default header.b=P8chu566; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=marcan.st Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231429AbjAKEiy (ORCPT + 99 others); Tue, 10 Jan 2023 23:38:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231312AbjAKEi1 (ORCPT ); Tue, 10 Jan 2023 23:38:27 -0500 Received: from mail.marcansoft.com (marcansoft.com [212.63.210.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A96D27640 for ; Tue, 10 Jan 2023 20:38:25 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sendonly@marcansoft.com) by mail.marcansoft.com (Postfix) with ESMTPSA id B050842165; Wed, 11 Jan 2023 04:38:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=marcan.st; s=default; t=1673411903; bh=HfFhuO/foSzEbmya21quSWIKZF8twzaOgyIjDrYqKHo=; h=From:To:Cc:Subject:Date; b=P8chu566SCCEyb4pTVwA4dMqw4vFrkbsl9qjBm/MzvlDIJeDc/vjNar8nvW82f2Fa 7MqX5rOJfyHjU3IOUkuYSN3QD+WiOGBXyp2nceOLmd3PfPilW+4wleApLWjewq2MGc jINYTXgCFgU6VUHeWxSNqA1phlmiBK3HjM6LILNs7ewfDLruFdpI4tulULomJCFX4k NitLYn4zFL13bDuf7cqnRSUUW9ci5pbejzZpiBRPRWBU9uLmo1IoYGMPd+cah930Gh PKF9f2COtxJiPou2h65K5B6FdLx2z17IXuMAhXRdyJAdU7t5MeVg1iA+w/xqswp4bb TnaO+WaEiSaxA== From: Hector Martin To: Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg Cc: 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, Hector Martin Subject: [PATCH 0/2] nvme-apple: Fix suspend-resume regression Date: Wed, 11 Jan 2023 13:36:12 +0900 Message-Id: <20230111043614.27087-1-marcan@marcan.st> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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?1754699642062476778?= X-GMAIL-MSGID: =?utf-8?q?1754699642062476778?= Commit c76b8308e4c9 introduced a behavior change in the way nvme-apple disables controllers, avoiding a disable in the shutdown path. Unfortunately, the NVMe core does not know how to actually start up controllers in the shutdown state, and this broke suspend/resume since we use the shutdown command for device suspend in nvme-apple. Additionally, nvme-apple was also checking only for the disable state in the reset path to decide whether to disable the controller again, and just having the controller shut down was triggering an unnecessary code path that broke things further. This short series fixes those issues and makes suspend/resume work on nvme-apple again. nvme-pci is, to my knowledge, not affected since it only issues a shutdown when the whole system is actually shutting down, never to come back. Hector Martin (2): nvme-apple: Do not try to shut down the controller twice nvme: Handle shut down controllers during initialization drivers/nvme/host/apple.c | 3 ++- drivers/nvme/host/core.c | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-)