Commit e175af88 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

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: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 7b25f04c
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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);
}