Page MenuHomeFreeBSD

bhyve: trap protected BAR regions of passthru devices
ClosedPublic

Authored by corvink on May 24 2024, 11:34 AM.
Tags
None
Referenced Files
F135693499: D45340.id159777.diff
Tue, Nov 11, 11:03 PM
Unknown Object (File)
Sat, Nov 8, 5:00 PM
Unknown Object (File)
Fri, Nov 7, 11:31 PM
Unknown Object (File)
Thu, Nov 6, 12:44 PM
Unknown Object (File)
Fri, Oct 31, 8:05 AM
Unknown Object (File)
Oct 11 2025, 3:18 PM
Unknown Object (File)
Oct 10 2025, 4:05 AM
Unknown Object (File)
Oct 3 2025, 8:16 AM
Subscribers

Details

Summary

At the moment, the list of protected BAR regions is unused by the passthru
emulation. Make use of it when mapping the BAR regions. This causes bhyve to
trap those regions.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 58050
Build 54938: arc lint + arc unit

Event Timeline

usr.sbin/bhyve/pci_passthru.c
1270–1271

Have you tried using tools/build/checkstyle9.pl?

1300
corvink added inline comments.
usr.sbin/bhyve/pci_passthru.c
1270–1271

Wasn't aware of this helper tool. I'm always using the top level .clang-format. Unfortunately, it seems to be incorrect for some cases.

Seems ok to me overall.

usr.sbin/bhyve/pci_passthru.c
1271
1301

You could perhaps use trunc_page and round_page here if you wished:

handler_off = trunc_page(handler->off);
handler_end = round_page(handler->off + handler->len);
1306
  • fix style issues
  • make use of trunc_page and round_page
  • rename len to size to match common naming in pci_passthru.c
This revision is now accepted and ready to land.Jun 30 2025, 6:30 PM