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
Unknown Object (File)
Sat, Nov 15, 9:58 AM
Unknown Object (File)
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
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 65118
Build 62001: arc lint + arc unit

Event Timeline

usr.sbin/bhyve/pci_passthru.c
1317–1318

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

1347
corvink added inline comments.
usr.sbin/bhyve/pci_passthru.c
1317–1318

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
1318
1348

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