Previously bhyve trusted whatever bits were set in the device's PCI
command register. However, this means that a guest's writes to a
device during shutdown can affect a future guest reusing devices. For
example, if a guest OS disables busmastering during shutdown, a
subsequent guest may not be able to use the device if it's driver does
not always enable busmastering.
Instead, try to set a more deterministic initial state in the command
register for passthrough devices just as we do for emulated devices.
At the start of each guest, start with the real device's command
register, but always enable busmastering and the memory and I/O
decoding bits needed for the device's BARs.
PR: 205549