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
F135103274: D45340.id139424.diff
Thu, Nov 6, 12:44 PM
Unknown Object (File)
Fri, Oct 31, 8:05 AM
Unknown Object (File)
Sat, Oct 11, 3:18 PM
Unknown Object (File)
Fri, Oct 10, 4:05 AM
Unknown Object (File)
Oct 3 2025, 8:16 AM
Unknown Object (File)
Oct 3 2025, 1:36 AM
Unknown Object (File)
Oct 2 2025, 10:30 PM
Unknown Object (File)
Oct 2 2025, 12:26 PM
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 Not Applicable
Unit
Tests Not Applicable

Event Timeline

usr.sbin/bhyve/pci_passthru.c
1335–1336

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

1398
corvink added inline comments.
usr.sbin/bhyve/pci_passthru.c
1335–1336

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
1336
1399

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);
1404
  • 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