Page MenuHomeFreeBSD

Deterministically initialize the PCI command register for passthru devices.
AcceptedPublic

Authored by jhb on Jun 12 2019, 5:21 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 29, 9:13 AM
Unknown Object (File)
Feb 28 2024, 7:49 AM
Unknown Object (File)
Jan 26 2024, 6:37 PM
Unknown Object (File)
Jan 14 2024, 3:48 PM
Unknown Object (File)
Jan 4 2024, 3:03 PM
Unknown Object (File)
Dec 24 2023, 5:52 AM
Unknown Object (File)
Dec 20 2023, 2:10 AM
Unknown Object (File)
Dec 12 2023, 10:45 AM

Details

Reviewers
rgrimes
markj
bz
Group Reviewers
bhyve
Summary

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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 24831
Build 23583: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Jun 13 2019, 4:41 AM
  • 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
This revision is now accepted and ready to land.Jun 17 2019, 8:18 PM

Need to emulate the read of the register.

This revision now requires review to proceed.Dec 11 2019, 10:28 PM
This revision is now accepted and ready to land.Dec 2 2021, 10:34 PM

This patch should be updated. @jhb I could do it for you if you like to.

usr.sbin/bhyve/pci_passthru.c
660

This part is already included in bhyve.

837

This part is already included in bhyve.