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 <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-04-14 10:59:06 -07:00
parent 7b25f04c43
commit e175af8879

View File

@ -38,6 +38,7 @@
#include "spdk/pci.h"
#include "spdk/nvme_spec.h"
#include <assert.h>
#include <unistd.h>
#include <rte_config.h>
#include <rte_cycles.h>
#include <rte_malloc.h>
@ -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);
}