Skip to content

Commit 0edb475

Browse files
shroffnikeithbusch
authored andcommitted
nvme: fix PCIe subsystem reset controller state transition
The commit d2fe192 (“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 d2fe192 (“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: d2fe192 ("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>
1 parent 84164ac commit 0edb475

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/nvme/host/pci.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,10 @@ static int nvme_pci_subsystem_reset(struct nvme_ctrl *ctrl)
15321532
}
15331533

15341534
writel(NVME_SUBSYS_RESET, dev->bar + NVME_REG_NSSR);
1535-
nvme_change_ctrl_state(ctrl, NVME_CTRL_LIVE);
1535+
1536+
if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_CONNECTING) ||
1537+
!nvme_change_ctrl_state(ctrl, NVME_CTRL_LIVE))
1538+
goto unlock;
15361539

15371540
/*
15381541
* Read controller status to flush the previous write and trigger a

0 commit comments

Comments
 (0)