From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E16C035504F for ; Wed, 21 Jan 2026 03:06:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768964784; cv=none; b=To6RbCPSl6lJ65o7lseSgbjshgbxK8FthtQyzjgxtp7l8EMxoc6YUYs6X/qhnYq70c8xGP3sj7Iw4yW6QelgmiHlnd29zugaYEtwUWVWNajnywxNYcNBktw+pbQ0x6vTxbvXiudfPPeEtkgBBR7BeaYijySUpvL/inxVI2Jisxo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768964784; c=relaxed/simple; bh=7n7alaLpNF/XhbKRFNHns/vyW90qOJnEs1B1q/EiJ4Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jYO7MPw4H0GQ6F1zotZzeXvkb7iLyGHQVpfE/nNlqH2yGxYmxf26ruP9ygQCl2LLylxAxCq8pdwikp5NREjhkiXJM46ndzRYx3+CXd7SG/+3z0yrdchf2TkQYFb04HTe/T5zWnq5G3Yv2/rM98E+70T96fv3oduS8iu3FMoLZwE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PSiho5uH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PSiho5uH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8F93C19423; Wed, 21 Jan 2026 03:06:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768964783; bh=7n7alaLpNF/XhbKRFNHns/vyW90qOJnEs1B1q/EiJ4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PSiho5uHN7hmeltEpdYXYOHEzV9u1IdDTPBz2eDmQ8oFB4IqHH+Qy9Bx1ReVO3f47 BAEkNjNOXCAd107qDt/z+QwOxrxdRvW76nL1W6cx3s9XkWH75fkYalYQSqrcAsfaBv 5JpbVMSJWHnE5ce1jJ4UsXKV8YzxHAqcGI5IEZJpqBbJVUtsuBbtRwJlzS7Fb24f2g uNQK6uKvCF3RuZ0oksmdTHsWI1NRI04AO16dPpvPdQBqOWHzjhmRuxI8R0fJkKj7cX rV0ZbIi9mnp/YeFxkPDxhD3iWScs0sbD1sFasMwt2VER1taQibPboRFd0WhkoVQKdT YZ+L2LMMeGN1g== From: Sasha Levin To: stable@vger.kernel.org Cc: Nilay Shroff , Daniel Wagner , Keith Busch , Sasha Levin Subject: [PATCH 5.10.y 3/3] nvme: fix PCIe subsystem reset controller state transition Date: Tue, 20 Jan 2026 22:06:19 -0500 Message-ID: <20260121030619.1172509-3-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260121030619.1172509-1-sashal@kernel.org> References: <2026012014-ferret-pungent-817b@gregkh> <20260121030619.1172509-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Nilay Shroff [ Upstream commit 0edb475ac0a7d153318a24d4dca175a270a5cc4f ] The commit d2fe192348f9 (“nvme: only allow entering LIVE from CONNECTING state”) disallows controller state transitions directly from RESETTING to LIVE. However, the NVMe PCIe subsystem reset path relies on this transition to recover the controller on PowerPC (PPC) systems. On PPC systems, issuing a subsystem reset causes a temporary loss of communication with the NVMe adapter. A subsequent PCIe MMIO read then triggers EEH recovery, which restores the PCIe link and brings the controller back online. For EEH recovery to proceed correctly, the controller must transition back to the LIVE state. Due to the changes introduced by commit d2fe192348f9 (“nvme: only allow entering LIVE from CONNECTING state”), the controller can no longer transition directly from RESETTING to LIVE. As a result, EEH recovery exits prematurely, leaving the controller stuck in the RESETTING state. Fix this by explicitly transitioning the controller state from RESETTING to CONNECTING and then to LIVE. This satisfies the updated state transition rules and allows the controller to be successfully recovered on PPC systems following a PCIe subsystem reset. Cc: stable@vger.kernel.org Fixes: d2fe192348f9 ("nvme: only allow entering LIVE from CONNECTING state") Reviewed-by: Daniel Wagner Signed-off-by: Nilay Shroff Signed-off-by: Keith Busch Signed-off-by: Sasha Levin --- drivers/nvme/host/pci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 4b19ae93b5ff2..7a6827306e740 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -1146,7 +1146,10 @@ static int nvme_pci_subsystem_reset(struct nvme_ctrl *ctrl) } writel(NVME_SUBSYS_RESET, dev->bar + NVME_REG_NSSR); - nvme_change_ctrl_state(ctrl, NVME_CTRL_LIVE); + + if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_CONNECTING) || + !nvme_change_ctrl_state(ctrl, NVME_CTRL_LIVE)) + goto unlock; /* * Read controller status to flush the previous write and trigger a -- 2.51.0