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 97C38331226 for ; Wed, 21 Jan 2026 03:02:42 +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=1768964562; cv=none; b=QqKuRRYdJyuNNDyvRwE3ZtyK/a9984BJ3evVa9UckU+4t7SmI10FH8HFytQ3YMN3S/mRcKMlB5OTQ5g+q1aSOzr27pfyMg2kUYuAj5tCeaY00nU5wzqWprkKV5AEkD/ssPqHamBeyB4ZS7/Qx51f86mqKLgvRG87wq8LNww6Srs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768964562; c=relaxed/simple; bh=duFKfoP2+w93RiZof2ONqQ1tAgT1ygkabwbWRETBEiw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BhaxMMReSEQOzzqgwNd29+VwtuJbEiKLW0vOQobzPzp3+k/fbIJtbe34fmBoEPQmkOA/iynTZEU1rF3RlaEHOyjxPaFD2Bsacl3AbdisI+EtwYVC9XPC2D7BNPPf7QbIGxoZVo+V+7g9dwLs8y2OjfnrG13vdPfXDlpghF0fXyI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hdoOTi/8; 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="hdoOTi/8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96BB4C19425; Wed, 21 Jan 2026 03:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768964562; bh=duFKfoP2+w93RiZof2ONqQ1tAgT1ygkabwbWRETBEiw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hdoOTi/8N3FunT9R299MCrbHxo4ttmRUJIx1gBTqJ1ZS1Cwyduad5l0YWVwKIJcxq SY9k+jL+zHk/TqcfOOjB6ZD+/T2ubH2bQybuuW59NcW6yuC5g2ydau5EzNo8fwGOi1 /Kgn32j+xVNHtXUDYMN7NQb/sEDv6Tk+CbZ82f6yAGc7UVZxBR0EfB5EOeFRryKPPj Pji11/Gou9Rhn++mwb7Y024d+MGagksuFg9jOjiYcE8sQGNt1Yst/V4BD5CxeNYw3u txzV152BQnIcZ7qG8MN2V4z3MDo+vlcT5WVu88nHS7/FnJxfGbxNj1SlTGe+R5mQDx iS5xeN8JHQwYg== From: Sasha Levin To: stable@vger.kernel.org Cc: Nilay Shroff , Daniel Wagner , Keith Busch , Sasha Levin Subject: [PATCH 5.15.y 3/3] nvme: fix PCIe subsystem reset controller state transition Date: Tue, 20 Jan 2026 22:02:38 -0500 Message-ID: <20260121030238.1163180-3-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260121030238.1163180-1-sashal@kernel.org> References: <2026012013-strive-tying-5ac1@gregkh> <20260121030238.1163180-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 0fd88317bbf1f..64c2275e2310d 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -1144,7 +1144,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