| From stable+bounces-210663-greg=kroah.com@vger.kernel.org Wed Jan 21 03:57:51 2026 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Tue, 20 Jan 2026 21:56:59 -0500 |
| Subject: nvme: fix PCIe subsystem reset controller state transition |
| To: stable@vger.kernel.org |
| Cc: Nilay Shroff <nilay@linux.ibm.com>, Daniel Wagner <dwagner@suse.de>, Keith Busch <kbusch@kernel.org>, Sasha Levin <sashal@kernel.org> |
| Message-ID: <20260121025659.1157002-3-sashal@kernel.org> |
| |
| From: Nilay Shroff <nilay@linux.ibm.com> |
| |
| [ 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 <dwagner@suse.de> |
| Signed-off-by: Nilay Shroff <nilay@linux.ibm.com> |
| Signed-off-by: Keith Busch <kbusch@kernel.org> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| --- |
| drivers/nvme/host/pci.c | 5 ++++- |
| 1 file changed, 4 insertions(+), 1 deletion(-) |
| |
| --- a/drivers/nvme/host/pci.c |
| +++ b/drivers/nvme/host/pci.c |
| @@ -1213,7 +1213,10 @@ static int nvme_pci_subsystem_reset(stru |
| } |
| |
| 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 |