vmd: dont remove the hooked pci device on its detach

The hooked spdk_pci_device was being removed when someone
stopped using it (detached from it). The following didn't
work:

$ rpc.py bdev_nvme_attach_controller 10000:00:01.0
$ rpc.py bdev_nvme_detach_controller 10000:00:01.0
$ rpc.py bdev_nvme_attach_controller 10000:00:01.0

The second attach can't find PCI device 10000:00:01.0.
To fix it, simply don't do anything in VMD on device detach.
The entire callback will be removed soon. You don't get
notified when someone starts using your hooked device, so
there's not much gain from knowing when someone stops.

Change-Id: I147c24609077be24182ecfd2e273988a2e9e26b2
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2938
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
This commit is contained in:
Darek Stojaczyk 2020-06-09 18:09:33 +02:00 committed by Jim Harris
parent 7c6f0ef001
commit f280ce59b7

View File

@ -863,6 +863,11 @@ vmd_dev_cfg_write(struct spdk_pci_device *_dev, void *value,
return 0;
}
static void
_vmd_dev_detach(struct spdk_pci_device *dev)
{
}
static void
vmd_dev_detach(struct spdk_pci_device *dev)
{
@ -902,7 +907,7 @@ vmd_dev_init(struct vmd_pci_device *dev)
dev->pci.unmap_bar = vmd_dev_unmap_bar;
dev->pci.cfg_read = vmd_dev_cfg_read;
dev->pci.cfg_write = vmd_dev_cfg_write;
dev->pci.detach = vmd_dev_detach;
dev->pci.detach = _vmd_dev_detach;
dev->hotplug_capable = false;
if (dev->pcie_cap != NULL) {
dev->cached_slot_control = dev->pcie_cap->slot_control;