From a818564374fa2c1300d2a66f56d94a79a7366152 Mon Sep 17 00:00:00 2001 From: Konrad Sztyber Date: Fri, 29 Jul 2022 06:43:41 +0200 Subject: [PATCH] nvme: check CSTS.CFS when initializing ctrlrs If Controller Fatal Status (CFS) bit is set, there's no point in waiting for CSTS.RDY and the only way to move forward with the initialization is to perform a controller reset. This fixes issues with test/nvme/sw_hotplug.sh when running under qemu. It seems that during that test, qemu marks the emulated NVMe drives as fatal, so if we didn't check CSTS.CFS, the initialization would time out. Fixes #2201. Signed-off-by: Konrad Sztyber Change-Id: I97712debc80c3dd6199545d393c0f340f29d33b2 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13820 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Michal Berger Reviewed-by: Changpeng Liu --- lib/nvme/nvme_ctrlr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/nvme/nvme_ctrlr.c b/lib/nvme/nvme_ctrlr.c index 72425ac02..c4a2d46fb 100644 --- a/lib/nvme/nvme_ctrlr.c +++ b/lib/nvme/nvme_ctrlr.c @@ -3641,7 +3641,7 @@ nvme_ctrlr_process_init_wait_for_ready_1(void *ctx, uint64_t value, const struct assert(value <= UINT32_MAX); csts.raw = (uint32_t)value; - if (csts.bits.rdy == 1) { + if (csts.bits.rdy == 1 || csts.bits.cfs == 1) { nvme_ctrlr_set_state(ctrlr, NVME_CTRLR_STATE_SET_EN_0, nvme_ctrlr_get_ready_timeout(ctrlr)); } else {