Page MenuHomeFreeBSD

Deterministically initialize the PCI command register for passthru devices.
AbandonedPublic

Authored by jhb on Jun 12 2019, 5:21 PM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 18 2024, 9:47 PM
Unknown Object (File)
Oct 5 2024, 7:42 AM
Unknown Object (File)
Oct 4 2024, 3:19 PM
Unknown Object (File)
Oct 2 2024, 8:07 PM
Unknown Object (File)
Oct 1 2024, 11:31 AM
Unknown Object (File)
Sep 30 2024, 1:40 PM
Unknown Object (File)
Sep 30 2024, 1:31 PM
Unknown Object (File)
Sep 30 2024, 1:31 PM

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 28086
Build 26231: 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.

834

This part is already included in bhyve.

I now believe that D46179 is a better fix.

Some bits were merged previously (c7ba149dbad3fb2de9b920b9c1933ea60760c8f8) and the rest is replaced by D46179.