From 748daaa12672ca36a541bb1a9e0f838f7ff1470d Mon Sep 17 00:00:00 2001 From: Michael Moll Date: Thu, 11 Jan 2024 18:12:36 +0100 Subject: [PATCH] NVME workaround https://lore.kernel.org/all/ZQ0PR01MB098182407F5F427D9A6C7CD9826BA@ZQ0PR01MB0981.CHNPR01.prod.partner.outlook.cn/ --- drivers/nvme/host/pci.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index c1d6357ec98a01..1b87efab4df8e3 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "trace.h" #include "nvme.h" @@ -1059,6 +1060,16 @@ static inline int nvme_poll_cq(struct nvme_queue *nvmeq, { int found = 0; + /* + * In some cases, such as JH7110 SoC working with Kingston SSD, + * the CQE status may update a little bit later than the MSI, + * which cause an IRQ handle missing. + * As a workaround, here we will check the status first, and wait + * 1us if we get nothing. + */ + if (!nvme_cqe_pending(nvmeq)) + udelay(1); + while (nvme_cqe_pending(nvmeq)) { found++; /*