From e175af887922af1886b24995530c9c6bdd5781a7 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Thu, 14 Apr 2016 10:59:06 -0700 Subject: [PATCH] nvme: add workaround for VFIO initialization issue When using DPDK PCI support via VFIO, the PCI device is reset immediately before calling the PCI driver's init function. In some cases, the device seems to not be ready to handle MMIO accesses right away. Until the cause of this issue is fully understood, add a 500 ms sleep as a workaround. Change-Id: Ic893080a6f34d57eee80df3e6aa68c220c08df3e Signed-off-by: Daniel Verkamp --- lib/nvme/nvme_impl.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/nvme/nvme_impl.h b/lib/nvme/nvme_impl.h index fc9d2b3b0..0b4485a75 100644 --- a/lib/nvme/nvme_impl.h +++ b/lib/nvme/nvme_impl.h @@ -38,6 +38,7 @@ #include "spdk/pci.h" #include "spdk/nvme_spec.h" #include +#include #include #include #include @@ -232,6 +233,12 @@ nvme_driver_init(struct rte_pci_driver *dr, struct rte_pci_device *rte_dev) */ struct spdk_pci_device *pci_dev = (struct spdk_pci_device *)rte_dev; + /* + * TODO: This is a workaround for an issue where the device is not ready after VFIO reset. + * Figure out what is actually going wrong and remove this sleep. + */ + usleep(500 * 1000); + return g_nvme_pci_enum_ctx.user_enum_cb(g_nvme_pci_enum_ctx.user_enum_ctx, pci_dev); }