Page MenuHomeFreeBSD

bhyve/pci_emul_init: Allow runtime device initialization
Needs ReviewPublic

Authored by bnovkov on Sun, Jan 11, 1:32 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jan 15, 3:29 AM
Unknown Object (File)
Thu, Jan 15, 3:28 AM
Unknown Object (File)
Thu, Jan 15, 2:05 AM
Unknown Object (File)
Wed, Jan 14, 8:50 PM
Unknown Object (File)
Mon, Jan 12, 9:16 AM
Unknown Object (File)
Sun, Jan 11, 9:58 PM
Unknown Object (File)
Sun, Jan 11, 9:44 PM
Subscribers

Details

Reviewers
None
Group Reviewers
bhyve
Summary

Emulated PCI devices may open and use various files during their
lifecycle. Unfortunately, since bhyve enters capability mode after
initialization we can't simply invoke device-specific initialization
routines when initializing a hotplugged device.

This change gets around that limitation by sourcing device-specific
file descriptors from the nvlist object provided by the party who
initiated the hotplugging request.
If the "ipc" boolean key is present in the nvlist object, the routine
will invoke libbhyve's pci_validate_hotplug_request to check
whether the provided nvlist object contains all necessary name/value
pairs. Otherwise, it calls pci_init_fds to populate the nvlist
object with the appropriate file descriptors.
For example, consider the scenario of adding an 'e1000' device backed
by a /dev/tap interface. Under this scheme, bhyvectl (or any other
client) is responsible for opening the tap device, storing the
resulting file descriptor in an nvlist object, and sending
it to bhyve.

This change is a noop for non-hotpluggable devices since their
file descriptor initialization routines aren't implemented
in libbhyve.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 69798
Build 66681: arc lint + arc unit