Page MenuHomeFreeBSD

Deterministically initialize the PCI command register for passthru devices.
Needs ReviewPublic

Authored by jhb on Jun 12 2019, 5:21 PM.


Group Reviewers

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

Diff Detail

rS FreeBSD src repository
Lint OK
No Unit Test Coverage
Build Status
Buildable 28086
Build 26231: arc lint + arc unit

Event Timeline

jhb created this revision.Jun 12 2019, 5:21 PM
rgrimes accepted this revision as: rgrimes.Jun 13 2019, 4:41 AM

Good find.

This revision is now accepted and ready to land.Jun 13 2019, 4:41 AM
markj accepted this revision.Jun 13 2019, 4:40 PM
jhb updated this revision to Diff 58746.Jun 17 2019, 8:02 PM
  • Always enable INTx interrupts in a PCI passthrough device when starting a guest.
This revision now requires review to proceed.Jun 17 2019, 8:02 PM
markj accepted this revision as: markj.Jun 17 2019, 8:18 PM
This revision is now accepted and ready to land.Jun 17 2019, 8:18 PM
jhb updated this revision to Diff 65513.Wed, Dec 11, 10:28 PM

Need to emulate the read of the register.

This revision now requires review to proceed.Wed, Dec 11, 10:28 PM