From: Kevin.xie Date: Thu, 24 Nov 2022 08:59:12 +0000 (+0800) Subject: drivers: nvme: Add precheck and delay for CQE pending status. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a8700cb09c164a0c0bcc07b1351802afabe78ea7;p=platform%2Fkernel%2Flinux-starfive.git drivers: nvme: Add precheck and delay for CQE pending status. To workaroud the NVMe I/O timeout problem in bootup S10udev case which caused by the CQE update lantancy. Signed-off-by: Kevin.xie --- diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 149ecf7..f9321fa 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "trace.h" #include "nvme.h" @@ -1042,6 +1043,15 @@ static inline int nvme_process_cq(struct nvme_queue *nvmeq) { int found = 0; + /* + * In some cases, such as udev trigger, cqe status may update + * a little bit later than MSI, which cause an irq handle missing. + * To workaound, here we will prefetch the status first, and wait + * 1us if we get nothing. + */ + if (!nvme_cqe_pending(nvmeq)) + udelay(1); + while (nvme_cqe_pending(nvmeq)) { found++; /*