nvme: Add support of hot remove vfio-attached devices in pcie layer.
Change-Id: Ia7d6ca2d6c0bec6345f05718f6a6328eccda2dcc Signed-off-by: Cunyin Chang <cunyin.chang@intel.com> Reviewed-on: https://review.gerrithub.io/391329 Reviewed-by: Ben Walker <benjamin.walker@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
2966839dd9
commit
6e82aa5ace
@ -235,9 +235,10 @@ static int
|
|||||||
_nvme_pcie_hotplug_monitor(void *cb_ctx, spdk_nvme_probe_cb probe_cb,
|
_nvme_pcie_hotplug_monitor(void *cb_ctx, spdk_nvme_probe_cb probe_cb,
|
||||||
spdk_nvme_remove_cb remove_cb)
|
spdk_nvme_remove_cb remove_cb)
|
||||||
{
|
{
|
||||||
struct spdk_nvme_ctrlr *ctrlr;
|
struct spdk_nvme_ctrlr *ctrlr, *tmp;
|
||||||
struct spdk_uevent event;
|
struct spdk_uevent event;
|
||||||
struct spdk_pci_addr pci_addr;
|
struct spdk_pci_addr pci_addr;
|
||||||
|
union spdk_nvme_csts_register csts;
|
||||||
|
|
||||||
while (spdk_get_uevent(hotplug_fd, &event) > 0) {
|
while (spdk_get_uevent(hotplug_fd, &event) > 0) {
|
||||||
if (event.subsystem == SPDK_NVME_UEVENT_SUBSYSTEM_UIO ||
|
if (event.subsystem == SPDK_NVME_UEVENT_SUBSYSTEM_UIO ||
|
||||||
@ -275,6 +276,17 @@ _nvme_pcie_hotplug_monitor(void *cb_ctx, spdk_nvme_probe_cb probe_cb,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This is a work around for vfio-attached device hot remove detection. */
|
||||||
|
TAILQ_FOREACH_SAFE(ctrlr, &g_spdk_nvme_driver->shared_attached_ctrlrs, tailq, tmp) {
|
||||||
|
csts = spdk_nvme_ctrlr_get_regs_csts(ctrlr);
|
||||||
|
if (csts.raw == 0xffffffffU) {
|
||||||
|
nvme_ctrlr_fail(ctrlr, true);
|
||||||
|
nvme_robust_mutex_unlock(&g_spdk_nvme_driver->lock);
|
||||||
|
remove_cb(cb_ctx, ctrlr);
|
||||||
|
nvme_robust_mutex_lock(&g_spdk_nvme_driver->lock);
|
||||||
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,6 +274,12 @@ spdk_nvme_get_ctrlr_by_trid_unsafe(const struct spdk_nvme_transport_id *trid)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
union spdk_nvme_csts_register spdk_nvme_ctrlr_get_regs_csts(struct spdk_nvme_ctrlr *ctrlr)
|
||||||
|
{
|
||||||
|
union spdk_nvme_csts_register csts = {};
|
||||||
|
|
||||||
|
return csts;
|
||||||
|
}
|
||||||
|
|
||||||
#if 0 /* TODO: update PCIe-specific unit test */
|
#if 0 /* TODO: update PCIe-specific unit test */
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user