Page MenuHomeFreeBSD

Enable memory and I/O decoding in PCI devices on demand.
ClosedPublic

Authored by jhb on Jun 5 2019, 10:36 PM.

Details

Summary

Rather than uncoditionally setting the MEMEN and PORTEN bits in
PCIR_COMMAND for PCI devices, set the respective bit when the first
BAR of a given type is added to the device. This more closely matches
what firmware does on bare metal.

BUSMASTEREN is still set unconditionally. Eventually this bit should
move into the device models as not all device models need this set.

Test Plan
  • booted a guest and verified hostb and isab devices now don't have either MEMEN or PORTEN enabled, but virtio devices still have both set

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jhb created this revision.Jun 5 2019, 10:36 PM
rgrimes accepted this revision as: rgrimes.Jun 6 2019, 12:59 AM
rgrimes added inline comments.
usr.sbin/bhyve/pci_emul.c
589 ↗(On Diff #58285)

Order of locals

This revision is now accepted and ready to land.Jun 6 2019, 12:59 AM
jhb marked an inline comment as done.Jun 7 2019, 3:48 PM
This revision was automatically updated to reflect the committed changes.