Skip to content

Commit

Permalink
bus/pci: enhance hotplug for VFIO bound devices
Browse files Browse the repository at this point in the history
VFIO modules may get loaded/initialized after DPDK initialized (like when
starting an application without knowing which devices will be used, and
whether their drivers require VFIO).

Retry enabling VFIO if not available.
This way, it is not required to restart the DPDK application anymore.

Signed-off-by: David Marchand <[email protected]>
Reviewed-by: Maxime Coquelin <[email protected]>
  • Loading branch information
david-marchand committed Oct 14, 2024
1 parent 6e18a2d commit 5f7b981
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/bus/pci/linux/pci_vfio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1319,6 +1319,12 @@ pci_vfio_mmio_write(const struct rte_pci_device *dev, int bar,
int
pci_vfio_is_enabled(void)
{
return rte_vfio_is_enabled("vfio_pci");
int status = rte_vfio_is_enabled("vfio_pci");

if (!status) {
rte_vfio_enable("vfio");
status = rte_vfio_is_enabled("vfio_pci");
}
return status;
}
#endif

0 comments on commit 5f7b981

Please sign in to comment.